[6779] | 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 | $phpgw_info = array(); |
---|
| 14 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 15 | 'noheader' => True, |
---|
| 16 | 'nonavbar' => True, |
---|
| 17 | 'currentapp' => 'home', |
---|
| 18 | 'noapi' => True |
---|
| 19 | ); |
---|
| 20 | include('./inc/functions.inc.php'); |
---|
| 21 | // Authorize the user to use setup app and load the database |
---|
| 22 | // Does not return unless user is authorized |
---|
| 23 | if (!$GLOBALS['phpgw_setup']->auth('Config') || @$_POST['cancel']) |
---|
| 24 | { |
---|
| 25 | Header('Location: index.php'); |
---|
| 26 | exit; |
---|
| 27 | } |
---|
| 28 | $GLOBALS['phpgw_setup']->loaddb(); |
---|
| 29 | |
---|
| 30 | if (@$_POST['submit']) |
---|
| 31 | { |
---|
| 32 | $GLOBALS['phpgw_setup']->translation->setup_translation_sql(); |
---|
| 33 | $GLOBALS['phpgw_setup']->translation->sql->install_langs(@$_POST['lang_selected'],@$_POST['upgrademethod']); |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | if( !$GLOBALS['phpgw_setup']->translation->sql->line_rejected ) |
---|
| 37 | { |
---|
| 38 | Header('Location: index.php'); |
---|
| 39 | exit; |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup'); |
---|
| 44 | $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); |
---|
| 45 | $setup_tpl->set_file(array( |
---|
| 46 | 'T_head' => 'head.tpl', |
---|
| 47 | 'T_footer' => 'footer.tpl', |
---|
| 48 | 'T_alert_msg' => 'msg_alert_msg.tpl', |
---|
| 49 | 'T_lang_main' => 'lang_main.tpl' |
---|
| 50 | )); |
---|
| 51 | |
---|
| 52 | $setup_tpl->set_block('T_lang_main','B_choose_method','V_choose_method'); |
---|
| 53 | |
---|
| 54 | $stage_title = lang('Multi-Language support setup'); |
---|
| 55 | $stage_desc = lang('This program will help you upgrade or install different languages for eGroupWare'); |
---|
| 56 | $tbl_width = @$newinstall ? '60%' : '80%'; |
---|
| 57 | $td_colspan = @$newinstall ? '1' : '2'; |
---|
| 58 | $td_align = @$newinstall ? ' align="center"' : ''; |
---|
| 59 | $hidden_var1 = @$newinstall ? '<input type="hidden" name="newinstall" value="True">' : ''; |
---|
| 60 | |
---|
| 61 | if (!@$newinstall && !isset($GLOBALS['phpgw_info']['setup']['installed_langs'])) |
---|
| 62 | { |
---|
| 63 | $GLOBALS['phpgw_setup']->detection->check_lang(false); // get installed langs |
---|
| 64 | } |
---|
| 65 | $select_box_desc = lang('Select which languages you would like to use'); |
---|
| 66 | $select_box = ''; |
---|
| 67 | $languages = get_langs(); |
---|
| 68 | uasort($languages,create_function('$a,$b','return strcmp(@$a[\'descr\'],@$b[\'descr\']);')); |
---|
| 69 | foreach($languages as $id => $data) |
---|
| 70 | { |
---|
| 71 | $select_box_langs = |
---|
| 72 | @$select_box_langs |
---|
| 73 | .'<option value="' . $id . '"' |
---|
| 74 | .(@$GLOBALS['phpgw_info']['setup']['installed_langs'][$id]?' SELECTED="1"':'').'>' |
---|
| 75 | . $data['descr'] . '</option>' |
---|
| 76 | ."\n"; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | if (!@$newinstall) |
---|
| 80 | { |
---|
| 81 | $meth_desc = lang('Select which method of upgrade you would like to do'); |
---|
| 82 | $blurb_addonlynew = lang('Only add languages that are not in the database already'); |
---|
| 83 | $blurb_addmissing = lang('Only add new phrases'); |
---|
| 84 | $blurb_dumpold = lang('Delete all old languages and install new ones'); |
---|
| 85 | |
---|
| 86 | $setup_tpl->set_var('meth_desc',$meth_desc); |
---|
| 87 | $setup_tpl->set_var('blurb_addonlynew',$blurb_addonlynew); |
---|
| 88 | $setup_tpl->set_var('blurb_addmissing',$blurb_addmissing); |
---|
| 89 | $setup_tpl->set_var('blurb_dumpold',$blurb_dumpold); |
---|
| 90 | $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
---|
| 91 | $setup_tpl->parse('V_choose_method','B_choose_method'); |
---|
| 92 | } |
---|
| 93 | else |
---|
| 94 | { |
---|
| 95 | $setup_tpl->set_var('V_choose_method',''); |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | // Rejected Lines |
---|
| 99 | if($_POST['debug'] && count($GLOBALS['phpgw_setup']->translation->sql->line_rejected)) |
---|
| 100 | { |
---|
| 101 | $str = ''; |
---|
| 102 | foreach($GLOBALS['phpgw_setup']->translation->sql->line_rejected as $badline) |
---|
| 103 | { |
---|
| 104 | _debug_array($badline); |
---|
| 105 | $_f_buffer = split("[/\\]", $badline['appfile']); |
---|
| 106 | $str .= lang('Application: %1, File: %2, Line: "%3"','<b>'.$_f_buffer[count($_f_buffer)-3].'</b>', |
---|
| 107 | '<b>'.$_f_buffer[count($_f_buffer)-1].'</b>',$badline['line'])."<br>\n"; |
---|
| 108 | } |
---|
| 109 | $setup_tpl->set_var('V_alert_word', lang('Rejected lines')); |
---|
| 110 | $setup_tpl->set_var('V_alert_msg', $str); |
---|
| 111 | $alert = TRUE; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | $setup_tpl->set_var('stage_title',$stage_title); |
---|
| 115 | $setup_tpl->set_var('stage_desc',$stage_desc); |
---|
| 116 | $setup_tpl->set_var('tbl_width',$tbl_width); |
---|
| 117 | $setup_tpl->set_var('td_colspan',$td_colspan); |
---|
| 118 | $setup_tpl->set_var('td_align',$td_align); |
---|
| 119 | $setup_tpl->set_var('hidden_var1',$hidden_var1); |
---|
| 120 | $setup_tpl->set_var('select_box_desc',$select_box_desc); |
---|
| 121 | $setup_tpl->set_var('select_box_langs',$select_box_langs); |
---|
| 122 | |
---|
| 123 | $setup_tpl->set_var('lang_install',lang('install')); |
---|
| 124 | $setup_tpl->set_var('lang_cancel',lang('cancel')); |
---|
| 125 | |
---|
| 126 | $GLOBALS['phpgw_setup']->html->show_header("$stage_title",False,'config',$GLOBALS['phpgw_setup']->ConfigDomain . '(' . $phpgw_domain[$GLOBALS['phpgw_setup']->ConfigDomain]['db_type'] . ')'); |
---|
| 127 | $setup_tpl->pparse('out','T_lang_main'); |
---|
| 128 | |
---|
| 129 | if($alert) |
---|
| 130 | $setup_tpl->pparse('out','T_alert_msg'); |
---|
| 131 | |
---|
| 132 | $GLOBALS['phpgw_setup']->html->show_footer(); |
---|
| 133 | ?> |
---|