<?php require_once '/var/www/lib/utilities.php'; $networkConfiguration = networkConfiguration(); $imOnCable = $_SERVER['SERVER_ADDR'] == $networkConfiguration['eth'] ? true : false; ?> <script src="/assets/js/app.config.js?"></script> <script src="/assets/js/bootstrap/bootstrap.min.js"></script> <script src="/assets/js/notification/SmartNotification.min.js"></script> <script src="/assets/js/plugin/jquery-validate/jquery.validate.min.js"></script> <script src="/assets/js/plugin/msie-fix/jquery.mb.browser.min.js"></script> <script src="/assets/js/plugin/fastclick/fastclick.min.js"></script> <script src="/assets/js/plugin/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script> <!--[if IE 7]> <h1> Your browser is out of date, please update your browser by going to www.microsoft.com/download </h1> <![endif]--> <!-- MAIN APP JS FILE --> <script src="/assets/js/app.min.js"></script> <script type="text/javascript"> runAllForms(); var ask_wifi_password = false; var wifi_password; var wifi_ssid; $(document).ready(function() {
function network() { $this->layout->add_js_file(array('src' => 'application/layout/assets/js/plugin/bootstrap-progressbar/bootstrap-progressbar.min.js', 'comment' => '')); $this->layout->add_js_file(array('src' => 'application/layout/assets/js/plugin/masked-input/jquery.maskedinput.min.js', 'comment' => '')); /** LOAD HELPERS */ $this->load->helper("os_helper"); $this->load->database(); $this->load->model('configuration'); $saved_wifi = $this->configuration->get_config_value('wifi'); $saved_wifi = json_decode($saved_wifi, true); $networkConfiguration = networkConfiguration(); $ethEndIp = explode('.', $networkConfiguration['eth']); $ethEndIp = end($ethEndIp); //current_wlan(); $data['ethEndIp'] = $ethEndIp; $_tab_header = $this->tab_header('network'); $data['wifi_saved'] = $saved_wifi; $data['_breadcrumb'] = 'Network'; $data['_tab_header'] = $_tab_header; $data['lan'] = lan(); $data['con_wlan'] = wlan(); $data['wlan'] = scan_wlan(); $data['networkConfiguration'] = $networkConfiguration; $data['imOnCable'] = $_SERVER['SERVER_ADDR'] == $networkConfiguration['eth'] ? true : false; $data['_tab_content'] = $this->load->view('index/network/index', $data, TRUE); $js_in_page = $this->load->view('index/network/js', $data, TRUE); $this->layout->add_js_in_page(array('data' => $js_in_page, 'comment' => '')); //$this->layout->set_compress(false); $this->layout->view('index/index', $data); }
clean_temp(); /** DELETE AUTOINSTALL FILE */ if (file_exists('/var/www/AUTOINSTALL')) { shell_exec('sudo rm /var/www/AUTOINSTALL'); } /** UPLOAD SIMBOLIC LINK */ if (!is_link(FABUI_PATH . 'upload')) { shell_exec('sudo ln -s ' . UPLOAD_PATH . ' ' . FABUI_PATH . 'upload'); } /** MOVE DEFAULT FILES TO FOLDERS */ shell_exec('sudo cp /var/www/recovery/install/file/Marvin_KeyChain_FABtotum.gcode ' . UPLOAD_PATH . 'gcode/Marvin_KeyChain_FABtotum.gcode'); shell_exec('sudo cp /var/www/recovery/install/file/bracelet.gcode ' . UPLOAD_PATH . 'gcode/bracelet.gcode'); shell_exec('sudo chmod 777 ' . UPLOAD_PATH . 'gcode/Marvin_KeyChain_FABtotum.gcode'); shell_exec('sudo chmod 777 ' . UPLOAD_PATH . 'gcode/bracelet.gcode'); /** CLEAN SESSION */ foreach ($_SESSION as $key => $value) { unset($_SESSION[$key]); } //set ip ethernet static address $actual_network_configuration = networkConfiguration(); $network = false; if ($actual_network_configuration['eth'] != '169.254.1.' . $_ip_address) { setEthIP($_ip_address); $network = true; } $response_items['installed'] = true; $response_items['network'] = $network; echo json_encode($response_items); } else { echo "Access denied"; }
/** * Set Ethernet static IP address */ function setEthIP($ip) { $ip = '169.254.1.' . $ip; $networkConfiguration = networkConfiguration(); setNetworkConfiguration($ip, $networkConfiguration['wifi']); $response = shell_exec("sudo service networking reload"); }
/** * Set Wlan */ function setWifi($ssid, $password, $type = "WPA") { $networkConfiguration = networkConfiguration(); setNetworkConfiguration($networkConfiguration['eth'], array('ssid' => $ssid, 'password' => $password, 'type' => $type)); $response = shell_exec("sudo service networking reload"); if (strpos($response, 'PING') !== false || strpos($response, 'errors') !== false) { return false; } else { return true; } }