/admin/
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
global $OPTIONS;
|
||||
?>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com - About</title>
|
||||
|
||||
59
www/pages/admin.php
Normal file
59
www/pages/admin.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
?>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com - About</title>
|
||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||
<link rel="canonical" href="https://www.mikescher.com/about"/>
|
||||
<?php printCSS(); ?>
|
||||
<?php includeScriptOnce("http://code.jquery.com/jquery-latest.min.js", true, '') ?>
|
||||
<?php includeScriptOnce("/data/javascript/admin.js", true, 'defer') ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mastercontainer">
|
||||
|
||||
<?php $HEADER_ACTIVE = 'admin'; include (__DIR__ . '/../fragments/header.php'); ?>
|
||||
|
||||
<div id="content" class="content-responsive">
|
||||
|
||||
<div class="admincontent">
|
||||
|
||||
<div class="contentheader"><h1>Admin</h1><hr/></div>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Version</div>
|
||||
|
||||
<div class="bc_data">
|
||||
<div><b style="display:inline-block; min-width: 100px">Branch: </b><span><?php echo exec('git rev-parse --abbrev-ref HEAD'); ?></span></div>
|
||||
<div><b style="display:inline-block; min-width: 100px">Commit: </b><span><?php echo exec('git rev-parse HEAD'); ?></span></div>
|
||||
<div><b style="display:inline-block; min-width: 100px">Date: </b><span><?php echo exec('git log -1 --format=%cd'); ?></span></div>
|
||||
<div><b style="display:inline-block; min-width: 100px">Message: </b><span><?php echo nl2br(exec('git log -1')); ?></span></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">ExtendedGitGraph</div>
|
||||
|
||||
<div class="bc_data">
|
||||
|
||||
<textarea class="egh_ajaxOutput" id="egh_ajaxOutput" readonly="readonly"></textarea>
|
||||
<a class="button" href="javascript:startAjaxRefresh('<?php echo $CONFIG['ajax_secret'] ?>')">Update</a>
|
||||
<a class="button" href="javascript:startAjaxRedraw('<?php echo $CONFIG['ajax_secret'] ?>')">Redraw</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
70
www/pages/admin_egh.php
Normal file
70
www/pages/admin_egh.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph.php');
|
||||
|
||||
$cmd = $OPTIONS['cmd'];
|
||||
$secret = $OPTIONS['secret'];
|
||||
|
||||
if ($secret !== $CONFIG['ajax_secret'])
|
||||
die('Unauthorized.');
|
||||
|
||||
function create()
|
||||
{
|
||||
global $CONFIG;
|
||||
|
||||
$v = new ExtendedGitGraph(__DIR__ . '/../temp/egh_cache.bin', ExtendedGitGraph::OUT_SESSION, __DIR__ . '/../temp/egh_log{num}.log');
|
||||
|
||||
$v->addRemote('github-user', null, 'Mikescher', 'Mikescher');
|
||||
//$v->addRemote('github-user', null, 'Mikescher', 'Sam-Development');
|
||||
//$v->addRemote('github-repository', null, 'Mikescher', 'Anastron/ColorRunner');
|
||||
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/server-scripts');
|
||||
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/apache-sites');
|
||||
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/MVU_API');
|
||||
|
||||
$v->setColorScheme($CONFIG['egh_theme']);
|
||||
|
||||
$v->ConnectionGithub->setAPIToken($CONFIG['egh_token']);
|
||||
|
||||
$v->ConnectionGitea->setURL('https://gogs.mikescher.com');
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
if ($cmd === 'status')
|
||||
{
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||
|
||||
if (key_exists('ajax_progress_egh_refresh', $_SESSION))
|
||||
echo $_SESSION['ajax_progress_egh_refresh'];
|
||||
else
|
||||
echo '[[ NO SESSION STARTED ]]';
|
||||
|
||||
return;
|
||||
}
|
||||
else if ($cmd === 'refresh')
|
||||
{
|
||||
set_time_limit(900); // 15min
|
||||
|
||||
$v = create();
|
||||
$v->init();
|
||||
$v->updateFromRemotes();
|
||||
$v->generate();
|
||||
|
||||
file_put_contents(__DIR__ . '/../dynamic/egh.html', $v->getAll());
|
||||
}
|
||||
else if ($cmd === 'redraw')
|
||||
{
|
||||
set_time_limit(900); // 15min
|
||||
|
||||
$v = create();
|
||||
$v->init();
|
||||
$v->updateFromCache();
|
||||
$v->generate();
|
||||
|
||||
file_put_contents(__DIR__ . '/../dynamic/egh.html', $v->getAll());
|
||||
}
|
||||
else
|
||||
{
|
||||
die('Wrong command.');
|
||||
}
|
||||
92
www/pages/login.php
Normal file
92
www/pages/login.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
global $OPTIONS;
|
||||
|
||||
$err = false;
|
||||
|
||||
if (key_exists('username', $_GET) && key_exists('password', $_GET) && key_exists('redirect', $_GET))
|
||||
{
|
||||
if ($_GET['username'] === $CONFIG['admin_username'] && $_GET['password'] === $CONFIG['admin_password'])
|
||||
{
|
||||
$expires = time() + (24*60*60); // 24h
|
||||
$hash = hash('sha256', $_GET['username'] . ';' . $_GET['password']);
|
||||
setcookie('mikescher_auth', $hash, $expires);
|
||||
|
||||
header('Location: ' . $_GET['redirect']);
|
||||
die();
|
||||
}
|
||||
else
|
||||
{
|
||||
$err = true;
|
||||
}
|
||||
}
|
||||
|
||||
$redirect = $OPTIONS['login_target'];
|
||||
|
||||
?>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com - Login</title>
|
||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||
<link rel="canonical" href="https://www.mikescher.com/login"/>
|
||||
<?php printCSS(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mastercontainer">
|
||||
|
||||
<?php $HEADER_ACTIVE = 'login'; include (__DIR__ . '/../fragments/header.php'); ?>
|
||||
|
||||
<div id="content" class="content-responsive">
|
||||
|
||||
<div class="aboutcontent">
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Mikescher.com - Login</div>
|
||||
|
||||
<div class="bc_data">
|
||||
|
||||
<div class="form">
|
||||
<form id="loginform" action="/login" method="GET">
|
||||
|
||||
<?php if ($err): ?>
|
||||
<span class="loginerror">Wrong username or password</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div>
|
||||
<label for="username" class="required">Username</label>
|
||||
<input name="username" id="username" type="text">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password">Password</label>
|
||||
<input name="password" id="password" type="password">
|
||||
</div>
|
||||
|
||||
<div style="display: none; visibility: hidden">
|
||||
<label for="redirect">Redirect</label>
|
||||
<input name="redirect" id="redirect" type="text" value="<?php echo $redirect ?>">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="button" type="submit" name="yt0">Login</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user