BMLT Root Server
Functions | Variables
installer_guts.php File Reference

Go to the source code of this file.

Functions

 bmlt_create_next_prev_buttons ($in_section)
 Creates the HTML for the next and prev buttons. More...
 
 bmlt_create_lang_select ()
 Creates the select element for the Server default language. More...
 
 ServerLangSortCallback ($in_lang_a, $in_lang_b)
 This is a callback to sort the server languages. The default server language will always be first, and the rest will be sorted alphabetically. More...
 
 bmlt_create_region_bias_select ()
 Creates the select element for the Region bias. More...
 
 bmlt_create_pdo_driver_select ()
 Creates the select element for the PDO driver selector. More...
 

Variables

 $basename = basename(realpath(dirname(__FILE__).'/../../'))
 
 $realpath = realpath(dirname(__FILE__).'/../../../')
 
global $default_lang = $lang
 
if(version_compare(PHP_VERSION, '5.6.0', '>=')) else
 

Function Documentation

bmlt_create_lang_select ( )

Creates the select element for the Server default language.

Returns
a string, containing the select element HTML.

Definition at line 467 of file installer_guts.php.

References $ret.

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 }
$ret
Definition: contact.php:226
bmlt_create_next_prev_buttons (   $in_section)

Creates the HTML for the next and prev buttons.

Returns
a string, containing the element HTML.
Parameters
$in_sectionThe page we are in. An integer.

Definition at line 441 of file installer_guts.php.

References $comdef_install_wizard_strings, and $ret.

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 }
$ret
Definition: contact.php:226
global $comdef_install_wizard_strings
Definition: installer.php:32
bmlt_create_pdo_driver_select ( )

Creates the select element for the PDO driver selector.

Returns
a string, containing the select element HTML.

Definition at line 562 of file installer_guts.php.

References $prefs_array, and $ret.

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 }
$ret
Definition: contact.php:226
global $prefs_array
Definition: installer.php:32
bmlt_create_region_bias_select ( )

Creates the select element for the Region bias.

Returns
a string, containing the select element HTML.

Definition at line 530 of file installer_guts.php.

References $prefs_array, and $ret.

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 }
$ret
Definition: contact.php:226
global $prefs_array
Definition: installer.php:32
ServerLangSortCallback (   $in_lang_a,
  $in_lang_b 
)

This is a callback to sort the server languages. The default server language will always be first, and the rest will be sorted alphabetically.

Returns
an integer. -1 if goes before b, 1 if otherwise, 0 if neither.

Definition at line 506 of file installer_guts.php.

References $default_lang, and $ret.

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 }
$ret
Definition: contact.php:226
global $default_lang

Variable Documentation

$basename = basename(realpath(dirname(__FILE__).'/../../'))

Definition at line 20 of file installer_guts.php.

$default_lang = $lang

Definition at line 23 of file installer_guts.php.

Referenced by GetServerInfo(), and ServerLangSortCallback().

$realpath = realpath(dirname(__FILE__).'/../../../')

Definition at line 21 of file installer_guts.php.

if (version_compare(PHP_VERSION, '5.6.0', '>=')) else
Initial value:
{
$ret .= '<span class="installer_error_display">'.htmlspecialchars($comdef_install_wizard_strings['Database_Version_Error']).'</span></dt>'
$ret
Definition: contact.php:226
global $comdef_install_wizard_strings
Definition: installer.php:32

Definition at line 405 of file installer_guts.php.