@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | if ($_POST['download']) |
42 | 42 | { |
43 | 43 | list($file) = each($_POST['download']); |
44 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
|
44 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
|
45 | 45 | while (@ob_end_clean()) {} // end all active output buffering |
46 | - ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
|
46 | + ini_set('zlib.output_compression', 0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
|
47 | 47 | Api\Header\Content::type(basename($file)); |
48 | 48 | readfile($file); |
49 | 49 | exit; |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | { |
62 | 62 | Api\Csrf::validate($_POST['csrf_token'], __FILE__); |
63 | 63 | } |
64 | -$setup_tpl->set_block('T_db_backup','schedule_row','schedule_rows'); |
|
65 | -$setup_tpl->set_block('T_db_backup','set_row','set_rows'); |
|
64 | +$setup_tpl->set_block('T_db_backup', 'schedule_row', 'schedule_rows'); |
|
65 | +$setup_tpl->set_block('T_db_backup', 'set_row', 'set_rows'); |
|
66 | 66 | |
67 | -$setup_tpl->set_var('stage_title',$stage_title = lang('DB backup and restore')); |
|
68 | -$setup_tpl->set_var('stage_desc',lang('This program lets you backup your database, schedule a backup or restore it.')); |
|
69 | -$setup_tpl->set_var('error_msg',''); |
|
67 | +$setup_tpl->set_var('stage_title', $stage_title = lang('DB backup and restore')); |
|
68 | +$setup_tpl->set_var('stage_desc', lang('This program lets you backup your database, schedule a backup or restore it.')); |
|
69 | +$setup_tpl->set_var('error_msg', ''); |
|
70 | 70 | |
71 | -$bgcolor = array('#DDDDDD','#EEEEEE'); |
|
71 | +$bgcolor = array('#DDDDDD', '#EEEEEE'); |
|
72 | 72 | |
73 | 73 | if (is_object($GLOBALS['egw_setup']->html)) |
74 | 74 | { |
75 | - $GLOBALS['egw_setup']->html->show_header($stage_title,False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
75 | + $GLOBALS['egw_setup']->html->show_header($stage_title, False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
76 | 76 | } |
77 | 77 | else |
78 | 78 | { |
79 | - $setup_tpl->set_block('T_db_backup','setup_header'); |
|
80 | - $setup_tpl->set_var('setup_header',''); |
|
79 | + $setup_tpl->set_block('T_db_backup', 'setup_header'); |
|
80 | + $setup_tpl->set_var('setup_header', ''); |
|
81 | 81 | $GLOBALS['egw_info']['flags']['app_header'] = $stage_title; |
82 | 82 | echo $GLOBALS['egw']->framework->header(); |
83 | 83 | echo $GLOBALS['egw']->framework->navbar(); |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | if (empty($minCount)) |
94 | 94 | { |
95 | 95 | $minCount = 0; |
96 | - $setup_tpl->set_var('error_msg',htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); |
|
96 | + $setup_tpl->set_var('error_msg', htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); |
|
97 | 97 | } |
98 | - $db_backup->saveConfig($minCount,$is_setup ? (boolean)$filesBackup : null); |
|
98 | + $db_backup->saveConfig($minCount, $is_setup ? (boolean)$filesBackup : null); |
|
99 | 99 | |
100 | 100 | if (is_int($minCount) && $minCount > 0) |
101 | 101 | { |
@@ -112,22 +112,21 @@ discard block |
||
112 | 112 | { |
113 | 113 | Vfs::$is_root = true; |
114 | 114 | echo '<div align="center">'. |
115 | - (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070','/backup',false) ? |
|
116 | - lang('Backup directory %1 mounted as %2',$db_backup->backup_dir,'/backup') : |
|
117 | - lang('Failed to mount Backup directory!')). |
|
115 | + (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070', '/backup', false) ? |
|
116 | + lang('Backup directory %1 mounted as %2', $db_backup->backup_dir, '/backup') : lang('Failed to mount Backup directory!')). |
|
118 | 117 | "</div>\n"; |
119 | 118 | Vfs::$is_root = false; |
120 | 119 | } |
121 | 120 | // create a backup now |
122 | -if($_POST['backup']) |
|
121 | +if ($_POST['backup']) |
|
123 | 122 | { |
124 | 123 | if (is_resource($f = $db_backup->fopen_backup())) |
125 | 124 | { |
126 | - echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
125 | + echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
127 | 126 | $db_backup->backup($f); |
128 | - if(is_resource($f)) |
|
127 | + if (is_resource($f)) |
|
129 | 128 | fclose($f); |
130 | - $setup_tpl->set_var('error_msg',lang('backup finished')); |
|
129 | + $setup_tpl->set_var('error_msg', lang('backup finished')); |
|
131 | 130 | |
132 | 131 | /* Remove old backups. */ |
133 | 132 | $cleaned_files = array(); |
@@ -139,38 +138,38 @@ discard block |
||
139 | 138 | } |
140 | 139 | else |
141 | 140 | { |
142 | - $setup_tpl->set_var('error_msg',$f); |
|
141 | + $setup_tpl->set_var('error_msg', $f); |
|
143 | 142 | } |
144 | 143 | } |
145 | -$setup_tpl->set_var('backup_now_button','<input type="submit" name="backup" title="'.htmlspecialchars(lang("back's up your DB now, this might take a few minutes")).'" value="'.htmlspecialchars(lang('backup now')).'" />'); |
|
146 | -$setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
144 | +$setup_tpl->set_var('backup_now_button', '<input type="submit" name="backup" title="'.htmlspecialchars(lang("back's up your DB now, this might take a few minutes")).'" value="'.htmlspecialchars(lang('backup now')).'" />'); |
|
145 | +$setup_tpl->set_var('upload', '<input type="file" name="uploaded" /> '. |
|
147 | 146 | '<input type="submit" name="upload" value="'.htmlspecialchars(lang('upload backup')).'" title="'.htmlspecialchars(lang("uploads a backup to the backup-dir, from where you can restore it")).'" />'); |
148 | -$setup_tpl->set_var('backup_mincount','<input type="text" name="backup_mincount" value="'.$db_backup->backup_mincount.'" size="3" maxlength="3"/>'); |
|
149 | -$setup_tpl->set_var('backup_files','<input type="checkbox" name="backup_files" value="backup_files"'. |
|
150 | - ($db_backup->backup_files ? ' checked="true"':''). |
|
147 | +$setup_tpl->set_var('backup_mincount', '<input type="text" name="backup_mincount" value="'.$db_backup->backup_mincount.'" size="3" maxlength="3"/>'); |
|
148 | +$setup_tpl->set_var('backup_files', '<input type="checkbox" name="backup_files" value="backup_files"'. |
|
149 | + ($db_backup->backup_files ? ' checked="true"' : ''). |
|
151 | 150 | // do NOT allow to change "backup files" outside of setup |
152 | 151 | ($is_setup ? '' : ' disabled="true" title="'.htmlspecialchars(lang('Can only be change via Setup!')).'"').'/>'); |
153 | -$setup_tpl->set_var('backup_save_settings','<input type="submit" name="save_backup_settings" value="'.htmlspecialchars(lang('save')).'" />'); |
|
154 | -$setup_tpl->set_var('backup_mount','<input type="submit" name="mount" value="'.htmlspecialchars(lang('Mount backup directory to %1','/backup')).'" />'); |
|
152 | +$setup_tpl->set_var('backup_save_settings', '<input type="submit" name="save_backup_settings" value="'.htmlspecialchars(lang('save')).'" />'); |
|
153 | +$setup_tpl->set_var('backup_mount', '<input type="submit" name="mount" value="'.htmlspecialchars(lang('Mount backup directory to %1', '/backup')).'" />'); |
|
155 | 154 | |
156 | 155 | if ($_POST['upload'] && is_array($_FILES['uploaded']) && !$_FILES['uploaded']['error'] && |
157 | 156 | is_uploaded_file($_FILES['uploaded']['tmp_name'])) |
158 | 157 | { |
159 | - move_uploaded_file($_FILES['uploaded']['tmp_name'],$db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
|
158 | + move_uploaded_file($_FILES['uploaded']['tmp_name'], $db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
|
160 | 159 | |
161 | 160 | $md5 = ', md5='.md5_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
162 | 161 | $md5 .= ', sha1='.sha1_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
163 | 162 | |
164 | - $setup_tpl->set_var('error_msg',lang("succesfully uploaded file %1",$_FILES['uploaded']['name'].', '. |
|
165 | - sprintf('%3.1lf MB (%d)',$_FILES['uploaded']['size']/(1024*1024),$_FILES['uploaded']['size']).$md5)); |
|
163 | + $setup_tpl->set_var('error_msg', lang("succesfully uploaded file %1", $_FILES['uploaded']['name'].', '. |
|
164 | + sprintf('%3.1lf MB (%d)', $_FILES['uploaded']['size'] / (1024 * 1024), $_FILES['uploaded']['size']).$md5)); |
|
166 | 165 | } |
167 | 166 | // delete a backup |
168 | 167 | if ($_POST['delete']) |
169 | 168 | { |
170 | 169 | list($file) = each($_POST['delete']); |
171 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
170 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
172 | 171 | |
173 | - if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
172 | + if (unlink($file)) $setup_tpl->set_var('error_msg', lang("backup '%1' deleted", $file)); |
|
174 | 173 | } |
175 | 174 | // rename a backup |
176 | 175 | if ($_POST['rename']) |
@@ -181,44 +180,44 @@ discard block |
||
181 | 180 | { |
182 | 181 | list($ending) = array_reverse(explode('.', $file)); |
183 | 182 | list($new_ending, $has_ending) = array_reverse(explode('.', $new_name)); |
184 | - if(!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
185 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
186 | - $ext = preg_match('/(\.gz|\.bz2)+$/i',$file,$matches) ? $matches[1] : ''; |
|
187 | - $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i','',basename($new_name)).$ext; |
|
188 | - if (rename($file,$new_file)) $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
183 | + if (!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
184 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
185 | + $ext = preg_match('/(\.gz|\.bz2)+$/i', $file, $matches) ? $matches[1] : ''; |
|
186 | + $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i', '', basename($new_name)).$ext; |
|
187 | + if (rename($file, $new_file)) $setup_tpl->set_var('error_msg', lang("backup '%1' renamed to '%2'", basename($file), basename($new_file))); |
|
189 | 188 | } |
190 | 189 | } |
191 | 190 | // restore a backup |
192 | 191 | if ($_POST['restore']) |
193 | 192 | { |
194 | 193 | list($file) = each($_POST['restore']); |
195 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
194 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
196 | 195 | |
197 | - if (is_resource($f = $db_backup->fopen_backup($file,true))) |
|
196 | + if (is_resource($f = $db_backup->fopen_backup($file, true))) |
|
198 | 197 | { |
199 | - echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
198 | + echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
200 | 199 | $start = time(); |
201 | - $db_backup->restore($f, true, $file); // allways convert to current system charset on restore |
|
202 | - $setup_tpl->set_var('error_msg',lang("backup '%1' restored",$file).' ('.(time()-$start).' s)'); |
|
200 | + $db_backup->restore($f, true, $file); // allways convert to current system charset on restore |
|
201 | + $setup_tpl->set_var('error_msg', lang("backup '%1' restored", $file).' ('.(time() - $start).' s)'); |
|
203 | 202 | if ($run_in_egw) |
204 | 203 | { |
205 | 204 | // updating the backup |
206 | 205 | $cmd = new setup_cmd_update($GLOBALS['egw']->session->account_domain, |
207 | - $GLOBALS['egw_info']['server']['header_admin_user']='admin', |
|
208 | - $GLOBALS['egw_info']['server']['header_admin_password']=uniqid('pw',true),false,true); |
|
206 | + $GLOBALS['egw_info']['server']['header_admin_user'] = 'admin', |
|
207 | + $GLOBALS['egw_info']['server']['header_admin_password'] = uniqid('pw', true), false, true); |
|
209 | 208 | echo $cmd->run()."\n"; |
210 | - echo '<h3>'.lang('You should %1log out%2 and in again, to update your current session!','<a href="'.Egw::link('/logout.php').'" target="_parent">','</a>')."</h3>\n"; |
|
209 | + echo '<h3>'.lang('You should %1log out%2 and in again, to update your current session!', '<a href="'.Egw::link('/logout.php').'" target="_parent">', '</a>')."</h3>\n"; |
|
211 | 210 | } |
212 | 211 | } |
213 | 212 | else |
214 | 213 | { |
215 | - $setup_tpl->set_var('error_msg',$f); |
|
214 | + $setup_tpl->set_var('error_msg', $f); |
|
216 | 215 | } |
217 | 216 | } |
218 | 217 | // create a new scheduled backup |
219 | 218 | if ($_POST['schedule']) |
220 | 219 | { |
221 | - $asyncservice->set_timer($_POST['times'],'db_backup-'.implode(':',$_POST['times']),'admin.admin_db_backup.do_backup',''); |
|
220 | + $asyncservice->set_timer($_POST['times'], 'db_backup-'.implode(':', $_POST['times']), 'admin.admin_db_backup.do_backup', ''); |
|
222 | 221 | } |
223 | 222 | // cancel a scheduled backup |
224 | 223 | if (is_array($_POST['cancel'])) |
@@ -229,29 +228,29 @@ discard block |
||
229 | 228 | // list scheduled backups |
230 | 229 | if (($jobs = $asyncservice->read('db_backup-%'))) |
231 | 230 | { |
232 | - foreach($jobs as $job) |
|
231 | + foreach ($jobs as $job) |
|
233 | 232 | { |
234 | 233 | $setup_tpl->set_var($job['times']); |
235 | - $setup_tpl->set_var('next_run',date('Y-m-d H:i',$job['next'])); |
|
236 | - $setup_tpl->set_var('actions','<input type="submit" name="cancel['.$job['id'].']" value="'.htmlspecialchars(lang('delete')).'" />'); |
|
237 | - $setup_tpl->parse('schedule_rows','schedule_row',true); |
|
234 | + $setup_tpl->set_var('next_run', date('Y-m-d H:i', $job['next'])); |
|
235 | + $setup_tpl->set_var('actions', '<input type="submit" name="cancel['.$job['id'].']" value="'.htmlspecialchars(lang('delete')).'" />'); |
|
236 | + $setup_tpl->parse('schedule_rows', 'schedule_row', true); |
|
238 | 237 | } |
239 | 238 | } |
240 | 239 | // input-fields to create a new scheduled backup |
241 | -foreach($times=array('year'=>'*','month'=>'*','day'=>'*','dow'=>'2-6','hour'=>3,'min'=>0) as $name => $default) |
|
240 | +foreach ($times = array('year'=>'*', 'month'=>'*', 'day'=>'*', 'dow'=>'2-6', 'hour'=>3, 'min'=>0) as $name => $default) |
|
242 | 241 | { |
243 | - $setup_tpl->set_var($name,'<input name="times['.$name.']" size="5" value="'.$default.'" />'); |
|
242 | + $setup_tpl->set_var($name, '<input name="times['.$name.']" size="5" value="'.$default.'" />'); |
|
244 | 243 | } |
245 | -$setup_tpl->set_var('next_run',' '); |
|
246 | -$setup_tpl->set_var('actions','<input type="submit" name="schedule" value="'.htmlspecialchars(lang('schedule')).'" />'); |
|
247 | -$setup_tpl->parse('schedule_rows','schedule_row',true); |
|
244 | +$setup_tpl->set_var('next_run', ' '); |
|
245 | +$setup_tpl->set_var('actions', '<input type="submit" name="schedule" value="'.htmlspecialchars(lang('schedule')).'" />'); |
|
246 | +$setup_tpl->parse('schedule_rows', 'schedule_row', true); |
|
248 | 247 | |
249 | 248 | // listing the availible backup sets |
250 | -$setup_tpl->set_var('backup_dir',$db_backup->backup_dir); |
|
251 | -$setup_tpl->set_var('set_rows',''); |
|
249 | +$setup_tpl->set_var('backup_dir', $db_backup->backup_dir); |
|
250 | +$setup_tpl->set_var('set_rows', ''); |
|
252 | 251 | $handle = @opendir($db_backup->backup_dir); |
253 | 252 | $files = array(); |
254 | -while($handle && ($file = readdir($handle))) |
|
253 | +while ($handle && ($file = readdir($handle))) |
|
255 | 254 | { |
256 | 255 | if ($file != '.' && $file != '..') |
257 | 256 | { |
@@ -261,13 +260,13 @@ discard block |
||
261 | 260 | if ($handle) closedir($handle); |
262 | 261 | |
263 | 262 | arsort($files); |
264 | -foreach($files as $file => $ctime) |
|
263 | +foreach ($files as $file => $ctime) |
|
265 | 264 | { |
266 | 265 | $size = filesize($db_backup->backup_dir.'/'.$file); |
267 | 266 | $setup_tpl->set_var(array( |
268 | 267 | 'filename' => $file, |
269 | - 'mod' => date('Y-m-d H:i',$ctime), |
|
270 | - 'size' => sprintf('%3.1lf MB (%d)',$size/(1024*1024),$size), |
|
268 | + 'mod' => date('Y-m-d H:i', $ctime), |
|
269 | + 'size' => sprintf('%3.1lf MB (%d)', $size / (1024 * 1024), $size), |
|
271 | 270 | 'actions' => '<input type="submit" name="download['.$file.']" value="'.htmlspecialchars(lang('download')).'" /> '."\n". |
272 | 271 | '<input type="submit" name="delete['.$file.']" value="'.htmlspecialchars(lang('delete')).'" onclick="return confirm(\''. |
273 | 272 | htmlspecialchars(lang('Confirm to delete this backup?')).'\');" /> '."\n". |
@@ -275,7 +274,7 @@ discard block |
||
275 | 274 | '<input type="submit" name="restore['.$file.']" value="'.htmlspecialchars(lang('restore')).'" onclick="return confirm(\''. |
276 | 275 | htmlspecialchars(lang('Restoring a backup will delete/replace all content in your database. Are you sure?')).'\');" />', |
277 | 276 | )); |
278 | - $setup_tpl->parse('set_rows','set_row',true); |
|
277 | + $setup_tpl->parse('set_rows', 'set_row', true); |
|
279 | 278 | } |
280 | 279 | |
281 | 280 | $setup_tpl->set_var(array( |
@@ -299,8 +298,8 @@ discard block |
||
299 | 298 | 'lang_size' => lang('size'), |
300 | 299 | )); |
301 | 300 | |
302 | -$setup_tpl->set_var('self',$self); |
|
303 | -$setup_tpl->pparse('out','T_db_backup'); |
|
301 | +$setup_tpl->set_var('self', $self); |
|
302 | +$setup_tpl->pparse('out', 'T_db_backup'); |
|
304 | 303 | |
305 | 304 | if ($run_in_egw) |
306 | 305 | { |
@@ -14,9 +14,12 @@ discard block |
||
14 | 14 | use EGroupware\Api\Egw; |
15 | 15 | use EGroupware\Api\Vfs; |
16 | 16 | |
17 | -if (!is_object(@$GLOBALS['egw'])) // called from outside eGW ==> setup |
|
17 | +if (!is_object(@$GLOBALS['egw'])) |
|
18 | +{ |
|
19 | + // called from outside eGW ==> setup |
|
18 | 20 | { |
19 | 21 | include ('./inc/functions.inc.php'); |
22 | +} |
|
20 | 23 | |
21 | 24 | @set_time_limit(0); |
22 | 25 | |
@@ -42,7 +45,9 @@ discard block |
||
42 | 45 | { |
43 | 46 | list($file) = each($_POST['download']); |
44 | 47 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
45 | - while (@ob_end_clean()) {} // end all active output buffering |
|
48 | + while (@ob_end_clean()) |
|
49 | + { |
|
50 | +} // end all active output buffering |
|
46 | 51 | ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
47 | 52 | Api\Header\Content::type(basename($file)); |
48 | 53 | readfile($file); |
@@ -126,7 +131,9 @@ discard block |
||
126 | 131 | echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
127 | 132 | $db_backup->backup($f); |
128 | 133 | if(is_resource($f)) |
129 | - fclose($f); |
|
134 | + { |
|
135 | + fclose($f); |
|
136 | + } |
|
130 | 137 | $setup_tpl->set_var('error_msg',lang('backup finished')); |
131 | 138 | |
132 | 139 | /* Remove old backups. */ |
@@ -170,8 +177,11 @@ discard block |
||
170 | 177 | list($file) = each($_POST['delete']); |
171 | 178 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
172 | 179 | |
173 | - if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
174 | -} |
|
180 | + if (unlink($file)) |
|
181 | + { |
|
182 | + $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
183 | + } |
|
184 | + } |
|
175 | 185 | // rename a backup |
176 | 186 | if ($_POST['rename']) |
177 | 187 | { |
@@ -181,11 +191,17 @@ discard block |
||
181 | 191 | { |
182 | 192 | list($ending) = array_reverse(explode('.', $file)); |
183 | 193 | list($new_ending, $has_ending) = array_reverse(explode('.', $new_name)); |
184 | - if(!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
194 | + if(!$has_ending || $new_ending != $ending) |
|
195 | + { |
|
196 | + $new_name .= '.'.$ending; |
|
197 | + } |
|
185 | 198 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
186 | 199 | $ext = preg_match('/(\.gz|\.bz2)+$/i',$file,$matches) ? $matches[1] : ''; |
187 | 200 | $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i','',basename($new_name)).$ext; |
188 | - if (rename($file,$new_file)) $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
201 | + if (rename($file,$new_file)) |
|
202 | + { |
|
203 | + $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
204 | + } |
|
189 | 205 | } |
190 | 206 | } |
191 | 207 | // restore a backup |
@@ -258,7 +274,10 @@ discard block |
||
258 | 274 | $files[$file] = filectime($db_backup->backup_dir.'/'.$file); |
259 | 275 | } |
260 | 276 | } |
261 | -if ($handle) closedir($handle); |
|
277 | +if ($handle) |
|
278 | +{ |
|
279 | + closedir($handle); |
|
280 | +} |
|
262 | 281 | |
263 | 282 | arsort($files); |
264 | 283 | foreach($files as $file => $ctime) |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | use EGroupware\Api; |
14 | 14 | use EGroupware\Api\Framework; |
15 | 15 | |
16 | -if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false) |
|
16 | +if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') !== false) |
|
17 | 17 | { |
18 | 18 | include('./inc/functions.inc.php'); |
19 | 19 | |
20 | 20 | // Authorize the user to use setup app and load the database |
21 | 21 | // Does not return unless user is authorized |
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; |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | $lname = $_POST['lname']; |
44 | 44 | $email = $_POST['email']; |
45 | 45 | |
46 | - if($passwd != $passwd2 || !$username) |
|
46 | + if ($passwd != $passwd2 || !$username) |
|
47 | 47 | { |
48 | - $error = '<p>'.lang('Passwords did not match, please re-enter') . ".</p>\n"; |
|
48 | + $error = '<p>'.lang('Passwords did not match, please re-enter').".</p>\n"; |
|
49 | 49 | } |
50 | - if(!$username) |
|
50 | + if (!$username) |
|
51 | 51 | { |
52 | - $error = '<p>'.lang('You must enter a username for the admin') . ".</p>\n"; |
|
52 | + $error = '<p>'.lang('You must enter a username for the admin').".</p>\n"; |
|
53 | 53 | } |
54 | 54 | } |
55 | -if(!$_POST['submit'] || $error) |
|
55 | +if (!$_POST['submit'] || $error) |
|
56 | 56 | { |
57 | 57 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
58 | 58 | $setup_tpl = new Framework\Template($tpl_root); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | 'T_login_stage_header' => 'login_stage_header.tpl', |
65 | 65 | 'T_admin_account' => 'admin_account.tpl' |
66 | 66 | )); |
67 | - $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
68 | - $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
67 | + $setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
68 | + $setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
69 | 69 | |
70 | 70 | $GLOBALS['egw_setup']->html->show_header(lang('Create admin account')); |
71 | 71 | |
@@ -76,27 +76,27 @@ discard block |
||
76 | 76 | 'lname' => $lname, |
77 | 77 | 'email' => $email, |
78 | 78 | )); |
79 | - $setup_tpl->set_var('action_url','admin_account.php'); |
|
80 | - $setup_tpl->set_var('description',lang('This will create a first user in eGroupWare or reset password and admin rights of an exiting user')); |
|
81 | - $setup_tpl->set_var('lang_deleteall',lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?')); |
|
82 | - |
|
83 | - $setup_tpl->set_var('detailadmin',lang('Details for Admin account')); |
|
84 | - $setup_tpl->set_var('adminusername',lang('Admin username')); |
|
85 | - $setup_tpl->set_var('adminfirstname',lang('Admin first name')); |
|
86 | - $setup_tpl->set_var('adminlastname',lang('Admin last name')); |
|
87 | - $setup_tpl->set_var('adminemail',lang('Admin email address')); |
|
88 | - $setup_tpl->set_var('adminpassword',lang('Admin password')); |
|
89 | - $setup_tpl->set_var('adminpassword2',lang('Re-enter password')); |
|
90 | - $setup_tpl->set_var('admin_all_apps',lang('Give admin access to all installed apps')); |
|
91 | - $setup_tpl->set_var('all_apps_desc',lang('Usually more annoying.<br />Admins can use Admin >> Manage accounts or groups to give access to further apps.')); |
|
92 | - $setup_tpl->set_var('create_demo_accounts',lang('Create demo accounts')); |
|
93 | - $setup_tpl->set_var('demo_desc',lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.')); |
|
79 | + $setup_tpl->set_var('action_url', 'admin_account.php'); |
|
80 | + $setup_tpl->set_var('description', lang('This will create a first user in eGroupWare or reset password and admin rights of an exiting user')); |
|
81 | + $setup_tpl->set_var('lang_deleteall', lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?')); |
|
82 | + |
|
83 | + $setup_tpl->set_var('detailadmin', lang('Details for Admin account')); |
|
84 | + $setup_tpl->set_var('adminusername', lang('Admin username')); |
|
85 | + $setup_tpl->set_var('adminfirstname', lang('Admin first name')); |
|
86 | + $setup_tpl->set_var('adminlastname', lang('Admin last name')); |
|
87 | + $setup_tpl->set_var('adminemail', lang('Admin email address')); |
|
88 | + $setup_tpl->set_var('adminpassword', lang('Admin password')); |
|
89 | + $setup_tpl->set_var('adminpassword2', lang('Re-enter password')); |
|
90 | + $setup_tpl->set_var('admin_all_apps', lang('Give admin access to all installed apps')); |
|
91 | + $setup_tpl->set_var('all_apps_desc', lang('Usually more annoying.<br />Admins can use Admin >> Manage accounts or groups to give access to further apps.')); |
|
92 | + $setup_tpl->set_var('create_demo_accounts', lang('Create demo accounts')); |
|
93 | + $setup_tpl->set_var('demo_desc', lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.')); |
|
94 | 94 | |
95 | 95 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
96 | 96 | |
97 | - $setup_tpl->set_var('lang_submit',lang('Save')); |
|
98 | - $setup_tpl->set_var('lang_cancel',lang('Cancel')); |
|
99 | - $setup_tpl->pparse('out','T_admin_account'); |
|
97 | + $setup_tpl->set_var('lang_submit', lang('Save')); |
|
98 | + $setup_tpl->set_var('lang_cancel', lang('Cancel')); |
|
99 | + $setup_tpl->pparse('out', 'T_admin_account'); |
|
100 | 100 | $GLOBALS['egw_setup']->html->show_footer(); |
101 | 101 | } |
102 | 102 | else |
@@ -104,25 +104,25 @@ discard block |
||
104 | 104 | /* Begin transaction for acl, etc */ |
105 | 105 | $GLOBALS['egw_setup']->db->transaction_begin(); |
106 | 106 | |
107 | - if($_POST['delete_all']) |
|
107 | + if ($_POST['delete_all']) |
|
108 | 108 | { |
109 | 109 | /* Now, clear out existing tables */ |
110 | - foreach(array($GLOBALS['egw_setup']->accounts_table,$GLOBALS['egw_setup']->acl_table,'egw_access_log') as $table) |
|
110 | + foreach (array($GLOBALS['egw_setup']->accounts_table, $GLOBALS['egw_setup']->acl_table, 'egw_access_log') as $table) |
|
111 | 111 | { |
112 | - $GLOBALS['egw_setup']->db->delete($table,'1=1',__LINE__,__FILE__); |
|
112 | + $GLOBALS['egw_setup']->db->delete($table, '1=1', __LINE__, __FILE__); |
|
113 | 113 | } |
114 | 114 | // keep default and forced prefs from installed apps |
115 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->prefs_table,'preference_owner NOT IN (-1,-2)',__LINE__,__FILE__); |
|
115 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->prefs_table, 'preference_owner NOT IN (-1,-2)', __LINE__, __FILE__); |
|
116 | 116 | // remove accounts from addressbook |
117 | - $GLOBALS['egw_setup']->db->delete('egw_addressbook','account_id IS NOT NULL',__LINE__,__FILE__); |
|
117 | + $GLOBALS['egw_setup']->db->delete('egw_addressbook', 'account_id IS NOT NULL', __LINE__, __FILE__); |
|
118 | 118 | } |
119 | 119 | // create our stock groups: Default (all users) and Admins (administrators) |
120 | - $defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
|
121 | - $admingroupid = (int)$GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); |
|
120 | + $defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False); |
|
121 | + $admingroupid = (int)$GLOBALS['egw_setup']->add_account('Admins', 'Admin', 'Group', False, False); |
|
122 | 122 | |
123 | 123 | if (!$defaultgroupid || !$admingroupid) |
124 | 124 | { |
125 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') === false) |
|
125 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') === false) |
|
126 | 126 | { |
127 | 127 | return 42; //lang('Error in group-creation !!!'); // dont exit on setup-cli |
128 | 128 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | // Group perms for the default group |
136 | - $default_group_apps = array('addressbook','calendar','infolog','mail','filemanager','preferences','manual','groupdav','notifications','timesheet','importexport','activesync'); |
|
137 | - $GLOBALS['egw_setup']->add_acl($default_group_apps,'run',$defaultgroupid); |
|
136 | + $default_group_apps = array('addressbook', 'calendar', 'infolog', 'mail', 'filemanager', 'preferences', 'manual', 'groupdav', 'notifications', 'timesheet', 'importexport', 'activesync'); |
|
137 | + $GLOBALS['egw_setup']->add_acl($default_group_apps, 'run', $defaultgroupid); |
|
138 | 138 | |
139 | 139 | $apps = array(); |
140 | - foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table,'app_name','app_enabled < 3',__LINE__,__FILE__) as $row) |
|
140 | + foreach ($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table, 'app_name', 'app_enabled < 3', __LINE__, __FILE__) as $row) |
|
141 | 141 | { |
142 | 142 | $apps[] = $row['app_name']; |
143 | 143 | } |
@@ -148,24 +148,24 @@ discard block |
||
148 | 148 | $apps = array_intersect( |
149 | 149 | // also give Admins apps of all users group Defaults, in case one forgot to add admins to it |
150 | 150 | array_unique(array_merge($default_group_apps, |
151 | - array('admin','bookmarks','emailadmin','news_admin','phpbrain','phpsysinfo','phpfreechat','projectmanager','resources','sitemgr','timesheet','tracker','wiki'))),$apps); |
|
151 | + array('admin', 'bookmarks', 'emailadmin', 'news_admin', 'phpbrain', 'phpsysinfo', 'phpfreechat', 'projectmanager', 'resources', 'sitemgr', 'timesheet', 'tracker', 'wiki'))), $apps); |
|
152 | 152 | } |
153 | - $GLOBALS['egw_setup']->add_acl($apps,'run',$admingroupid); |
|
153 | + $GLOBALS['egw_setup']->add_acl($apps, 'run', $admingroupid); |
|
154 | 154 | |
155 | 155 | /* Creation of the demo accounts is optional - the checkbox is on by default. */ |
156 | - if($_POST['create_demo']) |
|
156 | + if ($_POST['create_demo']) |
|
157 | 157 | { |
158 | 158 | // Create 3 demo accounts |
159 | - $GLOBALS['egw_setup']->add_account('demo','Demo','Account','guest'); |
|
160 | - $GLOBALS['egw_setup']->add_account('demo2','Demo2','Account','guest'); |
|
161 | - $GLOBALS['egw_setup']->add_account('demo3','Demo3','Account','guest'); |
|
159 | + $GLOBALS['egw_setup']->add_account('demo', 'Demo', 'Account', 'guest'); |
|
160 | + $GLOBALS['egw_setup']->add_account('demo2', 'Demo2', 'Account', 'guest'); |
|
161 | + $GLOBALS['egw_setup']->add_account('demo3', 'Demo3', 'Account', 'guest'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /* Create records for administrator account, with Admins as primary and Default as additional group */ |
165 | - $accountid = $GLOBALS['egw_setup']->add_account($username,$fname,$lname,$passwd,'Admins',True,$email); |
|
165 | + $accountid = $GLOBALS['egw_setup']->add_account($username, $fname, $lname, $passwd, 'Admins', True, $email); |
|
166 | 166 | if (!$accountid) |
167 | 167 | { |
168 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') === false) |
|
168 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') === false) |
|
169 | 169 | { |
170 | 170 | return 41; //lang('Error in admin-creation !!!'); // dont exit on setup-cli |
171 | 171 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | $GLOBALS['egw_setup']->db->transaction_abort(); |
175 | 175 | exit; |
176 | 176 | } |
177 | - $GLOBALS['egw_setup']->set_memberships(array($admingroupid,$defaultgroupid),$accountid); |
|
177 | + $GLOBALS['egw_setup']->set_memberships(array($admingroupid, $defaultgroupid), $accountid); |
|
178 | 178 | |
179 | 179 | $GLOBALS['egw_setup']->db->transaction_commit(); |
180 | 180 | |
181 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false) |
|
181 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') !== false) |
|
182 | 182 | { |
183 | 183 | Header('Location: index.php'); |
184 | 184 | } |
@@ -68,91 +68,91 @@ |
||
68 | 68 | |
69 | 69 | switch($action) |
70 | 70 | { |
71 | - case '--version': |
|
72 | - case '--check': |
|
73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
74 | - break; |
|
75 | - |
|
76 | - case '--create-header': |
|
77 | - case '--edit-header': |
|
78 | - case '--upgrade-header': |
|
79 | - case '--update-header': |
|
80 | - do_header($action == '--create-header',$arguments); |
|
81 | - break; |
|
82 | - |
|
83 | - case '--install': |
|
84 | - do_install($arguments); |
|
85 | - break; |
|
86 | - |
|
87 | - case '--config': |
|
88 | - do_config($arguments); |
|
89 | - break; |
|
90 | - |
|
91 | - case '--admin': |
|
92 | - do_admin($arguments[0]); |
|
93 | - break; |
|
94 | - |
|
95 | - case '--update': |
|
96 | - do_update($arguments[0]); |
|
97 | - break; |
|
98 | - |
|
99 | - case '--register-hooks': |
|
100 | - case '--register-all-hooks': |
|
101 | - do_hooks($arguments[0]); |
|
102 | - break; |
|
103 | - |
|
104 | - case '--backup': |
|
105 | - do_backup($arguments[0]); |
|
106 | - break; |
|
107 | - |
|
108 | - case '--languages': |
|
109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
110 | - break; |
|
111 | - |
|
112 | - case '--charsets': |
|
113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
114 | - break; |
|
115 | - |
|
116 | - case '--exit-codes': |
|
117 | - list_exit_codes(); |
|
118 | - break; |
|
119 | - |
|
120 | - case '--help': |
|
121 | - case '--usage': |
|
122 | - do_usage($arguments[0]); |
|
123 | - break; |
|
124 | - |
|
125 | - default: |
|
126 | - // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
129 | - { |
|
130 | - $args = array(); |
|
131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | - foreach($arguments as $arg) |
|
71 | + case '--version': |
|
72 | + case '--check': |
|
73 | + setup_cmd::check_installed($arguments[0],0,true); |
|
74 | + break; |
|
75 | + |
|
76 | + case '--create-header': |
|
77 | + case '--edit-header': |
|
78 | + case '--upgrade-header': |
|
79 | + case '--update-header': |
|
80 | + do_header($action == '--create-header',$arguments); |
|
81 | + break; |
|
82 | + |
|
83 | + case '--install': |
|
84 | + do_install($arguments); |
|
85 | + break; |
|
86 | + |
|
87 | + case '--config': |
|
88 | + do_config($arguments); |
|
89 | + break; |
|
90 | + |
|
91 | + case '--admin': |
|
92 | + do_admin($arguments[0]); |
|
93 | + break; |
|
94 | + |
|
95 | + case '--update': |
|
96 | + do_update($arguments[0]); |
|
97 | + break; |
|
98 | + |
|
99 | + case '--register-hooks': |
|
100 | + case '--register-all-hooks': |
|
101 | + do_hooks($arguments[0]); |
|
102 | + break; |
|
103 | + |
|
104 | + case '--backup': |
|
105 | + do_backup($arguments[0]); |
|
106 | + break; |
|
107 | + |
|
108 | + case '--languages': |
|
109 | + echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
110 | + break; |
|
111 | + |
|
112 | + case '--charsets': |
|
113 | + echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
114 | + break; |
|
115 | + |
|
116 | + case '--exit-codes': |
|
117 | + list_exit_codes(); |
|
118 | + break; |
|
119 | + |
|
120 | + case '--help': |
|
121 | + case '--usage': |
|
122 | + do_usage($arguments[0]); |
|
123 | + break; |
|
124 | + |
|
125 | + default: |
|
126 | + // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
127 | + if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | + is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
133 | 129 | { |
134 | - list($name,$value) = explode('=',$arg,2); |
|
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
136 | - { |
|
137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
138 | - } |
|
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
130 | + $args = array(); |
|
131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | + foreach($arguments as $arg) |
|
140 | 133 | { |
141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
142 | - $args[$name][$sub] = $value; |
|
143 | - } |
|
144 | - else |
|
145 | - { |
|
146 | - $args[$name] = $value; |
|
134 | + list($name,$value) = explode('=',$arg,2); |
|
135 | + if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
136 | + { |
|
137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
138 | + } |
|
139 | + if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
140 | + { |
|
141 | + list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
142 | + $args[$name][$sub] = $value; |
|
143 | + } |
|
144 | + else |
|
145 | + { |
|
146 | + $args[$name] = $value; |
|
147 | + } |
|
147 | 148 | } |
149 | + $cmd = new $class($args); |
|
150 | + $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | + if (is_array($msg)) $msg = print_r($msg,true); |
|
152 | + echo "$msg\n"; |
|
153 | + break; |
|
148 | 154 | } |
149 | - $cmd = new $class($args); |
|
150 | - $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
152 | - echo "$msg\n"; |
|
153 | - break; |
|
154 | - } |
|
155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
156 | 156 | } |
157 | 157 | exit(0); |
158 | 158 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | use EGroupware\Api; |
15 | 15 | |
16 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
16 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
17 | 17 | |
18 | 18 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
19 | 19 | { |
20 | 20 | die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
21 | 21 | } |
22 | -error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
|
22 | +error_reporting(E_ALL&~E_NOTICE&~E_STRICT); |
|
23 | 23 | |
24 | 24 | $dry_run = false; |
25 | 25 | array_shift($_SERVER['argv']); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | $arguments = $_SERVER['argv']; |
35 | 35 | $action = array_shift($arguments); |
36 | - if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',',$arguments[0]); // header include needs that to detects the right domain |
|
36 | + if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',', $arguments[0]); // header include needs that to detects the right domain |
|
37 | 37 | } |
38 | 38 | else |
39 | 39 | { |
@@ -42,42 +42,42 @@ discard block |
||
42 | 42 | |
43 | 43 | // setting the language from the enviroment |
44 | 44 | $_POST['ConfigLang'] = get_lang($charset); |
45 | -create_http_enviroment(); // guessing the docroot etc. |
|
45 | +create_http_enviroment(); // guessing the docroot etc. |
|
46 | 46 | |
47 | 47 | if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp')) |
48 | 48 | { |
49 | - ini_set('session.save_path','/tmp'); // regular users may have no rights to apache's session dir |
|
49 | + ini_set('session.save_path', '/tmp'); // regular users may have no rights to apache's session dir |
|
50 | 50 | } |
51 | 51 | // check if date.timezone is set, report it and set something if not, as it gives tons of errors in install log |
52 | 52 | if (!ini_get('date.timezone')) |
53 | 53 | { |
54 | 54 | if (!($tz = date_default_timezone_get())) $tz = 'UTC'; |
55 | 55 | echo "No default timezone (php.ini date.timezone) set, we temporary set '$tz'. You should fix that permanent!\n"; |
56 | - ini_set('date.timezone',$tz); |
|
56 | + ini_set('date.timezone', $tz); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // setting up the $GLOBALS['egw_setup'] object AND including the header.inc.php if it exists |
60 | 60 | include('inc/functions.inc.php'); |
61 | -$GLOBALS['egw_info']['flags']['no_exception_handler'] = 'cli'; // inc/functions.inc.php does NOT set it |
|
61 | +$GLOBALS['egw_info']['flags']['no_exception_handler'] = 'cli'; // inc/functions.inc.php does NOT set it |
|
62 | 62 | $GLOBALS['egw_setup']->system_charset = $charset; |
63 | 63 | |
64 | -if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
64 | +if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
65 | 65 | { |
66 | - throw new Api\Exception\WrongUserinput(lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.',PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version),98); |
|
66 | + throw new Api\Exception\WrongUserinput(lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.', PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version), 98); |
|
67 | 67 | } |
68 | 68 | |
69 | -switch($action) |
|
69 | +switch ($action) |
|
70 | 70 | { |
71 | 71 | case '--version': |
72 | 72 | case '--check': |
73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
73 | + setup_cmd::check_installed($arguments[0], 0, true); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case '--create-header': |
77 | 77 | case '--edit-header': |
78 | 78 | case '--upgrade-header': |
79 | 79 | case '--update-header': |
80 | - do_header($action == '--create-header',$arguments); |
|
80 | + do_header($action == '--create-header', $arguments); |
|
81 | 81 | break; |
82 | 82 | |
83 | 83 | case '--install': |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | break; |
107 | 107 | |
108 | 108 | case '--languages': |
109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
109 | + echo html_entity_decode(file_get_contents('lang/languages'), ENT_COMPAT, 'utf-8'); |
|
110 | 110 | break; |
111 | 111 | |
112 | 112 | case '--charsets': |
113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
113 | + echo html_entity_decode(implode("\n", $GLOBALS['egw_setup']->translation->get_charsets(false)), ENT_COMPAT, 'utf-8')."\n"; |
|
114 | 114 | break; |
115 | 115 | |
116 | 116 | case '--exit-codes': |
@@ -124,21 +124,21 @@ discard block |
||
124 | 124 | |
125 | 125 | default: |
126 | 126 | // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
127 | + if (substr($action, 0, 2) == '--' && class_exists($class = str_replace('-', '_', substr($action, 2))) && |
|
128 | + is_subclass_of($class, 'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
129 | 129 | { |
130 | 130 | $args = array(); |
131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | - foreach($arguments as $arg) |
|
131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | + foreach ($arguments as $arg) |
|
133 | 133 | { |
134 | - list($name,$value) = explode('=',$arg,2); |
|
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
134 | + list($name, $value) = explode('=', $arg, 2); |
|
135 | + if (property_exists('admin_cmd', $name)) // dont allow to overwrite admin_cmd properties |
|
136 | 136 | { |
137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!", $arg), 90); |
|
138 | 138 | } |
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
139 | + if (substr($name, -1) == ']') // allow 1-dim. arrays |
|
140 | 140 | { |
141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
141 | + list($name, $sub) = explode('[', substr($name, 0, -1), 2); |
|
142 | 142 | $args[$name][$sub] = $value; |
143 | 143 | } |
144 | 144 | else |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | } |
148 | 148 | } |
149 | 149 | $cmd = new $class($args); |
150 | - $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
150 | + $msg = $cmd->run($time = null, $set_modifier = true, $skip_checks = false, $check_only = $dry_run); |
|
151 | + if (is_array($msg)) $msg = print_r($msg, true); |
|
152 | 152 | echo "$msg\n"; |
153 | 153 | break; |
154 | 154 | } |
155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!", $action), 90); |
|
156 | 156 | } |
157 | 157 | exit(0); |
158 | 158 | |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function do_config($args) |
165 | 165 | { |
166 | - $arg0 = explode(',',array_shift($args)); |
|
166 | + $arg0 = explode(',', array_shift($args)); |
|
167 | 167 | if (!($domain = @array_shift($arg0))) $domain = 'default'; |
168 | 168 | $user = @array_shift($arg0); |
169 | 169 | $password = @array_shift($arg0); |
170 | - _fetch_user_password($user,$password); |
|
170 | + _fetch_user_password($user, $password); |
|
171 | 171 | |
172 | 172 | if ($arg0) // direct assignments (name=value,...) left |
173 | 173 | { |
174 | - array_unshift($args,implode(',',$arg0)); |
|
175 | - array_unshift($args,'--config'); |
|
174 | + array_unshift($args, implode(',', $arg0)); |
|
175 | + array_unshift($args, '--config'); |
|
176 | 176 | } |
177 | 177 | |
178 | - $cmd = new setup_cmd_config($domain,$user,$password,$args,true); |
|
178 | + $cmd = new setup_cmd_config($domain, $user, $password, $args, true); |
|
179 | 179 | echo $cmd->run()."\n\n"; |
180 | 180 | |
181 | 181 | $cmd->get_config(true); |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | */ |
189 | 189 | function do_hooks($arg) |
190 | 190 | { |
191 | - list($domain,$user,$password) = explode(',',$arg); |
|
192 | - _fetch_user_password($user,$password); |
|
191 | + list($domain, $user, $password) = explode(',', $arg); |
|
192 | + _fetch_user_password($user, $password); |
|
193 | 193 | |
194 | 194 | $domains = $GLOBALS['egw_domain']; |
195 | 195 | if ($domain && $domain != 'all') |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
198 | 198 | } |
199 | 199 | |
200 | - foreach(array_keys($domains) as $domain) |
|
200 | + foreach (array_keys($domains) as $domain) |
|
201 | 201 | { |
202 | - $cmd = new setup_cmd_hooks($domain,$user,$password); |
|
202 | + $cmd = new setup_cmd_hooks($domain, $user, $password); |
|
203 | 203 | echo "$domain: ".$cmd->run()."\n"; |
204 | 204 | } |
205 | 205 | echo "\n"; |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | */ |
213 | 213 | function do_admin($arg) |
214 | 214 | { |
215 | - list($domain,$user,$password,$admin,$pw,$first,$last,$email,$lang) = explode(',',$arg); |
|
216 | - _fetch_user_password($user,$password); |
|
215 | + list($domain, $user, $password, $admin, $pw, $first, $last, $email, $lang) = explode(',', $arg); |
|
216 | + _fetch_user_password($user, $password); |
|
217 | 217 | |
218 | - $cmd = new setup_cmd_admin($domain,$user,$password,$admin,$pw,$first,$last,$email,array(),$lang); |
|
218 | + $cmd = new setup_cmd_admin($domain, $user, $password, $admin, $pw, $first, $last, $email, array(), $lang); |
|
219 | 219 | echo $cmd->run()."\n"; |
220 | 220 | } |
221 | 221 | |
@@ -225,21 +225,21 @@ discard block |
||
225 | 225 | * @param string $arg domain(all),[config user(admin)],password,[backup-file, 'no' for no backup or empty for default name] |
226 | 226 | * @param boolean $quite_check quiten the call to _check_auth_config |
227 | 227 | */ |
228 | -function do_backup($arg,$quite_check=false) |
|
228 | +function do_backup($arg, $quite_check = false) |
|
229 | 229 | { |
230 | - list($domain,,,$backup) = $options = explode(',',$arg); |
|
230 | + list($domain,,, $backup) = $options = explode(',', $arg); |
|
231 | 231 | |
232 | 232 | $domains = $GLOBALS['egw_domain']; |
233 | 233 | if ($domain && $domain != 'all') |
234 | 234 | { |
235 | 235 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
236 | 236 | } |
237 | - foreach(array_keys($domains) as $domain) |
|
237 | + foreach (array_keys($domains) as $domain) |
|
238 | 238 | { |
239 | 239 | $options[0] = $domain; |
240 | 240 | |
241 | 241 | if ($quite_check) ob_start(); |
242 | - _check_auth_config(implode(',',$options),14); |
|
242 | + _check_auth_config(implode(',', $options), 14); |
|
243 | 243 | if ($quite_check) ob_end_clean(); |
244 | 244 | |
245 | 245 | if ($backup == 'no') |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | else // backup failed ==> dont start the upgrade |
259 | 259 | { |
260 | - throw new Api\Exception\WrongUserinput(lang('Backup failed').': '.$f,50); |
|
260 | + throw new Api\Exception\WrongUserinput(lang('Backup failed').': '.$f, 50); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | } |
@@ -270,31 +270,31 @@ discard block |
||
270 | 270 | */ |
271 | 271 | function do_update($arg) |
272 | 272 | { |
273 | - list($domain,$user,$password,$backup,$app) = explode(',',$arg); |
|
274 | - _fetch_user_password($user,$password); |
|
273 | + list($domain, $user, $password, $backup, $app) = explode(',', $arg); |
|
274 | + _fetch_user_password($user, $password); |
|
275 | 275 | |
276 | 276 | $domains = $GLOBALS['egw_domain']; |
277 | 277 | if ($domain && $domain != 'all') |
278 | 278 | { |
279 | 279 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
280 | 280 | } |
281 | - foreach($domains as $domain => $data) |
|
281 | + foreach ($domains as $domain => $data) |
|
282 | 282 | { |
283 | 283 | $arg = "$domain,$user,$password,$backup"; |
284 | 284 | |
285 | - _check_auth_config($arg,14); |
|
285 | + _check_auth_config($arg, 14); |
|
286 | 286 | |
287 | 287 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 4 && |
288 | 288 | (!$app || !in_array($app, setup_cmd::$apps_to_install) && !in_array($app, setup_cmd::$apps_to_upgrade)) && |
289 | 289 | !setup_cmd::check_autoinstall()) |
290 | 290 | { |
291 | - echo lang('No update necessary, domain %1(%2) is up to date.',$domain,$data['db_type'])."\n"; |
|
291 | + echo lang('No update necessary, domain %1(%2) is up to date.', $domain, $data['db_type'])."\n"; |
|
292 | 292 | } |
293 | 293 | else |
294 | 294 | { |
295 | - do_backup($arg,true); |
|
295 | + do_backup($arg, true); |
|
296 | 296 | |
297 | - $cmd = new setup_cmd_update($domain,$user,$password,$backup,false,$app); |
|
297 | + $cmd = new setup_cmd_update($domain, $user, $password, $backup, false, $app); |
|
298 | 298 | echo $cmd->run()."\n"; |
299 | 299 | } |
300 | 300 | } |
@@ -313,20 +313,20 @@ discard block |
||
313 | 313 | * @param boolean $set_lang =true set our charset, overwriting the charset of the eGW installation, default true |
314 | 314 | * @return array with unprocessed arguments from $arg |
315 | 315 | */ |
316 | -function _check_auth_config($arg,$stop,$set_lang=true) |
|
316 | +function _check_auth_config($arg, $stop, $set_lang = true) |
|
317 | 317 | { |
318 | - $options = explode(',',$arg); |
|
318 | + $options = explode(',', $arg); |
|
319 | 319 | if (!($domain = array_shift($options))) $domain = 'default'; |
320 | 320 | $user = array_shift($options); |
321 | 321 | $password = array_shift($options); |
322 | - _fetch_user_password($user,$password); |
|
322 | + _fetch_user_password($user, $password); |
|
323 | 323 | |
324 | - setup_cmd::check_installed($domain,$stop,true); |
|
324 | + setup_cmd::check_installed($domain, $stop, true); |
|
325 | 325 | |
326 | 326 | // reset charset for the output to the charset used by the OS |
327 | 327 | if ($set_lang) $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
328 | 328 | |
329 | - setup_cmd::check_setup_auth($user,$password,$domain); |
|
329 | + setup_cmd::check_setup_auth($user, $password, $domain); |
|
330 | 330 | |
331 | 331 | return $options; |
332 | 332 | } |
@@ -338,16 +338,16 @@ discard block |
||
338 | 338 | */ |
339 | 339 | function do_install($args) |
340 | 340 | { |
341 | - list($domain,$user,$password,$backup,$charset,$lang) = explode(',',array_shift($args)); |
|
342 | - _fetch_user_password($user,$password); |
|
341 | + list($domain, $user, $password, $backup, $charset, $lang) = explode(',', array_shift($args)); |
|
342 | + _fetch_user_password($user, $password); |
|
343 | 343 | |
344 | 344 | $config = array(); |
345 | - foreach($args as $arg) |
|
345 | + foreach ($args as $arg) |
|
346 | 346 | { |
347 | - list($name,$value) = explode('=',$arg,2); |
|
347 | + list($name, $value) = explode('=', $arg, 2); |
|
348 | 348 | $config[$name] = $value; |
349 | 349 | } |
350 | - $cmd = new setup_cmd_install($domain,$user,$password,$backup,$charset,true,$config,$lang); |
|
350 | + $cmd = new setup_cmd_install($domain, $user, $password, $backup, $charset, true, $config, $lang); |
|
351 | 351 | echo $cmd->run()."\n"; |
352 | 352 | } |
353 | 353 | |
@@ -357,14 +357,14 @@ discard block |
||
357 | 357 | * @param string &$user |
358 | 358 | * @param string &$password |
359 | 359 | */ |
360 | -function _fetch_user_password(&$user,&$password) |
|
360 | +function _fetch_user_password(&$user, &$password) |
|
361 | 361 | { |
362 | 362 | // read password from enviroment or query it from user, if not given |
363 | 363 | if (!$user) $user = 'admin'; |
364 | 364 | if (!$password && !($password = $_SERVER['EGW_CLI_PASSWORD'])) |
365 | 365 | { |
366 | 366 | echo lang('Admin password to header manager').' '; |
367 | - $password = trim(fgets($f = fopen('php://stdin','rb'))); |
|
367 | + $password = trim(fgets($f = fopen('php://stdin', 'rb'))); |
|
368 | 368 | fclose($f); |
369 | 369 | } |
370 | 370 | } |
@@ -376,18 +376,18 @@ discard block |
||
376 | 376 | * @param array $arguments |
377 | 377 | * @return int |
378 | 378 | */ |
379 | -function do_header($create,&$arguments) |
|
379 | +function do_header($create, &$arguments) |
|
380 | 380 | { |
381 | 381 | if (!$create) |
382 | 382 | { |
383 | 383 | // read password from enviroment or query it from user, if not given |
384 | - $options = explode(',',@$arguments[0]); |
|
385 | - _fetch_user_password($options[1],$options[0]); |
|
386 | - $arguments[0] = implode(',',$options); |
|
384 | + $options = explode(',', @$arguments[0]); |
|
385 | + _fetch_user_password($options[1], $options[0]); |
|
386 | + $arguments[0] = implode(',', $options); |
|
387 | 387 | } |
388 | - array_unshift($arguments,$create ? '--create-header' : '--edit-header'); |
|
388 | + array_unshift($arguments, $create ? '--create-header' : '--edit-header'); |
|
389 | 389 | |
390 | - $cmd = new setup_cmd_header($create?'create':'edit',$arguments); |
|
390 | + $cmd = new setup_cmd_header($create ? 'create' : 'edit', $arguments); |
|
391 | 391 | echo $cmd->run()."\n"; |
392 | 392 | } |
393 | 393 | |
@@ -399,11 +399,11 @@ discard block |
||
399 | 399 | */ |
400 | 400 | function get_lang(&$charset) |
401 | 401 | { |
402 | - @list($lang,$nation,$charset) = preg_split("/[_.]/",strtolower($_SERVER['LANG'])); |
|
402 | + @list($lang, $nation, $charset) = preg_split("/[_.]/", strtolower($_SERVER['LANG'])); |
|
403 | 403 | |
404 | - foreach(file('lang/languages') as $line) |
|
404 | + foreach (file('lang/languages') as $line) |
|
405 | 405 | { |
406 | - list($code,$language) = explode("\t",$line); |
|
406 | + list($code, $language) = explode("\t", $line); |
|
407 | 407 | $languages[$code] = $language; |
408 | 408 | } |
409 | 409 | if (isset($languages[$lang.'-'.$nation])) return $lang.'-'.$nation; |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | { |
421 | 421 | $_SERVER['SCRIPT_FILENAME'] = __FILE__; |
422 | 422 | |
423 | - foreach(array('httpsdocs','httpdocs','htdocs','html','www') as $docroottop) |
|
423 | + foreach (array('httpsdocs', 'httpdocs', 'htdocs', 'html', 'www') as $docroottop) |
|
424 | 424 | { |
425 | - $parts = explode($docroottop,__FILE__); |
|
425 | + $parts = explode($docroottop, __FILE__); |
|
426 | 426 | if (count($parts) == 2) |
427 | 427 | { |
428 | 428 | $_SERVER['DOCUMENT_ROOT'] = $parts[0].$docroottop; |
429 | - $_SERVER['PHP_SELF'] = str_replace('\\','/',$parts[1]); |
|
429 | + $_SERVER['PHP_SELF'] = str_replace('\\', '/', $parts[1]); |
|
430 | 430 | break; |
431 | 431 | } |
432 | 432 | } |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | /** |
437 | 437 | * Echos usage message |
438 | 438 | */ |
439 | -function do_usage($what='') |
|
439 | +function do_usage($what = '') |
|
440 | 440 | { |
441 | - echo lang('Usage: %1 command [additional options]',basename($_SERVER['argv'][0]))."\n\n"; |
|
441 | + echo lang('Usage: %1 command [additional options]', basename($_SERVER['argv'][0]))."\n\n"; |
|
442 | 442 | |
443 | 443 | if (!$what) |
444 | 444 | { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | if ($what == 'config') |
454 | 454 | { |
455 | 455 | echo ' --files-dir, --backup-dir, --temp-dir '.lang('path to various directories: have to exist and be writeable by the webserver')."\n"; |
456 | - echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1',str_replace('/setup/setup-cli.php','',$_SERVER['PHP_SELF']))."\n"; |
|
456 | + echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1', str_replace('/setup/setup-cli.php', '', $_SERVER['PHP_SELF']))."\n"; |
|
457 | 457 | echo ' --mailserver '.lang('host,port(143),[domain],[{standard(default)|vmailmgr = add domain for mailserver login}]').',[starttls|ssl|tls]'."\n"; |
458 | 458 | echo ' --smtpserver '.lang('host,[smtp port],[smtp user],[smtp password],[auth session user/pw=yes|no],[starttls|ssl|tls],[account user editable=yes|no],[further identities=yes|no]')."\n"; |
459 | 459 | echo ' --smtp '.lang('MTA (with LDAP): [yes(user edit forwarding)],emailadmin_smtp(|_sql|_ldap|_ads|_qmail|_mandriva|_dbmailuser|_suse)')."\n"; |
@@ -504,13 +504,13 @@ discard block |
||
504 | 504 | echo '--charsets '.lang('charsets used by the different languages')."\n"; |
505 | 505 | echo '--exit-codes '.lang('all exit codes of the command line interface')."\n"; |
506 | 506 | } |
507 | - if (!$what || !in_array($what,array('config','header','list'))) |
|
507 | + if (!$what || !in_array($what, array('config', 'header', 'list'))) |
|
508 | 508 | { |
509 | 509 | echo '--help [config|header|list] '.lang('gives further options')."\n"; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | -function fail($exit_code,$message) |
|
513 | +function fail($exit_code, $message) |
|
514 | 514 | { |
515 | 515 | echo $message."\n"; |
516 | 516 | exit($exit_code); |
@@ -526,40 +526,40 @@ discard block |
||
526 | 526 | */ |
527 | 527 | function list_exit_codes() |
528 | 528 | { |
529 | - error_reporting(error_reporting() & ~E_NOTICE); |
|
529 | + error_reporting(error_reporting()&~E_NOTICE); |
|
530 | 530 | |
531 | 531 | $codes = array('Ok'); |
532 | 532 | $setup_dir = EGW_SERVER_ROOT.'/setup/'; |
533 | 533 | //$files = array('setup-cli.php'); |
534 | - foreach(scandir($setup_dir.'/inc') as $file) |
|
534 | + foreach (scandir($setup_dir.'/inc') as $file) |
|
535 | 535 | { |
536 | - if (substr($file,0,strlen('class.setup_cmd')) == 'class.setup_cmd') |
|
536 | + if (substr($file, 0, strlen('class.setup_cmd')) == 'class.setup_cmd') |
|
537 | 537 | { |
538 | 538 | $files[] = 'inc/'.$file; |
539 | 539 | } |
540 | 540 | } |
541 | - foreach($files as $file) |
|
541 | + foreach ($files as $file) |
|
542 | 542 | { |
543 | 543 | $content = file_get_contents($setup_dir.'/'.$file); |
544 | 544 | |
545 | 545 | $matches = null; |
546 | - if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m',$content,$matches)) |
|
546 | + if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m', $content, $matches)) |
|
547 | 547 | { |
548 | 548 | //echo $file.":\n"; print_r($matches); |
549 | - foreach($matches[3] as $key => $code) |
|
549 | + foreach ($matches[3] as $key => $code) |
|
550 | 550 | { |
551 | 551 | //if (isset($codes[$code])) echo "$file redifines #$code: {$codes[$code]}\n"; |
552 | 552 | |
553 | - $src = preg_replace('/self::\$[a-z_>-]+/i', "''", $matches[2][$key]); // gives fatal error otherwise |
|
554 | - @eval($src='$codes['.$code.'] = '.$src.';'); |
|
553 | + $src = preg_replace('/self::\$[a-z_>-]+/i', "''", $matches[2][$key]); // gives fatal error otherwise |
|
554 | + @eval($src = '$codes['.$code.'] = '.$src.';'); |
|
555 | 555 | //echo "- codes[$code] => '{$codes[$code]}'\n"; |
556 | 556 | } |
557 | 557 | //echo $file.":\n"; print_r($codes); |
558 | 558 | } |
559 | 559 | } |
560 | - ksort($codes,SORT_NUMERIC); |
|
561 | - foreach($codes as $num => $msg) |
|
560 | + ksort($codes, SORT_NUMERIC); |
|
561 | + foreach ($codes as $num => $msg) |
|
562 | 562 | { |
563 | - echo $num."\t".str_replace("\n","\n\t",$msg)."\n"; |
|
563 | + echo $num."\t".str_replace("\n", "\n\t", $msg)."\n"; |
|
564 | 564 | } |
565 | 565 | } |
@@ -15,10 +15,13 @@ discard block |
||
15 | 15 | |
16 | 16 | chdir(dirname(__FILE__)); // to enable our relative pathes to work |
17 | 17 | |
18 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
|
18 | +if (php_sapi_name() !== 'cli') |
|
19 | +{ |
|
20 | + // security precaution: forbit calling setup-cli as web-page |
|
19 | 21 | { |
20 | 22 | die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
21 | 23 | } |
24 | +} |
|
22 | 25 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
23 | 26 | |
24 | 27 | $dry_run = false; |
@@ -33,7 +36,11 @@ discard block |
||
33 | 36 | } |
34 | 37 | $arguments = $_SERVER['argv']; |
35 | 38 | $action = array_shift($arguments); |
36 | - if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',',$arguments[0]); // header include needs that to detects the right domain |
|
39 | + if (isset($arguments[0])) |
|
40 | + { |
|
41 | + list($_POST['FormDomain']) = explode(',',$arguments[0]); |
|
42 | + } |
|
43 | + // header include needs that to detects the right domain |
|
37 | 44 | } |
38 | 45 | else |
39 | 46 | { |
@@ -51,7 +58,10 @@ discard block |
||
51 | 58 | // check if date.timezone is set, report it and set something if not, as it gives tons of errors in install log |
52 | 59 | if (!ini_get('date.timezone')) |
53 | 60 | { |
54 | - if (!($tz = date_default_timezone_get())) $tz = 'UTC'; |
|
61 | + if (!($tz = date_default_timezone_get())) |
|
62 | + { |
|
63 | + $tz = 'UTC'; |
|
64 | + } |
|
55 | 65 | echo "No default timezone (php.ini date.timezone) set, we temporary set '$tz'. You should fix that permanent!\n"; |
56 | 66 | ini_set('date.timezone',$tz); |
57 | 67 | } |
@@ -132,13 +142,19 @@ discard block |
||
132 | 142 | foreach($arguments as $arg) |
133 | 143 | { |
134 | 144 | list($name,$value) = explode('=',$arg,2); |
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
145 | + if(property_exists('admin_cmd',$name)) |
|
146 | + { |
|
147 | + // dont allow to overwrite admin_cmd properties |
|
136 | 148 | { |
137 | 149 | throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
138 | 150 | } |
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
151 | + } |
|
152 | + if (substr($name,-1) == ']') |
|
153 | + { |
|
154 | + // allow 1-dim. arrays |
|
140 | 155 | { |
141 | 156 | list($name,$sub) = explode('[',substr($name,0,-1),2); |
157 | + } |
|
142 | 158 | $args[$name][$sub] = $value; |
143 | 159 | } |
144 | 160 | else |
@@ -148,7 +164,10 @@ discard block |
||
148 | 164 | } |
149 | 165 | $cmd = new $class($args); |
150 | 166 | $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
167 | + if (is_array($msg)) |
|
168 | + { |
|
169 | + $msg = print_r($msg,true); |
|
170 | + } |
|
152 | 171 | echo "$msg\n"; |
153 | 172 | break; |
154 | 173 | } |
@@ -164,14 +183,20 @@ discard block |
||
164 | 183 | function do_config($args) |
165 | 184 | { |
166 | 185 | $arg0 = explode(',',array_shift($args)); |
167 | - if (!($domain = @array_shift($arg0))) $domain = 'default'; |
|
186 | + if (!($domain = @array_shift($arg0))) |
|
187 | + { |
|
188 | + $domain = 'default'; |
|
189 | + } |
|
168 | 190 | $user = @array_shift($arg0); |
169 | 191 | $password = @array_shift($arg0); |
170 | 192 | _fetch_user_password($user,$password); |
171 | 193 | |
172 | - if ($arg0) // direct assignments (name=value,...) left |
|
194 | + if ($arg0) |
|
195 | + { |
|
196 | + // direct assignments (name=value,...) left |
|
173 | 197 | { |
174 | 198 | array_unshift($args,implode(',',$arg0)); |
199 | + } |
|
175 | 200 | array_unshift($args,'--config'); |
176 | 201 | } |
177 | 202 | |
@@ -238,9 +263,15 @@ discard block |
||
238 | 263 | { |
239 | 264 | $options[0] = $domain; |
240 | 265 | |
241 | - if ($quite_check) ob_start(); |
|
266 | + if ($quite_check) |
|
267 | + { |
|
268 | + ob_start(); |
|
269 | + } |
|
242 | 270 | _check_auth_config(implode(',',$options),14); |
243 | - if ($quite_check) ob_end_clean(); |
|
271 | + if ($quite_check) |
|
272 | + { |
|
273 | + ob_end_clean(); |
|
274 | + } |
|
244 | 275 | |
245 | 276 | if ($backup == 'no') |
246 | 277 | { |
@@ -316,7 +347,10 @@ discard block |
||
316 | 347 | function _check_auth_config($arg,$stop,$set_lang=true) |
317 | 348 | { |
318 | 349 | $options = explode(',',$arg); |
319 | - if (!($domain = array_shift($options))) $domain = 'default'; |
|
350 | + if (!($domain = array_shift($options))) |
|
351 | + { |
|
352 | + $domain = 'default'; |
|
353 | + } |
|
320 | 354 | $user = array_shift($options); |
321 | 355 | $password = array_shift($options); |
322 | 356 | _fetch_user_password($user,$password); |
@@ -324,7 +358,10 @@ discard block |
||
324 | 358 | setup_cmd::check_installed($domain,$stop,true); |
325 | 359 | |
326 | 360 | // reset charset for the output to the charset used by the OS |
327 | - if ($set_lang) $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
|
361 | + if ($set_lang) |
|
362 | + { |
|
363 | + $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
|
364 | + } |
|
328 | 365 | |
329 | 366 | setup_cmd::check_setup_auth($user,$password,$domain); |
330 | 367 | |
@@ -360,7 +397,10 @@ discard block |
||
360 | 397 | function _fetch_user_password(&$user,&$password) |
361 | 398 | { |
362 | 399 | // read password from enviroment or query it from user, if not given |
363 | - if (!$user) $user = 'admin'; |
|
400 | + if (!$user) |
|
401 | + { |
|
402 | + $user = 'admin'; |
|
403 | + } |
|
364 | 404 | if (!$password && !($password = $_SERVER['EGW_CLI_PASSWORD'])) |
365 | 405 | { |
366 | 406 | echo lang('Admin password to header manager').' '; |
@@ -406,9 +446,15 @@ discard block |
||
406 | 446 | list($code,$language) = explode("\t",$line); |
407 | 447 | $languages[$code] = $language; |
408 | 448 | } |
409 | - if (isset($languages[$lang.'-'.$nation])) return $lang.'-'.$nation; |
|
449 | + if (isset($languages[$lang.'-'.$nation])) |
|
450 | + { |
|
451 | + return $lang.'-'.$nation; |
|
452 | + } |
|
410 | 453 | |
411 | - if (isset($languages[$lang])) return $lang; |
|
454 | + if (isset($languages[$lang])) |
|
455 | + { |
|
456 | + return $lang; |
|
457 | + } |
|
412 | 458 | |
413 | 459 | return 'en'; |
414 | 460 | } |
@@ -448,7 +494,10 @@ discard block |
||
448 | 494 | if (!$what || $what == 'config') |
449 | 495 | { |
450 | 496 | echo '--config '.lang('domain(default),[config user(admin)],password,[name=value,...] sets config values beside:')."\n"; |
451 | - if (!$what) echo ' --help config '.lang('gives further options')."\n"; |
|
497 | + if (!$what) |
|
498 | + { |
|
499 | + echo ' --help config '.lang('gives further options')."\n"; |
|
500 | + } |
|
452 | 501 | } |
453 | 502 | if ($what == 'config') |
454 | 503 | { |
@@ -477,7 +526,10 @@ discard block |
||
477 | 526 | echo lang('Create or edit the EGroupware configuration file: header.inc.php:')."\n"; |
478 | 527 | echo '--create-header '.lang('header-password[,header-user(admin)]')."\n"; |
479 | 528 | echo '--edit-header '.lang('[header-password],[header-user],[new-password],[new-user]')."\n"; |
480 | - if (!$what) echo ' --help header '.lang('gives further options')."\n"; |
|
529 | + if (!$what) |
|
530 | + { |
|
531 | + echo ' --help header '.lang('gives further options')."\n"; |
|
532 | + } |
|
481 | 533 | } |
482 | 534 | if ($what == 'header') |
483 | 535 | { |
@@ -222,7 +222,7 @@ |
||
222 | 222 | . '<br />'.lang('to allow password authentification add the following line to your pg_hba.conf (above all others) AND restart postgres:') |
223 | 223 | . '<br /><i># TYPE DATABASE USER CIDR-ADDRESS METHOD</i>' |
224 | 224 | .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : |
225 | - "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
225 | + "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
226 | 226 | //$setup_tpl->parse('V_db_stage_1','B_db_stage_1'); |
227 | 227 | //break; |
228 | 228 | default: |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | |
185 | 185 | switch($GLOBALS['egw_info']['setup']['stage']['db']) |
186 | 186 | { |
187 | - case 1: |
|
188 | - $setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
189 | - $setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set')); |
|
190 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
191 | - $setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly')); |
|
192 | - $setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
193 | - $setup_tpl->set_var('create_database',lang('Create database')); |
|
194 | - $setup_tpl->set_var('instr',''); |
|
195 | - $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; |
|
196 | - switch ($info['db_type']) |
|
197 | - { |
|
187 | + case 1: |
|
188 | + $setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
189 | + $setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set')); |
|
190 | + $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
191 | + $setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly')); |
|
192 | + $setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
193 | + $setup_tpl->set_var('create_database',lang('Create database')); |
|
194 | + $setup_tpl->set_var('instr',''); |
|
195 | + $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; |
|
196 | + switch ($info['db_type']) |
|
197 | + { |
|
198 | 198 | case 'mysql': |
199 | 199 | case 'mysqli': |
200 | 200 | case 'mysqlt': |
@@ -227,77 +227,77 @@ discard block |
||
227 | 227 | //break; |
228 | 228 | default: |
229 | 229 | $setup_tpl->parse('V_db_stage_1','B_db_stage_1a'); |
230 | - } |
|
230 | + } |
|
231 | 231 | $db_filled_block = $setup_tpl->get_var('V_db_stage_1'); |
232 | 232 | $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
233 | 233 | break; |
234 | - case 2: |
|
235 | - $setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
236 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
237 | - $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); |
|
238 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); |
|
239 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
240 | - break; |
|
241 | - case 3: |
|
242 | - $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
243 | - $setup_tpl->set_var('install',lang('Install')); |
|
244 | - $setup_tpl->set_var('proceed',lang('We can proceed')); |
|
245 | - $setup_tpl->set_var('coreapps',lang('all applications')); |
|
246 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
247 | - $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); |
|
248 | - $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
249 | - '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); |
|
250 | - $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
251 | - $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. |
|
252 | - lang('Convert backup to charset selected above').'</label>'); |
|
253 | - $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); |
|
254 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); |
|
255 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
256 | - break; |
|
257 | - case 4: |
|
258 | - $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
259 | - $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare', |
|
260 | - isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver'])); |
|
261 | - $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version'])); |
|
262 | - $setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
263 | - $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); |
|
264 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
265 | - $setup_tpl->set_var('upgrade',lang('Upgrade')); |
|
266 | - $setup_tpl->set_var('goto',lang('Go to')); |
|
267 | - $setup_tpl->set_var('configuration',lang('configuration')); |
|
268 | - $setup_tpl->set_var('admin_account',lang('Create admin account')); |
|
269 | - $setup_tpl->set_var('applications',lang('Manage Applications')); |
|
270 | - $setup_tpl->set_var('db_backup',lang('DB backup and restore')); |
|
271 | - $setup_tpl->set_var('language_management',lang('Manage Languages')); |
|
272 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
273 | - $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); |
|
274 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
234 | + case 2: |
|
235 | + $setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
236 | + $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
237 | + $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); |
|
238 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); |
|
239 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
240 | + break; |
|
241 | + case 3: |
|
242 | + $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
243 | + $setup_tpl->set_var('install',lang('Install')); |
|
244 | + $setup_tpl->set_var('proceed',lang('We can proceed')); |
|
245 | + $setup_tpl->set_var('coreapps',lang('all applications')); |
|
246 | + $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
247 | + $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); |
|
248 | + $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
249 | + '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); |
|
250 | + $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
251 | + $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. |
|
252 | + lang('Convert backup to charset selected above').'</label>'); |
|
253 | + $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); |
|
254 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); |
|
255 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
256 | + break; |
|
257 | + case 4: |
|
258 | + $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
259 | + $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare', |
|
260 | + isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver'])); |
|
261 | + $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version'])); |
|
262 | + $setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
263 | + $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); |
|
264 | + $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
265 | + $setup_tpl->set_var('upgrade',lang('Upgrade')); |
|
266 | + $setup_tpl->set_var('goto',lang('Go to')); |
|
267 | + $setup_tpl->set_var('configuration',lang('configuration')); |
|
268 | + $setup_tpl->set_var('admin_account',lang('Create admin account')); |
|
269 | + $setup_tpl->set_var('applications',lang('Manage Applications')); |
|
270 | + $setup_tpl->set_var('db_backup',lang('DB backup and restore')); |
|
271 | + $setup_tpl->set_var('language_management',lang('Manage Languages')); |
|
272 | + $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
273 | + $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); |
|
274 | + $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
275 | 275 | |
276 | - $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); |
|
277 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); |
|
278 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
279 | - break; |
|
280 | - case 5: |
|
281 | - $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
282 | - $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); |
|
283 | - $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); |
|
284 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
285 | - $setup_tpl->set_var('cancel',lang('cancel')); |
|
286 | - $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); |
|
287 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); |
|
288 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
289 | - break; |
|
290 | - case 6: |
|
291 | - $setup_tpl->set_var('status',lang('Status')); |
|
292 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
293 | - $setup_tpl->set_var('tblchange',lang('Table Change Messages')); |
|
294 | - $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); |
|
295 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); |
|
296 | - $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); |
|
276 | + $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); |
|
277 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); |
|
278 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
279 | + break; |
|
280 | + case 5: |
|
281 | + $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
282 | + $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); |
|
283 | + $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); |
|
284 | + $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
285 | + $setup_tpl->set_var('cancel',lang('cancel')); |
|
286 | + $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); |
|
287 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); |
|
288 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
289 | + break; |
|
290 | + case 6: |
|
291 | + $setup_tpl->set_var('status',lang('Status')); |
|
292 | + $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
293 | + $setup_tpl->set_var('tblchange',lang('Table Change Messages')); |
|
294 | + $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); |
|
295 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); |
|
296 | + $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); |
|
297 | 297 | |
298 | - try { // catch DB errors to report them |
|
299 | - switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) |
|
300 | - { |
|
298 | + try { // catch DB errors to report them |
|
299 | + switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) |
|
300 | + { |
|
301 | 301 | case 'dbcreate': |
302 | 302 | $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8', // create all new db's with utf8 |
303 | 303 | !preg_match('/^[0-9.a-z_]+$/i', $_POST['db_grant_host']) ? 'localhost' : $_POST['db_grant_host']); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; |
377 | 377 | } |
378 | 378 | break; |
379 | - } |
|
379 | + } |
|
380 | 380 | } |
381 | 381 | catch (Api\Db\Exception $e) |
382 | 382 | { |
@@ -388,21 +388,21 @@ discard block |
||
388 | 388 | $db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post'); |
389 | 389 | $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
390 | 390 | break; |
391 | - case 10: |
|
392 | - $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); |
|
393 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
394 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
395 | - $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); |
|
396 | - $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); |
|
397 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); |
|
398 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
399 | - break; |
|
400 | - default: |
|
401 | - $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); |
|
402 | - $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); |
|
403 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); |
|
404 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
405 | - break; |
|
391 | + case 10: |
|
392 | + $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); |
|
393 | + $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
394 | + $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
395 | + $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); |
|
396 | + $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); |
|
397 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); |
|
398 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
399 | + break; |
|
400 | + default: |
|
401 | + $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); |
|
402 | + $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); |
|
403 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); |
|
404 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
405 | + break; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // Config Section |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
22 | 22 | $setup_tpl = new Framework\Template($tpl_root); |
23 | -$setup_tpl->set_file(array |
|
24 | -( |
|
23 | +$setup_tpl->set_file(array( |
|
25 | 24 | 'T_head' => 'head.tpl', |
26 | 25 | 'T_footer' => 'footer.tpl', |
27 | 26 | 'T_alert_msg' => 'msg_alert_msg.tpl', |
@@ -31,19 +30,19 @@ discard block |
||
31 | 30 | 'T_setup_db_blocks' => 'setup_db_blocks.tpl' |
32 | 31 | )); |
33 | 32 | |
34 | -$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
35 | -$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
33 | +$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
34 | +$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
36 | 35 | |
37 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1','V_db_stage_1'); |
|
38 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1a','V_db_stage_1a'); |
|
39 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_2','V_db_stage_2'); |
|
40 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_3','V_db_stage_3'); |
|
41 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_4','V_db_stage_4'); |
|
42 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_5','V_db_stage_5'); |
|
43 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_6_pre','V_db_stage_6_pre'); |
|
44 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_6_post','V_db_stage_6_post'); |
|
45 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_10','V_db_stage_10'); |
|
46 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_default','V_db_stage_default'); |
|
36 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_1', 'V_db_stage_1'); |
|
37 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_1a', 'V_db_stage_1a'); |
|
38 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_2', 'V_db_stage_2'); |
|
39 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_3', 'V_db_stage_3'); |
|
40 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_4', 'V_db_stage_4'); |
|
41 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_5', 'V_db_stage_5'); |
|
42 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_6_pre', 'V_db_stage_6_pre'); |
|
43 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_6_post', 'V_db_stage_6_post'); |
|
44 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_10', 'V_db_stage_10'); |
|
45 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_default', 'V_db_stage_default'); |
|
47 | 46 | |
48 | 47 | // Check header and authentication |
49 | 48 | $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); |
@@ -59,9 +58,9 @@ discard block |
||
59 | 58 | } |
60 | 59 | exit; |
61 | 60 | } |
62 | -elseif(!$GLOBALS['egw_setup']->auth('Config')) |
|
61 | +elseif (!$GLOBALS['egw_setup']->auth('Config')) |
|
63 | 62 | { |
64 | - $GLOBALS['egw_setup']->html->show_header(lang('Please login'),True); |
|
63 | + $GLOBALS['egw_setup']->html->show_header(lang('Please login'), True); |
|
65 | 64 | $GLOBALS['egw_setup']->html->login_form(); |
66 | 65 | $GLOBALS['egw_setup']->html->show_footer(); |
67 | 66 | exit; |
@@ -73,11 +72,11 @@ discard block |
||
73 | 72 | $GLOBALS['egw_info']['setup']['header_msg'], |
74 | 73 | False, |
75 | 74 | 'config', |
76 | - $GLOBALS['egw_setup']->ConfigDomain . ' (' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].'://'. |
|
75 | + $GLOBALS['egw_setup']->ConfigDomain.' ('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].'://'. |
|
77 | 76 | $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_user'].'@'. |
78 | 77 | $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_host'].':'. |
79 | 78 | $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_port'].'/'. |
80 | - $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_name'] . ')' |
|
79 | + $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_name'].')' |
|
81 | 80 | ); |
82 | 81 | /* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */ |
83 | 82 | /* $GLOBALS['egw_setup']->clear_session_cache(); */ |
@@ -91,23 +90,23 @@ discard block |
||
91 | 90 | $GLOBALS['egw_setup']->detection->get_versions()); |
92 | 91 | |
93 | 92 | $GLOBALS['egw_info']['setup']['stage']['db'] = $GLOBALS['egw_setup']->detection->check_db($setup_info); |
94 | - if($GLOBALS['DEBUG']) |
|
93 | + if ($GLOBALS['DEBUG']) |
|
95 | 94 | { |
96 | 95 | _debug_array($setup_info); |
97 | 96 | } |
98 | 97 | } |
99 | 98 | |
100 | -if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
99 | +if ($GLOBALS['DEBUG']) { echo 'Stage: '.$GLOBALS['egw_info']['setup']['stage']['db']; } |
|
101 | 100 | // begin DEBUG code |
102 | 101 | //$GLOBALS['egw_info']['setup']['stage']['db'] = 0; |
103 | 102 | //$action = 'Upgrade'; |
104 | 103 | // end DEBUG code |
105 | 104 | |
106 | -switch($_POST['action']) |
|
105 | +switch ($_POST['action']) |
|
107 | 106 | { |
108 | 107 | case 'Uninstall all applications': |
109 | 108 | $subtitle = lang('Deleting Tables'); |
110 | - $submsg = lang('Are you sure you want to delete your existing tables and data?') . '.'; |
|
109 | + $submsg = lang('Are you sure you want to delete your existing tables and data?').'.'; |
|
111 | 110 | $subaction = lang('uninstall'); |
112 | 111 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'predrop'; |
113 | 112 | $GLOBALS['egw_info']['setup']['stage']['db'] = 5; |
@@ -121,7 +120,7 @@ discard block |
||
121 | 120 | break; |
122 | 121 | case 'REALLY Uninstall all applications': |
123 | 122 | $subtitle = lang('Deleting Tables'); |
124 | - $submsg = lang('At your request, this script is going to take the evil action of uninstalling all your apps, which deletes your existing tables and data') . '.'; |
|
123 | + $submsg = lang('At your request, this script is going to take the evil action of uninstalling all your apps, which deletes your existing tables and data').'.'; |
|
125 | 124 | $subaction = lang('uninstalled'); |
126 | 125 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'drop'; |
127 | 126 | $GLOBALS['egw_info']['setup']['stage']['db'] = 6; |
@@ -152,17 +151,17 @@ discard block |
||
152 | 151 | $GLOBALS['egw_info']['setup']['stage']['db'] = 6; |
153 | 152 | break; |
154 | 153 | } |
155 | -$setup_tpl->set_var('subtitle',@$subtitle); |
|
156 | -$setup_tpl->set_var('submsg',@$submsg); |
|
157 | -$setup_tpl->set_var('subaction',@$subaction); |
|
154 | +$setup_tpl->set_var('subtitle', @$subtitle); |
|
155 | +$setup_tpl->set_var('submsg', @$submsg); |
|
156 | +$setup_tpl->set_var('subaction', @$subaction); |
|
158 | 157 | |
159 | 158 | // Old PHP |
160 | -if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
159 | +if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
161 | 160 | { |
162 | - $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'],True); |
|
161 | + $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'], True); |
|
163 | 162 | $GLOBALS['egw_setup']->html->show_alert_msg('Error', |
164 | 163 | lang('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.', |
165 | - PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version)); |
|
164 | + PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version)); |
|
166 | 165 | $GLOBALS['egw_setup']->html->show_footer(); |
167 | 166 | exit; |
168 | 167 | } |
@@ -171,135 +170,134 @@ discard block |
||
171 | 170 | |
172 | 171 | //$GLOBALS['egw_setup']->app_status(); |
173 | 172 | $GLOBALS['egw_info']['server']['app_images'] = 'templates/default/images'; |
174 | -$incomplete = $GLOBALS['egw_info']['server']['app_images'] . '/incomplete.png'; |
|
175 | -$completed = $GLOBALS['egw_info']['server']['app_images'] . '/completed.png'; |
|
173 | +$incomplete = $GLOBALS['egw_info']['server']['app_images'].'/incomplete.png'; |
|
174 | +$completed = $GLOBALS['egw_info']['server']['app_images'].'/completed.png'; |
|
176 | 175 | |
177 | -$setup_tpl->set_var('img_incomplete',$incomplete); |
|
178 | -$setup_tpl->set_var('img_completed',$completed); |
|
176 | +$setup_tpl->set_var('img_incomplete', $incomplete); |
|
177 | +$setup_tpl->set_var('img_completed', $completed); |
|
179 | 178 | |
180 | -$setup_tpl->set_var('db_step_text',lang('Step %1 - Simple Application Management', ++$num)); |
|
181 | -$setup_tpl->set_var('lang_system_charset',lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):')); |
|
182 | -$setup_tpl->set_var('system_charset',str_replace('&','&', |
|
183 | - $GLOBALS['egw_setup']->translation->get_charsets('system_charset',$GLOBALS['egw_setup']->system_charset))); |
|
179 | +$setup_tpl->set_var('db_step_text', lang('Step %1 - Simple Application Management', ++$num)); |
|
180 | +$setup_tpl->set_var('lang_system_charset', lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):')); |
|
181 | +$setup_tpl->set_var('system_charset', str_replace('&', '&', |
|
182 | + $GLOBALS['egw_setup']->translation->get_charsets('system_charset', $GLOBALS['egw_setup']->system_charset))); |
|
184 | 183 | |
185 | -switch($GLOBALS['egw_info']['setup']['stage']['db']) |
|
184 | +switch ($GLOBALS['egw_info']['setup']['stage']['db']) |
|
186 | 185 | { |
187 | 186 | case 1: |
188 | - $setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
189 | - $setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set')); |
|
190 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
191 | - $setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly')); |
|
192 | - $setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
193 | - $setup_tpl->set_var('create_database',lang('Create database')); |
|
194 | - $setup_tpl->set_var('instr',''); |
|
187 | + $setup_tpl->set_var('dbnotexist', '<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
188 | + $setup_tpl->set_var('makesure', lang('Make sure that your database is created and the account permissions are set')); |
|
189 | + $setup_tpl->set_var('notcomplete', lang('not complete')); |
|
190 | + $setup_tpl->set_var('oncesetup', lang('Once the database is setup correctly')); |
|
191 | + $setup_tpl->set_var('createdb', '<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
192 | + $setup_tpl->set_var('create_database', lang('Create database')); |
|
193 | + $setup_tpl->set_var('instr', ''); |
|
195 | 194 | $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; |
196 | 195 | switch ($info['db_type']) |
197 | 196 | { |
198 | 197 | case 'mysql': |
199 | 198 | case 'mysqli': |
200 | 199 | case 'mysqlt': |
201 | - $set_charset = (float) $GLOBALS['egw_setup']->db->ServerInfo['version'] >= 4.1 ? ' DEFAULT CHARACTER SET utf8' : ''; |
|
200 | + $set_charset = (float)$GLOBALS['egw_setup']->db->ServerInfo['version'] >= 4.1 ? ' DEFAULT CHARACTER SET utf8' : ''; |
|
202 | 201 | $setup_tpl->set_var('instr', |
203 | - '<b>'.lang("Instructions for creating the database in %1:",'MySql').'</b>' |
|
202 | + '<b>'.lang("Instructions for creating the database in %1:", 'MySql').'</b>' |
|
204 | 203 | . '<br />'.lang('Login to mysql -') |
205 | 204 | . '<br /><i>[user@server user]# <b>mysql -u root -p</b></i><br />' |
206 | 205 | . lang('Create the empty database and grant user permissions -') |
207 | 206 | . "<br /><i>mysql> <b>CREATE DATABASE $info[db_name]$set_charset;</b></i>" |
208 | - . "<br /><i>mysql> <b>GRANT ALL ON " . $info['db_name'] |
|
209 | - . ".* TO " . $info['db_user'] . "@localhost IDENTIFIED BY '" . $info['db_pass'] . "';</b></i>"); |
|
210 | - $setup_tpl->parse('V_db_stage_1','B_db_stage_1'); |
|
207 | + . "<br /><i>mysql> <b>GRANT ALL ON ".$info['db_name'] |
|
208 | + . ".* TO ".$info['db_user']."@localhost IDENTIFIED BY '".$info['db_pass']."';</b></i>"); |
|
209 | + $setup_tpl->parse('V_db_stage_1', 'B_db_stage_1'); |
|
211 | 210 | break; |
212 | 211 | case 'pgsql': |
213 | 212 | $ip = $info['db_host'] == 'localhost' ? '127.0.0.1' : '<ip-address webserver>'; |
214 | 213 | $setup_tpl->set_var('instr', |
215 | - '<b>'.lang('Instructions for creating the database in %1:','PostgreSQL').'</b>' |
|
214 | + '<b>'.lang('Instructions for creating the database in %1:', 'PostgreSQL').'</b>' |
|
216 | 215 | . '<br />'.lang('Login as user postgres, eg. by using su as root') |
217 | 216 | . "<br /><i>[root@server /root]# <b>su - postgres</b></i><br />" |
218 | 217 | . lang('Create the empty database and grant user permissions -') |
219 | - . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createuser --no-adduser --no-createdb -P " . $info['db_user'] . "</b></i>" |
|
220 | - . "<br /><i>Enter password for new user: <b>" . $info['db_pass'] . "</b></i>" |
|
221 | - . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createdb --encoding=utf-8 --owner " . $info['db_user'] . ' ' . $info['db_name'] . "</b></i>" |
|
218 | + . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createuser --no-adduser --no-createdb -P ".$info['db_user']."</b></i>" |
|
219 | + . "<br /><i>Enter password for new user: <b>".$info['db_pass']."</b></i>" |
|
220 | + . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createdb --encoding=utf-8 --owner ".$info['db_user'].' '.$info['db_name']."</b></i>" |
|
222 | 221 | . '<br />'.lang('to allow password authentification add the following line to your pg_hba.conf (above all others) AND restart postgres:') |
223 | 222 | . '<br /><i># TYPE DATABASE USER CIDR-ADDRESS METHOD</i>' |
224 | - .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : |
|
225 | - "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
223 | + .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
226 | 224 | //$setup_tpl->parse('V_db_stage_1','B_db_stage_1'); |
227 | 225 | //break; |
228 | 226 | default: |
229 | - $setup_tpl->parse('V_db_stage_1','B_db_stage_1a'); |
|
227 | + $setup_tpl->parse('V_db_stage_1', 'B_db_stage_1a'); |
|
230 | 228 | } |
231 | 229 | $db_filled_block = $setup_tpl->get_var('V_db_stage_1'); |
232 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
230 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
233 | 231 | break; |
234 | 232 | case 2: |
235 | - $setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
236 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
237 | - $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); |
|
233 | + $setup_tpl->set_var('prebeta', lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
234 | + $setup_tpl->set_var('notcomplete', lang('not complete')); |
|
235 | + $setup_tpl->parse('V_db_stage_2', 'B_db_stage_2'); |
|
238 | 236 | $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); |
239 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
237 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
240 | 238 | break; |
241 | 239 | case 3: |
242 | - $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
243 | - $setup_tpl->set_var('install',lang('Install')); |
|
244 | - $setup_tpl->set_var('proceed',lang('We can proceed')); |
|
245 | - $setup_tpl->set_var('coreapps',lang('all applications')); |
|
246 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
247 | - $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); |
|
248 | - $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
240 | + $setup_tpl->set_var('dbexists', '<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
241 | + $setup_tpl->set_var('install', lang('Install')); |
|
242 | + $setup_tpl->set_var('proceed', lang('We can proceed')); |
|
243 | + $setup_tpl->set_var('coreapps', lang('all applications')); |
|
244 | + $setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages')); |
|
245 | + $setup_tpl->set_var('lang_restore', lang('Or you can install a previous backup.')); |
|
246 | + $setup_tpl->set_var('upload', '<input type="file" name="uploaded" /> '. |
|
249 | 247 | '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); |
250 | - $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
251 | - $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. |
|
248 | + $setup_tpl->set_var('convert_checkbox', '<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
249 | + $setup_tpl->set_var('lang_convert_charset', '<label for="convert_checkbox">'. |
|
252 | 250 | lang('Convert backup to charset selected above').'</label>'); |
253 | - $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); |
|
251 | + $setup_tpl->parse('V_db_stage_3', 'B_db_stage_3'); |
|
254 | 252 | $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); |
255 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
253 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
256 | 254 | break; |
257 | 255 | case 4: |
258 | 256 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
259 | - $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare', |
|
257 | + $setup_tpl->set_var('oldver', lang('You appear to be running version %1 of eGroupWare', |
|
260 | 258 | isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver'])); |
261 | - $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version'])); |
|
262 | - $setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
263 | - $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); |
|
264 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
265 | - $setup_tpl->set_var('upgrade',lang('Upgrade')); |
|
266 | - $setup_tpl->set_var('goto',lang('Go to')); |
|
267 | - $setup_tpl->set_var('configuration',lang('configuration')); |
|
268 | - $setup_tpl->set_var('admin_account',lang('Create admin account')); |
|
269 | - $setup_tpl->set_var('applications',lang('Manage Applications')); |
|
270 | - $setup_tpl->set_var('db_backup',lang('DB backup and restore')); |
|
271 | - $setup_tpl->set_var('language_management',lang('Manage Languages')); |
|
272 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
273 | - $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); |
|
274 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
259 | + $setup_tpl->set_var('automatic', lang('We will automatically update your tables/records to %1', $setup_info['api']['version'])); |
|
260 | + $setup_tpl->set_var('backupwarn', lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
261 | + $setup_tpl->set_var('lang_backup', lang('create a backup before upgrading the DB')); |
|
262 | + $setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages')); |
|
263 | + $setup_tpl->set_var('upgrade', lang('Upgrade')); |
|
264 | + $setup_tpl->set_var('goto', lang('Go to')); |
|
265 | + $setup_tpl->set_var('configuration', lang('configuration')); |
|
266 | + $setup_tpl->set_var('admin_account', lang('Create admin account')); |
|
267 | + $setup_tpl->set_var('applications', lang('Manage Applications')); |
|
268 | + $setup_tpl->set_var('db_backup', lang('DB backup and restore')); |
|
269 | + $setup_tpl->set_var('language_management', lang('Manage Languages')); |
|
270 | + $setup_tpl->set_var('uninstall_all_applications', lang('Uninstall all applications')); |
|
271 | + $setup_tpl->set_var('dont_touch_my_data', lang('Dont touch my data')); |
|
272 | + $setup_tpl->set_var('dropwarn', lang('Your tables will be dropped and you will lose data')); |
|
275 | 273 | |
276 | - $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); |
|
274 | + $setup_tpl->parse('V_db_stage_4', 'B_db_stage_4'); |
|
277 | 275 | $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); |
278 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
276 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
279 | 277 | break; |
280 | 278 | case 5: |
281 | 279 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
282 | - $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); |
|
283 | - $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); |
|
284 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
285 | - $setup_tpl->set_var('cancel',lang('cancel')); |
|
286 | - $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); |
|
280 | + $setup_tpl->set_var('are_you_sure', lang('ARE YOU SURE?')); |
|
281 | + $setup_tpl->set_var('really_uninstall_all_applications', lang('REALLY Uninstall all applications')); |
|
282 | + $setup_tpl->set_var('dropwarn', lang('Your tables will be dropped and you will lose data')); |
|
283 | + $setup_tpl->set_var('cancel', lang('cancel')); |
|
284 | + $setup_tpl->parse('V_db_stage_5', 'B_db_stage_5'); |
|
287 | 285 | $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); |
288 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
286 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
289 | 287 | break; |
290 | 288 | case 6: |
291 | - $setup_tpl->set_var('status',lang('Status')); |
|
292 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
293 | - $setup_tpl->set_var('tblchange',lang('Table Change Messages')); |
|
294 | - $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); |
|
289 | + $setup_tpl->set_var('status', lang('Status')); |
|
290 | + $setup_tpl->set_var('notcomplete', lang('not complete')); |
|
291 | + $setup_tpl->set_var('tblchange', lang('Table Change Messages')); |
|
292 | + $setup_tpl->parse('V_db_stage_6_pre', 'B_db_stage_6_pre'); |
|
295 | 293 | $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); |
296 | - $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); |
|
294 | + $setup_tpl->set_var('tableshave', lang('If you did not receive any errors, your applications have been')); |
|
297 | 295 | |
298 | 296 | try { // catch DB errors to report them |
299 | 297 | switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) |
300 | 298 | { |
301 | 299 | case 'dbcreate': |
302 | - $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8', // create all new db's with utf8 |
|
300 | + $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8', // create all new db's with utf8 |
|
303 | 301 | !preg_match('/^[0-9.a-z_]+$/i', $_POST['db_grant_host']) ? 'localhost' : $_POST['db_grant_host']); |
304 | 302 | break; |
305 | 303 | case 'drop': |
@@ -315,25 +313,25 @@ discard block |
||
315 | 313 | if (is_array($_FILES['uploaded']) && !$_FILES['uploaded']['error'] && |
316 | 314 | is_uploaded_file($_FILES['uploaded']['tmp_name'])) |
317 | 315 | { |
318 | - if (preg_match('/\.(bz2|gz)$/i',$_FILES['uploaded']['name'],$matches)) |
|
316 | + if (preg_match('/\.(bz2|gz)$/i', $_FILES['uploaded']['name'], $matches)) |
|
319 | 317 | { |
320 | 318 | $ext = '.'.$matches[1]; |
321 | - move_uploaded_file($_FILES['uploaded']['tmp_name'],$_FILES['uploaded']['tmp_name'].$ext); |
|
319 | + move_uploaded_file($_FILES['uploaded']['tmp_name'], $_FILES['uploaded']['tmp_name'].$ext); |
|
322 | 320 | $_FILES['uploaded']['tmp_name'] .= $ext; |
323 | 321 | } |
324 | - if (is_resource($f = $db_backup->fopen_backup($_FILES['uploaded']['tmp_name'],true))) |
|
322 | + if (is_resource($f = $db_backup->fopen_backup($_FILES['uploaded']['tmp_name'], true))) |
|
325 | 323 | { |
326 | - echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
327 | - $db_backup->restore($f,$_POST['convert_charset'],$_FILES['uploaded']['tmp_name'],false); |
|
324 | + echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
325 | + $db_backup->restore($f, $_POST['convert_charset'], $_FILES['uploaded']['tmp_name'], false); |
|
328 | 326 | fclose($f); |
329 | 327 | echo '<p align="center">'.lang('restore finished')."</p>\n"; |
330 | 328 | unlink($_FILES['uploaded']['tmp_name']); |
331 | 329 | } |
332 | 330 | else // backup failed ==> dont start the upgrade |
333 | 331 | { |
334 | - $setup_tpl->set_var('submsg',lang('Restore failed')); |
|
335 | - $setup_tpl->set_var('tableshave','<b>'.$f.'</b>'); |
|
336 | - $setup_tpl->set_var('subaction',''); |
|
332 | + $setup_tpl->set_var('submsg', lang('Restore failed')); |
|
333 | + $setup_tpl->set_var('tableshave', '<b>'.$f.'</b>'); |
|
334 | + $setup_tpl->set_var('subaction', ''); |
|
337 | 335 | } |
338 | 336 | } |
339 | 337 | } |
@@ -346,7 +344,7 @@ discard block |
||
346 | 344 | $GLOBALS['egw_setup']->system_charset = $_REQUEST['system_charset']; |
347 | 345 | $GLOBALS['egw_setup']->db->Link_ID->SetCharSet($_REQUEST['system_charset']); |
348 | 346 | } |
349 | - $setup_info = $GLOBALS['egw_setup']->process->pass($s_info,'new',$_REQUEST['debug'],True); |
|
347 | + $setup_info = $GLOBALS['egw_setup']->process->pass($s_info, 'new', $_REQUEST['debug'], True); |
|
350 | 348 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; |
351 | 349 | } |
352 | 350 | break; |
@@ -358,21 +356,21 @@ discard block |
||
358 | 356 | $db_backup = new Api\Db\Backup(); |
359 | 357 | if (is_resource($f = $db_backup->fopen_backup())) |
360 | 358 | { |
361 | - echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
359 | + echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
362 | 360 | $db_backup->backup($f); |
363 | 361 | fclose($f); |
364 | 362 | echo '<p align="center">'.lang('backup finished')."</p>\n"; |
365 | 363 | } |
366 | 364 | else // backup failed ==> dont start the upgrade |
367 | 365 | { |
368 | - $setup_tpl->set_var('submsg',lang('Backup failed')); |
|
369 | - $setup_tpl->set_var('tableshave','<b>'.$f.'</b>'); |
|
370 | - $setup_tpl->set_var('subaction',''); |
|
366 | + $setup_tpl->set_var('submsg', lang('Backup failed')); |
|
367 | + $setup_tpl->set_var('tableshave', '<b>'.$f.'</b>'); |
|
368 | + $setup_tpl->set_var('subaction', ''); |
|
371 | 369 | } |
372 | 370 | } |
373 | 371 | if (!@$_POST['backup'] || !is_string($f)) |
374 | 372 | { |
375 | - $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info,'upgrade',$_REQUEST['debug']); |
|
373 | + $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info, 'upgrade', $_REQUEST['debug']); |
|
376 | 374 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; |
377 | 375 | } |
378 | 376 | break; |
@@ -382,159 +380,159 @@ discard block |
||
382 | 380 | { |
383 | 381 | echo "<pre>".$e->getMessage()."</pre>\n"; |
384 | 382 | } |
385 | - $setup_tpl->set_var('re-check_my_installation',lang('Re-Check My Installation')); |
|
386 | - $setup_tpl->set_var('system_charset',$GLOBALS['egw']->system_charset); |
|
387 | - $setup_tpl->parse('V_db_stage_6_post','B_db_stage_6_post'); |
|
388 | - $db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post'); |
|
389 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
383 | + $setup_tpl->set_var('re-check_my_installation', lang('Re-Check My Installation')); |
|
384 | + $setup_tpl->set_var('system_charset', $GLOBALS['egw']->system_charset); |
|
385 | + $setup_tpl->parse('V_db_stage_6_post', 'B_db_stage_6_post'); |
|
386 | + $db_filled_block = $db_filled_block.$setup_tpl->get_var('V_db_stage_6_post'); |
|
387 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
390 | 388 | break; |
391 | 389 | case 10: |
392 | - $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); |
|
393 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
394 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
395 | - $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); |
|
396 | - $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); |
|
390 | + $setup_tpl->set_var('tablescurrent', lang('Your eGroupWare API is current')); |
|
391 | + $setup_tpl->set_var('uninstall_all_applications', lang('Uninstall all applications')); |
|
392 | + $setup_tpl->set_var('dropwarn', lang('Your tables will be dropped and you will lose data')); |
|
393 | + $setup_tpl->set_var('deletetables', lang('Uninstall all applications')); |
|
394 | + $setup_tpl->parse('V_db_stage_10', 'B_db_stage_10'); |
|
397 | 395 | $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); |
398 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
396 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
399 | 397 | break; |
400 | 398 | default: |
401 | - $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); |
|
402 | - $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); |
|
399 | + $setup_tpl->set_var('dbnotexist', lang('Your database does not exist')); |
|
400 | + $setup_tpl->parse('V_db_stage_default', 'B_db_stage_default'); |
|
403 | 401 | $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); |
404 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
402 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
405 | 403 | break; |
406 | 404 | } |
407 | 405 | |
408 | 406 | // Config Section |
409 | -$setup_tpl->set_var('config_step_text',lang('Step %1 - Configuration', ++$num)); |
|
407 | +$setup_tpl->set_var('config_step_text', lang('Step %1 - Configuration', ++$num)); |
|
410 | 408 | $GLOBALS['egw_info']['setup']['stage']['config'] = $GLOBALS['egw_setup']->detection->check_config(); |
411 | 409 | |
412 | 410 | // begin DEBUG code |
413 | 411 | //$GLOBALS['egw_info']['setup']['stage']['config'] = 10; |
414 | 412 | // end DEBUG code |
415 | 413 | |
416 | -$setup_tpl->set_var('config_status_img',$incomplete); |
|
417 | -$setup_tpl->set_var('config_status_alt',lang('not completed')); |
|
418 | -switch($GLOBALS['egw_info']['setup']['stage']['config']) |
|
414 | +$setup_tpl->set_var('config_status_img', $incomplete); |
|
415 | +$setup_tpl->set_var('config_status_alt', lang('not completed')); |
|
416 | +switch ($GLOBALS['egw_info']['setup']['stage']['config']) |
|
419 | 417 | { |
420 | 418 | case 1: // AFAIK this dont happen any more, as we have setup_process::save_minimal_config() now -- RalfBecker |
421 | 419 | $btn_config_now = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
422 | 420 | lang('Please configure eGroupWare for your environment'), |
423 | - 'post','config.php', |
|
424 | - 'submit',lang('Configure Now'), |
|
421 | + 'post', 'config.php', |
|
422 | + 'submit', lang('Configure Now'), |
|
425 | 423 | ''); |
426 | - $setup_tpl->set_var('config_table_data',$btn_config_now); |
|
424 | + $setup_tpl->set_var('config_table_data', $btn_config_now); |
|
427 | 425 | break; |
428 | 426 | case 10: |
429 | - $setup_tpl->set_var('config_status_img',$completed); |
|
430 | - $setup_tpl->set_var('config_status_alt',lang('completed')); |
|
427 | + $setup_tpl->set_var('config_status_img', $completed); |
|
428 | + $setup_tpl->set_var('config_status_alt', lang('completed')); |
|
431 | 429 | $config_msg = lang('Configuration completed'); |
432 | 430 | case 2: |
433 | 431 | if ($GLOBALS['egw_info']['setup']['config_errors']) |
434 | 432 | { |
435 | - $config_msg = implode('<br />',$GLOBALS['egw_info']['setup']['config_errors']); |
|
433 | + $config_msg = implode('<br />', $GLOBALS['egw_info']['setup']['config_errors']); |
|
436 | 434 | } |
437 | 435 | $btn_edit_config = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
438 | 436 | $config_msg, |
439 | - 'post','config.php', |
|
440 | - 'submit',lang('Edit Current Configuration'), |
|
437 | + 'post', 'config.php', |
|
438 | + 'submit', lang('Edit Current Configuration'), |
|
441 | 439 | '' |
442 | 440 | ); |
443 | - $setup_tpl->set_var('config_table_data',$btn_edit_config); |
|
441 | + $setup_tpl->set_var('config_table_data', $btn_edit_config); |
|
444 | 442 | break; |
445 | 443 | default: |
446 | - $setup_tpl->set_var('config_status_img',$incomplete); |
|
447 | - $setup_tpl->set_var('config_status_alt',lang('not completed')); |
|
448 | - $setup_tpl->set_var('config_table_data',lang('Not ready for this stage yet')); |
|
444 | + $setup_tpl->set_var('config_status_img', $incomplete); |
|
445 | + $setup_tpl->set_var('config_status_alt', lang('not completed')); |
|
446 | + $setup_tpl->set_var('config_table_data', lang('Not ready for this stage yet')); |
|
449 | 447 | break; |
450 | 448 | } |
451 | 449 | // Admin Account Section |
452 | -$setup_tpl->set_var('admin_step_text',lang('Step %1 - Admin Account', ++$num)); |
|
450 | +$setup_tpl->set_var('admin_step_text', lang('Step %1 - Admin Account', ++$num)); |
|
453 | 451 | |
454 | -switch($GLOBALS['egw_info']['setup']['stage']['config']) |
|
452 | +switch ($GLOBALS['egw_info']['setup']['stage']['config']) |
|
455 | 453 | { |
456 | 454 | case 10: |
457 | 455 | // check if there is already a user account (not the anonymous account of sitemgr or a group) |
458 | 456 | $no_accounts = !$GLOBALS['egw_setup']->accounts_exist(); |
459 | - $setup_tpl->set_var('admin_status_img',$no_accounts ? $incomplete : $completed); |
|
460 | - $setup_tpl->set_var('admin_status_alt',$no_accounts ? lang('not completed') : lang('completed')); |
|
461 | - $setup_tpl->set_var('admin_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
457 | + $setup_tpl->set_var('admin_status_img', $no_accounts ? $incomplete : $completed); |
|
458 | + $setup_tpl->set_var('admin_status_alt', $no_accounts ? lang('not completed') : lang('completed')); |
|
459 | + $setup_tpl->set_var('admin_table_data', $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
462 | 460 | $no_accounts ? lang('No accounts existing') : lang('Accounts existing'), |
463 | - 'post','admin_account.php', |
|
464 | - 'submit',lang('Create admin account'), |
|
461 | + 'post', 'admin_account.php', |
|
462 | + 'submit', lang('Create admin account'), |
|
465 | 463 | '' |
466 | 464 | )); |
467 | 465 | break; |
468 | 466 | default: |
469 | - $setup_tpl->set_var('admin_status_img',$incomplete); |
|
470 | - $setup_tpl->set_var('admin_status_alt',lang('not completed')); |
|
471 | - $setup_tpl->set_var('admin_table_data',lang('Not ready for this stage yet')); |
|
467 | + $setup_tpl->set_var('admin_status_img', $incomplete); |
|
468 | + $setup_tpl->set_var('admin_status_alt', lang('not completed')); |
|
469 | + $setup_tpl->set_var('admin_table_data', lang('Not ready for this stage yet')); |
|
472 | 470 | break; |
473 | 471 | } |
474 | 472 | |
475 | -$setup_tpl->set_var('apps_step_text',lang('Step %1 - Advanced Application Management', ++$num)); |
|
473 | +$setup_tpl->set_var('apps_step_text', lang('Step %1 - Advanced Application Management', ++$num)); |
|
476 | 474 | // $GLOBALS['egw_info']['setup']['stage']['apps'] = $GLOBALS['egw_setup']->check_apps(); |
477 | -switch($GLOBALS['egw_info']['setup']['stage']['db']) |
|
475 | +switch ($GLOBALS['egw_info']['setup']['stage']['db']) |
|
478 | 476 | { |
479 | 477 | case 10: |
480 | - $setup_tpl->set_var('apps_status_img',$completed); |
|
481 | - $setup_tpl->set_var('apps_status_alt',lang('completed')); |
|
478 | + $setup_tpl->set_var('apps_status_img', $completed); |
|
479 | + $setup_tpl->set_var('apps_status_alt', lang('completed')); |
|
482 | 480 | // check if we have apps to upgrade or essential apps not installed |
483 | 481 | $to_upgrade = $to_install = array(); |
484 | - foreach($setup_info as $app => $data) |
|
482 | + foreach ($setup_info as $app => $data) |
|
485 | 483 | { |
486 | 484 | if ($data['currentver'] && $data['version'] && $data['version'] != $data['currentver']) |
487 | 485 | { |
488 | 486 | $to_upgrade[] = $app; |
489 | - $setup_tpl->set_var('apps_status_img',$incomplete); |
|
487 | + $setup_tpl->set_var('apps_status_img', $incomplete); |
|
490 | 488 | } |
491 | 489 | } |
492 | 490 | // warn if essential apps are not installed |
493 | - foreach(array('api','admin','preferences') as $app) |
|
491 | + foreach (array('api', 'admin', 'preferences') as $app) |
|
494 | 492 | { |
495 | 493 | if (!isset($setup_info[$app]) || empty($setup_info[$app]['currentver'])) |
496 | 494 | { |
497 | 495 | $to_install[] = $app; |
498 | - $setup_tpl->set_var('apps_status_img',$incomplete); |
|
496 | + $setup_tpl->set_var('apps_status_img', $incomplete); |
|
499 | 497 | } |
500 | 498 | } |
501 | 499 | $msg = ''; |
502 | 500 | if ($to_upgrade || $to_install) |
503 | 501 | { |
504 | - if ($to_upgrade) $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
505 | - if ($to_install) $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
502 | + if ($to_upgrade) $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ', $to_upgrade); |
|
503 | + if ($to_install) $msg .= ($msg ? '<br />' : '').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ', $to_install); |
|
506 | 504 | } |
507 | 505 | $btn_manage_apps = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
508 | 506 | $msg ? $msg : lang('This stage is completed<br />'), |
509 | - 'post','applications.php', |
|
510 | - 'submit',lang('Manage Applications'), |
|
507 | + 'post', 'applications.php', |
|
508 | + 'submit', lang('Manage Applications'), |
|
511 | 509 | ''); |
512 | - $setup_tpl->set_var('apps_table_data',$btn_manage_apps); |
|
510 | + $setup_tpl->set_var('apps_table_data', $btn_manage_apps); |
|
513 | 511 | break; |
514 | 512 | default: |
515 | - $setup_tpl->set_var('apps_status_img',$incomplete); |
|
516 | - $setup_tpl->set_var('apps_status_alt',lang('not completed')); |
|
517 | - $setup_tpl->set_var('apps_table_data',lang('Not ready for this stage yet')); |
|
513 | + $setup_tpl->set_var('apps_status_img', $incomplete); |
|
514 | + $setup_tpl->set_var('apps_status_alt', lang('not completed')); |
|
515 | + $setup_tpl->set_var('apps_table_data', lang('Not ready for this stage yet')); |
|
518 | 516 | break; |
519 | 517 | } |
520 | 518 | // Backup and restore section |
521 | -$setup_tpl->set_var('backup_step_text',lang('Step %1 - DB backup and restore', ++$num)); |
|
519 | +$setup_tpl->set_var('backup_step_text', lang('Step %1 - DB backup and restore', ++$num)); |
|
522 | 520 | if ($GLOBALS['egw_info']['setup']['stage']['db'] == 10 && !$no_backup_dir) |
523 | 521 | { |
524 | - $setup_tpl->set_var('backup_status_img',$completed); |
|
525 | - $setup_tpl->set_var('backup_status_alt',lang('completed')); |
|
526 | - $setup_tpl->set_var('backup_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
522 | + $setup_tpl->set_var('backup_status_img', $completed); |
|
523 | + $setup_tpl->set_var('backup_status_alt', lang('completed')); |
|
524 | + $setup_tpl->set_var('backup_table_data', $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
527 | 525 | ''/*lang('This stage is completed<br />')*/, |
528 | - 'post','db_backup.php', |
|
529 | - 'submit',lang('backup and restore'), |
|
526 | + 'post', 'db_backup.php', |
|
527 | + 'submit', lang('backup and restore'), |
|
530 | 528 | '')); |
531 | 529 | } |
532 | 530 | else |
533 | 531 | { |
534 | - $setup_tpl->set_var('backup_status_img',$incomplete); |
|
535 | - $setup_tpl->set_var('backup_status_alt',lang('not completed')); |
|
536 | - $setup_tpl->set_var('backup_table_data',$no_backup_dir ? $no_backup_dir : lang('Not ready for this stage yet')); |
|
532 | + $setup_tpl->set_var('backup_status_img', $incomplete); |
|
533 | + $setup_tpl->set_var('backup_status_alt', lang('not completed')); |
|
534 | + $setup_tpl->set_var('backup_table_data', $no_backup_dir ? $no_backup_dir : lang('Not ready for this stage yet')); |
|
537 | 535 | } |
538 | 536 | |
539 | -$setup_tpl->pparse('out','T_setup_main'); |
|
537 | +$setup_tpl->pparse('out', 'T_setup_main'); |
|
540 | 538 | $GLOBALS['egw_setup']->html->show_footer(); |
@@ -49,10 +49,13 @@ discard block |
||
49 | 49 | $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); |
50 | 50 | if ($GLOBALS['egw_info']['setup']['stage']['header'] != '10') |
51 | 51 | { |
52 | - if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) // header needs update, go there direct |
|
52 | + if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) |
|
53 | + { |
|
54 | + // header needs update, go there direct |
|
53 | 55 | { |
54 | 56 | Header('Location: manageheader.php'); |
55 | 57 | } |
58 | + } |
|
56 | 59 | else // run check-install first |
57 | 60 | { |
58 | 61 | Header('Location: check_install.php?intro=1'); |
@@ -97,7 +100,9 @@ discard block |
||
97 | 100 | } |
98 | 101 | } |
99 | 102 | |
100 | -if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
103 | +if ($GLOBALS['DEBUG']) |
|
104 | +{ |
|
105 | +echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
101 | 106 | // begin DEBUG code |
102 | 107 | //$GLOBALS['egw_info']['setup']['stage']['db'] = 0; |
103 | 108 | //$action = 'Upgrade'; |
@@ -501,8 +506,14 @@ discard block |
||
501 | 506 | $msg = ''; |
502 | 507 | if ($to_upgrade || $to_install) |
503 | 508 | { |
504 | - if ($to_upgrade) $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
505 | - if ($to_install) $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
509 | + if ($to_upgrade) |
|
510 | + { |
|
511 | + $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
512 | + } |
|
513 | + if ($to_install) |
|
514 | + { |
|
515 | + $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
516 | + } |
|
506 | 517 | } |
507 | 518 | $btn_manage_apps = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
508 | 519 | $msg ? $msg : lang('This stage is completed<br />'), |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // Does not return unless user is authorized |
25 | 25 | |
26 | 26 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
27 | -$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); |
|
27 | +$setup_tpl = CreateObject('phpgwapi.Template', $tpl_root); |
|
28 | 28 | $setup_tpl->set_file(array( |
29 | 29 | 'migration' => 'account_migration.tpl', |
30 | 30 | 'T_head' => 'head.tpl', |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $GLOBALS['egw_setup']->loaddb(); |
46 | 46 | } |
47 | 47 | // Load configuration values account_repository and auth_type, as setup has not yet done so |
48 | -foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'config_name,config_value', |
|
48 | +foreach ($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table, 'config_name,config_value', |
|
49 | 49 | "config_name LIKE 'ldap%' OR config_name LIKE 'account_%' OR config_name LIKE '%encryption%' OR config_name='auth_type' OR config_name='mail_suffix'", |
50 | - __LINE__,__FILE__) as $row) |
|
50 | + __LINE__, __FILE__) as $row) |
|
51 | 51 | { |
52 | 52 | $GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value']; |
53 | 53 | } |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | } |
66 | 66 | $direction = strtoupper($from).' --> '.strtoupper($to); |
67 | 67 | |
68 | -$GLOBALS['egw_setup']->html->show_header($direction,False,'config',$GLOBALS['egw_setup']->ConfigDomain . |
|
69 | - '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
68 | +$GLOBALS['egw_setup']->html->show_header($direction, False, 'config', $GLOBALS['egw_setup']->ConfigDomain. |
|
69 | + '('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
70 | 70 | |
71 | 71 | // create base one level off ldap_context |
72 | -$base_parts = explode(',',$GLOBALS['egw_info']['server']['ldap_context']); |
|
72 | +$base_parts = explode(',', $GLOBALS['egw_info']['server']['ldap_context']); |
|
73 | 73 | array_shift($base_parts); |
74 | 74 | |
75 | 75 | $cmd = new setup_cmd_ldap(array( |
@@ -78,24 +78,24 @@ discard block |
||
78 | 78 | // allow to set ldap root DN (ldap_admin) to create instance specific admin DN and structure |
79 | 79 | 'ldap_admin' => !empty($_POST['ldap_admin']) ? $_POST['ldap_admin'] : $GLOBALS['egw_info']['server']['ldap_root_dn'], |
80 | 80 | 'ldap_admin_pw' => !empty($_POST['ldap_admin']) ? $_POST['ldap_admin_pw'] : $GLOBALS['egw_info']['server']['ldap_root_pw'], |
81 | - 'ldap_base' => implode(',',$base_parts), |
|
81 | + 'ldap_base' => implode(',', $base_parts), |
|
82 | 82 | 'truncate_egw_accounts' => !empty($_POST['truncate_egw_accounts']), |
83 | -)+$GLOBALS['egw_info']['server']); |
|
83 | +) + $GLOBALS['egw_info']['server']); |
|
84 | 84 | |
85 | 85 | if (!$_POST['migrate'] && !$_POST['passwords2sql']) |
86 | 86 | { |
87 | 87 | $accounts = $cmd->accounts($from); |
88 | 88 | |
89 | 89 | // now outputting the account selection |
90 | - $setup_tpl->set_block('migration','header','header'); |
|
91 | - $setup_tpl->set_block('migration','user_list','user_list'); |
|
92 | - $setup_tpl->set_block('migration','group_list','group_list'); |
|
93 | - $setup_tpl->set_block('migration','ldap_admin','ldap_admin'); |
|
94 | - $setup_tpl->set_block('migration','submit','submit'); |
|
95 | - $setup_tpl->set_block('migration','footer','footer'); |
|
96 | - $setup_tpl->set_block('migration','truncate_egw_accounts','truncate_egw_accounts'); |
|
97 | - |
|
98 | - foreach($accounts as $account_id => $account) |
|
90 | + $setup_tpl->set_block('migration', 'header', 'header'); |
|
91 | + $setup_tpl->set_block('migration', 'user_list', 'user_list'); |
|
92 | + $setup_tpl->set_block('migration', 'group_list', 'group_list'); |
|
93 | + $setup_tpl->set_block('migration', 'ldap_admin', 'ldap_admin'); |
|
94 | + $setup_tpl->set_block('migration', 'submit', 'submit'); |
|
95 | + $setup_tpl->set_block('migration', 'footer', 'footer'); |
|
96 | + $setup_tpl->set_block('migration', 'truncate_egw_accounts', 'truncate_egw_accounts'); |
|
97 | + |
|
98 | + foreach ($accounts as $account_id => $account) |
|
99 | 99 | { |
100 | 100 | if ($account['account_type'] == 'g') |
101 | 101 | { |
@@ -103,70 +103,69 @@ discard block |
||
103 | 103 | { |
104 | 104 | $identical_account_id_warning .= lang('Group %1 uses identical ID %2 as user %3!', $account['account_lid'], abs($account_id), $accounts[abs($account_id)]['account_lid']); |
105 | 105 | } |
106 | - $group_list .= '<option value="' . $account_id . '" selected="1">'. $account['account_lid'] . "</option>\n"; |
|
106 | + $group_list .= '<option value="'.$account_id.'" selected="1">'.$account['account_lid']."</option>\n"; |
|
107 | 107 | } |
108 | 108 | else |
109 | 109 | { |
110 | - $user_list .= '<option value="' . $account_id . '" selected="1">'. |
|
110 | + $user_list .= '<option value="'.$account_id.'" selected="1">'. |
|
111 | 111 | Api\Accounts::format_username($account['account_lid'], |
112 | - $account['account_firstname'],$account['account_lastname']) . "</option>\n"; |
|
112 | + $account['account_firstname'], $account['account_lastname'])."</option>\n"; |
|
113 | 113 | } |
114 | 114 | } |
115 | - $setup_tpl->set_var('action_url','account_migration.php'); |
|
116 | - $setup_tpl->set_var('users',$user_list); |
|
117 | - $setup_tpl->set_var('groups',$group_list); |
|
118 | - |
|
119 | - $setup_tpl->set_var('description',lang('Migration between EGroupware account repositories').': '.$direction); |
|
120 | - $setup_tpl->set_var('select_users',lang('Select which user(s) will be exported')); |
|
121 | - $setup_tpl->set_var('select_groups',lang('Select which group(s) will be exported')); |
|
122 | - $setup_tpl->set_var('memberships',$identical_account_id_warning ? |
|
123 | - '<p style="color: red">'.$identical_account_id_warning.'<br/>'.lang('Migration of group will fail, as SQL does NOT allow identical IDs.').'</p>' : |
|
124 | - lang('Group memberships will be migrated too.')); |
|
115 | + $setup_tpl->set_var('action_url', 'account_migration.php'); |
|
116 | + $setup_tpl->set_var('users', $user_list); |
|
117 | + $setup_tpl->set_var('groups', $group_list); |
|
118 | + |
|
119 | + $setup_tpl->set_var('description', lang('Migration between EGroupware account repositories').': '.$direction); |
|
120 | + $setup_tpl->set_var('select_users', lang('Select which user(s) will be exported')); |
|
121 | + $setup_tpl->set_var('select_groups', lang('Select which group(s) will be exported')); |
|
122 | + $setup_tpl->set_var('memberships', $identical_account_id_warning ? |
|
123 | + '<p style="color: red">'.$identical_account_id_warning.'<br/>'.lang('Migration of group will fail, as SQL does NOT allow identical IDs.').'</p>' : lang('Group memberships will be migrated too.')); |
|
125 | 124 | $setup_tpl->set_var('ldap_admin_message', lang('Give LDAP root DN and password, if you need to create an instance specific admin user, user- or group-context')); |
126 | 125 | $setup_tpl->set_var('ldap_admin_label', lang('Root DN')); |
127 | 126 | $setup_tpl->set_var('ldap_admin_pw_label', lang('Root DN password')); |
128 | - $setup_tpl->set_var('migrate',$direction); |
|
129 | - $setup_tpl->set_var('cancel',lang('Cancel')); |
|
127 | + $setup_tpl->set_var('migrate', $direction); |
|
128 | + $setup_tpl->set_var('cancel', lang('Cancel')); |
|
130 | 129 | if ($from == 'sql' && $GLOBALS['egw_info']['server']['auth_type'] == 'ldap') |
131 | 130 | { |
132 | 131 | $setup_tpl->set_var('extra_button', Api\Html::submit_button('passwords2sql', lang('Passwords --> SQL'))); |
133 | 132 | } |
134 | 133 | |
135 | - $setup_tpl->pfp('out','header'); |
|
136 | - if($user_list) |
|
134 | + $setup_tpl->pfp('out', 'header'); |
|
135 | + if ($user_list) |
|
137 | 136 | { |
138 | - $setup_tpl->pfp('out','user_list'); |
|
137 | + $setup_tpl->pfp('out', 'user_list'); |
|
139 | 138 | } |
140 | - if($group_list) |
|
139 | + if ($group_list) |
|
141 | 140 | { |
142 | - $setup_tpl->pfp('out','group_list'); |
|
141 | + $setup_tpl->pfp('out', 'group_list'); |
|
143 | 142 | } |
144 | 143 | if ($to == 'ldap') |
145 | 144 | { |
146 | - $setup_tpl->pfp('out','ldap_admin'); |
|
145 | + $setup_tpl->pfp('out', 'ldap_admin'); |
|
147 | 146 | } |
148 | 147 | if ($to == 'sql') |
149 | 148 | { |
150 | 149 | $setup_tpl->set_var('truncate_egw_accounts_message', lang('Delete all existing accounts from SQL database')); |
151 | - $setup_tpl->pfp('out','truncate_egw_accounts'); |
|
150 | + $setup_tpl->pfp('out', 'truncate_egw_accounts'); |
|
152 | 151 | } |
153 | - $setup_tpl->pfp('out','submit'); |
|
154 | - $setup_tpl->pfp('out','footer'); |
|
152 | + $setup_tpl->pfp('out', 'submit'); |
|
153 | + $setup_tpl->pfp('out', 'footer'); |
|
155 | 154 | } |
156 | 155 | else // do the migration |
157 | 156 | { |
158 | 157 | $cmd->only = (array)$_POST['users']; |
159 | 158 | if (empty($_POST['passwords2sql'])) $cmd->only = array_merge($cmd->only, (array)$_POST['groups']); |
160 | 159 | $cmd->verbose = true; |
161 | - echo '<p align="center">'.str_replace("\n","</p>\n<p align='center'>",$cmd->run())."</p>\n"; |
|
160 | + echo '<p align="center">'.str_replace("\n", "</p>\n<p align='center'>", $cmd->run())."</p>\n"; |
|
162 | 161 | |
163 | 162 | // store new repostory (and auth_type), as we are migrated now |
164 | 163 | if ($_POST['migrate']) |
165 | 164 | { |
166 | - Api\Config::save_value('account_repository', $GLOBALS['egw_info']['server']['account_repository']=$to, 'phpgwapi'); |
|
165 | + Api\Config::save_value('account_repository', $GLOBALS['egw_info']['server']['account_repository'] = $to, 'phpgwapi'); |
|
167 | 166 | if (empty($GLOBALS['egw_info']['server']['auth_type']) || $GLOBALS['egw_info']['server']['auth_type'] == $from) |
168 | 167 | { |
169 | - Api\Config::save_value('auth_type', $GLOBALS['egw_info']['server']['auth_type']=$to, 'phpgwapi'); |
|
168 | + Api\Config::save_value('auth_type', $GLOBALS['egw_info']['server']['auth_type'] = $to, 'phpgwapi'); |
|
170 | 169 | } |
171 | 170 | } |
172 | 171 | echo '<p align="center">'.lang('Click <a href="index.php">here</a> to return to setup.')."</p>\n"; |
@@ -156,7 +156,10 @@ |
||
156 | 156 | else // do the migration |
157 | 157 | { |
158 | 158 | $cmd->only = (array)$_POST['users']; |
159 | - if (empty($_POST['passwords2sql'])) $cmd->only = array_merge($cmd->only, (array)$_POST['groups']); |
|
159 | + if (empty($_POST['passwords2sql'])) |
|
160 | + { |
|
161 | + $cmd->only = array_merge($cmd->only, (array)$_POST['groups']); |
|
162 | + } |
|
160 | 163 | $cmd->verbose = true; |
161 | 164 | echo '<p align="center">'.str_replace("\n","</p>\n<p align='center'>",$cmd->run())."</p>\n"; |
162 | 165 |
@@ -350,7 +350,7 @@ |
||
350 | 350 | { |
351 | 351 | echo lang('because it depends upon') . ':<br />' . "\n"; |
352 | 352 | list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False); |
353 | - $depapp_count = count($depapp); |
|
353 | + $depapp_count = count($depapp); |
|
354 | 354 | for ($i=0; $i<$depapp_count; $i++) |
355 | 355 | { |
356 | 356 | echo '<br />' . $depapp[$i] . ': '; |
@@ -51,36 +51,36 @@ discard block |
||
51 | 51 | Api\Csrf::validate($_POST['csrf_token'], __FILE__); |
52 | 52 | } |
53 | 53 | |
54 | -$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
55 | -$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
56 | -$setup_tpl->set_block('T_setup_main','header','header'); |
|
57 | -$setup_tpl->set_block('T_setup_main','app_header','app_header'); |
|
58 | -$setup_tpl->set_block('T_setup_main','apps','apps'); |
|
59 | -$setup_tpl->set_block('T_setup_main','detail','detail'); |
|
60 | -$setup_tpl->set_block('T_setup_main','table','table'); |
|
61 | -$setup_tpl->set_block('T_setup_main','hook','hook'); |
|
62 | -$setup_tpl->set_block('T_setup_main','dep','dep'); |
|
63 | -$setup_tpl->set_block('T_setup_main','app_footer','app_footer'); |
|
64 | -$setup_tpl->set_block('T_setup_main','submit','submit'); |
|
65 | -$setup_tpl->set_block('T_setup_main','footer','footer'); |
|
66 | - |
|
67 | -$bgcolor = array('#DDDDDD','#EEEEEE'); |
|
68 | - |
|
69 | -function parsedep($depends,$main=True) |
|
54 | +$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
55 | +$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
56 | +$setup_tpl->set_block('T_setup_main', 'header', 'header'); |
|
57 | +$setup_tpl->set_block('T_setup_main', 'app_header', 'app_header'); |
|
58 | +$setup_tpl->set_block('T_setup_main', 'apps', 'apps'); |
|
59 | +$setup_tpl->set_block('T_setup_main', 'detail', 'detail'); |
|
60 | +$setup_tpl->set_block('T_setup_main', 'table', 'table'); |
|
61 | +$setup_tpl->set_block('T_setup_main', 'hook', 'hook'); |
|
62 | +$setup_tpl->set_block('T_setup_main', 'dep', 'dep'); |
|
63 | +$setup_tpl->set_block('T_setup_main', 'app_footer', 'app_footer'); |
|
64 | +$setup_tpl->set_block('T_setup_main', 'submit', 'submit'); |
|
65 | +$setup_tpl->set_block('T_setup_main', 'footer', 'footer'); |
|
66 | + |
|
67 | +$bgcolor = array('#DDDDDD', '#EEEEEE'); |
|
68 | + |
|
69 | +function parsedep($depends, $main = True) |
|
70 | 70 | { |
71 | 71 | $depstring = '('; |
72 | - foreach($depends as $b) |
|
72 | + foreach ($depends as $b) |
|
73 | 73 | { |
74 | - foreach($b as $c => $d) |
|
74 | + foreach ($b as $c => $d) |
|
75 | 75 | { |
76 | 76 | if (is_array($d)) |
77 | 77 | { |
78 | - $depstring .= $c . ': ' .implode(',',$d) . '; '; |
|
78 | + $depstring .= $c.': '.implode(',', $d).'; '; |
|
79 | 79 | $depver[] = $d; |
80 | 80 | } |
81 | 81 | else |
82 | 82 | { |
83 | - $depstring .= $c . ': ' . $d . '; '; |
|
83 | + $depstring .= $c.': '.$d.'; '; |
|
84 | 84 | $depapp[] = $d; |
85 | 85 | } |
86 | 86 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | else |
94 | 94 | { |
95 | - return array($depapp,$depver); |
|
95 | + return array($depapp, $depver); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | |
107 | 107 | @ksort($setup_info); |
108 | 108 | |
109 | -if(@$_POST['cancel']) |
|
109 | +if (@$_POST['cancel']) |
|
110 | 110 | { |
111 | 111 | Header("Location: index.php"); |
112 | 112 | exit; |
113 | 113 | } |
114 | 114 | |
115 | -if(@$_POST['submit']) |
|
115 | +if (@$_POST['submit']) |
|
116 | 116 | { |
117 | - $GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
118 | - $setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':'); |
|
119 | - $setup_tpl->pparse('out','header'); |
|
117 | + $GLOBALS['egw_setup']->html->show_header(lang('Application Management'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
118 | + $setup_tpl->set_var('description', lang('App install/remove/upgrade').':'); |
|
119 | + $setup_tpl->pparse('out', 'header'); |
|
120 | 120 | |
121 | 121 | $appname = $_POST['appname']; |
122 | 122 | $remove = $_POST['remove']; |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | |
126 | 126 | $register_hooks = false; |
127 | 127 | |
128 | - if(!empty($remove) && is_array($remove)) |
|
128 | + if (!empty($remove) && is_array($remove)) |
|
129 | 129 | { |
130 | 130 | $historylog = new Api\Storage\History(); |
131 | 131 | $historylog->db = $GLOBALS['egw_setup']->db; |
132 | 132 | |
133 | - foreach($remove as $appname => $key) |
|
133 | + foreach ($remove as $appname => $key) |
|
134 | 134 | { |
135 | 135 | $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name']; |
136 | 136 | $terror = array(); |
@@ -138,30 +138,30 @@ discard block |
||
138 | 138 | |
139 | 139 | if ($setup_info[$appname]['tables']) |
140 | 140 | { |
141 | - $GLOBALS['egw_setup']->process->droptables($terror,$DEBUG); |
|
142 | - echo '<br />' . $app_title . ' ' . lang('tables dropped') . '.'; |
|
141 | + $GLOBALS['egw_setup']->process->droptables($terror, $DEBUG); |
|
142 | + echo '<br />'.$app_title.' '.lang('tables dropped').'.'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | $GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']); |
146 | - echo '<br />' . $app_title . ' ' . lang('deregistered') . '.'; |
|
146 | + echo '<br />'.$app_title.' '.lang('deregistered').'.'; |
|
147 | 147 | |
148 | 148 | $register_hooks = true; |
149 | 149 | |
150 | 150 | $historylog->appname = $appname; |
151 | 151 | if ($historylog->delete(null)) |
152 | 152 | { |
153 | - echo '<br />' . $app_title . ' ' . lang('Historylog removed') . '.'; |
|
153 | + echo '<br />'.$app_title.' '.lang('Historylog removed').'.'; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // delete all application categories and ACL |
157 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table,array('cat_appname' => $appname),__LINE__,__FILE__); |
|
158 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table,array('acl_appname' => $appname),__LINE__,__FILE__); |
|
157 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table, array('cat_appname' => $appname), __LINE__, __FILE__); |
|
158 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table, array('acl_appname' => $appname), __LINE__, __FILE__); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - if(!empty($install) && is_array($install)) |
|
162 | + if (!empty($install) && is_array($install)) |
|
163 | 163 | { |
164 | - foreach($install as $appname => $key) |
|
164 | + foreach ($install as $appname => $key) |
|
165 | 165 | { |
166 | 166 | $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name']; |
167 | 167 | $terror = array(); |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | { |
172 | 172 | $terror_c = $GLOBALS['egw_setup']->process->current($terror, $DEBUG); |
173 | 173 | $terror = $GLOBALS['egw_setup']->process->default_records($terror_c, $DEBUG); |
174 | - echo '<br />' . $app_title . ' ' |
|
175 | - . lang('tables installed, unless there are errors printed above') . '.'; |
|
174 | + echo '<br />'.$app_title.' ' |
|
175 | + . lang('tables installed, unless there are errors printed above').'.'; |
|
176 | 176 | } |
177 | 177 | else |
178 | 178 | { |
179 | 179 | // check default_records for apps without tables, they might need some initial work too |
180 | - $terror = $GLOBALS['egw_setup']->process->default_records($terror,$DEBUG); |
|
180 | + $terror = $GLOBALS['egw_setup']->process->default_records($terror, $DEBUG); |
|
181 | 181 | if ($GLOBALS['egw_setup']->app_registered($setup_info[$appname]['name'])) |
182 | 182 | { |
183 | 183 | $GLOBALS['egw_setup']->update_app($setup_info[$appname]['name']); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | $GLOBALS['egw_setup']->register_app($setup_info[$appname]['name']); |
188 | 188 | } |
189 | - echo '<br />' . $app_title . ' ' . lang('registered') . '.'; |
|
189 | + echo '<br />'.$app_title.' '.lang('registered').'.'; |
|
190 | 190 | |
191 | 191 | if ($setup_info[$appname]['hooks']) |
192 | 192 | { |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if(!empty($upgrade) && is_array($upgrade)) |
|
199 | + if (!empty($upgrade) && is_array($upgrade)) |
|
200 | 200 | { |
201 | - foreach($upgrade as $appname => $key) |
|
201 | + foreach ($upgrade as $appname => $key) |
|
202 | 202 | { |
203 | 203 | $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name']; |
204 | 204 | $terror = array(); |
205 | 205 | $terror[$appname] = $setup_info[$appname]; |
206 | 206 | |
207 | - $GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG); |
|
207 | + $GLOBALS['egw_setup']->process->upgrade($terror, $DEBUG); |
|
208 | 208 | if ($setup_info[$appname]['tables']) |
209 | 209 | { |
210 | - echo '<br />' . $app_title . ' ' . lang('tables upgraded') . '.'; |
|
210 | + echo '<br />'.$app_title.' '.lang('tables upgraded').'.'; |
|
211 | 211 | // The process_upgrade() function also handles registration |
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
215 | - echo '<br />' . $app_title . ' ' . lang('upgraded') . '.'; |
|
215 | + echo '<br />'.$app_title.' '.lang('upgraded').'.'; |
|
216 | 216 | } |
217 | 217 | $register_hooks = true; |
218 | 218 | } |
@@ -221,61 +221,61 @@ discard block |
||
221 | 221 | if ($register_hooks) |
222 | 222 | { |
223 | 223 | Api\Hooks::read(true); |
224 | - echo '<br />' . $app_title . ' ' . lang('hooks registered') . '.'; |
|
224 | + echo '<br />'.$app_title.' '.lang('hooks registered').'.'; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | //$setup_tpl->set_var('goback', |
228 | - echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
|
228 | + echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>'; |
|
229 | 229 | //$setup_tpl->pparse('out','submit'); |
230 | - $setup_tpl->pparse('out','footer'); |
|
230 | + $setup_tpl->pparse('out', 'footer'); |
|
231 | 231 | exit; |
232 | 232 | } |
233 | 233 | else |
234 | 234 | { |
235 | - $GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
235 | + $GLOBALS['egw_setup']->html->show_header(lang('Application Management'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
236 | 236 | } |
237 | 237 | |
238 | -if(@$_GET['hooks']) |
|
238 | +if (@$_GET['hooks']) |
|
239 | 239 | { |
240 | 240 | Api\Cache::flush(Api\Cache::INSTANCE); |
241 | 241 | |
242 | - echo lang('Cached cleared') . '<br />'; |
|
242 | + echo lang('Cached cleared').'<br />'; |
|
243 | 243 | } |
244 | 244 | $detail = $_GET['detail']; |
245 | 245 | $resolve = $_GET['resolve']; |
246 | -if(@$detail) |
|
246 | +if (@$detail) |
|
247 | 247 | { |
248 | 248 | @ksort($setup_info[$detail]); |
249 | - $setup_tpl->set_var('description',lang('App details') . ':'); |
|
250 | - $setup_tpl->pparse('out','header'); |
|
249 | + $setup_tpl->set_var('description', lang('App details').':'); |
|
250 | + $setup_tpl->pparse('out', 'header'); |
|
251 | 251 | |
252 | - $setup_tpl->set_var('name','application'); |
|
252 | + $setup_tpl->set_var('name', 'application'); |
|
253 | 253 | $setup_tpl->set_var('details', lang($setup_info[$detail]['title'])); |
254 | - $setup_tpl->pparse('out','detail'); |
|
254 | + $setup_tpl->pparse('out', 'detail'); |
|
255 | 255 | |
256 | - foreach($setup_info[$detail] as $key => $val) |
|
256 | + foreach ($setup_info[$detail] as $key => $val) |
|
257 | 257 | { |
258 | - switch($key) |
|
258 | + switch ($key) |
|
259 | 259 | { |
260 | 260 | case 'title': |
261 | 261 | continue 2; |
262 | 262 | case 'tables': |
263 | 263 | $tblcnt = count($setup_info[$detail][$key]); |
264 | - if(is_array($val)) |
|
264 | + if (is_array($val)) |
|
265 | 265 | { |
266 | - $key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True&apps=True">' . $key . '(' . $tblcnt . ')</a>' . "\n"; |
|
267 | - $val = implode(',' . "\n",$val); |
|
266 | + $key = '<a href="sqltoarray.php?appname='.$detail.'&submit=True&apps=True">'.$key.'('.$tblcnt.')</a>'."\n"; |
|
267 | + $val = implode(','."\n", $val); |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | case 'hooks': |
271 | - foreach($val as &$hooks) |
|
271 | + foreach ($val as &$hooks) |
|
272 | 272 | { |
273 | 273 | $hooks = (array)$hooks; |
274 | 274 | } |
275 | 275 | $val = str_replace('EGroupware\\', '', implode(', ', call_user_func_array('array_merge', $val))); |
276 | 276 | break; |
277 | 277 | case 'depends': |
278 | - foreach($val as &$dep) |
|
278 | + foreach ($val as &$dep) |
|
279 | 279 | { |
280 | 280 | $dep = $dep['appname'].': '.implode(', ', $dep['versions']); |
281 | 281 | } |
@@ -288,174 +288,174 @@ discard block |
||
288 | 288 | if (is_array($val)) $val = implode(', ', $val); |
289 | 289 | break; |
290 | 290 | } |
291 | - $setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]); |
|
292 | - $setup_tpl->set_var('name',$key); |
|
293 | - $setup_tpl->set_var('details',$val); |
|
294 | - $setup_tpl->pparse('out','detail'); |
|
291 | + $setup_tpl->set_var('bg_color', $bgcolor[++$i&1]); |
|
292 | + $setup_tpl->set_var('name', $key); |
|
293 | + $setup_tpl->set_var('details', $val); |
|
294 | + $setup_tpl->pparse('out', 'detail'); |
|
295 | 295 | } |
296 | 296 | |
297 | - echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
|
298 | - $setup_tpl->pparse('out','footer'); |
|
297 | + echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>'; |
|
298 | + $setup_tpl->pparse('out', 'footer'); |
|
299 | 299 | exit; |
300 | 300 | } |
301 | 301 | elseif (@$resolve) |
302 | 302 | { |
303 | 303 | $version = $_GET['version']; |
304 | 304 | $notables = $_GET['notables']; |
305 | - $setup_tpl->set_var('description',lang('Problem resolution'). ':'); |
|
306 | - $setup_tpl->pparse('out','header'); |
|
305 | + $setup_tpl->set_var('description', lang('Problem resolution').':'); |
|
306 | + $setup_tpl->pparse('out', 'header'); |
|
307 | 307 | $app_title = $setup_info[$resolve]['title'] ? $setup_info[$resolve]['title'] : $setup_info[$resolve]['name']; |
308 | 308 | |
309 | - if($_GET['post']) |
|
309 | + if ($_GET['post']) |
|
310 | 310 | { |
311 | - echo '"' . $app_title . '" ' . lang('may be broken') . ' '; |
|
311 | + echo '"'.$app_title.'" '.lang('may be broken').' '; |
|
312 | 312 | echo lang('because an application it depends upon was upgraded'); |
313 | 313 | echo '<br />'; |
314 | - echo lang('to a version it does not know about') . '.'; |
|
314 | + echo lang('to a version it does not know about').'.'; |
|
315 | 315 | echo '<br />'; |
316 | - echo lang('However, the application may still work') . '.'; |
|
316 | + echo lang('However, the application may still work').'.'; |
|
317 | 317 | } |
318 | - elseif($_GET['badinstall']) |
|
318 | + elseif ($_GET['badinstall']) |
|
319 | 319 | { |
320 | - echo '"' . $app_title . '" ' . lang('is broken') . ' '; |
|
321 | - echo lang('because of a failed upgrade or install') . '.'; |
|
320 | + echo '"'.$app_title.'" '.lang('is broken').' '; |
|
321 | + echo lang('because of a failed upgrade or install').'.'; |
|
322 | 322 | echo '<br />'; |
323 | - echo lang('Some or all of its tables are missing') . '.'; |
|
323 | + echo lang('Some or all of its tables are missing').'.'; |
|
324 | 324 | echo '<br />'; |
325 | - echo lang('You should either uninstall and then reinstall it, or attempt manual repairs') . '.'; |
|
325 | + echo lang('You should either uninstall and then reinstall it, or attempt manual repairs').'.'; |
|
326 | 326 | } |
327 | - elseif($_GET['deleted']) |
|
327 | + elseif ($_GET['deleted']) |
|
328 | 328 | { |
329 | - echo '"' . $app_title . '" ' . lang('is broken') . ' '; |
|
330 | - echo lang('because its sources are missing') . '!'; |
|
329 | + echo '"'.$app_title.'" '.lang('is broken').' '; |
|
330 | + echo lang('because its sources are missing').'!'; |
|
331 | 331 | echo '<br />'; |
332 | - echo lang('However the tables are still in the database') . '.'; |
|
332 | + echo lang('However the tables are still in the database').'.'; |
|
333 | 333 | echo '<br />'; |
334 | - echo lang('You should either install the sources or uninstall it, to get rid of the tables') . '.'; |
|
334 | + echo lang('You should either install the sources or uninstall it, to get rid of the tables').'.'; |
|
335 | 335 | } |
336 | 336 | elseif (!$version) |
337 | 337 | { |
338 | - if($setup_info[$resolve]['enabled']) |
|
338 | + if ($setup_info[$resolve]['enabled']) |
|
339 | 339 | { |
340 | - echo '"' . $app_title . '" ' . lang('is broken') . ' '; |
|
340 | + echo '"'.$app_title.'" '.lang('is broken').' '; |
|
341 | 341 | } |
342 | 342 | else |
343 | 343 | { |
344 | - echo '"' . $app_title . '" ' . lang('is disabled') . ' '; |
|
344 | + echo '"'.$app_title.'" '.lang('is disabled').' '; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | if (!$notables) |
348 | 348 | { |
349 | - if($setup_info[$resolve]['status'] == 'D') |
|
349 | + if ($setup_info[$resolve]['status'] == 'D') |
|
350 | 350 | { |
351 | - echo lang('because it depends upon') . ':<br />' . "\n"; |
|
352 | - list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False); |
|
351 | + echo lang('because it depends upon').':<br />'."\n"; |
|
352 | + list($depapp, $depver) = parsedep($setup_info[$resolve]['depends'], False); |
|
353 | 353 | $depapp_count = count($depapp); |
354 | - for ($i=0; $i<$depapp_count; $i++) |
|
354 | + for ($i = 0; $i < $depapp_count; $i++) |
|
355 | 355 | { |
356 | - echo '<br />' . $depapp[$i] . ': '; |
|
356 | + echo '<br />'.$depapp[$i].': '; |
|
357 | 357 | $list = ''; |
358 | - foreach($depver[$i] as $x => $y) |
|
358 | + foreach ($depver[$i] as $x => $y) |
|
359 | 359 | { |
360 | - $list .= $y . ', '; |
|
360 | + $list .= $y.', '; |
|
361 | 361 | } |
362 | - echo substr($list,0,-2)."\n"; |
|
362 | + echo substr($list, 0, -2)."\n"; |
|
363 | 363 | } |
364 | - echo '<br /><br />' . lang('The table definition was correct, and the tables were installed') . '.'; |
|
364 | + echo '<br /><br />'.lang('The table definition was correct, and the tables were installed').'.'; |
|
365 | 365 | } |
366 | 366 | else |
367 | 367 | { |
368 | - echo lang('because it was manually disabled') . '.'; |
|
368 | + echo lang('because it was manually disabled').'.'; |
|
369 | 369 | } |
370 | 370 | } |
371 | - elseif($setup_info[$resolve]['enable'] == 2) |
|
371 | + elseif ($setup_info[$resolve]['enable'] == 2) |
|
372 | 372 | { |
373 | - echo lang('because it is not a user application, or access is controlled via acl') . '.'; |
|
373 | + echo lang('because it is not a user application, or access is controlled via acl').'.'; |
|
374 | 374 | } |
375 | - elseif($setup_info[$resolve]['enable'] == 0) |
|
375 | + elseif ($setup_info[$resolve]['enable'] == 0) |
|
376 | 376 | { |
377 | - echo lang('because the enable flag for this app is set to 0, or is undefined') . '.'; |
|
377 | + echo lang('because the enable flag for this app is set to 0, or is undefined').'.'; |
|
378 | 378 | } |
379 | 379 | else |
380 | 380 | { |
381 | - echo lang('because it requires manual table installation, <br />or the table definition was incorrect') . ".\n" |
|
382 | - . lang("Please check for sql scripts within the application's directory") . '.'; |
|
381 | + echo lang('because it requires manual table installation, <br />or the table definition was incorrect').".\n" |
|
382 | + . lang("Please check for sql scripts within the application's directory").'.'; |
|
383 | 383 | } |
384 | - echo '<br />' . lang('However, the application is otherwise installed') . '.'; |
|
384 | + echo '<br />'.lang('However, the application is otherwise installed').'.'; |
|
385 | 385 | } |
386 | 386 | else |
387 | 387 | { |
388 | - echo $app_title . ' ' . lang('has a version mismatch') . ' '; |
|
389 | - echo lang('because of a failed upgrade, or the database is newer than the installed version of this app') . '.'; |
|
388 | + echo $app_title.' '.lang('has a version mismatch').' '; |
|
389 | + echo lang('because of a failed upgrade, or the database is newer than the installed version of this app').'.'; |
|
390 | 390 | echo '<br />'; |
391 | - echo lang('If the application has no defined tables, selecting upgrade should remedy the problem') . '.'; |
|
392 | - echo '<br />' . lang('However, the application is otherwise installed') . '.'; |
|
391 | + echo lang('If the application has no defined tables, selecting upgrade should remedy the problem').'.'; |
|
392 | + echo '<br />'.lang('However, the application is otherwise installed').'.'; |
|
393 | 393 | } |
394 | 394 | |
395 | - echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
|
396 | - $setup_tpl->pparse('out','footer'); |
|
395 | + echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>'; |
|
396 | + $setup_tpl->pparse('out', 'footer'); |
|
397 | 397 | exit; |
398 | 398 | } |
399 | 399 | else |
400 | 400 | { |
401 | - $setup_tpl->set_var('description',lang('Select the desired action(s) from the available choices')); |
|
402 | - $setup_tpl->set_var('action_url','applications.php'); |
|
403 | - $setup_tpl->pparse('out','header'); |
|
404 | - |
|
405 | - $setup_tpl->set_var('appdata',lang('Application Data')); |
|
406 | - $setup_tpl->set_var('actions',lang('Actions')); |
|
407 | - $setup_tpl->set_var('app_info',lang('Application Name and Status Information')); |
|
408 | - $setup_tpl->set_var('app_title',lang('Application Title')); |
|
409 | - $setup_tpl->set_var('app_currentver',lang('Current Version')); |
|
410 | - $setup_tpl->set_var('app_version',lang('Available Version')); |
|
411 | - $setup_tpl->set_var('app_install',lang('Install')); |
|
412 | - $setup_tpl->set_var('app_remove',lang('Remove')); |
|
413 | - $setup_tpl->set_var('app_upgrade',lang('Upgrade')); |
|
414 | - $setup_tpl->set_var('app_resolve',lang('Resolve')); |
|
415 | - $setup_tpl->set_var('check','check.png'); |
|
416 | - $setup_tpl->set_var('install_all',lang('Install All')); |
|
417 | - $setup_tpl->set_var('upgrade_all',lang('Upgrade All')); |
|
418 | - $setup_tpl->set_var('remove_all',lang('Remove All')); |
|
419 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
420 | - $setup_tpl->set_var('debug','<input type="checkbox" name="debug" value="True"' .($DEBUG ? ' checked="checked"' : '') . ' />'); |
|
421 | - $setup_tpl->set_var('bg_color',$bgcolor[0]); |
|
422 | - |
|
423 | - $setup_tpl->pparse('out','app_header'); |
|
401 | + $setup_tpl->set_var('description', lang('Select the desired action(s) from the available choices')); |
|
402 | + $setup_tpl->set_var('action_url', 'applications.php'); |
|
403 | + $setup_tpl->pparse('out', 'header'); |
|
404 | + |
|
405 | + $setup_tpl->set_var('appdata', lang('Application Data')); |
|
406 | + $setup_tpl->set_var('actions', lang('Actions')); |
|
407 | + $setup_tpl->set_var('app_info', lang('Application Name and Status Information')); |
|
408 | + $setup_tpl->set_var('app_title', lang('Application Title')); |
|
409 | + $setup_tpl->set_var('app_currentver', lang('Current Version')); |
|
410 | + $setup_tpl->set_var('app_version', lang('Available Version')); |
|
411 | + $setup_tpl->set_var('app_install', lang('Install')); |
|
412 | + $setup_tpl->set_var('app_remove', lang('Remove')); |
|
413 | + $setup_tpl->set_var('app_upgrade', lang('Upgrade')); |
|
414 | + $setup_tpl->set_var('app_resolve', lang('Resolve')); |
|
415 | + $setup_tpl->set_var('check', 'check.png'); |
|
416 | + $setup_tpl->set_var('install_all', lang('Install All')); |
|
417 | + $setup_tpl->set_var('upgrade_all', lang('Upgrade All')); |
|
418 | + $setup_tpl->set_var('remove_all', lang('Remove All')); |
|
419 | + $setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages')); |
|
420 | + $setup_tpl->set_var('debug', '<input type="checkbox" name="debug" value="True"'.($DEBUG ? ' checked="checked"' : '').' />'); |
|
421 | + $setup_tpl->set_var('bg_color', $bgcolor[0]); |
|
422 | + |
|
423 | + $setup_tpl->pparse('out', 'app_header'); |
|
424 | 424 | |
425 | 425 | $i = 0; |
426 | - foreach($setup_info as $key => $value) |
|
426 | + foreach ($setup_info as $key => $value) |
|
427 | 427 | { |
428 | - if(@$value['name']) |
|
428 | + if (@$value['name']) |
|
429 | 429 | { |
430 | 430 | $i = ($i ? 0 : 1); |
431 | - $setup_tpl->set_var('apptitle',$value['title']?$value['title']:lang($value['name'])); |
|
432 | - $setup_tpl->set_var('currentver',@$value['currentver']); |
|
433 | - $setup_tpl->set_var('version',$value['version']); |
|
434 | - $setup_tpl->set_var('bg_color',$bgcolor[$i]); |
|
431 | + $setup_tpl->set_var('apptitle', $value['title'] ? $value['title'] : lang($value['name'])); |
|
432 | + $setup_tpl->set_var('currentver', @$value['currentver']); |
|
433 | + $setup_tpl->set_var('version', $value['version']); |
|
434 | + $setup_tpl->set_var('bg_color', $bgcolor[$i]); |
|
435 | 435 | |
436 | - switch($value['status']) |
|
436 | + switch ($value['status']) |
|
437 | 437 | { |
438 | 438 | case 'C': |
439 | - $setup_tpl->set_var('remove', in_array($key, array('api', 'phpgwapi')) ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
440 | - $setup_tpl->set_var('upgrade',' '); |
|
439 | + $setup_tpl->set_var('remove', in_array($key, array('api', 'phpgwapi')) ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
440 | + $setup_tpl->set_var('upgrade', ' '); |
|
441 | 441 | if (!$GLOBALS['egw_setup']->detection->check_app_tables($value['name'])) |
442 | 442 | { |
443 | 443 | // App installed and enabled, but some tables are missing |
444 | - $setup_tpl->set_var('instimg','table.png'); |
|
445 | - $setup_tpl->set_var('bg_color','FFCCAA'); |
|
446 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
447 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>'); |
|
448 | - $status = lang('Requires reinstall or manual repair') . ' - ' . $value['status']; |
|
444 | + $setup_tpl->set_var('instimg', 'table.png'); |
|
445 | + $setup_tpl->set_var('bg_color', 'FFCCAA'); |
|
446 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
447 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&badinstall=True">'.lang('Potential Problem').'</a>'); |
|
448 | + $status = lang('Requires reinstall or manual repair').' - '.$value['status']; |
|
449 | 449 | } |
450 | 450 | else |
451 | 451 | { |
452 | - $setup_tpl->set_var('instimg','completed.png'); |
|
453 | - $setup_tpl->set_var('instalt',lang('Completed')); |
|
454 | - $setup_tpl->set_var('install',' '); |
|
455 | - if($value['enabled']) |
|
452 | + $setup_tpl->set_var('instimg', 'completed.png'); |
|
453 | + $setup_tpl->set_var('instalt', lang('Completed')); |
|
454 | + $setup_tpl->set_var('install', ' '); |
|
455 | + if ($value['enabled']) |
|
456 | 456 | { |
457 | - $setup_tpl->set_var('resolution',''); |
|
458 | - $status = lang('OK') . ' - ' . $value['status']; |
|
457 | + $setup_tpl->set_var('resolution', ''); |
|
458 | + $status = lang('OK').' - '.$value['status']; |
|
459 | 459 | } |
460 | 460 | else |
461 | 461 | { |
@@ -463,123 +463,123 @@ discard block |
||
463 | 463 | { |
464 | 464 | $notables = '¬ables=True'; |
465 | 465 | } |
466 | - $setup_tpl->set_var('bg_color','CCCCFF'); |
|
466 | + $setup_tpl->set_var('bg_color', 'CCCCFF'); |
|
467 | 467 | $setup_tpl->set_var('resolution', |
468 | - '<a href="applications.php?resolve=' . $value['name'] . $notables . '">' . lang('Possible Reasons') . '</a>' |
|
468 | + '<a href="applications.php?resolve='.$value['name'].$notables.'">'.lang('Possible Reasons').'</a>' |
|
469 | 469 | ); |
470 | - $status = lang('Disabled') . ' - ' . $value['status']; |
|
470 | + $status = lang('Disabled').' - '.$value['status']; |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | break; |
474 | 474 | case 'U': |
475 | - $setup_tpl->set_var('instimg','incomplete.png'); |
|
476 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
475 | + $setup_tpl->set_var('instimg', 'incomplete.png'); |
|
476 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
477 | 477 | if (!@$value['currentver']) |
478 | 478 | { |
479 | - if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'],True)) |
|
479 | + if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'], True)) |
|
480 | 480 | { |
481 | 481 | // Some tables missing |
482 | - $setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
483 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>'); |
|
484 | - $status = lang('Requires reinstall or manual repair') . ' - ' . $value['status']; |
|
482 | + $setup_tpl->set_var('remove', $key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
483 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&badinstall=True">'.lang('Potential Problem').'</a>'); |
|
484 | + $status = lang('Requires reinstall or manual repair').' - '.$value['status']; |
|
485 | 485 | } |
486 | 486 | else |
487 | 487 | { |
488 | - $setup_tpl->set_var('remove',' '); |
|
489 | - $setup_tpl->set_var('resolution',''); |
|
490 | - $status = lang('Requires upgrade') . ' - ' . $value['status']; |
|
488 | + $setup_tpl->set_var('remove', ' '); |
|
489 | + $setup_tpl->set_var('resolution', ''); |
|
490 | + $status = lang('Requires upgrade').' - '.$value['status']; |
|
491 | 491 | } |
492 | 492 | // show not installed apps without icon |
493 | - $setup_tpl->set_var('instimg','spacer.png'); |
|
494 | - $setup_tpl->set_var('instalt',''); |
|
495 | - $setup_tpl->set_var('bg_color','CCFFCC'); |
|
496 | - $setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']" />'); |
|
497 | - $setup_tpl->set_var('upgrade',' '); |
|
498 | - $status = lang('Please install') . ' - ' . $value['status']; |
|
493 | + $setup_tpl->set_var('instimg', 'spacer.png'); |
|
494 | + $setup_tpl->set_var('instalt', ''); |
|
495 | + $setup_tpl->set_var('bg_color', 'CCFFCC'); |
|
496 | + $setup_tpl->set_var('install', '<input type="checkbox" name="install['.$value['name'].']" />'); |
|
497 | + $setup_tpl->set_var('upgrade', ' '); |
|
498 | + $status = lang('Please install').' - '.$value['status']; |
|
499 | 499 | } |
500 | 500 | else |
501 | 501 | { |
502 | - $setup_tpl->set_var('bg_color','CCCCFF'); |
|
503 | - $setup_tpl->set_var('install',' '); |
|
502 | + $setup_tpl->set_var('bg_color', 'CCCCFF'); |
|
503 | + $setup_tpl->set_var('install', ' '); |
|
504 | 504 | // TODO display some info about breakage if you mess with this app |
505 | - $setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />'); |
|
506 | - $setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
507 | - $setup_tpl->set_var('resolution',''); |
|
508 | - $status = lang('Requires upgrade') . ' - ' . $value['status']; |
|
505 | + $setup_tpl->set_var('upgrade', '<input type="checkbox" name="upgrade['.$value['name'].']" />'); |
|
506 | + $setup_tpl->set_var('remove', $key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
507 | + $setup_tpl->set_var('resolution', ''); |
|
508 | + $status = lang('Requires upgrade').' - '.$value['status']; |
|
509 | 509 | } |
510 | 510 | break; |
511 | 511 | case 'V': |
512 | - $setup_tpl->set_var('instimg','incomplete.png'); |
|
513 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
514 | - $setup_tpl->set_var('install',' '); |
|
515 | - $setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
512 | + $setup_tpl->set_var('instimg', 'incomplete.png'); |
|
513 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
514 | + $setup_tpl->set_var('install', ' '); |
|
515 | + $setup_tpl->set_var('remove', $key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
516 | 516 | if ($value['version'] == 'deleted') |
517 | 517 | { |
518 | - $setup_tpl->set_var('bg_color','CCAAAA'); |
|
519 | - $setup_tpl->set_var('upgrade',' '); |
|
520 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&deleted=True">' . lang('Possible Solutions') . '</a>'); |
|
521 | - $status = lang('Sources deleted/missing') . ' - ' . $value['status']; |
|
518 | + $setup_tpl->set_var('bg_color', 'CCAAAA'); |
|
519 | + $setup_tpl->set_var('upgrade', ' '); |
|
520 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&deleted=True">'.lang('Possible Solutions').'</a>'); |
|
521 | + $status = lang('Sources deleted/missing').' - '.$value['status']; |
|
522 | 522 | } |
523 | 523 | else |
524 | 524 | { |
525 | - $setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />'); |
|
526 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&version=True">' . lang('Possible Solutions') . '</a>'); |
|
527 | - $status = lang('Version Mismatch') . ' - ' . $value['status']; |
|
525 | + $setup_tpl->set_var('upgrade', '<input type="checkbox" name="upgrade['.$value['name'].']" />'); |
|
526 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&version=True">'.lang('Possible Solutions').'</a>'); |
|
527 | + $status = lang('Version Mismatch').' - '.$value['status']; |
|
528 | 528 | } |
529 | 529 | break; |
530 | 530 | case 'D': |
531 | - $setup_tpl->set_var('bg_color','FFCCCC'); |
|
531 | + $setup_tpl->set_var('bg_color', 'FFCCCC'); |
|
532 | 532 | $depstring = parsedep($value['depends']); |
533 | 533 | $depstring .= ')'; |
534 | - $setup_tpl->set_var('instimg','dep.png'); |
|
535 | - $setup_tpl->set_var('instalt',lang('Dependency Failure')); |
|
536 | - $setup_tpl->set_var('install',' '); |
|
534 | + $setup_tpl->set_var('instimg', 'dep.png'); |
|
535 | + $setup_tpl->set_var('instalt', lang('Dependency Failure')); |
|
536 | + $setup_tpl->set_var('install', ' '); |
|
537 | 537 | if ($values['currentver']) |
538 | 538 | { |
539 | - $setup_tpl->set_var('remove',$key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
540 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>'); |
|
539 | + $setup_tpl->set_var('remove', $key == 'phpgwapi' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
540 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'">'.lang('Possible Solutions').'</a>'); |
|
541 | 541 | } |
542 | 542 | else |
543 | 543 | { |
544 | - $setup_tpl->set_var('remove',' '); |
|
545 | - $setup_tpl->set_var('resolution',' '); |
|
544 | + $setup_tpl->set_var('remove', ' '); |
|
545 | + $setup_tpl->set_var('resolution', ' '); |
|
546 | 546 | } |
547 | - $setup_tpl->set_var('upgrade',' '); |
|
548 | - $status = lang('Dependency Failure') . ':' . $depstring . $value['status']; |
|
547 | + $setup_tpl->set_var('upgrade', ' '); |
|
548 | + $status = lang('Dependency Failure').':'.$depstring.$value['status']; |
|
549 | 549 | break; |
550 | 550 | case 'P': |
551 | - $setup_tpl->set_var('bg_color','FFCCFF'); |
|
551 | + $setup_tpl->set_var('bg_color', 'FFCCFF'); |
|
552 | 552 | $depstring = parsedep($value['depends']); |
553 | 553 | $depstring .= ')'; |
554 | - $setup_tpl->set_var('instimg','dep.png'); |
|
555 | - $setup_tpl->set_var('instalt',lang('Post-install Dependency Failure')); |
|
556 | - $setup_tpl->set_var('install',' '); |
|
557 | - $setup_tpl->set_var('remove',' '); |
|
558 | - $setup_tpl->set_var('upgrade',' '); |
|
559 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&post=True">' . lang('Possible Solutions') . '</a>'); |
|
560 | - $status = lang('Post-install Dependency Failure') . ':' . $depstring . $value['status']; |
|
554 | + $setup_tpl->set_var('instimg', 'dep.png'); |
|
555 | + $setup_tpl->set_var('instalt', lang('Post-install Dependency Failure')); |
|
556 | + $setup_tpl->set_var('install', ' '); |
|
557 | + $setup_tpl->set_var('remove', ' '); |
|
558 | + $setup_tpl->set_var('upgrade', ' '); |
|
559 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&post=True">'.lang('Possible Solutions').'</a>'); |
|
560 | + $status = lang('Post-install Dependency Failure').':'.$depstring.$value['status']; |
|
561 | 561 | break; |
562 | 562 | default: |
563 | - $setup_tpl->set_var('instimg','incomplete.png'); |
|
564 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
565 | - $setup_tpl->set_var('install',' '); |
|
566 | - $setup_tpl->set_var('remove',' '); |
|
567 | - $setup_tpl->set_var('upgrade',' '); |
|
568 | - $setup_tpl->set_var('resolution',''); |
|
563 | + $setup_tpl->set_var('instimg', 'incomplete.png'); |
|
564 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
565 | + $setup_tpl->set_var('install', ' '); |
|
566 | + $setup_tpl->set_var('remove', ' '); |
|
567 | + $setup_tpl->set_var('upgrade', ' '); |
|
568 | + $setup_tpl->set_var('resolution', ''); |
|
569 | 569 | $status = ''; |
570 | 570 | break; |
571 | 571 | } |
572 | 572 | //$setup_tpl->set_var('appname',$value['name'] . '-' . $status . ',' . $value['filename']); |
573 | - $setup_tpl->set_var('appinfo',$value['name'] . '-' . $status); |
|
574 | - $setup_tpl->set_var('appname',$value['name']); |
|
573 | + $setup_tpl->set_var('appinfo', $value['name'].'-'.$status); |
|
574 | + $setup_tpl->set_var('appname', $value['name']); |
|
575 | 575 | |
576 | - $setup_tpl->pparse('out','apps',True); |
|
576 | + $setup_tpl->pparse('out', 'apps', True); |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
580 | - $setup_tpl->set_var('submit',lang('Save')); |
|
581 | - $setup_tpl->set_var('cancel',lang('Cancel')); |
|
582 | - $setup_tpl->pparse('out','app_footer'); |
|
583 | - $setup_tpl->pparse('out','footer'); |
|
580 | + $setup_tpl->set_var('submit', lang('Save')); |
|
581 | + $setup_tpl->set_var('cancel', lang('Cancel')); |
|
582 | + $setup_tpl->pparse('out', 'app_footer'); |
|
583 | + $setup_tpl->pparse('out', 'footer'); |
|
584 | 584 | $GLOBALS['egw_setup']->html->show_footer(); |
585 | 585 | } |
@@ -285,7 +285,10 @@ |
||
285 | 285 | $val = array2string($val); |
286 | 286 | break; |
287 | 287 | default: |
288 | - if (is_array($val)) $val = implode(', ', $val); |
|
288 | + if (is_array($val)) |
|
289 | + { |
|
290 | + $val = implode(', ', $val); |
|
291 | + } |
|
289 | 292 | break; |
290 | 293 | } |
291 | 294 | $setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @version $Id$ |
12 | 12 | */ |
13 | 13 | |
14 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
14 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
15 | 15 | |
16 | 16 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
17 | 17 | { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | $ids = explode(',', $_SERVER['argv'][0]); |
41 | 41 | $change = array(); |
42 | -while($ids) |
|
42 | +while ($ids) |
|
43 | 43 | { |
44 | 44 | $from = (int)array_shift($ids); |
45 | 45 | $to = (int)array_shift($ids); |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | |
67 | 67 | chown_grp($path, null, $recursive); |
68 | 68 | |
69 | -function chown_grp($path, array $stat=null, $recursive=false) |
|
69 | +function chown_grp($path, array $stat = null, $recursive = false) |
|
70 | 70 | { |
71 | 71 | global $change; |
72 | 72 | |
73 | 73 | if (is_null($stat) && !($stat = stat($path))) return false; |
74 | 74 | |
75 | - if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']])) |
|
75 | + if (isset($change[$stat['uid']]) && !chown($path, $uid = $change[$stat['uid']])) |
|
76 | 76 | { |
77 | 77 | echo "Faild to set new owner #$uid for $path\n"; |
78 | 78 | } |
79 | - if (isset($change[-$stat['gid']]) && !chgrp($path, $gid=-$change[-$stat['gid']])) |
|
79 | + if (isset($change[-$stat['gid']]) && !chgrp($path, $gid = -$change[-$stat['gid']])) |
|
80 | 80 | { |
81 | 81 | echo "Faild to set new group #$gid for $path\n"; |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ($recursive && is_dir($path)) |
85 | 85 | { |
86 | - foreach(new DirectoryIterator($path) as $child) |
|
86 | + foreach (new DirectoryIterator($path) as $child) |
|
87 | 87 | { |
88 | 88 | if (!$child->isDot()) |
89 | 89 | chown_grp($child->getPathname(), array( |
@@ -13,10 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | chdir(dirname(__FILE__)); // to enable our relative pathes to work |
15 | 15 | |
16 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
|
16 | +if (php_sapi_name() !== 'cli') |
|
17 | +{ |
|
18 | + // security precaution: forbit calling as web-page |
|
17 | 19 | { |
18 | 20 | die('<h1>setup/doc/chown.php must NOT be called as web-page --> exiting !!!</h1>'); |
19 | 21 | } |
22 | +} |
|
20 | 23 | |
21 | 24 | $recursive = false; |
22 | 25 | |
@@ -70,7 +73,10 @@ discard block |
||
70 | 73 | { |
71 | 74 | global $change; |
72 | 75 | |
73 | - if (is_null($stat) && !($stat = stat($path))) return false; |
|
76 | + if (is_null($stat) && !($stat = stat($path))) |
|
77 | + { |
|
78 | + return false; |
|
79 | + } |
|
74 | 80 | |
75 | 81 | if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']])) |
76 | 82 | { |
@@ -86,10 +92,12 @@ discard block |
||
86 | 92 | foreach(new DirectoryIterator($path) as $child) |
87 | 93 | { |
88 | 94 | if (!$child->isDot()) |
89 | - chown_grp($child->getPathname(), array( |
|
95 | + { |
|
96 | + chown_grp($child->getPathname(), array( |
|
90 | 97 | 'uid' => $child->getOwner(), |
91 | 98 | 'gid' => $child->getGroup(), |
92 | 99 | ), $recursive); |
100 | + } |
|
93 | 101 | } |
94 | 102 | } |
95 | 103 | } |
@@ -20,9 +20,9 @@ |
||
20 | 20 | 'name' => 'eGroupware core team', |
21 | 21 | 'email' => '[email protected]' |
22 | 22 | ); |
23 | -$setup_info['importexport']['autoinstall'] = true; // install automatically on update |
|
23 | +$setup_info['importexport']['autoinstall'] = true; // install automatically on update |
|
24 | 24 | |
25 | -$setup_info['importexport']['license'] = 'GPL'; |
|
25 | +$setup_info['importexport']['license'] = 'GPL'; |
|
26 | 26 | $setup_info['importexport']['description'] = |
27 | 27 | ''; |
28 | 28 | $setup_info['importexport']['note'] = |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | $setup_info['resources']['depends'][] = array( |
40 | 40 | 'appname' => 'api', |
41 | - 'versions' => Array('16.1') |
|
41 | + 'versions' => array('16.1') |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 |
@@ -12,15 +12,15 @@ |
||
12 | 12 | $phpgw_baseline = array( |
13 | 13 | 'egw_importexport_definitions' => array( |
14 | 14 | 'fd' => array( |
15 | - 'definition_id' => array('type' => 'auto','nullable' => False), |
|
16 | - 'name' => array('type' => 'varchar','precision' => '255'), |
|
17 | - 'application' => array('type' => 'varchar','precision' => '50'), |
|
18 | - 'plugin' => array('type' => 'varchar','precision' => '100'), |
|
19 | - 'type' => array('type' => 'varchar','precision' => '20'), |
|
20 | - 'allowed_users' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255'), |
|
15 | + 'definition_id' => array('type' => 'auto', 'nullable' => False), |
|
16 | + 'name' => array('type' => 'varchar', 'precision' => '255'), |
|
17 | + 'application' => array('type' => 'varchar', 'precision' => '50'), |
|
18 | + 'plugin' => array('type' => 'varchar', 'precision' => '100'), |
|
19 | + 'type' => array('type' => 'varchar', 'precision' => '20'), |
|
20 | + 'allowed_users' => array('type' => 'varchar', 'meta' => 'account-commasep', 'precision' => '255'), |
|
21 | 21 | 'plugin_options' => array('type' => 'longtext'), |
22 | - 'owner' => array('type' => 'int','meta' => 'account','precision' => '4'), |
|
23 | - 'description' => array('type' => 'varchar','precision' => '255'), |
|
22 | + 'owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4'), |
|
23 | + 'description' => array('type' => 'varchar', 'precision' => '255'), |
|
24 | 24 | 'modified' => array('type' => 'timestamp'), |
25 | 25 | 'filter' => array('type' => 'longtext') |
26 | 26 | ), |