Alternc  latest
Alternc logiel libre pour l'hébergement
local.php
Go to the documentation of this file.
1 <?php
2 
3 /* Read global variables (AlternC configuration) */
4 $L_VERSION = "@@REPLACED_DURING_BUILD@@";
5 
6 // To be able to have displayer version != help version
7 // (usefull during RC, etc...)
9 
10 /* To ease the transition, we define a lookup table for old names */
11 $compat = array('DEFAULT_MX' => 'MX',
12 'MYSQL_USER' => 'MYSQL_LOGIN',
13 'MYSQL_PASS' => 'MYSQL_PWD',
14 'NS1_HOSTNAME' => 'NS1',
15 'NS2_HOSTNAME' => 'NS2');
16 
17 
18 $config_file = fopen('/etc/alternc/local.sh', 'r');
19 while (FALSE !== ($line = fgets($config_file))) {
20  if (preg_match('/^([A-Za-z0-9_]*) *= *"?(.*?)"?$/', trim($line), $regs)) {
21  $GLOBALS['L_' . $regs[1]] = $regs[2];
22  if (isset($compat[$regs[1]])) {
23  $GLOBALS['L_' . $compat[$regs[1]]] = $regs[2];
24  }
25  }
26 }
27 
28 fclose($config_file);
29 
30 $config_file = fopen('/etc/alternc/my.cnf', 'r');
31 while (false!== ($line = fgets($config_file))) {
32  if (preg_match('/^([A-Za-z0-9_]*) *= *"?(.*?)"?$/', trim($line), $regs)) {
33  switch ($regs[1]) {
34  case "user":
35  $GLOBALS['L_MYSQL_LOGIN'] = $regs[2];
36  break;
37  case "password":
38  $GLOBALS['L_MYSQL_PWD'] = $regs[2];
39  break;
40  case "host":
41  $GLOBALS['L_MYSQL_HOST'] = $regs[2];
42  break;
43  case "database":
44  $GLOBALS['L_MYSQL_DATABASE'] = $regs[2];
45  break;
46  }
47  }
48 }
49 
50 fclose($config_file);
$L_VERSION
Definition: local.php:4
$L_VERSION_HELP
Definition: local.php:8
$compat
Definition: local.php:11
$config_file
Definition: local.php:18