Alternc  latest
Alternc logiel libre pour l'hébergement
bootstrap.php
Go to the documentation of this file.
1 <?php
2 
3 
4 /* Global variables (AlternC configuration) */
5 require_once("/usr/share/alternc/panel/class/local.php");
6 
7 // Define constants from vars of /etc/alternc/local.sh
8 // The you can't choose where is the AlternC Panel
9 define('ALTERNC_MAIL', "$L_ALTERNC_MAIL");
10 define('ALTERNC_HTML', "$L_ALTERNC_HTML");
11 if(isset($L_ALTERNC_LOGS_ARCHIVE))
12  define('ALTERNC_LOGS_ARCHIVE', "$L_ALTERNC_LOGS_ARCHIVE");
13 define('ALTERNC_LOGS', "$L_ALTERNC_LOGS");
14 define('ALTERNC_PANEL', "/usr/share/alternc/panel");
15 define('ALTERNC_LOCALES', ALTERNC_PANEL."/locales");
16 define('ALTERNC_LOCK_JOBS', '/run/alternc/jobs-lock');
17 define('ALTERNC_LOCK_PANEL', '/var/lib/alternc/panel/nologin.lock');
18 
19 /* PHPLIB inclusions : */
21 
22 require_once($root."class/db_mysql.php");
23 require_once($root."class/functions.php");
24 
25 
27 
28 class DB_system extends DB_Sql {
29  function __construct() {
32  }
33 }
34 
35 // we do both:
36 $db= new DB_system();
37 $dbh = new PDO("mysql:host=".$L_MYSQL_HOST.";dbname=".$L_MYSQL_DATABASE, $L_MYSQL_LOGIN,$L_MYSQL_PWD,
38  array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8;")
39  );
40 
41 
42 // Current User ID = the user whose commands are made on behalf of.
44 
45 $classes=array();
46 /* CLASSES PHP : automatic include : */
47 $c=opendir($root."class/");
48 while ($di=readdir($c)) {
49  if (preg_match("#^m_(.*)\\.php$#",$di,$match)) { // $
50  $name1="m_".$match[1];
51  $name2=$match[1];
52  $classes[]=$name2;
53  require_once($root."class/".$name1.".php");
54  }
55 }
56 closedir($c);
57 /* THE DEFAULT CLASSES ARE :
58  dom, ftp, mail, quota, bro, admin, mem, mysql, err
59 */
60 
61 
62 /* Language */
63 //include_once("../../class/lang_env.php");
64 
65 // Adaptation to BOTH version of the variables managed by AlternC 1/3/4
66 if (is_file($root."/class/variables.php")) {
67  require_once($root."/class/variables.php");
68 } else {
69  $variables=new m_variables();
70 }
71 $mem=new m_mem();
72 $err=new m_err();
75 $msg = new m_messages();
76 
77 
78 for($i=0;$i<count($classes);$i++) {
79  $name2=$classes[$i];
80  if (isset($$name2)) continue; // for already instancied class like mem, err or authip
81  $name1="m_".$name2;
82  $$name2= new $name1();
83 }
84 
$hooks
Definition: bootstrap.php:74
const ALTERNC_PANEL
Definition: bootstrap.php:14
global $L_MYSQL_LOGIN
Definition: bootstrap.php:26
global $db
Definition: bootstrap.php:26
$classes
Definition: bootstrap.php:45
global $L_MYSQL_HOST
Definition: bootstrap.php:22
$mem
Definition: bootstrap.php:71
$msg
Definition: bootstrap.php:75
global $L_MYSQL_PWD
Definition: bootstrap.php:26
$authip
Definition: bootstrap.php:73
if(isset($L_ALTERNC_LOGS_ARCHIVE)) define('ALTERNC_LOGS_ARCHIVE' $L_ALTERNC_LOGS_ARCHIVE
Definition: bootstrap.php:11
$root
Definition: bootstrap.php:20
$c
Definition: bootstrap.php:47
global $dbh
Definition: bootstrap.php:26
global $L_MYSQL_DATABASE
Definition: bootstrap.php:26
$err
Definition: bootstrap.php:72
$cuid
Definition: bootstrap.php:43
Mysql Database class.
Definition: db_mysql.php:27
Class for MySQL management in the panel.
Definition: bootstrap.php:28
__construct()
Definition: bootstrap.php:29
Authorized-ip class.
Definition: m_authip.php:26
Classe de gestion des erreurs apparaissant lors d'appels API.
Definition: m_err.php:38
This class manage hooks that any other class or panel page can call.
Definition: m_hooks.php:27
This class manage user sessions in the web desktop.
Definition: m_mem.php:28
Handle messages (error, warning, info, ok) appearing in API calls.
Definition: m_messages.php:33
$i