1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare - Setup * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * -------------------------------------------- * |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | \**************************************************************************/ |
---|
11 | |
---|
12 | |
---|
13 | $DEBUG = @$_POST['debug'] || @$_GET['debug']; |
---|
14 | /* |
---|
15 | TODO: We allow a user to hose their setup here, need to make use |
---|
16 | of dependencies so they are warned that they are pulling the rug |
---|
17 | out from under other apps. e.g. if they select to uninstall the api |
---|
18 | this will happen without further warning. |
---|
19 | */ |
---|
20 | |
---|
21 | $phpgw_info = array(); |
---|
22 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
23 | 'noheader' => True, |
---|
24 | 'nonavbar' => True, |
---|
25 | 'currentapp' => 'home', |
---|
26 | 'noapi' => True |
---|
27 | ); |
---|
28 | include ('./inc/functions.inc.php'); |
---|
29 | |
---|
30 | @set_time_limit(0); |
---|
31 | |
---|
32 | // Check header and authentication |
---|
33 | if (!$GLOBALS['phpgw_setup']->auth('Config')) |
---|
34 | { |
---|
35 | Header('Location: index.php'); |
---|
36 | exit; |
---|
37 | } |
---|
38 | // Does not return unless user is authorized |
---|
39 | |
---|
40 | $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup'); |
---|
41 | $setup_tpl = CreateObject('setup.Template',$tpl_root); |
---|
42 | $setup_tpl->set_file(array( |
---|
43 | 'T_head' => 'head.tpl', |
---|
44 | 'T_footer' => 'footer.tpl', |
---|
45 | 'T_alert_msg' => 'msg_alert_msg.tpl', |
---|
46 | 'T_login_main' => 'login_main.tpl', |
---|
47 | 'T_login_stage_header' => 'login_stage_header.tpl', |
---|
48 | 'T_setup_main' => 'applications.tpl' |
---|
49 | )); |
---|
50 | |
---|
51 | $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
---|
52 | $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
---|
53 | $setup_tpl->set_block('T_setup_main','header','header'); |
---|
54 | $setup_tpl->set_block('T_setup_main','app_header','app_header'); |
---|
55 | $setup_tpl->set_block('T_setup_main','apps','apps'); |
---|
56 | $setup_tpl->set_block('T_setup_main','detail','detail'); |
---|
57 | $setup_tpl->set_block('T_setup_main','table','table'); |
---|
58 | $setup_tpl->set_block('T_setup_main','hook','hook'); |
---|
59 | $setup_tpl->set_block('T_setup_main','dep','dep'); |
---|
60 | $setup_tpl->set_block('T_setup_main','app_footer','app_footer'); |
---|
61 | $setup_tpl->set_block('T_setup_main','submit','submit'); |
---|
62 | $setup_tpl->set_block('T_setup_main','footer','footer'); |
---|
63 | |
---|
64 | $bgcolor = array('#DDDDDD','#EEEEEE'); |
---|
65 | |
---|
66 | function parsedep($depends,$main=True) |
---|
67 | { |
---|
68 | $depstring = '('; |
---|
69 | foreach($depends as $a => $b) |
---|
70 | { |
---|
71 | foreach($b as $c => $d) |
---|
72 | { |
---|
73 | if (is_array($d)) |
---|
74 | { |
---|
75 | $depstring .= $c . ': ' .implode(',',$d) . '; '; |
---|
76 | $depver[] = $d; |
---|
77 | } |
---|
78 | else |
---|
79 | { |
---|
80 | $depstring .= $c . ': ' . $d . '; '; |
---|
81 | $depapp[] = $d; |
---|
82 | } |
---|
83 | } |
---|
84 | } |
---|
85 | $depstring .= ')'; |
---|
86 | if ($main) |
---|
87 | { |
---|
88 | return $depstring; |
---|
89 | } |
---|
90 | else |
---|
91 | { |
---|
92 | return array($depapp,$depver); |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | $GLOBALS['phpgw_setup']->loaddb(); |
---|
97 | $GLOBALS['phpgw_info']['setup']['stage']['db'] = $GLOBALS['phpgw_setup']->detection->check_db(); |
---|
98 | |
---|
99 | $setup_info = $GLOBALS['phpgw_setup']->detection->get_versions(); |
---|
100 | //var_dump($setup_info);exit; |
---|
101 | $setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info); |
---|
102 | //var_dump($setup_info);exit; |
---|
103 | $setup_info = $GLOBALS['phpgw_setup']->detection->compare_versions($setup_info); |
---|
104 | //var_dump($setup_info);exit; |
---|
105 | $setup_info = $GLOBALS['phpgw_setup']->detection->check_depends($setup_info); |
---|
106 | //var_dump($setup_info);exit; |
---|
107 | @ksort($setup_info); |
---|
108 | |
---|
109 | if(@get_var('cancel',Array('POST'))) |
---|
110 | { |
---|
111 | Header("Location: index.php"); |
---|
112 | exit; |
---|
113 | } |
---|
114 | |
---|
115 | if(@get_var('submit',Array('POST'))) |
---|
116 | { |
---|
117 | $GLOBALS['phpgw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['phpgw_setup']->ConfigDomain . '(' . $phpgw_domain[$GLOBALS['phpgw_setup']->ConfigDomain]['db_type'] . ')'); |
---|
118 | $setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':'); |
---|
119 | $setup_tpl->pparse('out','header'); |
---|
120 | |
---|
121 | $appname = get_var('appname',Array('POST')); |
---|
122 | $remove = get_var('remove',Array('POST')); |
---|
123 | $install = get_var('install',Array('POST')); |
---|
124 | $upgrade = get_var('upgrade',Array('POST')); |
---|
125 | |
---|
126 | if(!empty($remove) && is_array($remove)) |
---|
127 | { |
---|
128 | $historylog = CreateObject('phpgwapi.historylog'); |
---|
129 | $historylog->db = $GLOBALS['phpgw_setup']->db; |
---|
130 | |
---|
131 | foreach($remove as $appname => $key) |
---|
132 | { |
---|
133 | $terror = array(); |
---|
134 | $terror[] = $setup_info[$appname]; |
---|
135 | |
---|
136 | if ($setup_info[$appname]['tables']) |
---|
137 | { |
---|
138 | $GLOBALS['phpgw_setup']->process->droptables($terror,$DEBUG); |
---|
139 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('tables dropped') . '.'; |
---|
140 | } |
---|
141 | |
---|
142 | $GLOBALS['phpgw_setup']->deregister_app($setup_info[$appname]['name']); |
---|
143 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('deregistered') . '.'; |
---|
144 | |
---|
145 | if ($setup_info[$appname]['hooks']) |
---|
146 | { |
---|
147 | $GLOBALS['phpgw_setup']->deregister_hooks($setup_info[$appname]['name']); |
---|
148 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('hooks deregistered') . '.'; |
---|
149 | } |
---|
150 | |
---|
151 | $terror = $GLOBALS['phpgw_setup']->process->drop_langs($terror,$DEBUG); |
---|
152 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations removed') . '.'; |
---|
153 | |
---|
154 | if ($historylog->delete($appname)) |
---|
155 | { |
---|
156 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Historylog removed') . '.'; |
---|
157 | } |
---|
158 | |
---|
159 | // delete all application categories and ACL |
---|
160 | $GLOBALS[ 'phpgw_setup' ] -> db -> query( "DELETE FROM phpgw_categories WHERE cat_appname='{$appname}'", __LINE__, __FILE__ ); |
---|
161 | $GLOBALS[ 'phpgw_setup' ] -> db -> query( "DELETE FROM phpgw_acl WHERE acl_appname='{$appname}'", __LINE__, __FILE__ ); |
---|
162 | $GLOBALS[ 'phpgw_setup' ] -> db -> query( "DELETE FROM phpgw_config WHERE config_app = '{$appname}'", __LINE__, __FILE__ ); |
---|
163 | $GLOBALS[ 'phpgw_setup' ] -> db -> query( "DELETE FROM phpgw_preferences WHERE preference_app = '{$appname}'", __LINE__, __FILE__ ); |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | if(!empty($install) && is_array($install)) |
---|
168 | { |
---|
169 | foreach($install as $appname => $key) |
---|
170 | { |
---|
171 | $terror = array(); |
---|
172 | $terror[] = $setup_info[$appname]; |
---|
173 | |
---|
174 | if ($setup_info[$appname]['tables']) |
---|
175 | { |
---|
176 | $terror = $GLOBALS['phpgw_setup']->process->current($terror,$DEBUG); |
---|
177 | $terror = $GLOBALS['phpgw_setup']->process->default_records($terror,$DEBUG); |
---|
178 | echo '<br>' . $setup_info[$appname]['title'] . ' ' |
---|
179 | . lang('tables installed, unless there are errors printed above') . '.'; |
---|
180 | } |
---|
181 | else |
---|
182 | { |
---|
183 | if ($GLOBALS['phpgw_setup']->app_registered($setup_info[$appname]['name'])) |
---|
184 | { |
---|
185 | $GLOBALS['phpgw_setup']->update_app($setup_info[$appname]['name']); |
---|
186 | } |
---|
187 | else |
---|
188 | { |
---|
189 | $GLOBALS['phpgw_setup']->register_app($setup_info[$appname]['name']); |
---|
190 | } |
---|
191 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('registered') . '.'; |
---|
192 | |
---|
193 | if ($setup_info[$appname]['hooks']) |
---|
194 | { |
---|
195 | $GLOBALS['phpgw_setup']->register_hooks($setup_info[$appname]['name']); |
---|
196 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('hooks registered') . '.'; |
---|
197 | } |
---|
198 | } |
---|
199 | $force_en = False; |
---|
200 | if($appname == 'phpgwapi') |
---|
201 | { |
---|
202 | $force_en = True; |
---|
203 | } |
---|
204 | $terror = $GLOBALS['phpgw_setup']->process->add_langs($terror,$DEBUG,$force_en); |
---|
205 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations added') . '.'; |
---|
206 | } |
---|
207 | } |
---|
208 | |
---|
209 | if(!empty($upgrade) && is_array($upgrade)) |
---|
210 | { |
---|
211 | foreach($upgrade as $appname => $key) |
---|
212 | { |
---|
213 | $terror = array(); |
---|
214 | $terror[] = $setup_info[$appname]; |
---|
215 | |
---|
216 | $GLOBALS['phpgw_setup']->process->upgrade($terror,$DEBUG); |
---|
217 | if ($setup_info[$appname]['tables']) |
---|
218 | { |
---|
219 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('tables upgraded') . '.'; |
---|
220 | // The process_upgrade() function also handles registration |
---|
221 | } |
---|
222 | else |
---|
223 | { |
---|
224 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('upgraded') . '.'; |
---|
225 | } |
---|
226 | |
---|
227 | $terror = $GLOBALS['phpgw_setup']->process->upgrade_langs($terror,$DEBUG); |
---|
228 | echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations upgraded') . '.'; |
---|
229 | } |
---|
230 | } |
---|
231 | |
---|
232 | //$setup_tpl->set_var('goback', |
---|
233 | echo '<br><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
---|
234 | //$setup_tpl->pparse('out','submit'); |
---|
235 | $setup_tpl->pparse('out','footer'); |
---|
236 | exit; |
---|
237 | } |
---|
238 | else |
---|
239 | { |
---|
240 | $GLOBALS['phpgw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['phpgw_setup']->ConfigDomain . '(' . $phpgw_domain[$GLOBALS['phpgw_setup']->ConfigDomain]['db_type'] . ')'); |
---|
241 | } |
---|
242 | |
---|
243 | $detail = get_var('detail',Array('GET')); |
---|
244 | $resolve = get_var('resolve',Array('GET')); |
---|
245 | if(@$detail) |
---|
246 | { |
---|
247 | @ksort($setup_info[$detail]); |
---|
248 | $setup_tpl->set_var('description',lang('App details') . ':'); |
---|
249 | $setup_tpl->pparse('out','header'); |
---|
250 | |
---|
251 | $setup_tpl->set_var('name','application'); |
---|
252 | $setup_tpl->set_var('details', lang($setup_info[$detail]['title'])); |
---|
253 | $setup_tpl->pparse('out','detail'); |
---|
254 | |
---|
255 | foreach($setup_info[$detail] as $key => $val) |
---|
256 | { |
---|
257 | if($key != 'title') |
---|
258 | { |
---|
259 | $i = ($i ? 0 : 1); |
---|
260 | |
---|
261 | |
---|
262 | if ($key == 'tables') |
---|
263 | { |
---|
264 | $tblcnt = count($setup_info[$detail][$key]); |
---|
265 | if(is_array($val)) |
---|
266 | { |
---|
267 | $key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True&apps=True">' . $key . '(' . $tblcnt . ')</a>' . "\n"; |
---|
268 | $val = implode(',' . "\n",$val); |
---|
269 | } |
---|
270 | } |
---|
271 | if ($key == 'hooks') { $val = implode(',',$val); } |
---|
272 | if ($key == 'depends') { $val = parsedep($val); } |
---|
273 | if (is_array($val)) { $val = implode(',',$val); } |
---|
274 | |
---|
275 | $setup_tpl->set_var('bg_color',$bgcolor[$i]); |
---|
276 | $setup_tpl->set_var('name',$key); |
---|
277 | $setup_tpl->set_var('details',$val); |
---|
278 | $setup_tpl->pparse('out','detail'); |
---|
279 | } |
---|
280 | } |
---|
281 | |
---|
282 | echo '<br><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
---|
283 | $setup_tpl->pparse('out','footer'); |
---|
284 | exit; |
---|
285 | } |
---|
286 | elseif (@$resolve) |
---|
287 | { |
---|
288 | $version = get_var('version',Array('GET')); |
---|
289 | $notables = get_var('notables',Array('GET')); |
---|
290 | $setup_tpl->set_var('description',lang('Problem resolution'). ':'); |
---|
291 | $setup_tpl->pparse('out','header'); |
---|
292 | |
---|
293 | if(get_var('post',Array('GET'))) |
---|
294 | { |
---|
295 | echo '"' . $setup_info[$resolve]['title'] . '" ' . lang('may be broken') . ' '; |
---|
296 | echo lang('because an application it depends upon was upgraded'); |
---|
297 | echo '<br>'; |
---|
298 | echo lang('to a version it does not know about') . '.'; |
---|
299 | echo '<br>'; |
---|
300 | echo lang('However, the application may still work') . '.'; |
---|
301 | } |
---|
302 | elseif(get_var('badinstall',Array('GET'))) |
---|
303 | { |
---|
304 | echo '"' . $setup_info[$resolve]['title'] . '" ' . lang('is broken') . ' '; |
---|
305 | echo lang('because of a failed upgrade or install') . '.'; |
---|
306 | echo '<br>'; |
---|
307 | echo lang('Some or all of its tables are missing') . '.'; |
---|
308 | echo '<br>'; |
---|
309 | echo lang('You should either uninstall and then reinstall it, or attempt manual repairs') . '.'; |
---|
310 | } |
---|
311 | elseif (!$version) |
---|
312 | { |
---|
313 | if($setup_info[$resolve]['enabled']) |
---|
314 | { |
---|
315 | echo '"' . $setup_info[$resolve]['title'] . '" ' . lang('is broken') . ' '; |
---|
316 | } |
---|
317 | else |
---|
318 | { |
---|
319 | echo '"' . $setup_info[$resolve]['title'] . '" ' . lang('is disabled') . ' '; |
---|
320 | } |
---|
321 | |
---|
322 | if (!$notables) |
---|
323 | { |
---|
324 | if($setup_info[$resolve]['status'] == 'D') |
---|
325 | { |
---|
326 | echo lang('because it depends upon') . ':<br>' . "\n"; |
---|
327 | list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False); |
---|
328 | $depapp_count = count($depapp); |
---|
329 | for ($i=0; $i<$depapp_count; $i++) |
---|
330 | { |
---|
331 | echo '<br>' . $depapp[$i] . ': '; |
---|
332 | $list = ''; |
---|
333 | foreach($depver[$i] as $x => $y) |
---|
334 | { |
---|
335 | $list .= $y . ', '; |
---|
336 | } |
---|
337 | $list = substr($list,0,-2); |
---|
338 | echo "$list\n"; |
---|
339 | } |
---|
340 | echo '<br><br>' . lang('The table definition was correct, and the tables were installed') . '.'; |
---|
341 | } |
---|
342 | else |
---|
343 | { |
---|
344 | echo lang('because it was manually disabled') . '.'; |
---|
345 | } |
---|
346 | } |
---|
347 | elseif($setup_info[$resolve]['enable'] == 2) |
---|
348 | { |
---|
349 | echo lang('because it is not a user application, or access is controlled via acl') . '.'; |
---|
350 | } |
---|
351 | elseif($setup_info[$resolve]['enable'] == 0) |
---|
352 | { |
---|
353 | echo lang('because the enable flag for this app is set to 0, or is undefined') . '.'; |
---|
354 | } |
---|
355 | else |
---|
356 | { |
---|
357 | echo lang('because it requires manual table installation, <br>or the table definition was incorrect') . ".\n" |
---|
358 | . lang("Please check for sql scripts within the application's directory") . '.'; |
---|
359 | } |
---|
360 | echo '<br>' . lang('However, the application is otherwise installed') . '.'; |
---|
361 | } |
---|
362 | else |
---|
363 | { |
---|
364 | echo $setup_info[$resolve]['title'] . ' ' . lang('has a version mismatch') . ' '; |
---|
365 | echo lang('because of a failed upgrade, or the database is newer than the installed version of this app') . '.'; |
---|
366 | echo '<br>'; |
---|
367 | echo lang('If the application has no defined tables, selecting upgrade should remedy the problem') . '.'; |
---|
368 | echo '<br>' . lang('However, the application is otherwise installed') . '.'; |
---|
369 | } |
---|
370 | |
---|
371 | echo '<br><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
---|
372 | $setup_tpl->pparse('out','footer'); |
---|
373 | exit; |
---|
374 | } |
---|
375 | else |
---|
376 | { |
---|
377 | $setup_tpl->set_var('description',lang('Select the desired action(s) from the available choices')); |
---|
378 | $setup_tpl->pparse('out','header'); |
---|
379 | |
---|
380 | $setup_tpl->set_var('appdata',lang('Application Data')); |
---|
381 | $setup_tpl->set_var('actions',lang('Actions')); |
---|
382 | $setup_tpl->set_var('action_url','applications.php'); |
---|
383 | $setup_tpl->set_var('app_info',lang('Application Name and Status Information')); |
---|
384 | $setup_tpl->set_var('app_title',lang('Application Title')); |
---|
385 | $setup_tpl->set_var('app_currentver',lang('Current Version')); |
---|
386 | $setup_tpl->set_var('app_version',lang('Available Version')); |
---|
387 | $setup_tpl->set_var('app_install',lang('Install')); |
---|
388 | $setup_tpl->set_var('app_remove',lang('Remove')); |
---|
389 | $setup_tpl->set_var('app_upgrade',lang('Upgrade')); |
---|
390 | $setup_tpl->set_var('app_resolve',lang('Resolve')); |
---|
391 | $setup_tpl->set_var('check','check.png'); |
---|
392 | $setup_tpl->set_var('install_all',lang('Install All')); |
---|
393 | $setup_tpl->set_var('upgrade_all',lang('Upgrade All')); |
---|
394 | $setup_tpl->set_var('remove_all',lang('Remove All')); |
---|
395 | $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
---|
396 | $setup_tpl->set_var('debug','<input type="checkbox" name="debug" value="True"' .($DEBUG ? ' checked' : '') . '>'); |
---|
397 | $setup_tpl->set_var('bg_color',$bgcolor[0]); |
---|
398 | |
---|
399 | $setup_tpl->pparse('out','app_header'); |
---|
400 | |
---|
401 | $i = 0; |
---|
402 | function allow_remove( $app ) |
---|
403 | { |
---|
404 | $never_remove = array( 'phpgwapi', 'preferences' ); |
---|
405 | |
---|
406 | return ( in_array( $app, $never_remove ) ) ? ' ' : '<input type="checkbox" name="remove[' . $app . ']">'; |
---|
407 | } |
---|
408 | |
---|
409 | foreach($setup_info as $key => $value) |
---|
410 | { |
---|
411 | if ( array_key_exists( 'name', $value ) ) |
---|
412 | { |
---|
413 | $i = ($i ? 0 : 1); |
---|
414 | $setup_tpl->set_var('apptitle',$value['title']?$value['title']:lang($value['name'])); |
---|
415 | $setup_tpl->set_var('currentver',@$value['currentver']); |
---|
416 | $setup_tpl->set_var('version',$value['version']); |
---|
417 | $setup_tpl->set_var('bg_color',$bgcolor[$i]); |
---|
418 | |
---|
419 | switch($value['status']) |
---|
420 | { |
---|
421 | case 'C': |
---|
422 | $setup_tpl->set_var('remove', allow_remove( $value[ 'name' ] ) ); |
---|
423 | $setup_tpl->set_var('upgrade',' '); |
---|
424 | if (!$GLOBALS['phpgw_setup']->detection->check_app_tables($value['name'])) |
---|
425 | { |
---|
426 | // App installed and enabled, but some tables are missing |
---|
427 | $setup_tpl->set_var('instimg','table.png'); |
---|
428 | $setup_tpl->set_var('bg_color','FFCCAA'); |
---|
429 | $setup_tpl->set_var('instalt',lang('Not Completed')); |
---|
430 | $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>'); |
---|
431 | $status = lang('Requires reinstall or manual repair') . ' - ' . $value['status']; |
---|
432 | } |
---|
433 | else |
---|
434 | { |
---|
435 | $setup_tpl->set_var('instimg','completed.png'); |
---|
436 | $setup_tpl->set_var('instalt',lang('Completed')); |
---|
437 | $setup_tpl->set_var('install',' '); |
---|
438 | if($value['enabled']) |
---|
439 | { |
---|
440 | $setup_tpl->set_var('resolution',''); |
---|
441 | $status = lang('OK') . ' - ' . $value['status']; |
---|
442 | } |
---|
443 | else |
---|
444 | { |
---|
445 | if ($value['tables'][0] != '') |
---|
446 | { |
---|
447 | $notables = '¬ables=True'; |
---|
448 | } |
---|
449 | $setup_tpl->set_var('bg_color','CCCCFF'); |
---|
450 | $setup_tpl->set_var('resolution', |
---|
451 | '<a href="applications.php?resolve=' . $value['name'] . $notables . '">' . lang('Possible Reasons') . '</a>' |
---|
452 | ); |
---|
453 | $status = lang('Disabled') . ' - ' . $value['status']; |
---|
454 | } |
---|
455 | } |
---|
456 | break; |
---|
457 | case 'U': |
---|
458 | $setup_tpl->set_var('instimg','incomplete.png'); |
---|
459 | $setup_tpl->set_var('instalt',lang('Not Completed')); |
---|
460 | if (!@$value['currentver']) |
---|
461 | { |
---|
462 | if ($value['tables'] && $GLOBALS['phpgw_setup']->detection->check_app_tables($value['name'],True)) |
---|
463 | { |
---|
464 | // Some tables missing |
---|
465 | $setup_tpl->set_var('remove', allow_remove( $value[ 'name' ] ) ); |
---|
466 | $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>'); |
---|
467 | $status = lang('Requires reinstall or manual repair') . ' - ' . $value['status']; |
---|
468 | } |
---|
469 | else |
---|
470 | { |
---|
471 | $setup_tpl->set_var('remove',' '); |
---|
472 | $setup_tpl->set_var('resolution',''); |
---|
473 | $status = lang('Requires upgrade') . ' - ' . $value['status']; |
---|
474 | } |
---|
475 | $setup_tpl->set_var('bg_color','CCFFCC'); |
---|
476 | $setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']">'); |
---|
477 | $setup_tpl->set_var('upgrade',' '); |
---|
478 | $status = lang('Please install') . ' - ' . $value['status']; |
---|
479 | } |
---|
480 | else |
---|
481 | { |
---|
482 | $setup_tpl->set_var('bg_color','CCCCFF'); |
---|
483 | $setup_tpl->set_var('install',' '); |
---|
484 | // TODO display some info about breakage if you mess with this app |
---|
485 | $setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']">'); |
---|
486 | $setup_tpl->set_var('remove', allow_remove( $value[ 'name' ] ) ); |
---|
487 | $setup_tpl->set_var('resolution',''); |
---|
488 | $status = lang('Requires upgrade') . ' - ' . $value['status']; |
---|
489 | } |
---|
490 | break; |
---|
491 | case 'V': |
---|
492 | $setup_tpl->set_var('instimg','incomplete.png'); |
---|
493 | $setup_tpl->set_var('instalt',lang('Not Completed')); |
---|
494 | $setup_tpl->set_var('install',' '); |
---|
495 | $setup_tpl->set_var('remove', allow_remove( $value[ 'name' ] ) ); |
---|
496 | $setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']">'); |
---|
497 | $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&version=True">' . lang('Possible Solutions') . '</a>'); |
---|
498 | $status = lang('Version Mismatch') . ' - ' . $value['status']; |
---|
499 | break; |
---|
500 | case 'D': |
---|
501 | $setup_tpl->set_var('bg_color','FFCCCC'); |
---|
502 | $depstring = parsedep($value['depends']); |
---|
503 | $depstring .= ')'; |
---|
504 | $setup_tpl->set_var('instimg','dep.png'); |
---|
505 | $setup_tpl->set_var('instalt',lang('Dependency Failure')); |
---|
506 | $setup_tpl->set_var('install',' '); |
---|
507 | $setup_tpl->set_var('remove',' '); |
---|
508 | $setup_tpl->set_var('upgrade',' '); |
---|
509 | $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>'); |
---|
510 | $status = lang('Dependency Failure') . ':' . $depstring . $value['status']; |
---|
511 | break; |
---|
512 | case 'P': |
---|
513 | $setup_tpl->set_var('bg_color','FFCCFF'); |
---|
514 | $depstring = parsedep($value['depends']); |
---|
515 | $depstring .= ')'; |
---|
516 | $setup_tpl->set_var('instimg','dep.png'); |
---|
517 | $setup_tpl->set_var('instalt',lang('Post-install Dependency Failure')); |
---|
518 | $setup_tpl->set_var('install',' '); |
---|
519 | $setup_tpl->set_var('remove',' '); |
---|
520 | $setup_tpl->set_var('upgrade',' '); |
---|
521 | $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&post=True">' . lang('Possible Solutions') . '</a>'); |
---|
522 | $status = lang('Post-install Dependency Failure') . ':' . $depstring . $value['status']; |
---|
523 | break; |
---|
524 | default: |
---|
525 | $setup_tpl->set_var('instimg','incomplete.png'); |
---|
526 | $setup_tpl->set_var('instalt',lang('Not Completed')); |
---|
527 | $setup_tpl->set_var('install',' '); |
---|
528 | $setup_tpl->set_var('remove',' '); |
---|
529 | $setup_tpl->set_var('upgrade',' '); |
---|
530 | $setup_tpl->set_var('resolution',''); |
---|
531 | $status = ''; |
---|
532 | break; |
---|
533 | } |
---|
534 | //$setup_tpl->set_var('appname',$value['name'] . '-' . $status . ',' . $value['filename']); |
---|
535 | $setup_tpl->set_var('appinfo',$value['name'] . '-' . $status); |
---|
536 | $setup_tpl->set_var('appname',$value['name']); |
---|
537 | |
---|
538 | $setup_tpl->pparse('out','apps',True); |
---|
539 | } |
---|
540 | } |
---|
541 | |
---|
542 | $setup_tpl->set_var('submit',lang('Save')); |
---|
543 | $setup_tpl->set_var('cancel',lang('Cancel')); |
---|
544 | $setup_tpl->pparse('out','app_footer'); |
---|
545 | $setup_tpl->pparse('out','footer'); |
---|
546 | $GLOBALS['phpgw_setup']->html->show_footer(); |
---|
547 | } |
---|
548 | ?> |
---|