root/alternc/tags/0.9.7/bureau/class/local.php

Revision 1012, 0.7 kB (checked in by anarcat, 3 years ago)

bring back the version in the left menu. we do it on build as before,
editing local.php, but not exactly as before as local.php is now
dynamic. we therefore rely of it containing a special string which
we replace in debian/rules. admins can disable the version display by
setting it to empty in /etc/alternc/local.sh

Closes: #637

Line 
1 <?php
2 /* Read global variables (AlternC configuration) */
3
4 $L_VERSION="v. @@REPLACED_DURING_BUILD@@";
5
6 /* To ease the transition, we define a lookup table for old names */
7 $compat = array('DEFAULT_MX' => 'MX',
8                 'MYSQL_USER' => 'MYSQL_LOGIN',
9                 'MYSQL_PASS' => 'MYSQL_PWD',
10                'NS1_HOSTNAME' => 'NS1',
11                'NS2_HOSTNAME' => 'NS2'
12               );
13
14
15 $config_file = fopen('/etc/alternc/local.sh', 'r');
16 while (FALSE !== ($line = fgets($config_file))) {
17     if (ereg('([A-Z0-9_]*)="([^"]*)"', $line, $regs)) {
18         $GLOBALS['L_'.$regs[1]] = $regs[2];
19        if (isset($compat[$regs[1]])) {
20            $GLOBALS['L_'.$compat[$regs[1]]] = $regs[2];
21        }
22     }
23 }
24 fclose($config_file);
25 ?>
26
Note: See TracBrowser for help on using the browser.