2015-02-16 10:30:58 +01:00
|
|
|
<?php
|
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
/**
|
|
|
|
* Raspbian WiFi Configuration Portal
|
|
|
|
*
|
|
|
|
* Enables use of simple web interface rather than SSH to control wifi and hostapd on the Raspberry Pi.
|
|
|
|
* Recommended distribution is Raspbian Server Edition. Specific instructions to install the supported software are
|
|
|
|
* in the README and original post by @SirLagz. For a quick run through, the packages required for the WebGUI are:
|
2019-04-13 17:19:13 +02:00
|
|
|
* lighttpd (I have version 1.4.45 installed via apt)
|
|
|
|
* php7-cgi (I have version 7.0.33-0+deb9u3 installed via apt)
|
|
|
|
* along with their supporting packages, php7 will also need to be enabled.
|
2019-04-10 10:37:35 +02:00
|
|
|
*
|
2017-10-03 06:32:30 +02:00
|
|
|
* @author Lawrence Yau <sirlagz@gmail.com>
|
2015-02-25 14:06:48 +01:00
|
|
|
* @author Bill Zimmerman <billzimmerman@gmail.com>
|
2016-06-14 21:00:17 +02:00
|
|
|
* @license GNU General Public License, version 3 (GPL-3.0)
|
2019-06-12 21:14:26 +02:00
|
|
|
* @version 1.5.1
|
2016-06-14 21:00:17 +02:00
|
|
|
* @link https://github.com/billz/raspap-webgui
|
2015-02-25 14:06:48 +01:00
|
|
|
* @see http://sirlagz.net/2013/02/08/raspap-webgui/
|
|
|
|
*/
|
|
|
|
|
2019-08-06 21:34:58 +02:00
|
|
|
require('includes/csrf.php');
|
2019-08-07 23:53:04 +02:00
|
|
|
ensureCSRFSessionToken();
|
2018-05-29 20:52:41 +02:00
|
|
|
|
2019-04-10 10:37:35 +02:00
|
|
|
include_once('includes/config.php');
|
|
|
|
include_once(RASPI_CONFIG.'/raspap.php');
|
|
|
|
include_once('includes/locale.php');
|
|
|
|
include_once('includes/functions.php');
|
|
|
|
include_once('includes/dashboard.php');
|
|
|
|
include_once('includes/authenticate.php');
|
|
|
|
include_once('includes/admin.php');
|
|
|
|
include_once('includes/dhcp.php');
|
|
|
|
include_once('includes/hostapd.php');
|
|
|
|
include_once('includes/system.php');
|
|
|
|
include_once('includes/configure_client.php');
|
|
|
|
include_once('includes/networking.php');
|
|
|
|
include_once('includes/themes.php');
|
|
|
|
include_once('includes/data_usage.php');
|
|
|
|
include_once('includes/about.php');
|
2015-02-25 14:06:48 +01:00
|
|
|
|
2015-02-16 10:30:58 +01:00
|
|
|
$output = $return = 0;
|
|
|
|
$page = $_GET['page'];
|
2016-06-24 23:39:39 +02:00
|
|
|
|
2019-04-10 10:37:35 +02:00
|
|
|
if (!isset($_COOKIE['theme'])) {
|
2017-10-09 16:04:59 +02:00
|
|
|
$theme = "custom.css";
|
2017-10-07 01:08:06 +02:00
|
|
|
} else {
|
2017-10-09 16:04:59 +02:00
|
|
|
$theme = $_COOKIE['theme'];
|
2017-10-07 01:08:06 +02:00
|
|
|
}
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2018-07-31 23:51:15 +02:00
|
|
|
$theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
|
|
|
|
|
|
|
|
?><!DOCTYPE html>
|
2015-02-25 14:06:48 +01:00
|
|
|
<html lang="en">
|
2016-07-27 22:34:56 +02:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2019-07-30 17:22:03 +02:00
|
|
|
<?php echo CSRFMetaTag() ?>
|
2015-02-25 14:06:48 +01:00
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta name="description" content="">
|
|
|
|
<meta name="author" content="">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2017-10-23 19:37:59 +02:00
|
|
|
<title><?php echo _("Raspbian WiFi Configuration Portal"); ?></title>
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Bootstrap Core CSS -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2019-03-06 11:43:36 +01:00
|
|
|
<!-- Bootstrap Toggle CSS -->
|
|
|
|
<link href="vendor/bootstrap-toggle/css/bootstrap-toggle.min.css" rel="stylesheet">
|
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- MetisMenu CSS -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Timeline CSS -->
|
|
|
|
<link href="dist/css/timeline.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Custom CSS -->
|
2018-03-09 11:08:52 +01:00
|
|
|
<link href="dist/css/sb-admin-2.min.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Morris Charts CSS -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<link href="vendor/morrisjs/morris.css" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Custom Fonts -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Custom CSS -->
|
2017-10-07 01:08:06 +02:00
|
|
|
<link href="<?php echo $theme_url; ?>" title="main" rel="stylesheet">
|
2015-02-16 10:30:58 +01:00
|
|
|
|
2019-08-01 15:37:27 +02:00
|
|
|
<link rel="shortcut icon" type="image/png" href="/dist/icons/favicon.png?ver=2.0">
|
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/dist/icons/apple-touch-icon.png">
|
|
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/dist/icons/favicon-32x32.png">
|
|
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/dist/icons/favicon-16x16.png">
|
|
|
|
<link rel="icon" type="image/png" href="/dist/icons/favicon.png" />
|
2019-08-01 15:31:34 +02:00
|
|
|
<link rel="manifest" href="/dist/icons/site.webmanifest">
|
2019-08-01 15:37:27 +02:00
|
|
|
<link rel="mask-icon" href="/dist/icons/safari-pinned-tab.svg" color="#b91d47">
|
|
|
|
<meta name="msapplication-config" content="/dist/icons/browserconfig.xml">
|
2019-04-23 23:30:00 +02:00
|
|
|
<meta name="msapplication-TileColor" content="#b91d47">
|
|
|
|
<meta name="theme-color" content="#ffffff">
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
|
|
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
|
|
|
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
|
|
|
<![endif]-->
|
2016-07-27 22:34:56 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="wrapper">
|
|
|
|
<!-- Navigation -->
|
|
|
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
|
|
|
<div class="navbar-header">
|
|
|
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
</button>
|
2019-04-10 10:37:35 +02:00
|
|
|
<a class="navbar-brand" href="index.php"><?php echo _("RaspAP Wifi Portal"); ?> v<?php echo RASPI_VERSION; ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</div>
|
|
|
|
<!-- /.navbar-header -->
|
|
|
|
|
|
|
|
<!-- Navigation -->
|
|
|
|
<div class="navbar-default sidebar" role="navigation">
|
|
|
|
<div class="sidebar-nav navbar-collapse">
|
|
|
|
<ul class="nav" id="side-menu">
|
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> <?php echo _("Dashboard"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php if (RASPI_WIFICLIENT_ENABLED) : ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2019-03-15 13:39:03 +01:00
|
|
|
<a href="index.php?page=wpa_conf"><i class="fa fa-wifi fa-fw"></i> <?php echo _("Configure WiFi client"); ?></a>
|
2019-04-10 10:37:35 +02:00
|
|
|
</li>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_HOTSPOT_ENABLED) : ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=hostapd_conf"><i class="fa fa-dot-circle-o fa-fw"></i> <?php echo _("Configure hotspot"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_NETWORK_ENABLED) : ?>
|
2017-10-29 19:21:34 +01:00
|
|
|
<li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<a href="index.php?page=network_conf"><i class="fa fa-sitemap fa-fw"></i> <?php echo _("Configure networking"); ?></a>
|
2017-11-04 21:23:55 +01:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_DHCP_ENABLED) : ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2018-05-30 00:44:18 +02:00
|
|
|
<a href="index.php?page=dhcpd_conf"><i class="fa fa-exchange fa-fw"></i> <?php echo _("Configure DHCP Server"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_OPENVPN_ENABLED) : ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=openvpn_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure OpenVPN"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_TORPROXY_ENABLED) : ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=torproxy_conf"><i class="fa fa-eye-slash fa-fw"></i> <?php echo _("Configure TOR proxy"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_CONFAUTH_ENABLED) : ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=auth_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure Auth"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_CHANGETHEME_ENABLED) : ?>
|
2017-10-07 01:08:06 +02:00
|
|
|
<li>
|
2017-10-23 19:37:59 +02:00
|
|
|
<a href="index.php?page=theme_conf"><i class="fa fa-wrench fa-fw"></i> <?php echo _("Change Theme"); ?></a>
|
2017-10-07 01:08:06 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (RASPI_VNSTAT_ENABLED) : ?>
|
2018-08-21 16:34:01 +02:00
|
|
|
<li>
|
2018-09-14 01:06:13 +02:00
|
|
|
<a href="index.php?page=data_use"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Data usage"); ?></a>
|
2018-08-21 16:34:01 +02:00
|
|
|
</li>
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php endif; ?>
|
2016-07-27 22:34:56 +02:00
|
|
|
<li>
|
2018-05-27 22:41:21 +02:00
|
|
|
<a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></a>
|
2016-07-27 22:34:56 +02:00
|
|
|
</li>
|
2019-03-15 13:39:03 +01:00
|
|
|
<li>
|
|
|
|
<a href="index.php?page=about"><i class="fa fa-info-circle fa-fw"></i> <?php echo _("About RaspAP"); ?></a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2016-07-27 22:34:56 +02:00
|
|
|
</div><!-- /.navbar-collapse -->
|
|
|
|
</div><!-- /.navbar-default -->
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<div id="page-wrapper">
|
|
|
|
|
|
|
|
<!-- Page Heading -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<h1 class="page-header">
|
|
|
|
<img class="logo" src="img/raspAP-logo.png" width="45" height="45">RaspAP
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.row -->
|
|
|
|
|
2019-04-10 10:37:35 +02:00
|
|
|
<?php
|
|
|
|
$extraFooterScripts = array();
|
2016-07-27 22:34:56 +02:00
|
|
|
// handle page actions
|
2019-04-10 10:37:35 +02:00
|
|
|
switch ($page) {
|
|
|
|
case "wlan0_info":
|
|
|
|
DisplayDashboard();
|
|
|
|
break;
|
|
|
|
case "dhcpd_conf":
|
|
|
|
DisplayDHCPConfig();
|
|
|
|
break;
|
|
|
|
case "wpa_conf":
|
|
|
|
DisplayWPAConfig();
|
|
|
|
break;
|
|
|
|
case "network_conf":
|
|
|
|
DisplayNetworkingConfig();
|
|
|
|
break;
|
|
|
|
case "hostapd_conf":
|
|
|
|
DisplayHostAPDConfig();
|
|
|
|
break;
|
|
|
|
case "openvpn_conf":
|
|
|
|
DisplayOpenVPNConfig();
|
|
|
|
break;
|
|
|
|
case "torproxy_conf":
|
|
|
|
DisplayTorProxyConfig();
|
|
|
|
break;
|
|
|
|
case "auth_conf":
|
|
|
|
DisplayAuthConfig($config['admin_user'], $config['admin_pass']);
|
|
|
|
break;
|
|
|
|
case "save_hostapd_conf":
|
|
|
|
SaveTORAndVPNConfig();
|
|
|
|
break;
|
|
|
|
case "theme_conf":
|
|
|
|
DisplayThemeConfig();
|
|
|
|
break;
|
|
|
|
case "data_use":
|
|
|
|
DisplayDataUsage($extraFooterScripts);
|
|
|
|
break;
|
|
|
|
case "system_info":
|
|
|
|
DisplaySystem();
|
|
|
|
break;
|
|
|
|
case "about":
|
|
|
|
DisplayAbout();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DisplayDashboard();
|
2016-07-27 22:34:56 +02:00
|
|
|
}
|
2018-09-10 16:53:05 +02:00
|
|
|
|
|
|
|
?>
|
2016-07-27 22:34:56 +02:00
|
|
|
</div><!-- /#page-wrapper -->
|
2015-02-25 14:06:48 +01:00
|
|
|
</div><!-- /#wrapper -->
|
|
|
|
|
2015-02-27 16:12:26 +01:00
|
|
|
<!-- RaspAP JavaScript -->
|
|
|
|
<script src="dist/js/functions.js"></script>
|
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- jQuery -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<script src="vendor/jquery/jquery.min.js"></script>
|
2015-02-25 14:06:48 +01:00
|
|
|
|
|
|
|
<!-- Bootstrap Core JavaScript -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
|
2015-02-25 14:06:48 +01:00
|
|
|
|
2019-03-06 11:43:36 +01:00
|
|
|
<!-- Bootstrap Toggle JavaScript -->
|
|
|
|
<script src="vendor/bootstrap-toggle/js/bootstrap-toggle.min.js"></script>
|
|
|
|
|
2015-02-25 14:06:48 +01:00
|
|
|
<!-- Metis Menu Plugin JavaScript -->
|
2018-03-09 03:03:53 +01:00
|
|
|
<script src="vendor/metisMenu/metisMenu.min.js"></script>
|
2015-02-25 14:06:48 +01:00
|
|
|
|
|
|
|
<!-- Custom Theme JavaScript -->
|
|
|
|
<script src="dist/js/sb-admin-2.js"></script>
|
2017-10-27 20:40:30 +02:00
|
|
|
|
|
|
|
<!-- Custom RaspAP JS -->
|
|
|
|
<script src="js/custom.js"></script>
|
2018-09-10 16:53:05 +02:00
|
|
|
|
|
|
|
<?php
|
|
|
|
// Load non default JS/ECMAScript in footer.
|
|
|
|
foreach ($extraFooterScripts as $script) {
|
|
|
|
echo ' <script type="text/javascript" src="' , $script['src'] , '"';
|
|
|
|
if ($script['defer']) {
|
|
|
|
echo ' defer="defer"';
|
|
|
|
}
|
|
|
|
|
|
|
|
// if ($script['async']) { echo ( echo ' defer="async"'; ), intrigity=, nonce= etc. etc.
|
|
|
|
echo '></script>' , PHP_EOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2016-07-27 22:34:56 +02:00
|
|
|
</body>
|
2015-02-25 14:06:48 +01:00
|
|
|
</html>
|