@@ -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 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'flags' => array( |
25 | 25 | 'currentapp' => 'api', |
26 | 26 | 'noheader' => true, |
27 | - 'load_translations' => false, // do not automatically load translations |
|
27 | + 'load_translations' => false, // do not automatically load translations |
|
28 | 28 | 'nocachecontrol' => true, |
29 | 29 | ) |
30 | 30 | ); |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | // use an etag with app, lang and a hash over the creation-times of all lang-files |
42 | -$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'. Api\Translation::etag($_GET['app'], $_GET['lang']).'"'; |
|
42 | +$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.Api\Translation::etag($_GET['app'], $_GET['lang']).'"'; |
|
43 | 43 | |
44 | 44 | // headers to allow caching, we specify etag on url to force reload, even with Expires header |
45 | -Api\Session::cache_control(864000); // cache for 10 days |
|
45 | +Api\Session::cache_control(864000); // cache for 10 days |
|
46 | 46 | Header('Content-Type: text/javascript; charset=utf-8'); |
47 | 47 | Header('ETag: '.$etag); |
48 | 48 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(Api\Translation::$lang_arr)).', egw && egw.window !== window);'; |
65 | 65 | |
66 | 66 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
67 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
67 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
68 | 68 | { |
69 | 69 | $content = gzencode($content); |
70 | 70 | header('Content-Encoding: gzip'); |
@@ -14,8 +14,14 @@ |
||
14 | 14 | use EGroupware\Api; |
15 | 15 | |
16 | 16 | // just to be sure, noone tries something nasty ... |
17 | -if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!'); |
|
18 | -if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) die('No valid lang-name given!'); |
|
17 | +if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) |
|
18 | +{ |
|
19 | + die('No valid application-name given!'); |
|
20 | +} |
|
21 | +if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) |
|
22 | +{ |
|
23 | + die('No valid lang-name given!'); |
|
24 | +} |
|
19 | 25 | |
20 | 26 | // switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression |
21 | 27 | ini_set('zlib.output_compression', 0); |
@@ -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 | ?> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | // if we are NOT called as part of an update script, behave like a regular setup script |
13 | 13 | if (!isset($GLOBALS['egw_setup']) || !is_object($GLOBALS['egw_setup'])) |
14 | 14 | { |
15 | - $diagnostics = 1; // can be set to 0=non, 1=some (default for now), 2=all |
|
15 | + $diagnostics = 1; // can be set to 0=non, 1=some (default for now), 2=all |
|
16 | 16 | |
17 | 17 | include('./inc/functions.inc.php'); |
18 | 18 | // Authorize the user to use setup app and load the database |
@@ -25,50 +25,50 @@ discard block |
||
25 | 25 | $GLOBALS['egw_setup']->loaddb(); |
26 | 26 | |
27 | 27 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
28 | - $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); |
|
28 | + $setup_tpl = CreateObject('phpgwapi.Template', $tpl_root); |
|
29 | 29 | $setup_tpl->set_file(array( |
30 | 30 | 'T_head' => 'head.tpl', |
31 | 31 | 'T_footer' => 'footer.tpl', |
32 | 32 | )); |
33 | - $GLOBALS['egw_setup']->html->show_header('',False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
33 | + $GLOBALS['egw_setup']->html->show_header('', False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
34 | 34 | echo '<h3>'.'Fix mysql DB to match the eGroupWare system_charset'."</h3>\n"; |
35 | 35 | $running_standalone = true; |
36 | 36 | } |
37 | -$db =& $GLOBALS['egw_setup']->db; |
|
38 | -$charset2mysql =& $GLOBALS['egw_setup']->db->Link_ID->charset2mysql; |
|
37 | +$db = & $GLOBALS['egw_setup']->db; |
|
38 | +$charset2mysql = & $GLOBALS['egw_setup']->db->Link_ID->charset2mysql; |
|
39 | 39 | $mysql2charset = array_flip($charset2mysql); |
40 | 40 | |
41 | 41 | $ServerInfo = $db->Link_ID->ServerInfo(); |
42 | -$db_version = (float) $ServerInfo['version']; |
|
42 | +$db_version = (float)$ServerInfo['version']; |
|
43 | 43 | |
44 | 44 | if ($running_standalone || $_REQUEST['debug']) echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n"; |
45 | 45 | |
46 | 46 | $mysql_system_charset = isset($charset2mysql[$GLOBALS['egw_setup']->system_charset]) ? |
47 | 47 | $charset2mysql[$GLOBALS['egw_setup']->system_charset] : $GLOBALS['egw_setup']->system_charset; |
48 | 48 | |
49 | -if (substr($db->Type,0,5) == 'mysql' && $db_version >= 4.1 && $GLOBALS['egw_setup']->system_charset && $GLOBALS['egw_setup']->db_charset_was && |
|
49 | +if (substr($db->Type, 0, 5) == 'mysql' && $db_version >= 4.1 && $GLOBALS['egw_setup']->system_charset && $GLOBALS['egw_setup']->db_charset_was && |
|
50 | 50 | $GLOBALS['egw_setup']->system_charset != $GLOBALS['egw_setup']->db_charset_was) |
51 | 51 | { |
52 | 52 | $tables_modified = 'no'; |
53 | 53 | |
54 | 54 | $tables = array(); |
55 | - $db->query("SHOW TABLE STATUS",__LINE__,__FILE__); |
|
55 | + $db->query("SHOW TABLE STATUS", __LINE__, __FILE__); |
|
56 | 56 | while (($row = $db->row(true))) |
57 | 57 | { |
58 | 58 | $tables[$row['Name']] = $row['Collation']; |
59 | 59 | } |
60 | - foreach($tables as $table => $collation) |
|
60 | + foreach ($tables as $table => $collation) |
|
61 | 61 | { |
62 | 62 | $columns = array(); |
63 | - $db->query("SHOW FULL FIELDS FROM `$table`",__LINE__,__FILE__); |
|
64 | - while(($row = $db->row(true))) |
|
63 | + $db->query("SHOW FULL FIELDS FROM `$table`", __LINE__, __FILE__); |
|
64 | + while (($row = $db->row(true))) |
|
65 | 65 | { |
66 | 66 | $columns[] = $row; |
67 | 67 | } |
68 | 68 | //echo $table; _debug_array($columns); |
69 | 69 | $fulltext = $fulltext_back = array(); |
70 | - $db->query("SHOW KEYS FROM `$table`",__LINE__,__FILE__); |
|
71 | - while(($row = $db->row(true))) |
|
70 | + $db->query("SHOW KEYS FROM `$table`", __LINE__, __FILE__); |
|
71 | + while (($row = $db->row(true))) |
|
72 | 72 | { |
73 | 73 | if ($row['Index_type'] == 'FULLTEXT') |
74 | 74 | { |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | $alter_table = $alter_table_back = array(); |
80 | - foreach($columns as $column) |
|
80 | + foreach ($columns as $column) |
|
81 | 81 | { |
82 | - if ($column['Collation'] && preg_match('/^(char|varchar|.*text)\(?([0-9]*)\)?$/i',$column['Type'],$matches)) |
|
82 | + if ($column['Collation'] && preg_match('/^(char|varchar|.*text)\(?([0-9]*)\)?$/i', $column['Type'], $matches)) |
|
83 | 83 | { |
84 | - list(,$type,$size) = $matches; |
|
85 | - list($charset) = explode('_',$column['Collation']); |
|
84 | + list(,$type, $size) = $matches; |
|
85 | + list($charset) = explode('_', $column['Collation']); |
|
86 | 86 | |
87 | 87 | if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset]; |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | else |
99 | 99 | { |
100 | - $bintype = str_replace('text','blob',$type); |
|
100 | + $bintype = str_replace('text', 'blob', $type); |
|
101 | 101 | } |
102 | 102 | //echo "<p>$table.$col $type CHARACTER SET $charset $default $null</p>\n"; |
103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $idx_name = $fulltext[$col]; |
110 | 110 | $idx_cols = array(); |
111 | - foreach($fulltext as $c => $i) |
|
111 | + foreach ($fulltext as $c => $i) |
|
112 | 112 | { |
113 | 113 | if ($i == $idx_name) |
114 | 114 | { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | - list($charset) = explode('_',$collation); |
|
127 | + list($charset) = explode('_', $collation); |
|
128 | 128 | if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset]; |
129 | 129 | if ($charset != $GLOBALS['egw_setup']->system_charset) |
130 | 130 | { |
@@ -132,26 +132,26 @@ discard block |
||
132 | 132 | } |
133 | 133 | if (count($alter_table)) |
134 | 134 | { |
135 | - $alter_table = "ALTER TABLE $table\n".implode(",\n",$alter_table); |
|
135 | + $alter_table = "ALTER TABLE $table\n".implode(",\n", $alter_table); |
|
136 | 136 | |
137 | 137 | if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table)."</p>\n"; |
138 | - if (!$db->query($alter_table,__LINE__,__FILE__)) |
|
138 | + if (!$db->query($alter_table, __LINE__, __FILE__)) |
|
139 | 139 | { |
140 | 140 | echo "<p>SQL Error: ".nl2br($alter_table)."</p>\n"; |
141 | 141 | echo "<b>{$db->Type} Error</b>: {$db->Errno} ({$db->Error})</p>\n"; |
142 | 142 | echo "<p>continuing ...</p>\n"; |
143 | 143 | continue; |
144 | 144 | } |
145 | - foreach($fulltext_back as $idx_name => $idx_cols) |
|
145 | + foreach ($fulltext_back as $idx_name => $idx_cols) |
|
146 | 146 | { |
147 | - $alter_table_back[] = " ADD FULLTEXT `$idx_name` (`".implode('`,`',$idx_cols)."`)"; |
|
147 | + $alter_table_back[] = " ADD FULLTEXT `$idx_name` (`".implode('`,`', $idx_cols)."`)"; |
|
148 | 148 | } |
149 | 149 | if (count($alter_table_back)) |
150 | 150 | { |
151 | - $alter_table_back = "ALTER TABLE $table\n".implode(",\n",$alter_table_back); |
|
151 | + $alter_table_back = "ALTER TABLE $table\n".implode(",\n", $alter_table_back); |
|
152 | 152 | |
153 | 153 | if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table_back)."</p>\n"; |
154 | - if (!$db->query($alter_table_back,__LINE__,__FILE__)) |
|
154 | + if (!$db->query($alter_table_back, __LINE__, __FILE__)) |
|
155 | 155 | { |
156 | 156 | echo "<p><b>SQL Error</b>: ".nl2br($alter_table_back)."</p>\n"; |
157 | 157 | echo "<b>{$db->Type} Error</b>: {$db->Errno} ({$db->Error})</p>\n"; |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | // change the default charset of the DB |
166 | - $db->query("SHOW CREATE DATABASE `$db->Database`",__LINE__,__FILE__); |
|
166 | + $db->query("SHOW CREATE DATABASE `$db->Database`", __LINE__, __FILE__); |
|
167 | 167 | $create_db = $db->next_record() ? $db->f(1) : ''; |
168 | - if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i',$create_db,$matches) && $matches[1] != $mysql_system_charset) |
|
168 | + if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i', $create_db, $matches) && $matches[1] != $mysql_system_charset) |
|
169 | 169 | { |
170 | 170 | $alter_db = "ALTER DATABASE `$db->Database` DEFAULT CHARACTER SET $mysql_system_charset"; |
171 | 171 | if ($running_standalone || $_REQUEST['debug']) echo '<p>'.$alter_db."</p>\n"; |
172 | - $db->query($alter_db,__LINE__,__FILE__); |
|
172 | + $db->query($alter_db, __LINE__, __FILE__); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | if ($running_standalone || $_REQUEST['debug']) |
@@ -41,7 +41,10 @@ discard block |
||
41 | 41 | $ServerInfo = $db->Link_ID->ServerInfo(); |
42 | 42 | $db_version = (float) $ServerInfo['version']; |
43 | 43 | |
44 | -if ($running_standalone || $_REQUEST['debug']) echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n"; |
|
44 | +if ($running_standalone || $_REQUEST['debug']) |
|
45 | +{ |
|
46 | + echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n"; |
|
47 | +} |
|
45 | 48 | |
46 | 49 | $mysql_system_charset = isset($charset2mysql[$GLOBALS['egw_setup']->system_charset]) ? |
47 | 50 | $charset2mysql[$GLOBALS['egw_setup']->system_charset] : $GLOBALS['egw_setup']->system_charset; |
@@ -84,15 +87,21 @@ discard block |
||
84 | 87 | list(,$type,$size) = $matches; |
85 | 88 | list($charset) = explode('_',$column['Collation']); |
86 | 89 | |
87 | - if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset]; |
|
90 | + if (isset($mysql2charset[$charset])) |
|
91 | + { |
|
92 | + $charset = $mysql2charset[$charset]; |
|
93 | + } |
|
88 | 94 | |
89 | 95 | if ($charset != $GLOBALS['egw_setup']->system_charset) |
90 | 96 | { |
91 | 97 | $col = $column['Field']; |
92 | 98 | |
93 | - if ($type == 'varchar' || $type == 'char') // old schema_proc (pre 1.0.1) used also char |
|
99 | + if ($type == 'varchar' || $type == 'char') |
|
100 | + { |
|
101 | + // old schema_proc (pre 1.0.1) used also char |
|
94 | 102 | { |
95 | 103 | $type = 'varchar('.$size.')'; |
104 | + } |
|
96 | 105 | $bintype = 'varbinary('.$size.')'; |
97 | 106 | } |
98 | 107 | else |
@@ -125,7 +134,10 @@ discard block |
||
125 | 134 | } |
126 | 135 | } |
127 | 136 | list($charset) = explode('_',$collation); |
128 | - if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset]; |
|
137 | + if (isset($mysql2charset[$charset])) |
|
138 | + { |
|
139 | + $charset = $mysql2charset[$charset]; |
|
140 | + } |
|
129 | 141 | if ($charset != $GLOBALS['egw_setup']->system_charset) |
130 | 142 | { |
131 | 143 | $alter_table[] = " DEFAULT CHARACTER SET $mysql_system_charset"; |
@@ -134,7 +146,10 @@ discard block |
||
134 | 146 | { |
135 | 147 | $alter_table = "ALTER TABLE $table\n".implode(",\n",$alter_table); |
136 | 148 | |
137 | - if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table)."</p>\n"; |
|
149 | + if ($running_standalone || $_REQUEST['debug']) |
|
150 | + { |
|
151 | + echo '<p>'.nl2br($alter_table)."</p>\n"; |
|
152 | + } |
|
138 | 153 | if (!$db->query($alter_table,__LINE__,__FILE__)) |
139 | 154 | { |
140 | 155 | echo "<p>SQL Error: ".nl2br($alter_table)."</p>\n"; |
@@ -150,7 +165,10 @@ discard block |
||
150 | 165 | { |
151 | 166 | $alter_table_back = "ALTER TABLE $table\n".implode(",\n",$alter_table_back); |
152 | 167 | |
153 | - if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table_back)."</p>\n"; |
|
168 | + if ($running_standalone || $_REQUEST['debug']) |
|
169 | + { |
|
170 | + echo '<p>'.nl2br($alter_table_back)."</p>\n"; |
|
171 | + } |
|
154 | 172 | if (!$db->query($alter_table_back,__LINE__,__FILE__)) |
155 | 173 | { |
156 | 174 | echo "<p><b>SQL Error</b>: ".nl2br($alter_table_back)."</p>\n"; |
@@ -168,7 +186,10 @@ discard block |
||
168 | 186 | if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i',$create_db,$matches) && $matches[1] != $mysql_system_charset) |
169 | 187 | { |
170 | 188 | $alter_db = "ALTER DATABASE `$db->Database` DEFAULT CHARACTER SET $mysql_system_charset"; |
171 | - if ($running_standalone || $_REQUEST['debug']) echo '<p>'.$alter_db."</p>\n"; |
|
189 | + if ($running_standalone || $_REQUEST['debug']) |
|
190 | + { |
|
191 | + echo '<p>'.$alter_db."</p>\n"; |
|
192 | + } |
|
172 | 193 | $db->query($alter_db,__LINE__,__FILE__); |
173 | 194 | } |
174 | 195 | } |
@@ -176,5 +197,8 @@ discard block |
||
176 | 197 | { |
177 | 198 | echo "<p>$tables_modified tables changed to our system_charset {$GLOBALS['egw_setup']->system_charset}($mysql_system_charset)</p>\n"; |
178 | 199 | |
179 | - if ($running_standalone) $GLOBALS['egw_setup']->html->show_footer(); |
|
180 | -} |
|
200 | + if ($running_standalone) |
|
201 | + { |
|
202 | + $GLOBALS['egw_setup']->html->show_footer(); |
|
203 | + } |
|
204 | + } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | require_once('./inc/class.setup_header.inc.php'); |
19 | 19 | $GLOBALS['egw_setup']->header = new setup_header(); |
20 | 20 | |
21 | -$setup_tpl = new Framework\Template('./templates/default', 'keep'); // 'keep' to keep our {hash} prefix of passwords |
|
21 | +$setup_tpl = new Framework\Template('./templates/default', 'keep'); // 'keep' to keep our {hash} prefix of passwords |
|
22 | 22 | $setup_tpl->set_file(array( |
23 | 23 | 'T_head' => 'head.tpl', |
24 | 24 | 'T_footer' => 'footer.tpl', |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | 'T_login_stage_header' => 'login_stage_header.tpl', |
28 | 28 | 'T_setup_manage' => 'manageheader.tpl' |
29 | 29 | )); |
30 | -$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
31 | -$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
32 | -$setup_tpl->set_block('T_setup_manage','manageheader','manageheader'); |
|
33 | -$setup_tpl->set_block('T_setup_manage','domain','domain'); |
|
30 | +$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
31 | +$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
32 | +$setup_tpl->set_block('T_setup_manage', 'manageheader', 'manageheader'); |
|
33 | +$setup_tpl->set_block('T_setup_manage', 'domain', 'domain'); |
|
34 | 34 | |
35 | 35 | $setup_tpl->set_var(array( |
36 | 36 | 'lang_select' => '', |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | |
45 | 45 | if ($GLOBALS['egw_info']['setup']['stage']['header'] > 2 && !$GLOBALS['egw_setup']->auth('Header')) |
46 | 46 | { |
47 | - $GLOBALS['egw_setup']->html->show_header('Please login',True); |
|
47 | + $GLOBALS['egw_setup']->html->show_header('Please login', True); |
|
48 | 48 | $GLOBALS['egw_setup']->html->login_form(); |
49 | 49 | $GLOBALS['egw_setup']->html->show_footer(); |
50 | 50 | exit; |
51 | 51 | } |
52 | 52 | // Detect current mode |
53 | -switch($GLOBALS['egw_info']['setup']['stage']['header']) |
|
53 | +switch ($GLOBALS['egw_info']['setup']['stage']['header']) |
|
54 | 54 | { |
55 | 55 | case '1': |
56 | 56 | $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php'); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | if (isset($_POST['setting'])) // Post of the header-form |
88 | 88 | { |
89 | - $validation_errors = check_header_form(); // validate the submitted form |
|
89 | + $validation_errors = check_header_form(); // validate the submitted form |
|
90 | 90 | } |
91 | 91 | if (!isset($_POST['action']) || $validation_errors) // generate form to edit the header |
92 | 92 | { |
@@ -94,25 +94,25 @@ discard block |
||
94 | 94 | } |
95 | 95 | else |
96 | 96 | { |
97 | - $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); |
|
97 | + $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'], $GLOBALS['egw_domain']); |
|
98 | 98 | |
99 | 99 | list($action) = @each($_POST['action']); |
100 | - switch($action) |
|
100 | + switch ($action) |
|
101 | 101 | { |
102 | 102 | case 'download': |
103 | - Api\Header\Content::type('header.inc.php','application/octet-stream'); |
|
103 | + Api\Header\Content::type('header.inc.php', 'application/octet-stream'); |
|
104 | 104 | echo $newheader; |
105 | 105 | break; |
106 | 106 | |
107 | 107 | case 'view': |
108 | 108 | $GLOBALS['egw_setup']->html->show_header('Generated header.inc.php', False, 'header'); |
109 | 109 | echo '<table width="90%"><tr><td>'; |
110 | - echo '<br />' . lang('Save this text as contents of your header.inc.php') . '<br /><hr />'; |
|
110 | + echo '<br />'.lang('Save this text as contents of your header.inc.php').'<br /><hr />'; |
|
111 | 111 | echo "<pre>\n"; |
112 | 112 | echo htmlentities($newheader); |
113 | 113 | echo "\n</pre><hr />\n"; |
114 | 114 | echo '<form action="index.php" method="post">'; |
115 | - echo '<br />' . lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".') . '<br />'; |
|
115 | + echo '<br />'.lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".').'<br />'; |
|
116 | 116 | echo '<input type="hidden" name="FormLogout" value="header" />'; |
117 | 117 | echo '<input type="submit" name="junk" value="'.lang('Continue').'" />'; |
118 | 118 | echo '</form>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | |
123 | 123 | case 'write': |
124 | 124 | if ((is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) && |
125 | - ($f = fopen('../header.inc.php','wb'))) |
|
125 | + ($f = fopen('../header.inc.php', 'wb'))) |
|
126 | 126 | { |
127 | - fwrite($f,$newheader); |
|
127 | + fwrite($f, $newheader); |
|
128 | 128 | fclose($f); |
129 | 129 | $GLOBALS['egw_setup']->html->show_header('Saved header.inc.php', False, 'header'); |
130 | 130 | echo '<form action="index.php" method="post">'; |
131 | - echo '<br />' . lang('Created header.inc.php!'); |
|
131 | + echo '<br />'.lang('Created header.inc.php!'); |
|
132 | 132 | echo '<input type="hidden" name="FormLogout" value="header" />'; |
133 | 133 | echo '<input type="submit" name="junk" value="'.lang('Continue').'" />'; |
134 | 134 | echo '</form>'; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | else |
139 | 139 | { |
140 | 140 | $GLOBALS['egw_setup']->html->show_header('Error generating header.inc.php', False, 'header'); |
141 | - echo lang('Could not open header.inc.php for writing!') . '<br />' . "\n"; |
|
142 | - echo lang('Please check read/write permissions on directories, or back up and use another option.') . '<br />'; |
|
141 | + echo lang('Could not open header.inc.php for writing!').'<br />'."\n"; |
|
142 | + echo lang('Please check read/write permissions on directories, or back up and use another option.').'<br />'; |
|
143 | 143 | $GLOBALS['egw_setup']->html->show_footer(); |
144 | 144 | } |
145 | 145 | break; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | function check_header_form() |
155 | 155 | { |
156 | 156 | // setting the non-domain settings from the posted content |
157 | - foreach($_POST['setting'] as $name => $value) |
|
157 | + foreach ($_POST['setting'] as $name => $value) |
|
158 | 158 | { |
159 | 159 | if (get_magic_quotes_gpc()) $value = stripslashes($value); |
160 | 160 | |
161 | - switch($name) |
|
161 | + switch ($name) |
|
162 | 162 | { |
163 | 163 | case 'show_domain_selectbox': |
164 | 164 | case 'mcrypt_enabled': |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | // setting the domain settings from the posted content |
178 | - foreach($_POST['domains'] as $key => $domain) |
|
178 | + foreach ($_POST['domains'] as $key => $domain) |
|
179 | 179 | { |
180 | 180 | if ($_POST['deletedomain'][$key]) |
181 | 181 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | continue; |
185 | 185 | } |
186 | 186 | |
187 | - foreach($_POST['setting_'.$key] as $name => $value) |
|
187 | + foreach ($_POST['setting_'.$key] as $name => $value) |
|
188 | 188 | { |
189 | 189 | if (get_magic_quotes_gpc()) $value = stripslashes($value); |
190 | 190 | |
@@ -218,20 +218,20 @@ discard block |
||
218 | 218 | |
219 | 219 | $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['HeaderFormMSG'], False, 'header'); |
220 | 220 | |
221 | - if(empty($_REQUEST['ConfigLang'])) |
|
221 | + if (empty($_REQUEST['ConfigLang'])) |
|
222 | 222 | { |
223 | - $setup_tpl->set_var('lang_select','<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.setup_html::lang_select(True,'en')."</form></td></tr>"); |
|
223 | + $setup_tpl->set_var('lang_select', '<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.setup_html::lang_select(True, 'en')."</form></td></tr>"); |
|
224 | 224 | } |
225 | 225 | |
226 | - $setup_tpl->set_var('pagemsg',$GLOBALS['egw_info']['setup']['PageMSG']); |
|
226 | + $setup_tpl->set_var('pagemsg', $GLOBALS['egw_info']['setup']['PageMSG']); |
|
227 | 227 | |
228 | 228 | // checking required PHP version |
229 | - if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
229 | + if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
230 | 230 | { |
231 | - $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'],True); |
|
231 | + $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'], True); |
|
232 | 232 | $GLOBALS['egw_setup']->html->show_alert_msg('Error', |
233 | 233 | lang('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.', |
234 | - PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version)); |
|
234 | + PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version)); |
|
235 | 235 | $GLOBALS['egw_setup']->html->show_footer(); |
236 | 236 | exit; |
237 | 237 | } |
@@ -249,33 +249,33 @@ discard block |
||
249 | 249 | exit; |
250 | 250 | } |
251 | 251 | $js_default_db_ports = 'var default_db_ports = new Array();'."\n"; |
252 | - foreach($GLOBALS['egw_setup']->header->default_db_ports as $db => $port) |
|
252 | + foreach ($GLOBALS['egw_setup']->header->default_db_ports as $db => $port) |
|
253 | 253 | { |
254 | 254 | $js_default_db_ports .= ' default_db_ports["'.$db.'"]="'.$port.'";'."\n"; |
255 | 255 | } |
256 | - $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); |
|
256 | + $setup_tpl->set_var('js_default_db_ports', $js_default_db_ports); |
|
257 | 257 | |
258 | - if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
258 | + if ($validation_errors) $setup_tpl->set_var('detected', '<ul><li>'.implode("</li>\n<li>", $validation_errors)."</li>\n</ul>\n"); |
|
259 | 259 | |
260 | 260 | if ($_POST['adddomain']) |
261 | 261 | { |
262 | 262 | $GLOBALS['egw_domain'][lang('new')] = $GLOBALS['egw_setup']->header->domain_defaults( |
263 | 263 | $GLOBALS['egw_info']['server']['header_admin_user'], |
264 | - $GLOBALS['egw_info']['server']['header_admin_password'],$supported_db); |
|
264 | + $GLOBALS['egw_info']['server']['header_admin_password'], $supported_db); |
|
265 | 265 | } |
266 | 266 | // show the non-domain settings |
267 | 267 | //echo "<pre>".print_r($GLOBALS['egw_info']['server'],true)."</pre>\n"; |
268 | - foreach($GLOBALS['egw_info']['server'] as $name => $value) |
|
268 | + foreach ($GLOBALS['egw_info']['server'] as $name => $value) |
|
269 | 269 | { |
270 | - switch($name) |
|
270 | + switch ($name) |
|
271 | 271 | { |
272 | 272 | case 'db_persistent': |
273 | 273 | case 'show_domain_selectbox': |
274 | 274 | case 'mcrypt_enabled': |
275 | - $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"'); |
|
275 | + $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'), ' selected="selected"'); |
|
276 | 276 | break; |
277 | 277 | default: |
278 | - if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
278 | + if (!is_array($value)) $setup_tpl->set_var($name, htmlspecialchars($value)); |
|
279 | 279 | break; |
280 | 280 | } |
281 | 281 | } |
@@ -284,48 +284,48 @@ discard block |
||
284 | 284 | ); |
285 | 285 | if ($GLOBALS['egw_info']['server']['session_handler'] && !isset($supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']])) |
286 | 286 | { |
287 | - $supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']] = lang("Custom handler: %1",$GLOBALS['egw_info']['server']['session_handler']); |
|
287 | + $supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']] = lang("Custom handler: %1", $GLOBALS['egw_info']['server']['session_handler']); |
|
288 | 288 | } |
289 | 289 | $options = array(); |
290 | - foreach($supported_session_handler as $type => $label) |
|
290 | + foreach ($supported_session_handler as $type => $label) |
|
291 | 291 | { |
292 | - $options[] = '<option ' . ($type == $GLOBALS['egw_info']['server']['session_handler'] ? |
|
293 | - 'selected="selected" ' : '') . 'value="' . $type . '">' . $label . '</option>'; |
|
292 | + $options[] = '<option '.($type == $GLOBALS['egw_info']['server']['session_handler'] ? |
|
293 | + 'selected="selected" ' : '').'value="'.$type.'">'.$label.'</option>'; |
|
294 | 294 | } |
295 | - $setup_tpl->set_var('session_options',implode("\n",$options)); |
|
295 | + $setup_tpl->set_var('session_options', implode("\n", $options)); |
|
296 | 296 | |
297 | 297 | // showing the settings of all domains |
298 | - foreach($GLOBALS['egw_domain'] as $domain => $data) |
|
298 | + foreach ($GLOBALS['egw_domain'] as $domain => $data) |
|
299 | 299 | { |
300 | - $setup_tpl->set_var('db_domain',htmlspecialchars($domain)); |
|
301 | - foreach($data as $name => $value) |
|
300 | + $setup_tpl->set_var('db_domain', htmlspecialchars($domain)); |
|
301 | + foreach ($data as $name => $value) |
|
302 | 302 | { |
303 | 303 | if ($name == 'db_port' && !$value) // Set default here if the admin didn't set a port yet |
304 | 304 | { |
305 | 305 | $value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']]; |
306 | 306 | } |
307 | - $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
307 | + $setup_tpl->set_var($name, htmlspecialchars($value)); |
|
308 | 308 | } |
309 | 309 | $dbtype_options = ''; |
310 | - foreach($supported_db as $db) |
|
310 | + foreach ($supported_db as $db) |
|
311 | 311 | { |
312 | - $dbtype_options .= '<option ' . ($db == $data['db_type'] ? 'selected="selected" ' : ''). |
|
313 | - 'value="' . $db . '">' . $GLOBALS['egw_setup']->header->db_fullnames[$db] . "</option>\n"; |
|
312 | + $dbtype_options .= '<option '.($db == $data['db_type'] ? 'selected="selected" ' : ''). |
|
313 | + 'value="'.$db.'">'.$GLOBALS['egw_setup']->header->db_fullnames[$db]."</option>\n"; |
|
314 | 314 | } |
315 | - $setup_tpl->set_var('dbtype_options',$dbtype_options); |
|
315 | + $setup_tpl->set_var('dbtype_options', $dbtype_options); |
|
316 | 316 | |
317 | - $setup_tpl->parse('domains','domain',True); |
|
317 | + $setup_tpl->parse('domains', 'domain', True); |
|
318 | 318 | } |
319 | - if(is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) |
|
319 | + if (is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) |
|
320 | 320 | { |
321 | - $setup_tpl->set_var('actions',lang('%1, %2 or %3 the configuration file.', |
|
321 | + $setup_tpl->set_var('actions', lang('%1, %2 or %3 the configuration file.', |
|
322 | 322 | '<input type="submit" name="action[write]" value="'.htmlspecialchars(lang('Write')).'" />', |
323 | 323 | '<input type="submit" name="action[download]" value="'.htmlspecialchars(lang('Download')).'" />', |
324 | 324 | '<input type="submit" name="action[view]" value="'.htmlspecialchars(lang('View')).'" />')); |
325 | 325 | } |
326 | 326 | else |
327 | 327 | { |
328 | - $setup_tpl->set_var('actions',lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.', |
|
328 | + $setup_tpl->set_var('actions', lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.', |
|
329 | 329 | '<input type="submit" name="action[download]" value="'.htmlspecialchars(lang('Download')).'" />', |
330 | 330 | '<input type="submit" name="action[view]" value="'.htmlspecialchars(lang('View')).'" />')); |
331 | 331 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | 'lang_Yes' => lang('Yes'), |
388 | 388 | 'lang_No' => lang('No') |
389 | 389 | )); |
390 | - $setup_tpl->pfp('out','manageheader'); |
|
390 | + $setup_tpl->pfp('out', 'manageheader'); |
|
391 | 391 | |
392 | 392 | $GLOBALS['egw_setup']->html->show_footer(); |
393 | 393 | } |
@@ -84,14 +84,21 @@ discard block |
||
84 | 84 | { |
85 | 85 | $GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT; |
86 | 86 | } |
87 | -if (isset($_POST['setting'])) // Post of the header-form |
|
87 | +if (isset($_POST['setting'])) |
|
88 | 88 | { |
89 | - $validation_errors = check_header_form(); // validate the submitted form |
|
89 | + // Post of the header-form |
|
90 | +{ |
|
91 | + $validation_errors = check_header_form(); |
|
92 | +} |
|
93 | +// validate the submitted form |
|
90 | 94 | } |
91 | -if (!isset($_POST['action']) || $validation_errors) // generate form to edit the header |
|
95 | +if (!isset($_POST['action']) || $validation_errors) |
|
96 | +{ |
|
97 | + // generate form to edit the header |
|
92 | 98 | { |
93 | 99 | show_header_form($validation_errors); |
94 | 100 | } |
101 | +} |
|
95 | 102 | else |
96 | 103 | { |
97 | 104 | $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); |
@@ -156,7 +163,10 @@ discard block |
||
156 | 163 | // setting the non-domain settings from the posted content |
157 | 164 | foreach($_POST['setting'] as $name => $value) |
158 | 165 | { |
159 | - if (get_magic_quotes_gpc()) $value = stripslashes($value); |
|
166 | + if (get_magic_quotes_gpc()) |
|
167 | + { |
|
168 | + $value = stripslashes($value); |
|
169 | + } |
|
160 | 170 | |
161 | 171 | switch($name) |
162 | 172 | { |
@@ -166,7 +176,10 @@ discard block |
||
166 | 176 | $GLOBALS['egw_info']['server'][$name] = $value == 'True'; |
167 | 177 | break; |
168 | 178 | case 'new_admin_password': |
169 | - if ($value) $GLOBALS['egw_info']['server']['header_admin_password'] = $value; |
|
179 | + if ($value) |
|
180 | + { |
|
181 | + $GLOBALS['egw_info']['server']['header_admin_password'] = $value; |
|
182 | + } |
|
170 | 183 | break; |
171 | 184 | default: |
172 | 185 | $GLOBALS['egw_info']['server'][$name] = $value; |
@@ -186,11 +199,17 @@ discard block |
||
186 | 199 | |
187 | 200 | foreach($_POST['setting_'.$key] as $name => $value) |
188 | 201 | { |
189 | - if (get_magic_quotes_gpc()) $value = stripslashes($value); |
|
202 | + if (get_magic_quotes_gpc()) |
|
203 | + { |
|
204 | + $value = stripslashes($value); |
|
205 | + } |
|
190 | 206 | |
191 | 207 | if ($name == 'new_config_passwd') |
192 | 208 | { |
193 | - if ($value) $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value; |
|
209 | + if ($value) |
|
210 | + { |
|
211 | + $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value; |
|
212 | + } |
|
194 | 213 | continue; |
195 | 214 | } |
196 | 215 | $GLOBALS['egw_domain'][$domain][$name] = $value; |
@@ -255,7 +274,10 @@ discard block |
||
255 | 274 | } |
256 | 275 | $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); |
257 | 276 | |
258 | - if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
277 | + if ($validation_errors) |
|
278 | + { |
|
279 | + $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
280 | + } |
|
259 | 281 | |
260 | 282 | if ($_POST['adddomain']) |
261 | 283 | { |
@@ -275,7 +297,10 @@ discard block |
||
275 | 297 | $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"'); |
276 | 298 | break; |
277 | 299 | default: |
278 | - if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
300 | + if (!is_array($value)) |
|
301 | + { |
|
302 | + $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
303 | + } |
|
279 | 304 | break; |
280 | 305 | } |
281 | 306 | } |
@@ -300,10 +325,13 @@ discard block |
||
300 | 325 | $setup_tpl->set_var('db_domain',htmlspecialchars($domain)); |
301 | 326 | foreach($data as $name => $value) |
302 | 327 | { |
303 | - if ($name == 'db_port' && !$value) // Set default here if the admin didn't set a port yet |
|
328 | + if ($name == 'db_port' && !$value) |
|
329 | + { |
|
330 | + // Set default here if the admin didn't set a port yet |
|
304 | 331 | { |
305 | 332 | $value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']]; |
306 | 333 | } |
334 | + } |
|
307 | 335 | $setup_tpl->set_var($name,htmlspecialchars($value)); |
308 | 336 | } |
309 | 337 | $dbtype_options = ''; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | Authorize the user to use setup app and load the database |
20 | 20 | Does not return unless user is authorized |
21 | 21 | */ |
22 | -if(!$GLOBALS['egw_setup']->auth('Config') || @$_POST['cancel']) |
|
22 | +if (!$GLOBALS['egw_setup']->auth('Config') || @$_POST['cancel']) |
|
23 | 23 | { |
24 | 24 | Header('Location: index.php'); |
25 | 25 | exit; |
@@ -55,35 +55,35 @@ discard block |
||
55 | 55 | |
56 | 56 | $newsettings = $_POST['newsettings']; |
57 | 57 | |
58 | -if(@$_POST['submit'] && @$newsettings) |
|
58 | +if (@$_POST['submit'] && @$newsettings) |
|
59 | 59 | { |
60 | 60 | /* Load hook file with functions to validate each config (one/none/all) */ |
61 | - $GLOBALS['egw_setup']->hook('config_validate','setup'); |
|
61 | + $GLOBALS['egw_setup']->hook('config_validate', 'setup'); |
|
62 | 62 | |
63 | - $newsettings['tz_offset'] = date('Z')/3600; |
|
63 | + $newsettings['tz_offset'] = date('Z') / 3600; |
|
64 | 64 | |
65 | 65 | $GLOBALS['egw_setup']->db->transaction_begin(); |
66 | - foreach($newsettings as $setting => $value) |
|
66 | + foreach ($newsettings as $setting => $value) |
|
67 | 67 | { |
68 | - if(in_array($setting, (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && function_exists($setting)) |
|
68 | + if (in_array($setting, (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && function_exists($setting)) |
|
69 | 69 | { |
70 | 70 | $setting($newsettings); |
71 | - if($GLOBALS['config_error']) |
|
71 | + if ($GLOBALS['config_error']) |
|
72 | 72 | { |
73 | - $GLOBALS['error'] .= '<b>'.$GLOBALS['config_error'] ."</b><br />\n"; |
|
73 | + $GLOBALS['error'] .= '<b>'.$GLOBALS['config_error']."</b><br />\n"; |
|
74 | 74 | $GLOBALS['config_error'] = ''; |
75 | 75 | /* Bail out, stop writing config data */ |
76 | 76 | break; |
77 | 77 | } |
78 | - $value = $newsettings[$setting]; // it might be changed by the validation hook |
|
78 | + $value = $newsettings[$setting]; // it might be changed by the validation hook |
|
79 | 79 | } |
80 | 80 | /* Don't erase passwords, since we also do not print them below */ |
81 | - if(!empty($value) || !(stristr($setting,'passwd') || stristr($setting,'password') || stristr($setting,'root_pw'))) |
|
81 | + if (!empty($value) || !(stristr($setting, 'passwd') || stristr($setting, 'password') || stristr($setting, 'root_pw'))) |
|
82 | 82 | { |
83 | 83 | Api\Config::save_value($setting, $value, 'phpgwapi'); |
84 | 84 | } |
85 | 85 | } |
86 | - if(!$GLOBALS['error']) |
|
86 | + if (!$GLOBALS['error']) |
|
87 | 87 | { |
88 | 88 | $GLOBALS['egw_setup']->db->transaction_commit(); |
89 | 89 | // unset cached config, as this is the primary source for configuration now |
@@ -94,21 +94,21 @@ discard block |
||
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -$GLOBALS['egw_setup']->html->show_header(lang('Configuration'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
97 | +$GLOBALS['egw_setup']->html->show_header(lang('Configuration'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
98 | 98 | |
99 | 99 | // if we have an validation error, use the new settings made by the user and not the stored config |
100 | -if($GLOBALS['error'] && is_array($newsettings)) |
|
100 | +if ($GLOBALS['error'] && is_array($newsettings)) |
|
101 | 101 | { |
102 | 102 | $GLOBALS['current_config'] = $newsettings; |
103 | 103 | } |
104 | 104 | else |
105 | 105 | { |
106 | - foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'*',false,__LINES__,__FILES__) as $row) |
|
106 | + foreach ($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table, '*', false, __LINES__, __FILES__) as $row) |
|
107 | 107 | { |
108 | 108 | $GLOBALS['current_config'][$row['config_name']] = $row['config_value']; |
109 | 109 | } |
110 | 110 | } |
111 | -$setup_tpl->pparse('out','T_config_pre_script'); |
|
111 | +$setup_tpl->pparse('out', 'T_config_pre_script'); |
|
112 | 112 | |
113 | 113 | /* Now parse each of the templates we want to show here */ |
114 | 114 | class phpgw |
@@ -118,90 +118,90 @@ discard block |
||
118 | 118 | var $db; |
119 | 119 | } |
120 | 120 | $GLOBALS['egw'] = new phpgw; |
121 | -$GLOBALS['egw']->db =& $GLOBALS['egw_setup']->db; |
|
121 | +$GLOBALS['egw']->db = & $GLOBALS['egw_setup']->db; |
|
122 | 122 | |
123 | 123 | $t = new Framework\Template(Framework\Template::get_dir('setup')); |
124 | 124 | |
125 | 125 | $t->set_unknowns('keep'); |
126 | 126 | $t->set_file(array('config' => 'config.tpl')); |
127 | -$t->set_block('config','body','body'); |
|
127 | +$t->set_block('config', 'body', 'body'); |
|
128 | 128 | |
129 | 129 | $vars = $t->get_undefined('body'); |
130 | -$GLOBALS['egw_setup']->hook('config','setup'); |
|
130 | +$GLOBALS['egw_setup']->hook('config', 'setup'); |
|
131 | 131 | |
132 | -foreach($vars as $value) |
|
132 | +foreach ($vars as $value) |
|
133 | 133 | { |
134 | - $valarray = explode('_',$value); |
|
134 | + $valarray = explode('_', $value); |
|
135 | 135 | $type = $valarray[0]; |
136 | 136 | $new = $newval = ''; |
137 | 137 | |
138 | - while($chunk = next($valarray)) |
|
138 | + while ($chunk = next($valarray)) |
|
139 | 139 | { |
140 | 140 | $new[] = $chunk; |
141 | 141 | } |
142 | - $newval = implode(' ',$new); |
|
142 | + $newval = implode(' ', $new); |
|
143 | 143 | |
144 | 144 | switch ($type) |
145 | 145 | { |
146 | 146 | case 'lang': |
147 | - $t->set_var($value,lang($newval)); |
|
147 | + $t->set_var($value, lang($newval)); |
|
148 | 148 | break; |
149 | 149 | case 'value': |
150 | - $newval = str_replace(' ','_',$newval); |
|
150 | + $newval = str_replace(' ', '_', $newval); |
|
151 | 151 | /* Don't show passwords in the form */ |
152 | - if(strpos($value,'passwd') !== false || strpos($value,'password') !== false || strpos($value,'root_pw') !== false) |
|
152 | + if (strpos($value, 'passwd') !== false || strpos($value, 'password') !== false || strpos($value, 'root_pw') !== false) |
|
153 | 153 | { |
154 | - $t->set_var($value,''); |
|
154 | + $t->set_var($value, ''); |
|
155 | 155 | } |
156 | 156 | else |
157 | 157 | { |
158 | - $t->set_var($value,@$current_config[$newval]); |
|
158 | + $t->set_var($value, @$current_config[$newval]); |
|
159 | 159 | } |
160 | 160 | break; |
161 | 161 | case 'selected': |
162 | - $newvals = explode(' ',$newval); |
|
162 | + $newvals = explode(' ', $newval); |
|
163 | 163 | $setting = array_pop($newvals); |
164 | - $config = implode('_',$newvals); |
|
164 | + $config = implode('_', $newvals); |
|
165 | 165 | /* echo $config . '=' . $current_config[$config]; */ |
166 | - if(@$current_config[$config] == $setting) |
|
166 | + if (@$current_config[$config] == $setting) |
|
167 | 167 | { |
168 | - $t->set_var($value,' selected'); |
|
168 | + $t->set_var($value, ' selected'); |
|
169 | 169 | } |
170 | 170 | else |
171 | 171 | { |
172 | - $t->set_var($value,''); |
|
172 | + $t->set_var($value, ''); |
|
173 | 173 | } |
174 | 174 | break; |
175 | 175 | case 'hook': |
176 | - $newval = str_replace(' ','_',$newval); |
|
177 | - $t->set_var($value,$newval($current_config)); |
|
176 | + $newval = str_replace(' ', '_', $newval); |
|
177 | + $t->set_var($value, $newval($current_config)); |
|
178 | 178 | break; |
179 | 179 | default: |
180 | - $t->set_var($value,''); |
|
180 | + $t->set_var($value, ''); |
|
181 | 181 | break; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | -if($GLOBALS['error']) |
|
185 | +if ($GLOBALS['error']) |
|
186 | 186 | { |
187 | - if($GLOBALS['error'] == 'badldapconnection') |
|
187 | + if ($GLOBALS['error'] == 'badldapconnection') |
|
188 | 188 | { |
189 | 189 | /* Please check the number and dial again :) */ |
190 | 190 | $GLOBALS['egw_setup']->html->show_alert_msg('Error', |
191 | 191 | lang('There was a problem trying to connect to your LDAP server. <br />' |
192 | - .'please check your LDAP server configuration') . '.'); |
|
192 | + .'please check your LDAP server configuration').'.'); |
|
193 | 193 | } |
194 | 194 | |
195 | - $GLOBALS['egw_setup']->html->show_alert_msg('Error',$GLOBALS['error'].'<p>'); |
|
195 | + $GLOBALS['egw_setup']->html->show_alert_msg('Error', $GLOBALS['error'].'<p>'); |
|
196 | 196 | } |
197 | 197 | |
198 | -$t->pfp('out','body'); |
|
198 | +$t->pfp('out', 'body'); |
|
199 | 199 | unset($t); |
200 | 200 | |
201 | -$setup_tpl->set_var('more_configs',lang('Please login to egroupware and run the admin application for additional site configuration') . '.'); |
|
201 | +$setup_tpl->set_var('more_configs', lang('Please login to egroupware and run the admin application for additional site configuration').'.'); |
|
202 | 202 | |
203 | -$setup_tpl->set_var('lang_submit',lang('Save')); |
|
204 | -$setup_tpl->set_var('lang_cancel',lang('Cancel')); |
|
205 | -$setup_tpl->pparse('out','T_config_post_script'); |
|
203 | +$setup_tpl->set_var('lang_submit', lang('Save')); |
|
204 | +$setup_tpl->set_var('lang_cancel', lang('Cancel')); |
|
205 | +$setup_tpl->pparse('out', 'T_config_post_script'); |
|
206 | 206 | |
207 | 207 | $GLOBALS['egw_setup']->html->show_footer(); |
@@ -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 | { |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function vfs_storage_mode_options($config) |
22 | 22 | { |
23 | - if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default=array( |
|
23 | + if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default = array( |
|
24 | 24 | '/' => 'sqlfs://$host/', |
25 | 25 | '/apps' => 'links://$host/apps', |
26 | 26 | )) || $config['vfs_fstab'] == serialize($default)) // detect old serialized value too |
27 | 27 | { |
28 | 28 | $config['vfs_storage_mode'] = 'fs'; |
29 | 29 | } |
30 | - elseif($config['vfs_fstab'] == json_encode($default_db=array( |
|
30 | + elseif ($config['vfs_fstab'] == json_encode($default_db = array( |
|
31 | 31 | '/' => 'sqlfs://$host/?storage=db', |
32 | 32 | '/apps' => 'links://$host/apps?storage=db', |
33 | 33 | )) || $config['vfs_fstab'] == serialize($default_db)) // detect old serialized value too |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $config['vfs_storage_mode'] = 'custom'; |
40 | 40 | } |
41 | 41 | //_debug_array(array_intersect_key($config,array('vfs_fstab'=>1,'vfs_storage_mode'=>1))); |
42 | - foreach(array( |
|
42 | + foreach (array( |
|
43 | 43 | 'fs' => lang('Filesystem (default)'), |
44 | 44 | 'db' => lang('Database').' (problems with files > 1MB)', |
45 | - 'custom' => lang('Custom set via %1','filemanager/cli.php mount'), |
|
45 | + 'custom' => lang('Custom set via %1', 'filemanager/cli.php mount'), |
|
46 | 46 | ) as $name => $label) |
47 | 47 | { |
48 | 48 | if ($name != 'custom' || $name === $config['vfs_storage_mode']) // dont show custom, if not custom |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | |
58 | 58 | function encryptalgo($config) |
59 | 59 | { |
60 | - if(@function_exists('mcrypt_list_algorithms')) |
|
60 | + if (@function_exists('mcrypt_list_algorithms')) |
|
61 | 61 | { |
62 | 62 | $listed = array(); |
63 | - if(!isset($config['mcrypt_algo'])) |
|
63 | + if (!isset($config['mcrypt_algo'])) |
|
64 | 64 | { |
65 | - $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ |
|
65 | + $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ |
|
66 | 66 | } |
67 | 67 | $algos = @mcrypt_list_algorithms(); |
68 | 68 | $found = False; |
69 | 69 | |
70 | 70 | $out = ''; |
71 | - while(list($key,$value) = each($algos)) |
|
71 | + while (list($key, $value) = each($algos)) |
|
72 | 72 | { |
73 | 73 | $found = True; |
74 | 74 | /* Only show each once - seems this is a problem in some installs */ |
75 | - if(!in_array($value,$listed)) |
|
75 | + if (!in_array($value, $listed)) |
|
76 | 76 | { |
77 | - if($config['mcrypt_algo'] == $value) |
|
77 | + if ($config['mcrypt_algo'] == $value) |
|
78 | 78 | { |
79 | 79 | $selected = ' selected="selected"'; |
80 | 80 | } |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | } |
85 | 85 | $descr = strtoupper($value); |
86 | 86 | |
87 | - $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; |
|
87 | + $out .= '<option value="'.$value.'"'.$selected.'>'.$descr.'</option>'."\n"; |
|
88 | 88 | $listed[] = $value; |
89 | 89 | } |
90 | 90 | } |
91 | - if(!$found) |
|
91 | + if (!$found) |
|
92 | 92 | { |
93 | 93 | /* Something is wrong with their mcrypt install or php.ini */ |
94 | - $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n"; |
|
94 | + $out = '<option value="">'.lang('no algorithms available').'</option>'."\n"; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | else |
98 | 98 | { |
99 | - $out = '<option value="tripledes">TRIPLEDES</option>' . "\n"; |
|
99 | + $out = '<option value="tripledes">TRIPLEDES</option>'."\n"; |
|
100 | 100 | } |
101 | 101 | return $out; |
102 | 102 | } |
103 | 103 | |
104 | 104 | function encryptmode($config) |
105 | 105 | { |
106 | - if(@function_exists('mcrypt_list_modes')) |
|
106 | + if (@function_exists('mcrypt_list_modes')) |
|
107 | 107 | { |
108 | 108 | $listed = array(); |
109 | - if(!isset($config['mcrypt_mode'])) |
|
109 | + if (!isset($config['mcrypt_mode'])) |
|
110 | 110 | { |
111 | 111 | $config['mcrypt_mode'] = 'cbc'; /* MCRYPT_MODE_CBC */ |
112 | 112 | } |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | $found = False; |
115 | 115 | |
116 | 116 | $out = ''; |
117 | - while(list($key,$value) = each($modes)) |
|
117 | + while (list($key, $value) = each($modes)) |
|
118 | 118 | { |
119 | 119 | $found = True; |
120 | 120 | /* Only show each once - seems this is a problem in some installs */ |
121 | - if(!in_array($value,$listed)) |
|
121 | + if (!in_array($value, $listed)) |
|
122 | 122 | { |
123 | - if($config['mcrypt_mode'] == $value) |
|
123 | + if ($config['mcrypt_mode'] == $value) |
|
124 | 124 | { |
125 | 125 | $selected = ' selected="selected"'; |
126 | 126 | } |
@@ -130,34 +130,34 @@ discard block |
||
130 | 130 | } |
131 | 131 | $descr = strtoupper($value); |
132 | 132 | |
133 | - $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; |
|
133 | + $out .= '<option value="'.$value.'"'.$selected.'>'.$descr.'</option>'."\n"; |
|
134 | 134 | $listed[] = $value; |
135 | 135 | } |
136 | 136 | } |
137 | - if(!$found) |
|
137 | + if (!$found) |
|
138 | 138 | { |
139 | 139 | /* Something is wrong with their mcrypt install or php.ini */ |
140 | - $out = '<option value="" selected="selected">' . lang('no modes available') . '</option>' . "\n"; |
|
140 | + $out = '<option value="" selected="selected">'.lang('no modes available').'</option>'."\n"; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | else |
144 | 144 | { |
145 | - $out = '<option value="cbc" selected="selected">CBC</option>' . "\n"; |
|
145 | + $out = '<option value="cbc" selected="selected">CBC</option>'."\n"; |
|
146 | 146 | } |
147 | 147 | return $out; |
148 | 148 | } |
149 | 149 | |
150 | -function passwdhashes($config,$return_hashes=false) |
|
150 | +function passwdhashes($config, $return_hashes = false) |
|
151 | 151 | { |
152 | - $hashes = sql_passwdhashes($config,true); |
|
152 | + $hashes = sql_passwdhashes($config, true); |
|
153 | 153 | if (isset($hashes['crypt'])) |
154 | 154 | { |
155 | - $hashes['des'] = 'des (=crypt)'; // old LDAP name for crypt |
|
155 | + $hashes['des'] = 'des (=crypt)'; // old LDAP name for crypt |
|
156 | 156 | } |
157 | 157 | return $return_hashes ? $hashes : _options_from($hashes, $config['ldap_encryption_type'] ? $config['ldap_encryption_type'] : 'des'); |
158 | 158 | } |
159 | 159 | |
160 | -function sql_passwdhashes($config, $return_hashes=false, &$securest=null) |
|
160 | +function sql_passwdhashes($config, $return_hashes = false, &$securest = null) |
|
161 | 161 | { |
162 | 162 | $hashes = Api\Auth::passwdhashes($securest); |
163 | 163 | |
@@ -172,19 +172,19 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function auth_types($config) |
174 | 174 | { |
175 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type']); |
|
175 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type']); |
|
176 | 176 | } |
177 | 177 | function auth_type_syncml($config) |
178 | 178 | { |
179 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_syncml']); |
|
179 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_syncml']); |
|
180 | 180 | } |
181 | 181 | function auth_type_groupdav($config) |
182 | 182 | { |
183 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_groupdav']); |
|
183 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_groupdav']); |
|
184 | 184 | } |
185 | 185 | function auth_type_activesync($config) |
186 | 186 | { |
187 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_activesync']); |
|
187 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_activesync']); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @param string $selected value of selected optino |
206 | 206 | * @return string |
207 | 207 | */ |
208 | -function _options_from(array $options,$selected) |
|
208 | +function _options_from(array $options, $selected) |
|
209 | 209 | { |
210 | - foreach($options as $value => $label) |
|
210 | + foreach ($options as $value => $label) |
|
211 | 211 | { |
212 | - $out .= '<option value="' . htmlspecialchars($value) . '"' . |
|
213 | - ($selected == $value ? ' selected="selected"' : '') . '>' . $label . '</option>' . "\n"; |
|
212 | + $out .= '<option value="'.htmlspecialchars($value).'"'. |
|
213 | + ($selected == $value ? ' selected="selected"' : '').'>'.$label.'</option>'."\n"; |
|
214 | 214 | } |
215 | 215 | return $out; |
216 | 216 | } |
@@ -23,17 +23,23 @@ discard block |
||
23 | 23 | if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default=array( |
24 | 24 | '/' => 'sqlfs://$host/', |
25 | 25 | '/apps' => 'links://$host/apps', |
26 | - )) || $config['vfs_fstab'] == serialize($default)) // detect old serialized value too |
|
26 | + )) || $config['vfs_fstab'] == serialize($default)) |
|
27 | + { |
|
28 | + // detect old serialized value too |
|
27 | 29 | { |
28 | 30 | $config['vfs_storage_mode'] = 'fs'; |
29 | 31 | } |
32 | + } |
|
30 | 33 | elseif($config['vfs_fstab'] == json_encode($default_db=array( |
31 | 34 | '/' => 'sqlfs://$host/?storage=db', |
32 | 35 | '/apps' => 'links://$host/apps?storage=db', |
33 | - )) || $config['vfs_fstab'] == serialize($default_db)) // detect old serialized value too |
|
36 | + )) || $config['vfs_fstab'] == serialize($default_db)) |
|
37 | + { |
|
38 | + // detect old serialized value too |
|
34 | 39 | { |
35 | 40 | $config['vfs_storage_mode'] = 'db'; |
36 | 41 | } |
42 | + } |
|
37 | 43 | else |
38 | 44 | { |
39 | 45 | $config['vfs_storage_mode'] = 'custom'; |
@@ -45,11 +51,14 @@ discard block |
||
45 | 51 | 'custom' => lang('Custom set via %1','filemanager/cli.php mount'), |
46 | 52 | ) as $name => $label) |
47 | 53 | { |
48 | - if ($name != 'custom' || $name === $config['vfs_storage_mode']) // dont show custom, if not custom |
|
54 | + if ($name != 'custom' || $name === $config['vfs_storage_mode']) |
|
55 | + { |
|
56 | + // dont show custom, if not custom |
|
49 | 57 | { |
50 | 58 | $options .= '<option value="'.$name.($name === $config['vfs_storage_mode'] ? '" selected="selected' : ''). |
51 | 59 | '">'.htmlspecialchars($label)."</options>\n"; |
52 | 60 | } |
61 | + } |
|
53 | 62 | } |
54 | 63 | //echo "<pre>".htmlspecialchars($options)."</pre>\n"; |
55 | 64 | return $options; |