@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $etag = '"'.md5($config.$link_registry).'"'; |
33 | 33 | |
34 | 34 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
35 | -Api\Session::cache_control(86400); // cache for one day |
|
35 | +Api\Session::cache_control(86400); // cache for one day |
|
36 | 36 | Header('Content-Type: text/javascript; charset=utf-8'); |
37 | 37 | Header('ETag: '.$etag); |
38 | 38 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $content .= 'egw.set_link_registry('.$link_registry.", undefined, egw && egw.window !== window);\n"; |
48 | 48 | |
49 | 49 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
50 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
50 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
51 | 51 | { |
52 | 52 | $content = gzencode($content); |
53 | 53 | header('Content-Encoding: gzip'); |
@@ -16,18 +16,18 @@ |
||
16 | 16 | |
17 | 17 | use EGroupware\Api; |
18 | 18 | |
19 | -Api\Framework::includeJS('.','etemplate2','etemplate'); |
|
20 | -Api\Framework::includeJS('jquery','jquery.tools.min','phpgwapi'); // Not needed once JS require works for files like this |
|
21 | -Api\Framework::includeJS('jquery','jquery.html5_upload','phpgwapi'); // Not needed once JS require works for files like this |
|
19 | +Api\Framework::includeJS('.', 'etemplate2', 'etemplate'); |
|
20 | +Api\Framework::includeJS('jquery', 'jquery.tools.min', 'phpgwapi'); // Not needed once JS require works for files like this |
|
21 | +Api\Framework::includeJS('jquery', 'jquery.html5_upload', 'phpgwapi'); // Not needed once JS require works for files like this |
|
22 | 22 | Api\Framework::includeCSS('/api/js/etemplate/test/test.css'); |
23 | 23 | |
24 | 24 | /* |
25 | 25 | * Test using any actual template |
26 | 26 | */ |
27 | 27 | $template = 'etemplate.et2_test_file_upload'; |
28 | - if($template) { |
|
28 | + if ($template) { |
|
29 | 29 | $etemplate = new Api\Etemplate('etemplate.et2_test_file_upload'); |
30 | - $etemplate->exec('',array()); |
|
30 | + $etemplate->exec('', array()); |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | echo $GLOBALS['egw']->framework->header(); |
@@ -25,7 +25,8 @@ |
||
25 | 25 | * Test using any actual template |
26 | 26 | */ |
27 | 27 | $template = 'etemplate.et2_test_file_upload'; |
28 | - if($template) { |
|
28 | + if($template) |
|
29 | + { |
|
29 | 30 | $etemplate = new Api\Etemplate('etemplate.et2_test_file_upload'); |
30 | 31 | $etemplate->exec('',array()); |
31 | 32 | return; |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | $appname = $_GET['app'] && $GLOBALS['egw_info']['apps'][$_GET['app']] ? $_GET['app'] : Api\Categories::GLOBAL_APPNAME; |
31 | 31 | |
32 | 32 | $cats = new Api\Categories('', $appname); |
33 | -$categories = $cats->return_array('all',0, false, '', 'ASC','',$appname==Api\Categories::GLOBAL_APPNAME); |
|
33 | +$categories = $cats->return_array('all', 0, false, '', 'ASC', '', $appname == Api\Categories::GLOBAL_APPNAME); |
|
34 | 34 | |
35 | 35 | $content = "/* Category CSS for $appname */\n\n"; |
36 | 36 | |
37 | -foreach($categories as $cat) |
|
37 | +foreach ($categories as $cat) |
|
38 | 38 | { |
39 | 39 | if (!isset($cat['data'])) continue; |
40 | 40 | if (!empty($cat['data']['color'])) |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | if (!empty($cat['data']['icon'])) |
47 | 47 | { |
48 | - $content .= ".cat_{$cat['id']} .cat_icon { background-image: url('". admin_categories::icon_url($cat['data']['icon']) ."');} /*{$cat['name']}*/\n"; |
|
48 | + $content .= ".cat_{$cat['id']} .cat_icon { background-image: url('".admin_categories::icon_url($cat['data']['icon'])."');} /*{$cat['name']}*/\n"; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $etag = '"'.md5($content).'"'; |
54 | 54 | |
55 | 55 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
56 | -Api\Session::cache_control(86400); // cache for 1 day |
|
56 | +Api\Session::cache_control(86400); // cache for 1 day |
|
57 | 57 | Header('Content-Type: text/css; charset=utf-8'); |
58 | 58 | Header('ETag: '.$etag); |
59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
68 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
68 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
69 | 69 | { |
70 | 70 | $content = gzencode($content); |
71 | 71 | header('Content-Encoding: gzip'); |
@@ -36,7 +36,10 @@ |
||
36 | 36 | |
37 | 37 | foreach($categories as $cat) |
38 | 38 | { |
39 | - if (!isset($cat['data'])) continue; |
|
39 | + if (!isset($cat['data'])) |
|
40 | + { |
|
41 | + continue; |
|
42 | + } |
|
40 | 43 | if (!empty($cat['data']['color'])) |
41 | 44 | { |
42 | 45 | // Use slightly more specific selector that just class, to allow defaults |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $etag = '"'.md5($preferences.$ab_preferences.$user).'"'; |
34 | 34 | |
35 | 35 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
36 | -Api\Session::cache_control(86400); // cache for 1 day |
|
36 | +Api\Session::cache_control(86400); // cache for 1 day |
|
37 | 37 | Header('Content-Type: text/javascript; charset=utf-8'); |
38 | 38 | Header('ETag: '.$etag); |
39 | 39 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $content .= 'egw.set_user('.$user.", egw && egw.window !== window);\n"; |
50 | 50 | |
51 | 51 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
52 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
52 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
53 | 53 | { |
54 | 54 | $content = gzencode($content); |
55 | 55 | header('Content-Encoding: gzip'); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | include('./inc/functions.inc.php'); |
24 | 24 | |
25 | 25 | // Check header and authentication |
26 | - if(!$GLOBALS['egw_setup']->auth('Config')) |
|
26 | + if (!$GLOBALS['egw_setup']->auth('Config')) |
|
27 | 27 | { |
28 | 28 | Header('Location: index.php'); |
29 | 29 | exit; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // Does not return unless user is authorized |
32 | 32 | |
33 | 33 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
34 | - $GLOBALS['setup_tpl'] = CreateObject('phpgwapi.Template',$tpl_root); |
|
34 | + $GLOBALS['setup_tpl'] = CreateObject('phpgwapi.Template', $tpl_root); |
|
35 | 35 | $GLOBALS['setup_tpl']->set_file(array( |
36 | 36 | 'T_head' => 'head.tpl', |
37 | 37 | 'T_footer' => 'footer.tpl', |
@@ -41,48 +41,48 @@ discard block |
||
41 | 41 | 'T_setup_main' => 'schema.tpl' |
42 | 42 | )); |
43 | 43 | |
44 | - $GLOBALS['setup_tpl']->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
45 | - $GLOBALS['setup_tpl']->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
46 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','header','header'); |
|
47 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','app_header','app_header'); |
|
48 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','apps','apps'); |
|
49 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','detail','detail'); |
|
50 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','table','table'); |
|
51 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','hook','hook'); |
|
52 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','dep','dep'); |
|
53 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','app_footer','app_footer'); |
|
54 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','submit','submit'); |
|
55 | - $GLOBALS['setup_tpl']->set_block('T_setup_main','footer','footer'); |
|
56 | - |
|
57 | - $bgcolor = array('DDDDDD','EEEEEE'); |
|
58 | - |
|
59 | - function parsedep($depends,$main=True) |
|
44 | + $GLOBALS['setup_tpl']->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
45 | + $GLOBALS['setup_tpl']->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
46 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'header', 'header'); |
|
47 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'app_header', 'app_header'); |
|
48 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'apps', 'apps'); |
|
49 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'detail', 'detail'); |
|
50 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'table', 'table'); |
|
51 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'hook', 'hook'); |
|
52 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'dep', 'dep'); |
|
53 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'app_footer', 'app_footer'); |
|
54 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'submit', 'submit'); |
|
55 | + $GLOBALS['setup_tpl']->set_block('T_setup_main', 'footer', 'footer'); |
|
56 | + |
|
57 | + $bgcolor = array('DDDDDD', 'EEEEEE'); |
|
58 | + |
|
59 | + function parsedep($depends, $main = True) |
|
60 | 60 | { |
61 | 61 | $depstring = '('; |
62 | - foreach($depends as $a => $b) |
|
62 | + foreach ($depends as $a => $b) |
|
63 | 63 | { |
64 | - foreach($b as $c => $d) |
|
64 | + foreach ($b as $c => $d) |
|
65 | 65 | { |
66 | - if(is_array($d)) |
|
66 | + if (is_array($d)) |
|
67 | 67 | { |
68 | - $depstring .= $c . ': ' .implode(',',$d) . '; '; |
|
68 | + $depstring .= $c.': '.implode(',', $d).'; '; |
|
69 | 69 | $depver[] = $d; |
70 | 70 | } |
71 | 71 | else |
72 | 72 | { |
73 | - $depstring .= $c . ': ' . $d . '; '; |
|
73 | + $depstring .= $c.': '.$d.'; '; |
|
74 | 74 | $depapp[] = $d; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | 78 | $depstring .= ')'; |
79 | - if($main) |
|
79 | + if ($main) |
|
80 | 80 | { |
81 | 81 | return $depstring; |
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - return array($depapp,$depver); |
|
85 | + return array($depapp, $depver); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -99,178 +99,178 @@ discard block |
||
99 | 99 | //var_dump($GLOBALS['setup_info']);exit; |
100 | 100 | @ksort($GLOBALS['setup_info']); |
101 | 101 | |
102 | - if($_POST['cancel']) |
|
102 | + if ($_POST['cancel']) |
|
103 | 103 | { |
104 | 104 | Header('Location: index.php'); |
105 | 105 | exit; |
106 | 106 | } |
107 | 107 | |
108 | - $GLOBALS['egw_setup']->html->show_header(lang("Developers' Table Schema Toy"),False,'config',$GLOBALS['egw_setup']->ConfigDomain); |
|
108 | + $GLOBALS['egw_setup']->html->show_header(lang("Developers' Table Schema Toy"), False, 'config', $GLOBALS['egw_setup']->ConfigDomain); |
|
109 | 109 | |
110 | - if($_POST['submit']) |
|
110 | + if ($_POST['submit']) |
|
111 | 111 | { |
112 | - $GLOBALS['setup_tpl']->set_var('description',lang('App process') . ':'); |
|
113 | - $GLOBALS['setup_tpl']->pparse('out','header'); |
|
112 | + $GLOBALS['setup_tpl']->set_var('description', lang('App process').':'); |
|
113 | + $GLOBALS['setup_tpl']->pparse('out', 'header'); |
|
114 | 114 | |
115 | 115 | $appname = $_POST['appname']; |
116 | 116 | $install = $_POST['install']; |
117 | 117 | $version = $_POST['version']; |
118 | 118 | |
119 | - foreach($install as $appname => $key) |
|
119 | + foreach ($install as $appname => $key) |
|
120 | 120 | { |
121 | 121 | $terror = array(); |
122 | 122 | $terror[$appname]['name'] = $appname; |
123 | 123 | $terror[$appname]['version'] = $version[$appname]; |
124 | 124 | $terror[$appname]['status'] = 'U'; |
125 | 125 | |
126 | - $appdir = EGW_SERVER_ROOT . '/' . $appname . '/setup/'; |
|
126 | + $appdir = EGW_SERVER_ROOT.'/'.$appname.'/setup/'; |
|
127 | 127 | |
128 | 128 | // Drop newest tables |
129 | 129 | $terror[$appname]['tables'] = $GLOBALS['setup_info'][$appname]['tables']; |
130 | - $GLOBALS['egw_setup']->process->droptables($terror,$GLOBALS['DEBUG']); |
|
130 | + $GLOBALS['egw_setup']->process->droptables($terror, $GLOBALS['DEBUG']); |
|
131 | 131 | $terror[$appname]['tables'] = array(); |
132 | 132 | |
133 | 133 | // Reset tables field to baseline table names |
134 | - if(file_exists($appdir.'tables_baseline.inc.php')) |
|
134 | + if (file_exists($appdir.'tables_baseline.inc.php')) |
|
135 | 135 | { |
136 | 136 | include($appdir.'tables_baseline.inc.php'); |
137 | - foreach($phpgw_baseline as $table => $null) |
|
137 | + foreach ($phpgw_baseline as $table => $null) |
|
138 | 138 | { |
139 | 139 | $terror[$appname]['tables'][] = $table; |
140 | - echo '<br />Adding app table: ' . $table; |
|
140 | + echo '<br />Adding app table: '.$table; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | - if($version[$appname]) |
|
144 | + if ($version[$appname]) |
|
145 | 145 | { |
146 | - echo '<br />Processing ' . $terror[$appname]['name'] . ' to ' . $version[$appname]; |
|
146 | + echo '<br />Processing '.$terror[$appname]['name'].' to '.$version[$appname]; |
|
147 | 147 | |
148 | - $terror = $GLOBALS['egw_setup']->process->droptables($terror,$GLOBALS['DEBUG']); |
|
148 | + $terror = $GLOBALS['egw_setup']->process->droptables($terror, $GLOBALS['DEBUG']); |
|
149 | 149 | $GLOBALS['egw_setup']->deregister_app($terror[$appname]['name']); |
150 | 150 | |
151 | - $terror = $GLOBALS['egw_setup']->process->baseline($terror,$GLOBALS['DEBUG']); |
|
152 | - $terror = $GLOBALS['egw_setup']->process->test_data($terror,$GLOBALS['DEBUG']); |
|
151 | + $terror = $GLOBALS['egw_setup']->process->baseline($terror, $GLOBALS['DEBUG']); |
|
152 | + $terror = $GLOBALS['egw_setup']->process->test_data($terror, $GLOBALS['DEBUG']); |
|
153 | 153 | |
154 | - $terror = $GLOBALS['egw_setup']->process->upgrade($terror,$GLOBALS['DEBUG']); |
|
154 | + $terror = $GLOBALS['egw_setup']->process->upgrade($terror, $GLOBALS['DEBUG']); |
|
155 | 155 | $terror[$appname]['version'] = $version[$appname]; |
156 | 156 | } |
157 | 157 | else |
158 | 158 | { |
159 | - echo '<br />Baseline-only completed for ' . $terror[$appname]['name']; |
|
159 | + echo '<br />Baseline-only completed for '.$terror[$appname]['name']; |
|
160 | 160 | } |
161 | - echo '<br />' . $GLOBALS['setup_info'][$appname]['title'] . ' ' |
|
162 | - . lang('tables installed, unless there are errors printed above') . '.'; |
|
161 | + echo '<br />'.$GLOBALS['setup_info'][$appname]['title'].' ' |
|
162 | + . lang('tables installed, unless there are errors printed above').'.'; |
|
163 | 163 | |
164 | 164 | $GLOBALS['setup_info'][$appname]['version'] = $terror[$appname]['version']; |
165 | 165 | $GLOBALS['egw_setup']->register_app($appname); |
166 | - echo '<br />' . $terror[$appname]['title'] . ' ' . lang('registered') . '.'; |
|
166 | + echo '<br />'.$terror[$appname]['title'].' '.lang('registered').'.'; |
|
167 | 167 | } |
168 | 168 | |
169 | - echo '<br /><a href="schematoy.php">' . lang('Go back') . '</a>'; |
|
170 | - $GLOBALS['setup_tpl']->pparse('out','footer'); |
|
169 | + echo '<br /><a href="schematoy.php">'.lang('Go back').'</a>'; |
|
170 | + $GLOBALS['setup_tpl']->pparse('out', 'footer'); |
|
171 | 171 | exit; |
172 | 172 | } |
173 | 173 | $detail = $_REQUEST['detail']; |
174 | - if($detail) |
|
174 | + if ($detail) |
|
175 | 175 | { |
176 | 176 | @ksort($GLOBALS['setup_info'][$detail]); |
177 | 177 | @reset($GLOBALS['setup_info'][$detail]); |
178 | - $GLOBALS['setup_tpl']->set_var('description',lang('App details') . ':'); |
|
179 | - $GLOBALS['setup_tpl']->pparse('out','header'); |
|
178 | + $GLOBALS['setup_tpl']->set_var('description', lang('App details').':'); |
|
179 | + $GLOBALS['setup_tpl']->pparse('out', 'header'); |
|
180 | 180 | |
181 | - foreach($GLOBALS['setup_info'][$detail] as $key => $val) |
|
181 | + foreach ($GLOBALS['setup_info'][$detail] as $key => $val) |
|
182 | 182 | { |
183 | 183 | $i = $i ? 0 : 1; |
184 | 184 | |
185 | 185 | //if(!$val) { $val = 'none'; } |
186 | 186 | |
187 | - if($key == 'tables') |
|
187 | + if ($key == 'tables') |
|
188 | 188 | { |
189 | - if(is_array($val)) |
|
189 | + if (is_array($val)) |
|
190 | 190 | { |
191 | - $key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True">' . $key . '</a>' . "\n"; |
|
192 | - $val = implode(',',$val); |
|
191 | + $key = '<a href="sqltoarray.php?appname='.$detail.'&submit=True">'.$key.'</a>'."\n"; |
|
192 | + $val = implode(',', $val); |
|
193 | 193 | } |
194 | 194 | } |
195 | - if($key == 'hooks') |
|
195 | + if ($key == 'hooks') |
|
196 | 196 | { |
197 | - $val = implode(',',$val); |
|
197 | + $val = implode(',', $val); |
|
198 | 198 | } |
199 | - if($key == 'depends') |
|
199 | + if ($key == 'depends') |
|
200 | 200 | { |
201 | 201 | $val = parsedep($val); |
202 | 202 | } |
203 | - if(is_array($val)) |
|
203 | + if (is_array($val)) |
|
204 | 204 | { |
205 | - $val = implode(',',$val); |
|
205 | + $val = implode(',', $val); |
|
206 | 206 | } |
207 | 207 | |
208 | - $GLOBALS['setup_tpl']->set_var('bg_color',$bgcolor[$i]); |
|
209 | - $GLOBALS['setup_tpl']->set_var('name',$key); |
|
210 | - $GLOBALS['setup_tpl']->set_var('details',$val); |
|
211 | - $GLOBALS['setup_tpl']->pparse('out','detail'); |
|
208 | + $GLOBALS['setup_tpl']->set_var('bg_color', $bgcolor[$i]); |
|
209 | + $GLOBALS['setup_tpl']->set_var('name', $key); |
|
210 | + $GLOBALS['setup_tpl']->set_var('details', $val); |
|
211 | + $GLOBALS['setup_tpl']->pparse('out', 'detail'); |
|
212 | 212 | } |
213 | 213 | |
214 | - echo '<br /><a href="schematoy.php">' . lang('Go back') . '</a>'; |
|
215 | - $GLOBALS['setup_tpl']->pparse('out','footer'); |
|
214 | + echo '<br /><a href="schematoy.php">'.lang('Go back').'</a>'; |
|
215 | + $GLOBALS['setup_tpl']->pparse('out', 'footer'); |
|
216 | 216 | exit; |
217 | 217 | } |
218 | 218 | else |
219 | 219 | { |
220 | - $GLOBALS['setup_tpl']->set_var('description',lang("Select an app, enter a target version, then submit to process to that version.<br />If you do not enter a version, only the baseline tables will be installed for the app.<br /><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>")); |
|
221 | - $GLOBALS['setup_tpl']->pparse('out','header'); |
|
222 | - |
|
223 | - $GLOBALS['setup_tpl']->set_var('appdata',lang('Application Data')); |
|
224 | - $GLOBALS['setup_tpl']->set_var('actions',lang('Actions')); |
|
225 | - $GLOBALS['setup_tpl']->set_var('action_url','schematoy.php'); |
|
226 | - $GLOBALS['setup_tpl']->set_var('app_info',lang('Application Name and Status')); |
|
227 | - $GLOBALS['setup_tpl']->set_var('app_title',lang('Application Title')); |
|
228 | - $GLOBALS['setup_tpl']->set_var('app_version',lang('Target Version')); |
|
229 | - $GLOBALS['setup_tpl']->set_var('app_install',lang('Process')); |
|
230 | - $GLOBALS['setup_tpl']->pparse('out','app_header'); |
|
231 | - |
|
232 | - foreach($GLOBALS['setup_info'] as $key => $value) |
|
220 | + $GLOBALS['setup_tpl']->set_var('description', lang("Select an app, enter a target version, then submit to process to that version.<br />If you do not enter a version, only the baseline tables will be installed for the app.<br /><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>")); |
|
221 | + $GLOBALS['setup_tpl']->pparse('out', 'header'); |
|
222 | + |
|
223 | + $GLOBALS['setup_tpl']->set_var('appdata', lang('Application Data')); |
|
224 | + $GLOBALS['setup_tpl']->set_var('actions', lang('Actions')); |
|
225 | + $GLOBALS['setup_tpl']->set_var('action_url', 'schematoy.php'); |
|
226 | + $GLOBALS['setup_tpl']->set_var('app_info', lang('Application Name and Status')); |
|
227 | + $GLOBALS['setup_tpl']->set_var('app_title', lang('Application Title')); |
|
228 | + $GLOBALS['setup_tpl']->set_var('app_version', lang('Target Version')); |
|
229 | + $GLOBALS['setup_tpl']->set_var('app_install', lang('Process')); |
|
230 | + $GLOBALS['setup_tpl']->pparse('out', 'app_header'); |
|
231 | + |
|
232 | + foreach ($GLOBALS['setup_info'] as $key => $value) |
|
233 | 233 | { |
234 | 234 | unset($test); |
235 | - if(file_exists(EGW_SERVER_ROOT . '/' . $value['name'] . '/setup/tables_update.inc.php')) |
|
235 | + if (file_exists(EGW_SERVER_ROOT.'/'.$value['name'].'/setup/tables_update.inc.php')) |
|
236 | 236 | { |
237 | - include(EGW_SERVER_ROOT . '/' . $value['name'] . '/setup/tables_update.inc.php'); |
|
237 | + include(EGW_SERVER_ROOT.'/'.$value['name'].'/setup/tables_update.inc.php'); |
|
238 | 238 | |
239 | - if(is_array($test)) |
|
239 | + if (is_array($test)) |
|
240 | 240 | { |
241 | 241 | reset($test); |
242 | 242 | } |
243 | 243 | |
244 | 244 | $s = '<option value=""> </option>'; |
245 | - while(is_array($test) && list(,$versionnumber) = each($test)) |
|
245 | + while (is_array($test) && list(,$versionnumber) = each($test)) |
|
246 | 246 | { |
247 | - $s .= '<option value="' . $versionnumber . '">' . $versionnumber . '</option>'; |
|
247 | + $s .= '<option value="'.$versionnumber.'">'.$versionnumber.'</option>'; |
|
248 | 248 | } |
249 | - $GLOBALS['setup_tpl']->set_var('select_version',$s); |
|
249 | + $GLOBALS['setup_tpl']->set_var('select_version', $s); |
|
250 | 250 | |
251 | - if($value['name']) |
|
251 | + if ($value['name']) |
|
252 | 252 | { |
253 | 253 | $i = $i ? 0 : 1; |
254 | - $GLOBALS['setup_tpl']->set_var('apptitle',$value['title']); |
|
255 | - $GLOBALS['setup_tpl']->set_var('currentver',$value['currentver']); |
|
256 | - $GLOBALS['setup_tpl']->set_var('bg_color',$bgcolor[$i]); |
|
254 | + $GLOBALS['setup_tpl']->set_var('apptitle', $value['title']); |
|
255 | + $GLOBALS['setup_tpl']->set_var('currentver', $value['currentver']); |
|
256 | + $GLOBALS['setup_tpl']->set_var('bg_color', $bgcolor[$i]); |
|
257 | 257 | |
258 | - $GLOBALS['setup_tpl']->set_var('instimg','completed.png'); |
|
259 | - $GLOBALS['setup_tpl']->set_var('instalt',lang('Completed')); |
|
260 | - $GLOBALS['setup_tpl']->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']" />'); |
|
261 | - $status = lang('OK') . ' - ' . $value['status']; |
|
258 | + $GLOBALS['setup_tpl']->set_var('instimg', 'completed.png'); |
|
259 | + $GLOBALS['setup_tpl']->set_var('instalt', lang('Completed')); |
|
260 | + $GLOBALS['setup_tpl']->set_var('install', '<input type="checkbox" name="install['.$value['name'].']" />'); |
|
261 | + $status = lang('OK').' - '.$value['status']; |
|
262 | 262 | |
263 | - $GLOBALS['setup_tpl']->set_var('appinfo',$value['name'] . '-' . $status); |
|
264 | - $GLOBALS['setup_tpl']->set_var('appname',$value['name']); |
|
263 | + $GLOBALS['setup_tpl']->set_var('appinfo', $value['name'].'-'.$status); |
|
264 | + $GLOBALS['setup_tpl']->set_var('appname', $value['name']); |
|
265 | 265 | |
266 | - $GLOBALS['setup_tpl']->pparse('out','apps',True); |
|
266 | + $GLOBALS['setup_tpl']->pparse('out', 'apps', True); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | } |
270 | 270 | } |
271 | - $GLOBALS['setup_tpl']->set_var('submit',lang('Save')); |
|
272 | - $GLOBALS['setup_tpl']->set_var('cancel',lang('Cancel')); |
|
273 | - $GLOBALS['setup_tpl']->pparse('out','app_footer'); |
|
274 | - $GLOBALS['setup_tpl']->pparse('out','footer'); |
|
271 | + $GLOBALS['setup_tpl']->set_var('submit', lang('Save')); |
|
272 | + $GLOBALS['setup_tpl']->set_var('cancel', lang('Cancel')); |
|
273 | + $GLOBALS['setup_tpl']->pparse('out', 'app_footer'); |
|
274 | + $GLOBALS['setup_tpl']->pparse('out', 'footer'); |
|
275 | 275 | $GLOBALS['egw_setup']->html->show_footer(); |
276 | 276 | ?> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | include('./inc/functions.inc.php'); |
22 | 22 | |
23 | 23 | /* Check header and authentication */ |
24 | -if(!$GLOBALS['egw_setup']->auth('Config')) |
|
24 | +if (!$GLOBALS['egw_setup']->auth('Config')) |
|
25 | 25 | { |
26 | 26 | Header('Location: index.php'); |
27 | 27 | exit; |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | // Does not return unless user is authorized |
30 | 30 | |
31 | 31 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
32 | -$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); |
|
32 | +$setup_tpl = CreateObject('phpgwapi.Template', $tpl_root); |
|
33 | 33 | |
34 | 34 | $cancel = $_REQUEST['cancel']; |
35 | -if($cancel) |
|
35 | +if ($cancel) |
|
36 | 36 | { |
37 | 37 | Header('Location: applications.php'); |
38 | 38 | exit; |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | $submit = $_REQUEST['submit']; |
43 | 43 | $showall = $_REQUEST['showall']; |
44 | 44 | $appname = $_REQUEST['appname']; |
45 | -if($download) |
|
45 | +if ($download) |
|
46 | 46 | { |
47 | 47 | $setup_tpl->set_file(array( |
48 | 48 | 'sqlarr' => 'arraydl.tpl' |
49 | 49 | )); |
50 | - $setup_tpl->set_var('idstring',"/* \$Id" . ": tables_current.inc.php" . ",v 1.0" . " 2001/05/28 08:42:04 username " . "Exp \$ */"); |
|
51 | - $setup_tpl->set_block('sqlarr','sqlheader','sqlheader'); |
|
52 | - $setup_tpl->set_block('sqlarr','sqlbody','sqlbody'); |
|
53 | - $setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter'); |
|
50 | + $setup_tpl->set_var('idstring', "/* \$Id".": tables_current.inc.php".",v 1.0"." 2001/05/28 08:42:04 username "."Exp \$ */"); |
|
51 | + $setup_tpl->set_block('sqlarr', 'sqlheader', 'sqlheader'); |
|
52 | + $setup_tpl->set_block('sqlarr', 'sqlbody', 'sqlbody'); |
|
53 | + $setup_tpl->set_block('sqlarr', 'sqlfooter', 'sqlfooter'); |
|
54 | 54 | } |
55 | 55 | else |
56 | 56 | { |
@@ -66,44 +66,44 @@ discard block |
||
66 | 66 | 'T_head' => 'head.tpl', |
67 | 67 | 'T_footer' => 'footer.tpl' |
68 | 68 | )); |
69 | - $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
70 | - $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
71 | - $setup_tpl->set_block('T_setup_main','header','header'); |
|
72 | - $setup_tpl->set_block('applist','appheader','appheader'); |
|
73 | - $setup_tpl->set_block('applist','appitem','appitem'); |
|
74 | - $setup_tpl->set_block('applist','appfooter','appfooter'); |
|
75 | - $setup_tpl->set_block('sqlarr','sqlheader','sqlheader'); |
|
76 | - $setup_tpl->set_block('sqlarr','sqlbody','sqlbody'); |
|
77 | - $setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter'); |
|
69 | + $setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
70 | + $setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
71 | + $setup_tpl->set_block('T_setup_main', 'header', 'header'); |
|
72 | + $setup_tpl->set_block('applist', 'appheader', 'appheader'); |
|
73 | + $setup_tpl->set_block('applist', 'appitem', 'appitem'); |
|
74 | + $setup_tpl->set_block('applist', 'appfooter', 'appfooter'); |
|
75 | + $setup_tpl->set_block('sqlarr', 'sqlheader', 'sqlheader'); |
|
76 | + $setup_tpl->set_block('sqlarr', 'sqlbody', 'sqlbody'); |
|
77 | + $setup_tpl->set_block('sqlarr', 'sqlfooter', 'sqlfooter'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $GLOBALS['egw_setup']->loaddb(); |
81 | 81 | |
82 | -function parse_vars($table,$term) |
|
82 | +function parse_vars($table, $term) |
|
83 | 83 | { |
84 | 84 | $GLOBALS['setup_tpl']->set_var('table', $table); |
85 | - $GLOBALS['setup_tpl']->set_var('term',$term); |
|
85 | + $GLOBALS['setup_tpl']->set_var('term', $term); |
|
86 | 86 | |
87 | - list($arr,$pk,$fk,$ix,$uc) = $GLOBALS['egw_setup']->process->sql_to_array($table); |
|
88 | - $GLOBALS['setup_tpl']->set_var('arr',$arr); |
|
87 | + list($arr, $pk, $fk, $ix, $uc) = $GLOBALS['egw_setup']->process->sql_to_array($table); |
|
88 | + $GLOBALS['setup_tpl']->set_var('arr', $arr); |
|
89 | 89 | |
90 | - foreach(array('pk','fk','ix','uc') as $kind) |
|
90 | + foreach (array('pk', 'fk', 'ix', 'uc') as $kind) |
|
91 | 91 | { |
92 | - $GLOBALS['setup_tpl']->set_var($kind.'s',_arr2str($$kind)); |
|
92 | + $GLOBALS['setup_tpl']->set_var($kind.'s', _arr2str($$kind)); |
|
93 | 93 | } |
94 | - unset($pk,$fk,$ix,$uc); |
|
94 | + unset($pk, $fk, $ix, $uc); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | function _arr2str($arr) |
98 | 98 | { |
99 | - if(!is_array($arr)) return $arr; |
|
99 | + if (!is_array($arr)) return $arr; |
|
100 | 100 | |
101 | 101 | $str = ''; |
102 | - foreach($arr as $key => $val) |
|
102 | + foreach ($arr as $key => $val) |
|
103 | 103 | { |
104 | - if($str) $str .= ','; |
|
104 | + if ($str) $str .= ','; |
|
105 | 105 | |
106 | - if(!is_int($key)) |
|
106 | + if (!is_int($key)) |
|
107 | 107 | { |
108 | 108 | $str .= "'$key' => "; |
109 | 109 | } |
@@ -119,71 +119,71 @@ discard block |
||
119 | 119 | $showall = $_REQUEST['showall']; |
120 | 120 | $apps = $GLOBALS['apps'] ? $GLOBALS['apps'] : ''; |
121 | 121 | |
122 | - if($download) |
|
122 | + if ($download) |
|
123 | 123 | { |
124 | - $GLOBALS['setup_tpl']->set_var('appname',$appname); |
|
125 | - $GLOBALS['setup_tpl']->set_var('apps',$apps); |
|
126 | - $string = $GLOBALS['setup_tpl']->parse('out',$template); |
|
124 | + $GLOBALS['setup_tpl']->set_var('appname', $appname); |
|
125 | + $GLOBALS['setup_tpl']->set_var('apps', $apps); |
|
126 | + $string = $GLOBALS['setup_tpl']->parse('out', $template); |
|
127 | 127 | } |
128 | 128 | else |
129 | 129 | { |
130 | 130 | // $url = $GLOBALS['appname'] ? 'applications.php' : 'sqltoarray.php'; |
131 | - $GLOBALS['setup_tpl']->set_var('appname',$appname); |
|
132 | - $GLOBALS['setup_tpl']->set_var('lang_download',lang('Download')); |
|
133 | - $GLOBALS['setup_tpl']->set_var('lang_cancel',lang('Cancel')); |
|
134 | - $GLOBALS['setup_tpl']->set_var('showall',$showall); |
|
135 | - $GLOBALS['setup_tpl']->set_var('apps',$apps); |
|
136 | - $GLOBALS['setup_tpl']->set_var('action_url','sqltoarray.php'); |
|
137 | - $GLOBALS['setup_tpl']->pfp('out',$template); |
|
131 | + $GLOBALS['setup_tpl']->set_var('appname', $appname); |
|
132 | + $GLOBALS['setup_tpl']->set_var('lang_download', lang('Download')); |
|
133 | + $GLOBALS['setup_tpl']->set_var('lang_cancel', lang('Cancel')); |
|
134 | + $GLOBALS['setup_tpl']->set_var('showall', $showall); |
|
135 | + $GLOBALS['setup_tpl']->set_var('apps', $apps); |
|
136 | + $GLOBALS['setup_tpl']->set_var('action_url', 'sqltoarray.php'); |
|
137 | + $GLOBALS['setup_tpl']->pfp('out', $template); |
|
138 | 138 | } |
139 | 139 | return $string; |
140 | 140 | } |
141 | 141 | |
142 | -function download_handler($dlstring,$fn='tables_current.inc.php') |
|
142 | +function download_handler($dlstring, $fn = 'tables_current.inc.php') |
|
143 | 143 | { |
144 | 144 | Api\Header\Content::type($fn); |
145 | 145 | echo $dlstring; |
146 | 146 | exit; |
147 | 147 | } |
148 | 148 | |
149 | -if($submit || $showall) |
|
149 | +if ($submit || $showall) |
|
150 | 150 | { |
151 | 151 | $dlstring = ''; |
152 | 152 | $term = ''; |
153 | 153 | |
154 | - if(!$download) |
|
154 | + if (!$download) |
|
155 | 155 | { |
156 | 156 | $GLOBALS['egw_setup']->html->show_header(); |
157 | 157 | } |
158 | 158 | |
159 | - if($showall) |
|
159 | + if ($showall) |
|
160 | 160 | { |
161 | 161 | $table = $appname = ''; |
162 | 162 | } |
163 | 163 | |
164 | - if(!$table && !$appname) |
|
164 | + if (!$table && !$appname) |
|
165 | 165 | { |
166 | 166 | $term = ','; |
167 | 167 | $dlstring .= printout('sqlheader'); |
168 | 168 | |
169 | 169 | $GLOBALS['egw_setup']->db->connect(); |
170 | - foreach($GLOBALS['egw_setup']->db->Link_ID->MetaTables() as $table) |
|
170 | + foreach ($GLOBALS['egw_setup']->db->Link_ID->MetaTables() as $table) |
|
171 | 171 | { |
172 | - parse_vars($table,$term); |
|
172 | + parse_vars($table, $term); |
|
173 | 173 | $dlstring .= printout('sqlbody'); |
174 | 174 | } |
175 | 175 | $dlstring .= printout('sqlfooter'); |
176 | 176 | |
177 | 177 | } |
178 | - elseif($appname) |
|
178 | + elseif ($appname) |
|
179 | 179 | { |
180 | 180 | $dlstring .= printout('sqlheader'); |
181 | 181 | $term = ','; |
182 | 182 | |
183 | - if(!$setup_info[$appname]['tables']) |
|
183 | + if (!$setup_info[$appname]['tables']) |
|
184 | 184 | { |
185 | - $f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php'; |
|
186 | - if(file_exists($f)) |
|
185 | + $f = EGW_SERVER_ROOT.'/'.$appname.'/setup/setup.inc.php'; |
|
186 | + if (file_exists($f)) |
|
187 | 187 | { |
188 | 188 | include($f); |
189 | 189 | } |
@@ -193,28 +193,28 @@ discard block |
||
193 | 193 | $tables = $setup_info[$appname]['tables']; |
194 | 194 | $i = 0; |
195 | 195 | $tbls = count($tables); |
196 | - while(list($key,$table) = @each($tables)) |
|
196 | + while (list($key, $table) = @each($tables)) |
|
197 | 197 | { |
198 | 198 | $i++; |
199 | - if($i == $tbls) |
|
199 | + if ($i == $tbls) |
|
200 | 200 | { |
201 | 201 | $term = ''; |
202 | 202 | } |
203 | - parse_vars($table,$term); |
|
203 | + parse_vars($table, $term); |
|
204 | 204 | $dlstring .= printout('sqlbody'); |
205 | 205 | /* $i++; */ |
206 | 206 | } |
207 | 207 | $dlstring .= printout('sqlfooter'); |
208 | 208 | } |
209 | - elseif($table) |
|
209 | + elseif ($table) |
|
210 | 210 | { |
211 | 211 | $term = ';'; |
212 | - parse_vars($table,$term); |
|
212 | + parse_vars($table, $term); |
|
213 | 213 | $dlstring .= printout('sqlheader'); |
214 | 214 | $dlstring .= printout('sqlbody'); |
215 | 215 | $dlstring .= printout('sqlfooter'); |
216 | 216 | } |
217 | - if($download) |
|
217 | + if ($download) |
|
218 | 218 | { |
219 | 219 | download_handler($dlstring); |
220 | 220 | } |
@@ -223,32 +223,32 @@ discard block |
||
223 | 223 | { |
224 | 224 | $GLOBALS['egw_setup']->html->show_header(); |
225 | 225 | |
226 | - $setup_tpl->set_var('action_url','sqltoarray.php'); |
|
227 | - $setup_tpl->set_var('lang_submit','Show selected'); |
|
228 | - $setup_tpl->set_var('lang_showall','Show all'); |
|
229 | - $setup_tpl->set_var('title','SQL to schema_proc array util'); |
|
230 | - $setup_tpl->set_var('lang_applist','Applications'); |
|
231 | - $setup_tpl->set_var('select_to_download_file',lang('Select to download file')); |
|
232 | - $setup_tpl->pfp('out','appheader'); |
|
226 | + $setup_tpl->set_var('action_url', 'sqltoarray.php'); |
|
227 | + $setup_tpl->set_var('lang_submit', 'Show selected'); |
|
228 | + $setup_tpl->set_var('lang_showall', 'Show all'); |
|
229 | + $setup_tpl->set_var('title', 'SQL to schema_proc array util'); |
|
230 | + $setup_tpl->set_var('lang_applist', 'Applications'); |
|
231 | + $setup_tpl->set_var('select_to_download_file', lang('Select to download file')); |
|
232 | + $setup_tpl->pfp('out', 'appheader'); |
|
233 | 233 | |
234 | 234 | $d = dir(EGW_SERVER_ROOT); |
235 | - while($entry = $d->read()) |
|
235 | + while ($entry = $d->read()) |
|
236 | 236 | { |
237 | - $f = EGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php'; |
|
238 | - if(file_exists($f)) |
|
237 | + $f = EGW_SERVER_ROOT.'/'.$entry.'/setup/setup.inc.php'; |
|
238 | + if (file_exists($f)) |
|
239 | 239 | { |
240 | 240 | include($f); |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | - while(list($key,$data) = @each($setup_info)) |
|
244 | + while (list($key, $data) = @each($setup_info)) |
|
245 | 245 | { |
246 | - if($data['tables']) |
|
246 | + if ($data['tables']) |
|
247 | 247 | { |
248 | - $setup_tpl->set_var('appname',$data['name']); |
|
249 | - $setup_tpl->set_var('apptitle',$data['title']); |
|
250 | - $setup_tpl->pfp('out','appitem'); |
|
248 | + $setup_tpl->set_var('appname', $data['name']); |
|
249 | + $setup_tpl->set_var('apptitle', $data['title']); |
|
250 | + $setup_tpl->pfp('out', 'appitem'); |
|
251 | 251 | } |
252 | 252 | } |
253 | - $setup_tpl->pfp('out','appfooter'); |
|
253 | + $setup_tpl->pfp('out', 'appfooter'); |
|
254 | 254 | } |
@@ -96,12 +96,18 @@ |
||
96 | 96 | |
97 | 97 | function _arr2str($arr) |
98 | 98 | { |
99 | - if(!is_array($arr)) return $arr; |
|
99 | + if(!is_array($arr)) |
|
100 | + { |
|
101 | + return $arr; |
|
102 | + } |
|
100 | 103 | |
101 | 104 | $str = ''; |
102 | 105 | foreach($arr as $key => $val) |
103 | 106 | { |
104 | - if($str) $str .= ','; |
|
107 | + if($str) |
|
108 | + { |
|
109 | + $str .= ','; |
|
110 | + } |
|
105 | 111 | |
106 | 112 | if(!is_int($key)) |
107 | 113 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param boolean $verbose =false if true, echos out some status information during the run |
31 | 31 | * @param string $app =null single application to update or install |
32 | 32 | */ |
33 | - function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$verbose=false,$app=null) |
|
33 | + function __construct($domain, $config_user = null, $config_passwd = null, $backup = null, $verbose = false, $app = null) |
|
34 | 34 | { |
35 | 35 | if (!is_array($domain)) |
36 | 36 | { |
@@ -55,32 +55,32 @@ discard block |
||
55 | 55 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
56 | 56 | * @throws Exception('header.inc.php not found!'); |
57 | 57 | */ |
58 | - protected function exec($check_only=false) |
|
58 | + protected function exec($check_only = false) |
|
59 | 59 | { |
60 | 60 | global $setup_info; |
61 | 61 | |
62 | 62 | // instanciate setup object and check authorisation |
63 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
63 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
64 | 64 | |
65 | - $this->check_installed($this->domain,array(14),$this->verbose); |
|
65 | + $this->check_installed($this->domain, array(14), $this->verbose); |
|
66 | 66 | |
67 | 67 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 4 && |
68 | 68 | (!$this->app || !in_array($this->app, self::$apps_to_install) && !in_array($this->app, self::$apps_to_upgrade)) && |
69 | 69 | !self::check_autoinstall()) |
70 | 70 | { |
71 | - return lang('No update necessary, domain %1(%2) is up to date.',$this->domain,$GLOBALS['egw_domain'][$this->domain]['db_type']); |
|
71 | + return lang('No update necessary, domain %1(%2) is up to date.', $this->domain, $GLOBALS['egw_domain'][$this->domain]['db_type']); |
|
72 | 72 | } |
73 | 73 | if ($check_only) return lang('Update necessary.'); |
74 | 74 | |
75 | 75 | $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); |
76 | 76 | |
77 | - self::$egw_setup->process->init_process(); // we need a new schema-proc instance for each new domain |
|
77 | + self::$egw_setup->process->init_process(); // we need a new schema-proc instance for each new domain |
|
78 | 78 | |
79 | 79 | // request to install a single app |
80 | 80 | if ($this->app && in_array($this->app, self::$apps_to_install)) |
81 | 81 | { |
82 | 82 | $app_title = $setup_info[$this->app]['title'] ? $setup_info[$this->app]['title'] : $setup_info[$this->app]['name']; |
83 | - self::_echo_message($this->verbose,lang('Start installing application %1 ...',$app_title)); |
|
83 | + self::_echo_message($this->verbose, lang('Start installing application %1 ...', $app_title)); |
|
84 | 84 | ob_start(); |
85 | 85 | $terror = array($this->app => $setup_info[$this->app]); |
86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $errors = self::$egw_setup->process->current($terror, $this->verbose); |
90 | 90 | $terror = self::$egw_setup->process->default_records($errors, $this->verbose); |
91 | - echo $app_title . ' ' . lang('tables installed, unless there are errors printed above') . '.'; |
|
91 | + echo $app_title.' '.lang('tables installed, unless there are errors printed above').'.'; |
|
92 | 92 | } |
93 | 93 | else |
94 | 94 | { |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | { |
103 | 103 | self::$egw_setup->register_app($setup_info[$this->app]['name']); |
104 | 104 | } |
105 | - echo $app_title . ' ' . lang('registered') . '.'; |
|
105 | + echo $app_title.' '.lang('registered').'.'; |
|
106 | 106 | |
107 | 107 | if ($setup_info[$this->app]['hooks']) |
108 | 108 | { |
109 | 109 | self::$egw_setup->register_hooks($setup_info[$this->app]['name']); |
110 | - echo "\n".$app_title . ' ' . lang('hooks registered') . '.'; |
|
110 | + echo "\n".$app_title.' '.lang('hooks registered').'.'; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | 114 | else |
115 | 115 | { |
116 | - self::_echo_message($this->verbose,lang('Start updating the database ...')); |
|
116 | + self::_echo_message($this->verbose, lang('Start updating the database ...')); |
|
117 | 117 | ob_start(); |
118 | - self::$egw_setup->process->pass($setup_info,'upgrade',false); |
|
118 | + self::$egw_setup->process->pass($setup_info, 'upgrade', false); |
|
119 | 119 | } |
120 | 120 | $messages = ob_get_contents(); |
121 | 121 | ob_end_clean(); |
@@ -70,7 +70,10 @@ discard block |
||
70 | 70 | { |
71 | 71 | return lang('No update necessary, domain %1(%2) is up to date.',$this->domain,$GLOBALS['egw_domain'][$this->domain]['db_type']); |
72 | 72 | } |
73 | - if ($check_only) return lang('Update necessary.'); |
|
73 | + if ($check_only) |
|
74 | + { |
|
75 | + return lang('Update necessary.'); |
|
76 | + } |
|
74 | 77 | |
75 | 78 | $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); |
76 | 79 | |
@@ -119,7 +122,10 @@ discard block |
||
119 | 122 | } |
120 | 123 | $messages = ob_get_contents(); |
121 | 124 | ob_end_clean(); |
122 | - if ($messages && $this->verbose) echo strip_tags($messages)."\n"; |
|
125 | + if ($messages && $this->verbose) |
|
126 | + { |
|
127 | + echo strip_tags($messages)."\n"; |
|
128 | + } |
|
123 | 129 | |
124 | 130 | $this->restore_db(); |
125 | 131 |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @param array $config =array() extra config for the account object: account_repository, ldap_* |
39 | 39 | * @param string $lang ='en' |
40 | 40 | */ |
41 | - function __construct($domain,$config_user=null,$config_passwd=null,$admin_user=null,$admin_password=null, |
|
42 | - $admin_firstname=null,$admin_lastname=null,$admin_email=null,array $config=array(),$lang='en') |
|
41 | + function __construct($domain, $config_user = null, $config_passwd = null, $admin_user = null, $admin_password = null, |
|
42 | + $admin_firstname = null, $admin_lastname = null, $admin_email = null, array $config = array(), $lang = 'en') |
|
43 | 43 | { |
44 | 44 | if (!is_array($domain)) |
45 | 45 | { |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
69 | 69 | * @throws Exception('header.inc.php not found!'); |
70 | 70 | */ |
71 | - protected function exec($check_only=false) |
|
71 | + protected function exec($check_only = false) |
|
72 | 72 | { |
73 | 73 | if ($check_only && $this->remote_id) |
74 | 74 | { |
75 | - return true; // can only check locally |
|
75 | + return true; // can only check locally |
|
76 | 76 | } |
77 | - $this->check_installed($this->domain,15); |
|
77 | + $this->check_installed($this->domain, 15); |
|
78 | 78 | |
79 | 79 | if (!$this->admin_firstname) $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
80 | 80 | if (!$this->admin_lastname) $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
81 | - if (strpos($this->admin_email,'$') !== false) |
|
81 | + if (strpos($this->admin_email, '$') !== false) |
|
82 | 82 | { |
83 | 83 | $this->set_defaults['email'] = $this->admin_email = str_replace( |
84 | - array('$domain','$uid','$account_lid'), |
|
85 | - array($this->domain,$this->admin_user,$this->admin_user),$this->admin_email); |
|
84 | + array('$domain', '$uid', '$account_lid'), |
|
85 | + array($this->domain, $this->admin_user, $this->admin_user), $this->admin_email); |
|
86 | 86 | } |
87 | 87 | $_POST['username'] = $this->admin_user; |
88 | 88 | $_POST['passwd2'] = $_POST['passwd'] = $this->admin_password; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | switch ($error) |
100 | 100 | { |
101 | 101 | case 41: |
102 | - throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'),41); |
|
102 | + throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'), 41); |
|
103 | 103 | case 42: |
104 | - throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'),42); |
|
104 | + throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'), 42); |
|
105 | 105 | } |
106 | 106 | $this->restore_db(); |
107 | 107 | |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | if (php_sapi_name() !== 'cli' || !file_exists(EGW_SERVER_ROOT.'/stylite') || file_exists(EGW_SERVER_ROOT.'/managementserver')) |
113 | 113 | { |
114 | 114 | $output = $ret = null; |
115 | - exec($cmd,$output,$ret); |
|
115 | + exec($cmd, $output, $ret); |
|
116 | 116 | } |
117 | - $output = implode("\n",$output); |
|
117 | + $output = implode("\n", $output); |
|
118 | 118 | //echo "ret=$ret\n".$output; |
119 | 119 | if ($ret) |
120 | 120 | { |
121 | - throw new Api\Exception ($output,$ret); |
|
121 | + throw new Api\Exception($output, $ret); |
|
122 | 122 | } |
123 | 123 | return lang('Admin account successful created.'); |
124 | 124 | } |
@@ -76,8 +76,14 @@ |
||
76 | 76 | } |
77 | 77 | $this->check_installed($this->domain,15); |
78 | 78 | |
79 | - if (!$this->admin_firstname) $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
|
80 | - if (!$this->admin_lastname) $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
|
79 | + if (!$this->admin_firstname) |
|
80 | + { |
|
81 | + $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
|
82 | + } |
|
83 | + if (!$this->admin_lastname) |
|
84 | + { |
|
85 | + $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
|
86 | + } |
|
81 | 87 | if (strpos($this->admin_email,'$') !== false) |
82 | 88 | { |
83 | 89 | $this->set_defaults['email'] = $this->admin_email = str_replace( |
@@ -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 |
@@ -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 | { |
@@ -13,7 +13,7 @@ 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 | { |
@@ -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 | } |