1<?php
2
3/* @config file ------------------ */
4require_once( dirname(__FILE__) . '/classes/class.Config.php' );
5$config = Config::get('config');
6
7/**
8 * proxy to use for every internet access like update check
9 ******************************/
10if (Config::get('proxy_enabled') == true) {
11	$proxy_settings = [
12		'proxy'           => 'tcp://'.Config::get('proxy_server').':'.Config::get('proxy_port'),
13		'request_fulluri' => true];
14
15	if (Config::get('proxy_use_auth') == true) {
16		$proxy_auth = base64_encode(Config::get('proxy_user').':'.Config::get('proxy_pass'));
17		$proxy_settings['header'] = "Proxy-Authorization: Basic ".$proxy_auth;
18	}
19	stream_context_set_default (['http' => $proxy_settings]);
20
21	/* for debugging proxy config uncomment next line */
22	// var_dump(stream_context_get_options(stream_context_get_default()));
23}
24
25/* global and missing functions */
26require('global_functions.php');
27
28/* @http only cookies ------------------- */
29if(php_sapi_name()!="cli")
30	ini_set('session.cookie_httponly', 1);
31
32/* @debugging functions ------------------- */
33if(Config::get('debugging')==true) {
34	ini_set('display_errors', 1);
35	ini_set('display_startup_errors', 1);
36	error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
37}
38else {
39	ini_set('display_errors', 0);
40	ini_set('display_startup_errors', 0);
41	error_reporting(E_ERROR ^ E_WARNING);
42}
43
44// auto-set base if not already defined
45if(!defined('BASE')) {
46	$root = substr($_SERVER['DOCUMENT_ROOT'],-1)=="/" ? substr($_SERVER['DOCUMENT_ROOT'],0,-1) : $_SERVER['DOCUMENT_ROOT'];	// fix for missing / in some environments
47	define('BASE', substr(str_replace($root, "", dirname(__FILE__)),0,-9));
48}
49
50// Fix JSON_UNESCAPED_UNICODE for PHP 5.3
51defined('JSON_UNESCAPED_UNICODE') or define('JSON_UNESCAPED_UNICODE', 256);
52
53/* @classes ---------------------- */
54require( dirname(__FILE__) . '/classes/class.Common.php' );		//Class common - common functions
55require( dirname(__FILE__) . '/classes/class.PDO.php' );		//Class PDO - wrapper for database
56require( dirname(__FILE__) . '/classes/class.User.php' );		//Class for active user management
57require( dirname(__FILE__) . '/classes/class.Log.php' );		//Class for log saving
58require( dirname(__FILE__) . '/classes/class.Result.php' );		//Class for result printing
59require( dirname(__FILE__) . '/classes/class.Install.php' );	//Class for Install
60require( dirname(__FILE__) . '/classes/class.Sections.php' );	//Class for sections
61require( dirname(__FILE__) . '/classes/class.Subnets.php' );	//Class for subnets
62require( dirname(__FILE__) . '/classes/class.Tools.php' );		//Class for tools
63require( dirname(__FILE__) . '/classes/class.Addresses.php' );	//Class for addresses
64require( dirname(__FILE__) . '/classes/class.Scan.php' );		//Class for Scanning and pinging
65require( dirname(__FILE__) . '/classes/class.DNS.php' );		//Class for DNS management
66require( dirname(__FILE__) . '/classes/class.PowerDNS.php' );	//Class for PowerDNS management
67require( dirname(__FILE__) . '/classes/class.FirewallZones.php' );	//Class for firewall zone management
68require( dirname(__FILE__) . '/classes/class.Admin.php' );		//Class for Administration
69require( dirname(__FILE__) . '/classes/class.Mail.php' );		//Class for Mailing
70require( dirname(__FILE__) . '/classes/class.Rackspace.php' );	//Class for Racks
71require( dirname(__FILE__) . '/classes/class.SNMP.php' );	    //Class for SNMP queries
72require( dirname(__FILE__) . '/classes/class.DHCP.php' );	    //Class for DHCP
73require( dirname(__FILE__) . '/classes/class.Rewrite.php' );	    //Class for DHCP
74require( dirname(__FILE__) . '/classes/class.SubnetsTree.php' );	    //Class for generating list of subnets based on nested tree structure
75require( dirname(__FILE__) . '/classes/class.SubnetsMenu.php' );	    //Class for generating subnets menu.
76require( dirname(__FILE__) . '/classes/class.SubnetsTable.php' );	    //Class for generating JSON to populate subnet <tables> using boostrap-tables.
77require( dirname(__FILE__) . '/classes/class.SubnetsMasterDropDown.php' );	    //Class for generating HTML master subnet dropdown menus
78require( dirname(__FILE__) . '/classes/class.Devtype.php' );	    //
79require( dirname(__FILE__) . '/classes/class.Devices.php' );	    //
80require( dirname(__FILE__) . '/classes/class.Crypto.php' );	    	// Crypto class
81require( dirname(__FILE__) . '/classes/class.Password_check.php' );	// Class for password check
82require( dirname(__FILE__) . '/classes/class.Session_DB.php' );	    // Class for storing sessions to database
83require( dirname(__FILE__) . '/classes/class.LockForUpdate.php' );	    // Class for MySQL row locking
84
85
86
87# create default GET parameters
88$Rewrite = new Rewrite ();
89$_GET = $Rewrite->get_url_params ();
90
91/* get version */
92include('version.php');
93