<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * config.replication.php - DHCPD Replication configuration
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
        //define the template and cache directories
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * manage.pools.php - Manage custom pools
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $encrypt = new Encryption();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * hosts.search.php - DHCPD Search for static host
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $encrypt = new Encryption();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * admin.import.hosts.php - DHCPD Import static hosts using xml or csv files
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
        //define the template and cache directories
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * index.php - index or main page
 */
// load our config data
if (file_exists("../../../scripts/inc.config.php")) {
    require '../../../scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $encrypt = new Encryption();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * setup.php - Setup script
 */
// get our libraries
require '../scripts/classes/class.dbase.php';
require '../scripts/classes/class.errors.php';
require '../scripts/classes/class.validation.php';
require '../scripts/classes/class.libraries.php';
// init our libraries
$db = new dbConn();
$err = new GenerateErrors();
$val = new ValidateStrings();
$misc = new MiscFunctions();
// Assign some defaults since nothing is configured
$TITLE = "phpDHCPAdmin-0.9.5-beta Setup Wizard";
$STYLE = "../templates/black";
$DESCRIPTION = "I am here to help you import the database structure and setup the application defaults";
$DISCLAIMER = "All rights reserved 2009 &reg; Jason Gerfen";
$TABLES = array('admin_backup_conf', 'admin_config_algorithm', 'admin_logs', 'admin_sessions', 'auth_groups', 'auth_levels', 'auth_users', 'conf_adapters', 'conf_classes', 'conf_classes_options', 'conf_classes_opts', 'conf_dnssec_opts', 'conf_dns_opts', 'conf_failover', 'conf_global_opts', 'conf_hosts', 'conf_leases', 'conf_leases_properties', 'conf_pools', 'conf_pxe_groups', 'conf_pxe_opts', 'conf_shared_networks', 'conf_subnets', 'conf_traffic');
$REGEX = array('/\\$defined[\'hostname\']\\s\\s\\s\\s=\\s\\"\\";/', '/\\$defined[\'dbhost\']\\s\\s\\s\\s\\s\\s=\\s\\"localhost\\";/', '/\\$defined[\'username\']\\s\\s\\s\\s=\\s\\"\\";/', '/\\$defined[\'password\']\\s\\s\\s\\s=\\s\\"\\";/', '/\\$defined[\'mail\']\\s\\s\\s\\s\\s\\s\\s\\s=\\s\\"\\";/', '/\\$defined[\'virpath\']\\s\\s\\s\\s\\s=\\s\\"\\";/');
// lets process the form
if (!empty($_POST)) {
    // make sure we have a complete form submission
    if (!empty($_POST['mysql_root_user']) && !empty($_POST['mysql_root_passwd']) && !empty($_POST['defined_hostname']) && !empty($_POST['mysql_server_address']) && !empty($_POST['mysql_server_username']) && !empty($_POST['mysql_server_password']) && !empty($_POST['configuration_path']) && !empty($_POST['admin_email'])) {
        // ensure nothing screwy is going on in regards to input
        if ($val->ValidateString($_POST['mysql_root_user']) !== -1 && $val->ValidateParagraph($_POST['mysql_root_passwd']) !== -1 && $val->ValidateDomain($_POST['defined_hostname']) !== -1 && $val->ValidateDomain($_POST['mysql_server_address']) !== -1 && $val->ValidateParagraph($_POST['mysql_server_username']) !== -1 && $val->ValidateParagraph($_POST['mysql_server_password']) !== -1 && $val->ValidateParagraph($_POST['configuration_path']) !== -1 && $val->ValidateEmail($_POST['admin_email']) !== -1) {
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * admin.manage.groups.php - Manage groups
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $encrypt = new Encryption();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        $enc = new Encryption();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * subnet.add.php - DHCPD Add a new subnet
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $encrypt = new Encryption();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * restart.dhcpd.php - DHCPD Restart service
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
        //define the template and cache directories
<?php

/*
 * phpDHCPAdmin
 * Jason Gerfen [jason.gerfen@gmail.com]
 *
 * hosts.search.php - DHCPD Search for static host
 */
// load our config data
if (file_exists("scripts/inc.config.php")) {
    require 'scripts/inc.config.php';
    // ensure we are being called from our configured host
    if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
        // Initialize classes
        $db = new dbConn();
        $err = new GenerateErrors();
        $tpl = new Template();
        $skin = new PageSkinner();
        $val = new ValidateStrings();
        $menu = new GenerateNavMenu();
        $auth = new Authenticate();
        $encrypt = new Encryption();
        $level = new AccessLevels();
        $misc = new MiscFunctions();
        $debug = new DebugData();
        // initialize a db connection handle
        $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
        // ensure our sessions are present
        if (empty($_SESSION['token'])) {
            $sessions = new dbSession();
        }
     }
 }
 // configuration check
 if (empty($defined['hostname']) || empty($defined['dbhost']) || empty($defined['username']) || empty($defined['password']) || empty($defined['dbname']) || empty($defined['virpath'])) {
     $configerrors = "The inc.config.php file is missing configuration directives.";
     echo $configerrors;
     exit;
 }
 // just some defs
 $LIBERROR = NULL;
 $CONFIGERRORS = NULL;
 // ensure we are being called from our configured host
 if ($defined['hostname'] === $_SERVER['SERVER_NAME']) {
     // Initialize classes
     $db = new dbConn();
     $err = new GenerateErrors();
     $tpl = new Template();
     $skin = new PageSkinner();
     $val = new ValidateStrings();
     $menu = new GenerateNavMenu();
     $auth = new Authenticate();
     $encrypt = new Encryption();
     $level = new AccessLevels();
     $misc = new MiscFunctions();
     $debug = new DebugData();
     // initialize a db connection handle
     $dbconn = $db->dbConnect($defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname']);
     // ensure our sessions are present
     if (empty($_SESSION['token'])) {
         $sessions = new dbSession();
     }