You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LabyrinthAP/index.php

285 lines
11 KiB
PHP

<?php
/**
* LabyrinthAP is open source software offered under GNU General Public License v3.0.
* Ongoing development is reliant on voluntary financial support through donations to the project.
* I hope that you find using LabyrithAP beneficial and also hope there's sufficient widespread
* support for it to financially support it's future. Seeing support for it will assist in continued
* improvements as well as adapting it to future requirements.
*
* LabyrinthAP was initially conceived to provide users with a platform agnostic way to connect networked
* devices to Lokinet without the need to install and configure Lokinet applications on individual systems.
* From initial research on compiling Lokinet for ARM, it was demonstrated that it could be feasibile to
* use SBC's to create access points which could encrypt, decrypt, route and onion route traffic over
* Lokinet while managing dns requirements. In addition it could provide a means to select and connect
* to various exits located all around the globe. Through utilizing various robust packages and coding
* custom networking configurations LabyrinthAP utilizing Lokinet is able to achieve all this.
*
* This early research and further development led to the current version of LabyrithAP which provides
* a solution which is able to connect virtually any networked device to Lokinet without the device
* needing to have Lokinet installed, configured or running the application natively. The devices need
* only to connect to LabyrinthAP and it will handle the rest of Lokinet's connection requirements.
*
* If you wish to donate to this development the Oxen wallet for LabyrinthAP is:
* LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh
*
* Additional information can be found on the github repo located at:
* https://github.com/necro-nemesis/LabyrinthAP. Further discussions and assistance with using Lokinet is provided on Session in the Lokinet open group.
*
* I hope that LabyrinthAP will continue to service your needs for gaining access to Lokinet.
*
* Thank-you for using LabyrinthAP,
*
* Technical Tumbleweed
*
*
* @author TechnicalTumbleweed (Oxen-> Session Lokinet/Telegram Oxen Community)
* @license GNU General Public License, version 3 (GPL-3.0)
* @version 2.7
* @link https://github.com/necro-nemesis/LabyrinthAP
*/
session_start();
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' );
$output = $return = 0;
$page = $_GET['page'];
if (empty($_SESSION['csrf_token'])) {
if (function_exists('mcrypt_create_iv')) {
$_SESSION['csrf_token'] = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
} else {
$_SESSION['csrf_token'] = bin2hex(openssl_random_pseudo_bytes(32));
}
}
$csrf_token = $_SESSION['csrf_token'];
if(!isset($_COOKIE['theme'])) {
$theme = "custom.css";
} else {
$theme = $_COOKIE['theme'];
}
$theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<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="">
<title><?php echo _("LabyrinthAP"); ?></title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS -->
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
<!-- Timeline CSS -->
<link href="dist/css/timeline.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="dist/css/sb-admin-2.min.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="vendor/morrisjs/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- Custom CSS -->
<link href="<?php echo $theme_url; ?>" title="main" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="../img/favicon.png">
<!-- 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]-->
</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>
<a class="navbar-brand" href="index.php"style="font-family: Arial;font-size: 20px; color: #609aac"><?php echo _("LabyrinthAP Lokinet Access Point"); ?> v<?php echo RASPI_VERSION; ?></a>
</div>
<!-- /.navbar-header -->
<!-- Navigation -->
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<?php if ( RASPI_LOKINET_ENABLED ) : ?>
<li>
<a href="index.php?page=lokinet_conf"><i class="fa fa-eye-slash fa-fw"></i> <?php echo _("Configure Lokinet"); ?></a>
</li>
<?php endif; ?>
<li>
<a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> <?php echo _("Dashboard"); ?></a>
</li>
<?php if ( RASPI_WIFICLIENT_ENABLED ) : ?>
<li>
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> <?php echo _("Configure WiFi client"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_HOTSPOT_ENABLED ) : ?>
<li>
<a href="index.php?page=hostapd_conf"><i class="fa fa-dot-circle-o fa-fw"></i> <?php echo _("Configure hotspot"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_NETWORK_ENABLED ) : ?>
<li>
<a href="index.php?page=network_conf"><i class="fa fa-sitemap fa-fw"></i> <?php echo _("Configure networking"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_DHCP_ENABLED ) : ?>
<li>
<a href="index.php?page=dhcpd_conf"><i class="fa fa-exchange fa-fw"></i> <?php echo _("Configure DHCP Server"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_CONFAUTH_ENABLED ) : ?>
<li>
<a href="index.php?page=auth_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure Auth"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_CHANGETHEME_ENABLED ) : ?>
<li>
<a href="index.php?page=theme_conf"><i class="fa fa-wrench fa-fw"></i> <?php echo _("Change Theme"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_VNSTAT_ENABLED ) : ?>
<li>
<a href="index.php?page=data_use"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Data usage"); ?></a>
</li>
<?php endif; ?>
<li>
<a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></a>
</li>
</div>
</div>
</ul>
</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-logo64px.png" width="64" height="64">
<span style="font-weight: 700; font-size: 48px; color: #B026FF">Labyrinth</span><span style="font-weight: 700; font-size: 48px; color:#FF0038">AP</span>
</h1>
</div>
</div><!-- /.row -->
<?php
$extraFooterScripts = array();
// handle page actions
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 "lokinet_conf":
DisplayLokinetConfig();
break;
case "auth_conf":
DisplayAuthConfig($config['admin_user'], $config['admin_pass']);
break;
case "save_hostapd_conf":
ActivateLokinetConfig();
break;
case "theme_conf":
DisplayThemeConfig();
break;
case "data_use":
DisplayDataUsage($extraFooterScripts);
break;
case "system_info":
DisplaySystem();
break;
default:
DisplayLokinetConfig();
}
?>
</div><!-- /#page-wrapper -->
</div><!-- /#wrapper -->
<!-- RaspAP JavaScript -->
<script src="dist/js/functions.js"></script>
<!-- jQuery -->
<script src="vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="vendor/metisMenu/metisMenu.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="dist/js/sb-admin-2.js"></script>
<!-- Custom RaspAP JS -->
<script src="js/custom.js"></script>
<?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;
}
?>
</body>
</html>