<commit_before><?php
/*
    PufferPanel - A Minecraft Server Management Panel
    Copyright (c) 2013 <NAME>
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/.
 */
session_start();
require_once('../../../../src/framework/framework.core.php');

if($core->auth->isLoggedIn($_SERVER['REMOTE_ADDR'], $core->auth->getCookie('pp_auth_token'), null, true) !== true){
	Page\components::redirect('../../../index.php?login');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<?php include('../../../../src/include/header.php'); ?>
	<title>PufferPanel Admin Control Panel</title>
</head>
<body>
	<div class="container">
		<div class="navbar navbar-default">
			<div class="navbar-header">
				<a class="navbar-brand" href="#"><?php echo $core->settings->get('company_name'); ?></a>
			</div>
			<div class="navbar-collapse navbar-responsive-collapse collapse" style="height: 1px;">
				<ul class="nav navbar-nav navbar-right">
					<li class="dropdown">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown">Account <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li><a href="<?php echo $core->settings->get('master_url'); ?>logout.php">Logout</a></li>
								<li><a href="<?php echo $core->settings->get('master_url'); ?>servers.php">View All Servers</a></li>
							</ul>
					</li>
				</ul>
			</div>
		</div>
		<div class="row">
			<div class="col-3"><?php include('../../../../src/include/admin.php'); ?></div>
			<div class="col-9">
				<ul class="nav nav-tabs" id="config_tabs">
					<li class="active"><a href="#view" data-toggle="tab">List Keys</a></li>
					<li><a href="#add" data-toggle="tab">New Key</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="view">
						<h3>Current API Keys</h3><hr />
						<table class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>API Key</th>
									<th>Permissions</th>
								</tr>
							</thead>
							<tbody>
								<?php
									$select = $mysql->prepare("SELECT * FROM `api`");
									$select->execute();
									
									while($row = $select->fetch()){
									
										echo '<tr>
											<td>
												<code>'.$row['key'].'</code>
											</td>
											<td>
												'.json_encode(json_decode($row['permissions'], true), JSON_PRETTY_PRINT).'
											</td>
										</tr>';
									
									}
								?>
							</tbody>
						</table>
					</div>
					<div class="tab-pane" id="add">
						<h3>Add New API Key</h3><hr />
						<form action="ajax/add.php" method="POST">
							<fieldset>
								<div class="form-group">
									<label for="main_url" class="control-label">Allowed Connection IPs</label>
									<div>
										<input type="text" name="allowed_ips" class="form-control" />
										<p><small class="text-muted"><em>Please enter a comma separated list of IPv4 addresses that are allowed to connect to the API to send and receive data. Enter * or leave blank to allow any IP to connect.</em></small></p>
									</div>
								</div>
								<div class="form-group">
									<h3>Permissions</h3><hr />
									<div class="checkbox">
										<label><input type="checkbox" onclick="toggle(this);" /> Check All</label><br />
										<hr />
										<label><input type="checkbox" name="permissions[]" value="list_nodes" /> List Nodes</label><br />
										<label><input type="checkbox" name="permissions[]" value="list_ips" /> List IPs</label><br />
										<label><input type="checkbox" name="permissions[]" value="list_ports" /> List Ports</label><br />
										<label><input type="checkbox" name="permissions[]" value="list_user" /> List User Information</label><br /><commit_msg>add trash can<commit_after><?php
/*
    PufferPanel - A Minecraft Server Management Panel
    Copyright (c) 2013 <NAME>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/.
 */
session_start();
require_once('../../../../src/framework/framework.core.php');

if($core->auth->isLoggedIn($_SERVER['REMOTE_ADDR'], $core->auth->getCookie('pp_auth_token'), null, true) !== true){
	Page\components::redirect('../../../index.php?login');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<?php include('../../../../src/include/header.php'); ?>
	<title>PufferPanel Admin Control Panel</title>
</head>
<body>
	<div class="container">
		<div class="navbar navbar-default">
			<div class="navbar-header">
				<a class="navbar-brand" href="#"><?php echo $core->settings->get('company_name'); ?></a>
			</div>
			<div class="navbar-collapse navbar-responsive-collapse collapse" style="height: 1px;">
				<ul class="nav navbar-nav navbar-right">
					<li class="dropdown">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown">Account <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li><a href="<?php echo $core->settings->get('master_url'); ?>logout.php">Logout</a></li>
								<li><a href="<?php echo $core->settings->get('master_url'); ?>servers.php">View All Servers</a></li>
							</ul>
					</li>
				</ul>
			</div>
		</div>
		<div class="row">
			<div class="col-3"><?php include('../../../../src/include/admin.php'); ?></div>
			<div class="col-9">
				<ul class="nav nav-tabs" id="config_tabs">
					<li class="active"><a href="#view" data-toggle="tab">List Keys</a></li>
					<li><a href="#add" data-toggle="tab">New Key</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="view">
						<h3>Current API Keys</h3><hr />
						<table class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>API Key</th>
									<th>Permissions</th>
                                    <th></th>
								</tr>
							</thead>
							<tbody>
								<?php
									$select = $mysql->prepare("SELECT * FROM `api`");
									$select->execute();

									while($row = $select->fetch()){

										echo '<tr>
											<td>
												<code>'.$row['key'].'</code>
											</td>
											<td>
												'.json_encode(json_decode($row['permissions'], true), JSON_PRETTY_PRINT).'
											</td>
                                            <td style="vertical-align: middle;">
                                                <a href="#/trash"><i class="fa fa-trash"></i></a>
                                            </td>
										</tr>';

									}
								?>
							</tbody>
						</table>
					</div>
					<div class="tab-pane" id="add">
						<h3>Add New API Key</h3><hr />
						<form action="ajax/add.php" method="POST">
							<fieldset>
								<div class="form-group">
									<label for="main_url" class="control-label">Allowed Connection IPs</label>
									<div>
										<input type="text" name="allowed_ips" class="form-control" />
										<p><small class="text-muted"><em>Please enter a comma separated list of IPv4 addresses that are allowed to connect to the API to send and receive data. Enter * or leave blank to allow any IP to connect.</em></small></p>
									</div>
								</div>
								<div class="form-group">
									<h3>Permissions</h3><hr />
									<div class="checkbox">
										<label><input type="checkbox" onclick="toggle(this);" /> Check All</label><br />
										<hr />
										<label><input type="checkbox" name="permissions[]" value="list_nodes" /> List Nodes</label><br />
										<label><input type="checkbox" name="permissions[]" value="list_ips" /> List IPs</label><br />
										<label><input type="checkbox" name="permissions[]" value="list_ports" /> List Ports</label><br />
										<label><input type="checkbox" name="permissions[]" value="list_user" /> List User Information</label><br />
{'fraction_non_alphanumeric': 0.18191068400226115, 'fraction_numerical': 0.0033917467495760316, 'mean_word_length': 2.5915550142103125, 'pattern_counts': {'":': 0, '<': 265, '<?xml version=': 0, '>': 291, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2465253', 'n_tokens_mistral': 3570, 'n_tokens_neox': 2650, 'n_words': 695}