BMLT Root Server
installer_guts.php
Go to the documentation of this file.
1 <?php
2 /*
3  This file is part of the Basic Meeting List Toolbox (BMLT).
4 
5  Find out more at: https://bmlt.app
6 
7  BMLT is free software: you can redistribute it and/or modify
8  it under the terms of the MIT License.
9 
10  BMLT is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  MIT License for more details.
14 
15  You should have received a copy of the MIT License along with this code.
16  If not, see <https://opensource.org/licenses/MIT>.
17 */
18 defined('BMLT_EXEC') or die('Cannot Execute Directly'); // Makes sure that this file is in the correct context.
19 
20 $basename = basename(realpath(dirname(__FILE__).'/../../'));
21 $realpath = realpath(dirname(__FILE__).'/../../../');
22 
24 $default_lang = $lang;
25 ?>
26 <div id="installer_wrapper" class="page_1_wrapper">
27  <div id="bmlt_installer_tab_bar" class="bmlt_installer_tab_bar">
28  <div id="bmlt_installer_tab_1" class="bmlt_installer_tab_1">
29  <a href="javascript:g_installer_object.selectPage1()"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_1_Tab']); ?></a>
30  </div>
31  <div id="bmlt_installer_tab_2" class="bmlt_installer_tab_2">
32  <a href="javascript:g_installer_object.selectPage2()"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_2_Tab']); ?></a>
33  </div>
34  <div id="bmlt_installer_tab_3" class="bmlt_installer_tab_3">
35  <a href="javascript:g_installer_object.selectPage3()"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_3_Tab']); ?></a>
36  </div>
37  <div id="bmlt_installer_tab_4" class="bmlt_installer_tab_4">
38  <a href="javascript:g_installer_object.selectPage4()"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_4_Tab']); ?></a>
39  </div>
40  </div>
41  <form action="" method="post">
42  <div class="page_content">
43  <?php
44  if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
45  if (class_exists('PDO')) {
46  $drivers = PDO::getAvailableDrivers();
47 
48  $found = false;
49 
50  foreach ($drivers as $driver) {
51  if ($driver == 'mysql') {
52  $found = true;
53  break;
54  }
55  }
56 
57  if ($found) {
58  ?>
59  <script type="text/javascript">
60  var g_maps_api_key_warning = '<?php echo htmlspecialchars($comdef_install_wizard_strings['Maps_API_Key_Warning']); ?>';
61  var g_maps_api_key_not_set = '<?php echo htmlspecialchars($comdef_install_wizard_strings['Maps_API_Key_Not_Set']); ?>';
62  var g_maps_api_key_valid = '<?php echo htmlspecialchars($comdef_install_wizard_strings['Maps_API_Key_Valid']); ?>';
63  var g_maps_api_key_click_here = '<?php echo htmlspecialchars($comdef_install_wizard_strings['Maps_API_Key_ClickHere']); ?>';
64  </script>
65  <script type="text/javascript" src="local_server/install_wizard/installer.js"></script>
66  <script type="text/javascript">
67  var g_installer_object = new BMLTInstaller ( <?php echo array2json($prefs_array) ?> );
68  </script>
69  <div id="bmlt_installer_page_1" class="bmlt_installer_page_1">
70  <?php echo bmlt_create_next_prev_buttons(1) ?>
71  <h1 class="page_heading_h1"><?php echo $comdef_install_wizard_strings['Page_1_Heading']; ?></h1>
72  <h2 class="page_heading_h2"><?php echo $comdef_install_wizard_strings['Page_1_Text']; ?></h2>
73  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_1_Initial_Intro']; ?></div>
74  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_1_DB_Intro']; ?></div>
75  <div class="one_line_div">
76  <label class="left_right_aligned bold_char" for="installer_db_type_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_Type']); ?></label>
77  <div class="right_left_aligned_div">
78  <?php echo bmlt_create_pdo_driver_select(); ?>
79  </div>
80  </div>
81  <div class="one_line_div">
82  <label class="left_right_aligned bold_char" for="installer_db_host_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_Host']); ?></label>
83  <div class="right_left_aligned_div">
84  <input type="text" id="installer_db_host_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo htmlspecialchars($prefs_array['dbServer']); ?>" class="bmlt_text_item_small" />
85  </div>
86  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_Host_Additional_Text']); ?></div>
87  </div>
88  <div class="one_line_div">
89  <label class="left_right_aligned bold_char" for="installer_db_prefix_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['Table_Prefix']); ?></label>
90  <div class="right_left_aligned_div">
91  <input type="text" id="installer_db_prefix_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo htmlspecialchars($prefs_array['dbPrefix']); ?>" class="bmlt_text_item_small" />
92  </div>
93  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['Table_Prefix_Additional_Text']); ?></div>
94  </div>
95  <div class="one_line_div">
96  <label class="left_right_aligned bold_char" for="installer_db_name_input"><?php echo $comdef_install_wizard_strings['Database_Name']; ?></label>
97  <div class="right_left_aligned_div">
98  <input type="text" id="installer_db_name_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo $prefs_array['dbName']; ?>" class="bmlt_text_item_small" />
99  </div>
100  </div>
101  <div class="one_line_div">
102  <label class="left_right_aligned bold_char" for="installer_db_user_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_User']); ?></label>
103  <div class="right_left_aligned_div">
104  <input type="text" id="installer_db_user_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo htmlspecialchars($prefs_array['dbUser']); ?>" class="bmlt_text_item_small" />
105  </div>
106  </div>
107  <div class="one_line_div">
108  <label class="left_right_aligned bold_char" for="installer_db_pw_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_PW']); ?></label>
109  <div class="right_left_aligned_div">
110  <input type="text" id="installer_db_pw_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo htmlspecialchars($prefs_array['dbPassword']); ?>" class="bmlt_text_item_small" />
111  </div>
112  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_PW_Additional_Text']); ?></div>
113  </div>
114  <div class="one_line_div">
115  <div class="one_line_div centered_text">
116  <a class="bmlt_admin_ajax_button" href="javascript:g_installer_object.buttonTestForDatabaseSetup()"><?php echo htmlspecialchars($comdef_install_wizard_strings['Database_TestButton_Text']); ?></a>
117  </div>
118  </div>
119  <div class="clear_both"></div>
120  <?php echo bmlt_create_next_prev_buttons(1) ?>
121  </div>
122  <div id="bmlt_installer_page_2" class="bmlt_installer_page_2">
123  <?php echo bmlt_create_next_prev_buttons(2) ?>
124  <h1 class="page_heading_h1"><?php echo $comdef_install_wizard_strings['Page_2_Heading']; ?></h1>
125  <h2 class="page_heading_h2"><?php echo $comdef_install_wizard_strings['Page_2_Text']; ?></h2>
126  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_2_API_key_Intro']; ?></div>
127  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_2_API_key_2_Intro']; ?></div>
128  <div class="one_line_div">
129  <label class="left_right_aligned bold_char" for="api_text_entry"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_2_API_Key_Prompt']); ?></label>
130  <div class="right_left_aligned_div">
131  <input type="text" class="api_text_entry" id="api_text_entry" value="" />
132  <a class="bmlt_admin_ajax_button" href="javascript:g_installer_object.testMapsApiKey();"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_2_API_Key_Set_Button']); ?></a>
133  </div>
134  </div>
135  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_2_Region_Bias_Intro']; ?></div>
136  <div class="one_line_div">
137  <label class="left_right_aligned bold_char" for="installer_region_bias_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['RegionBiasLabel']); ?></label>
138  <div class="right_left_aligned_div">
139  <?php echo bmlt_create_region_bias_select(); ?>
140  </div>
141  </div>
142  <div class="clear_both"></div>
143  <?php echo bmlt_create_next_prev_buttons(2) ?>
144  </div>
145  <div id="bmlt_installer_page_3" class="bmlt_installer_page_3">
146  <?php echo bmlt_create_next_prev_buttons(3) ?>
147  <h1 class="page_heading_h1"><?php echo $comdef_install_wizard_strings['Page_3_Heading']; ?></h1>
148  <h2 class="page_heading_h2"><?php echo $comdef_install_wizard_strings['Page_3_Text']; ?></h2>
149  <fieldset id="admin_login_stuff_fieldset">
150  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_3_Server_Admin_Intro']; ?></div>
151  <div class="one_line_div">
152  <label class="left_right_aligned bold_char" for="installer_admin_login_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['Admin_Login']); ?></label>
153  <div class="right_left_aligned_div">
154  <input type="text" id="installer_admin_login_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo $comdef_install_wizard_strings['ServerAdminDefaultLogin'] ?>" class="bmlt_text_item_med" />
155  </div>
156  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['Admin_Login_Additional_Text']); ?></div>
157  </div>
158  <div class="one_line_div">
159  <label class="left_right_aligned bold_char" for="installer_admin_password_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['Admin_Password']); ?></label>
160  <div class="right_left_aligned_div">
161  <input type="text" id="installer_admin_password_input" onkeyup="g_installer_object.gatherInstallerState()" value="" class="bmlt_text_item_med" />
162  </div>
163  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['Admin_Password_Additional_Text']); ?></div>
164  </div>
165  <div class="one_line_div"><div id="admin_pw_warning_div" class="extra_text_div red_char"></div></div>
166  <div class="clear_both"></div>
167  </fieldset>
168  <div class="one_line_div"><div id="admin_pw_warning_div_2" class="item_hidden"><?php echo htmlspecialchars($comdef_install_wizard_strings['NoServerAdmin_Note_AlreadySet']); ?></div></div>
169  <fieldset id="admin_settings_fieldset">
170  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_3_Misc_Intro']; ?></div>
171  <div class="one_line_div">
172  <label class="left_right_aligned bold_char" for="installer_title_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['TitleTextLabel']); ?></label>
173  <div class="right_left_aligned_div">
174  <input type="text" id="installer_title_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo htmlspecialchars($prefs_array['bmlt_title']); ?>" class="bmlt_text_item" />
175  </div>
176  </div>
177  <div class="one_line_div">
178  <label class="left_right_aligned bold_char" for="installer_banner_input"><?php echo htmlspecialchars($comdef_install_wizard_strings['BannerTextLabel']); ?></label>
179  <div class="right_left_aligned_div">
180  <input type="text" id="installer_banner_input" onkeyup="g_installer_object.gatherInstallerState()" value="<?php echo htmlspecialchars($prefs_array['banner_text']); ?>" class="bmlt_text_item" />
181  </div>
182  </div>
183  <div class="one_line_div">
184  <label class="left_right_aligned bold_char" for="installer_lang_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['ServerLangLabel']); ?></label>
185  <div class="right_left_aligned_div"><?php echo bmlt_create_lang_select(); ?></div>
186  </div>
187  <div class="one_line_div">
188  <label class="left_right_aligned bold_char" for="format_lang_names"><?php echo htmlspecialchars($comdef_install_wizard_strings['FormatLangNamesLabel']); ?></label>
189  <input class="text" id="format_lang_names" value="">
190  </div>
191  <div class="one_line_div">
192  <label class="left_right_aligned bold_char" for="installer_pw_length_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['PasswordLengthLabel']); ?></label>
193  <div class="right_left_aligned_div">
194  <select onchange="g_installer_object.gatherInstallerState()" id="installer_pw_length_select">
195  <?php
196  foreach ($comdef_install_wizard_strings['PW_LengthChices'] as $count) {
197  echo '<option';
198  if ($count == $prefs_array['min_pw_len']) {
199  echo ' selected="selected"';
200  }
201  echo ">$count</option>";
202  }
203  ?>
204  </select>
205  </div>
206  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['PasswordLengthExtraText']); ?></div>
207  </div>
208  <div class="one_line_div">
209  <label class="left_right_aligned bold_char" for="distance_units_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['DistanceUnitsLabel']); ?></label>
210  <div class="right_left_aligned_div">
211  <select onchange="g_installer_object.gatherInstallerState()" id="distance_units_select">
212  <option value="mi"<?php
213  if ($comdef_install_wizard_strings['DefaultDistanceUnits'] == 'mi') {
214  echo ' selected="selected"';
215  }
216  echo '>'.htmlspecialchars($comdef_install_wizard_strings['DistanceUnitsMiles']);
217  ?></option>
218  <option value="km"<?php
219  if ($comdef_install_wizard_strings['DefaultDistanceUnits'] == 'km') {
220  echo ' selected="selected"';
221  }
222 
223  echo '>'.htmlspecialchars($comdef_install_wizard_strings['DistanceUnitsKM']);
224  ?></option>
225  </select>
226  </div>
227  </div>
228  <div class="one_line_div">
229  <label class="left_right_aligned bold_char" for="search_count_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['SearchDepthLabel']); ?></label>
230  <div class="right_left_aligned_div">
231  <select onchange="g_installer_object.gatherInstallerState()" id="search_count_select">
232  <?php
233  foreach ($comdef_install_wizard_strings['DistanceChoices'] as $count) {
234  echo '<option';
235  if ($count == $prefs_array['number_of_meetings_for_auto']) {
236  echo ' selected="selected"';
237  }
238  echo ">$count</option>";
239  }
240  ?>
241  </select>
242  </div>
243  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['SearchDepthText']); ?></div>
244  </div>
245  <div class="one_line_div">
246  <label class="left_right_aligned bold_char" for="installer_history_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['HistoryDepthLabel']); ?></label>
247  <div class="right_left_aligned_div">
248  <select onchange="g_installer_object.gatherInstallerState()" id="installer_history_select">
249  <?php
250  foreach ($comdef_install_wizard_strings['HistoryChoices'] as $count) {
251  echo '<option';
252  if ($count == $prefs_array['change_depth_for_meetings']) {
253  echo ' selected="selected"';
254  }
255  echo ">$count</option>";
256  }
257  ?>
258  </select>
259  </div>
260  <div class="extra_text_div"><?php echo htmlspecialchars($comdef_install_wizard_strings['HistoryDepthText']); ?></div>
261  </div>
262  <div class="clear_both"></div>
263  <div class="one_line_div">
264  <label class="left_right_aligned bold_char" for="installer_duration_hour_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['DurationLabel']); ?></label>
265  <div class="right_left_aligned_div">
266  <select onchange="g_installer_object.gatherInstallerState()" id="installer_duration_hour_select">
267  <?php
268  $default_duration = explode(':', $comdef_install_wizard_strings['DefaultDurationTime']);
269  $default_duration[0] = intval($default_duration[0]);
270  $default_duration[1] = intval($default_duration[1]);
271 
272  for ($hours = 0; $hours < 24; $hours++) {
273  echo '<option value ="'.htmlspecialchars($hours).'"';
274  if ($default_duration[0] == $hours) {
275  echo ' selected="selected"';
276  }
277  echo '>'.htmlspecialchars($hours).'</option>';
278  }
279  ?>
280  </select>
281  <label class="extra_text_label" for="installer_duration_hour_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['DurationHourLabel']); ?></label>
282  </div>
283  <div class="right_left_aligned_div">
284  <select onchange="g_installer_object.gatherInstallerState()" id="installer_duration_minutes_select">
285  <?php
286  for ($minutes = 0; $minutes < 60; $minutes++) {
287  echo '<option value ="'.htmlspecialchars($minutes).'"';
288  if ($default_duration[1] == $minutes) {
289  echo ' selected="selected"';
290  }
291  echo '>'.htmlspecialchars(sprintf("%02d", $minutes)).'</option>';
292  }
293  ?>
294  </select>
295  <label class="extra_text_label" for="installer_duration_minute_select"><?php echo htmlspecialchars($comdef_install_wizard_strings['DurationMinutesLabel']); ?></label>
296  </div>
297  </div>
298  <div class="one_line_div">
299  <label class="left_right_aligned bold_char" for="installer_admin_language_selector_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['LanguageSelectorEnableLabel']); ?></label>
300  <div class="right_left_aligned_div">
301  <input type="checkbox" id="installer_admin_language_selector_checkbox" value="enable_language_selector" />
302  </div>
303  <div class="extra_text_div">
304  <?php echo htmlspecialchars($comdef_install_wizard_strings['LanguageSelectorEnableExtraText']); ?>
305  </div>
306  </div>
307  <div class="one_line_div">
308  <label class="left_right_aligned bold_char" for="semantic_admin_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['SemanticAdminLabel']); ?></label>
309  <div class="right_left_aligned_div">
310  <input type="checkbox" id="semantic_admin_checkbox" checked="checked" value="semantic_admin_checkbox_selector" />
311  </div>
312  <div class="extra_text_div">
313  <?php echo htmlspecialchars($comdef_install_wizard_strings['SemanticAdminExtraText']); ?>
314  </div>
315  </div>
316  <div class="one_line_div">
317  <label class="left_right_aligned bold_char" for="default_closed_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['DefaultClosedStatus']); ?></label>
318  <div class="right_left_aligned_div">
319  <input type="checkbox" id="default_closed_checkbox" checked="checked" value="default_closed_checkbox_selector" />
320  </div>
321  <div class="extra_text_div">
322  <?php echo htmlspecialchars($comdef_install_wizard_strings['DefaultClosedStatusExtraText']); ?>
323  </div>
324  </div>
325  <div class="one_line_div">
326  <label class="left_right_aligned bold_char" for="installer_admin_email_contact_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['EmailContactEnableLabel']); ?></label>
327  <div class="right_left_aligned_div">
328  <input type="checkbox" id="installer_admin_email_contact_checkbox" value="enable_email_contact_selector" onclick="reactToEmailCheckbox()" />
329  </div>
330  <div class="extra_text_div">
331  <?php echo htmlspecialchars($comdef_install_wizard_strings['EmailContactEnableExtraText']); ?>
332  </div>
333  </div>
334  <div class="one_line_div">
335  <label class="left_right_aligned bold_char" for="installer_admin_email_sba_contact_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['EmailContactAdminEnableLabel']); ?></label>
336  <div class="right_left_aligned_div">
337  <input type="checkbox" disabled="disabled" id="installer_admin_email_sba_contact_checkbox" value="enable_email_sba_contact_selector" onclick="reactToEmailCheckbox()" />
338  </div>
339  <div class="extra_text_div">
340  <?php echo htmlspecialchars($comdef_install_wizard_strings['EmailContactAdminEnableExtraText']); ?>
341  </div>
342  </div>
343  <div class="one_line_div">
344  <label class="left_right_aligned bold_char" for="installer_admin_email_all_admins_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['EmailContactAllAdminEnableLabel']); ?></label>
345  <div class="right_left_aligned_div">
346  <input type="checkbox" disabled="disabled" id="installer_admin_email_all_admins_checkbox" value="enable_email_all_admins_contact_selector" />
347  </div>
348  <div class="extra_text_div">
349  <?php echo htmlspecialchars($comdef_install_wizard_strings['EmailContactAllAdminEnableExtraText']); ?>
350  </div>
351  </div>
352  <div class="clear_both"></div>
353  </fieldset>
354  <?php echo bmlt_create_next_prev_buttons(3) ?>
355  </div>
356  <div id="bmlt_installer_page_4" class="bmlt_installer_page_4">
357  <?php echo bmlt_create_next_prev_buttons(4) ?>
358  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_4_Main_Intro']; ?></div>
359  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_4_NAWS_Export']; ?></div>
360  <div id="database_install_stuff_div" class="item_hidden">
361  <h1 class="page_heading_h1"><?php echo $comdef_install_wizard_strings['Page_4_Initialize_Root_Server_Heading']; ?></h1>
362  <div class="one_line_div">
363  <label class="left_right_aligned bold_char" for="bmlt_admin_naws_spreadsheet_file_input"><?php echo $comdef_install_wizard_strings['NAWS_Export_Spreadsheet_Optional']; ?></label>
364  <div class="right_left_aligned_div">
365  <input name="bmlt_admin_naws_spreadsheet_file_input" id="bmlt_admin_naws_spreadsheet_file_input" type="file" />
366  </div>
367  </div>
368  <div class="one_line_div">
369  <label class="left_right_aligned bold_char" for="bmlt_admin_naws_spreadsheet_publish_checkbox"><?php echo htmlspecialchars($comdef_install_wizard_strings['NAWS_Export_Spreadsheet_Initially_Publish']); ?></label>
370  <div class="right_left_aligned_div">
371  <input type="checkbox" id="bmlt_admin_naws_spreadsheet_publish_checkbox" checked="checked" />
372  </div>
373  </div>
374  <div class="one_line_div centered_text">
375  <a id="bmlt_installer_initialize_ajax_button" class="bmlt_admin_ajax_button" href="javascript:g_installer_object.initializeRootServer()"><?php echo htmlspecialchars($comdef_install_wizard_strings['Page_4_Initialize_Root_Server_Button']) ?></a>
376  <span id="bmlt_installer_initialize_ajax_button_throbber_span" class="item_hidden">
377  <img src="local_server/server_admin/style/images/ajax-throbber-white.gif" alt="AJAX Throbber" />
378  </span>
379  </div>
380  </div>
381  <div class="one_line_div"><div id="admin_db_items_warning" class="extra_text_div red_char"></div></div>
382  <div class="one_line_div"><div id="admin_google_api_key_warning" class="extra_text_div red_char"></div></div>
383  <div class="one_line_div"><div id="admin_server_admin_user_warning" class="extra_text_div red_char"></div></div>
384  <div id="result_code_div" class="item_hidden">
385  <h1 class="page_heading_h1"><?php echo $comdef_install_wizard_strings['Page_4_Heading']; ?></h1>
386  <h2 class="page_heading_h2"><?php echo $comdef_install_wizard_strings['Page_4_Text']; ?></h2>
387  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_4_File_Intro']; ?></div>
388  <div class="explanatory_text_div"><?php echo $comdef_install_wizard_strings['Explanatory_Text_4_File_Extra']; ?></div>
389  <pre class="result_code_pre" id="file_text_pre"></pre>
390  <h2 class="page_heading_h2"><?php echo sprintf($comdef_install_wizard_strings['Page_4_PathInfo'], $realpath, $basename); ?></h2>
391  <pre class="result_code_pre"><?php echo "chmod 0644 $realpath/auto-config.inc.php"; ?></pre>
392  <h2 class="page_heading_h2"><?php echo $comdef_install_wizard_strings['Page_4_Final']; ?></h2>
393  </div>
394  <div class="clear_both"></div>
395  <?php echo bmlt_create_next_prev_buttons(4) ?>
396  </div><?php
397  } else {
398  $ret .= '<span class="installer_error_display">';
399  $ret .= ( is_array($drivers) && count($drivers) ) ? htmlspecialchars($comdef_install_wizard_strings['Database_Type_MySQL_Error']) : htmlspecialchars($comdef_install_wizard_strings['Database_Type_Error']);
400  $ret .= '</span></dt>';
401  }
402  } else {
403  $ret .= '<span class="installer_error_display">'.htmlspecialchars($comdef_install_wizard_strings['Database_PDO_Error']).'</span></dt>';
404  }
405  } else {
406  $ret .= '<span class="installer_error_display">'.htmlspecialchars($comdef_install_wizard_strings['Database_Version_Error']).'</span></dt>';
407  }
408  ?>
409  </div>
410  </form>
411  <script type="text/javascript">
412  g_pw_length_warning_text = '<?php echo htmlspecialchars($comdef_install_wizard_strings['NeedLongerPasswordNote']); ?>';
413  g_db_init_no_pw_warning_text = '<?php echo htmlspecialchars($comdef_install_wizard_strings['NoDatabase_Note_PasswordIssue']); ?>';
414  g_server_settings_click_here = '<?php echo htmlspecialchars($comdef_install_wizard_strings['NoDatabase_Note_ServerSettings_ClickHere']); ?>';
415  g_db_init_db_set_warning_text = '<?php echo htmlspecialchars($comdef_install_wizard_strings['NoDatabase_Note_AlreadySet']); ?>';
416  g_db_init_db_generic_db_error_text = '<?php echo htmlspecialchars($comdef_install_wizard_strings['NoDatabase_Note_GenericError']); ?>';
417  g_db_init_db_click_here = '<?php echo htmlspecialchars($comdef_install_wizard_strings['NoDatabase_Note_ClickHere']); ?>';
418 
419  g_installer_object.m_ajax_uri = '<?php echo htmlspecialchars($_SERVER['PHP_SELF'].'?ajax_req='); ?>';
420 
421  g_installer_object.handleTextInputLoad(document.getElementById('installer_db_name_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Database_Name_Default_Text']); ?>','small');
422  g_installer_object.handleTextInputLoad(document.getElementById('installer_db_user_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Database_User_Default_Text']); ?>','small');
423  g_installer_object.handleTextInputLoad(document.getElementById('installer_db_pw_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Database_PW_Default_Text']); ?>','small');
424  g_installer_object.handleTextInputLoad(document.getElementById('installer_db_host_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Database_Host_Default_Text']); ?>','small');
425  g_installer_object.handleTextInputLoad(document.getElementById('installer_db_prefix_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Table_Prefix_Default_Text']); ?>','small');
426 
427  g_installer_object.handleTextInputLoad(document.getElementById('installer_admin_login_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Admin_Login_Default_Text']); ?>','med');
428  g_installer_object.handleTextInputLoad(document.getElementById('installer_admin_password_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['Admin_Password_Default_Text']); ?>','med');
429 
430  g_installer_object.handleTextInputLoad(document.getElementById('installer_title_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['TitleTextDefaultText']); ?>');
431  g_installer_object.handleTextInputLoad(document.getElementById('installer_banner_input'),'<?php echo htmlspecialchars($comdef_install_wizard_strings['BannerTextDefaultText']); ?>');
432  </script>
433 </div>
434 
435 <?php
436 /*******************************************************************/
437 /** \brief Creates the HTML for the next and prev buttons.
438 
439  \returns a string, containing the element HTML.
440 */
441 function bmlt_create_next_prev_buttons( $in_section ///< The page we are in. An integer.
442  )
443 {
445  $ret = '<div class="next_prev_container_div">';
446  if ($in_section > 1) {
447  $ret .= '<div class="prev_button_div">';
448  $ret .= '<a class="bmlt_admin_ajax_button" href="javascript:g_installer_object.selectPage'.strval($in_section - 1).'()">'.$comdef_install_wizard_strings['Prev_Button'].'</a>';
449  $ret .= '</div>';
450  }
451  if ($in_section < 4) {
452  $ret .= '<div class="next_button_div">';
453  $ret .= '<a class="bmlt_admin_ajax_button" href="javascript:g_installer_object.selectPage'.strval($in_section + 1).'()">'.$comdef_install_wizard_strings['Next_Button'].'</a>';
454  $ret .= '</div>';
455  }
456  $ret .= '<div class="clear_both"></div>';
457  $ret .= '</div>';
458 
459  return $ret;
460 }
461 
462 /*******************************************************************/
463 /** \brief Creates the select element for the Server default language.
464 
465  \returns a string, containing the select element HTML.
466 */
468 {
469  $ret = '';
470 
471  $basedir = dirname(dirname(__FILE__)).'/server_admin/lang/';
472 
473  $ret .= '<select onchange="g_installer_object.gatherInstallerState()" id="installer_lang_select">';
474  $dh = opendir($basedir);
475  $server_lang_names = array();
476 
477  if ($dh) {
478  while (false !== ($enum = readdir($dh))) {
479  $file_path = "$basedir$enum/name.txt";
480  if (file_exists($file_path)) {
481  $name = trim(file_get_contents($file_path));
482  $server_lang_names[$enum] = $name;
483  }
484  }
485 
486  closedir($dh);
487  }
488 
489  uksort($server_lang_names, 'ServerLangSortCallback');
490 
491  foreach ($server_lang_names as $enum => $name) {
492  $ret .= '<option value="'.htmlspecialchars($enum).'">'.htmlspecialchars($name).'</option>';
493  }
494 
495  $ret .= '</select>';
496 
497  return $ret;
498 }
499 
500 /*******************************************************************/
501 /** \brief This is a callback to sort the server languages.
502  The default server language will always be first, and
503  the rest will be sorted alphabetically.
504  \returns an integer. -1 if goes before b, 1 if otherwise, 0 if neither.
505 */
507  $in_lang_a,
508  $in_lang_b
509 ) {
510  global $default_lang;
511 
512  $ret = 0;
513 
514  if ($in_lang_a == $default_lang) {
515  $ret = -1;
516  } elseif ($in_lang_b == $default_lang) {
517  $ret = 1;
518  } else {
519  $ret = strncasecmp($in_lang_a, $in_lang_b, strlen($in_lang_a));
520  }
521 
522  return $ret;
523 }
524 
525 /*******************************************************************/
526 /** \brief Creates the select element for the Region bias.
527 
528  \returns a string, containing the select element HTML.
529 */
531 {
532  global $prefs_array;
533  $ret = '';
534 
535  $file_path = dirname(__FILE__).'/country_names_and_code_elements.txt';
536  $cc_array = explode("\n", file_get_contents($file_path));
537 
538  $ret .= '<select onchange="g_installer_object.gatherInstallerState()" id="installer_region_bias_select">';
539  foreach ($cc_array as $cc) {
540  $cc_elem = explode("\t", trim($cc));
541 
542  if (isset($cc_elem) && is_array($cc_elem) && (count($cc_elem) == 2)) {
543  $name = ucwords(strtolower(trim($cc_elem[0])));
544  $code = strtolower(trim($cc_elem[1]));
545  $ret .= '<option value="'.htmlspecialchars($code).'"';
546  if (strtolower($prefs_array['region_bias']) == $code) {
547  $ret .= ' selected="selected"';
548  }
549  $ret .= '>'.htmlspecialchars($name).'</option>';
550  }
551  }
552  $ret .= '</select>';
553 
554  return $ret;
555 }
556 
557 /*******************************************************************/
558 /** \brief Creates the select element for the PDO driver selector.
559 
560  \returns a string, containing the select element HTML.
561 */
563 {
564  global $prefs_array;
565  $ret = '';
566 
567  $ret .= '<select onchange="g_installer_object.gatherInstallerState()" id="installer_db_type_select">';
568  $found = false;
569  foreach (PDO::getAvailableDrivers() as $driver) {
570  if ($driver == 'mysql') { // Currently, we only support MySQL.
571  $ret .= '<option value="'.htmlspecialchars($driver).'"';
572 // if ( $driver == $prefs_array['dbType'] )
573 // {
574  $ret .= ' selected="selected"';
575 // }
576  $ret .= '>'.htmlspecialchars($driver).'</option>';
577  $found = true;
578  }
579  }
580  if ($found) {
581  $ret .= '</select>';
582  } else {
583  $ret = '<h1>ERROR!</h1>';
584  }
585 
586  return $ret;
587 }
588 ?>
ServerLangSortCallback($in_lang_a, $in_lang_b)
This is a callback to sort the server languages. The default server language will always be first...
if($handler instanceof c_comdef_admin_ajax_handler)
$ret
Definition: contact.php:226
function sprintf()
Definition: installer.js:873
bmlt_create_pdo_driver_select()
Creates the select element for the PDO driver selector.
bmlt_create_region_bias_select()
Creates the select element for the Region bias.
var a
$realpath
global $comdef_install_wizard_strings
Definition: installer.php:32
function BMLTInstaller(in_prefs)
Definition: installer.js:17
$basename
global $default_lang
array2json($arr)
Encodes a given associative array into a JSON object string.
Definition: Array2Json.php:41
bmlt_create_next_prev_buttons($in_section)
Creates the HTML for the next and prev buttons.
defined('BMLT_EXEC') or define('BMLT_EXEC'
Definition: index.php:3
global $prefs_array
Definition: installer.php:32
bmlt_create_lang_select()
Creates the select element for the Server default language.