Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to index.php #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 149 additions & 141 deletions www/index.php
Original file line number Diff line number Diff line change
@@ -1,167 +1,175 @@
<?php
if (!empty($_GET['q'])) {
switch ($_GET['q']) {
case 'info':
phpinfo();
exit;
break;
}
if (!empty($_GET['q']) && $_GET['q'] === 'info') {
phpinfo();
exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laragon</title>
<link href="https://fonts.googleapis.com/css?family=Karla:400" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="https://i.imgur.com/ky9oqct.png" type="image/png">
<style>
*,
:before *,
:after * {
box-sizing: border-box;
}

body {
margin: 0;
min-height: 100vh;
font-weight: 100;
font-family: 'Karla', sans-serif;
font-size: 18px;
}

header,
main,
nav,
aside {
padding: 1rem;
margin: auto;
max-width: 1200px;
text-align: center;
}

header {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}

.header__item {
margin: 0;
padding: 1rem;
}

.header--logo {
height: 8rem;
}

h1 {
font-size: 5rem;
}

main {
background-color: #f5f5f5;
}

nav {
width: 100%;
}

ul {
list-style: none;
padding: 0;
margin: auto;
}

a {
color: #37ADFF;
font-weight: 900;
text-decoration: none;
}

a:hover {
color: red;
font-weight: 900;
transition: 300ms;
}

main a {
color: grey;
function getPrettyDomain()
{
$iniContents = file_get_contents(__DIR__ . '/../usr/laragon.ini');
if (!$iniContents) {
return 'test';
}
preg_match('/HostnameFormat=\{name\}\.(.*?)\s/', $iniContents, $hostnameFormat);
return $hostnameFormat ? $hostnameFormat[1] : 'test';
}

nav a {
display: block;
margin: 1rem 0;
}
$dirList = glob('*', GLOB_ONLYDIR);

nav a:after {
content: '→';
margin-left: 0.5rem;
}
$prettyDomain = getPrettyDomain();

.alert {
color: red;
font-weight: 900;
}
?>
<!DOCTYPE html>
<html lang="en">

@media (min-width: 650px) {
h1 {
font-size: 10rem;
}
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laragon</title>
<link href="https://fonts.googleapis.com/css?family=Karla:400" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="https://i.imgur.com/ky9oqct.png" type="image/png">
<style>
*,
:before *,
:after * {
box-sizing: border-box;
}

body {
margin: 0;
min-height: 100vh;
font-weight: 100;
font-family: 'Karla', sans-serif;
font-size: 18px;
}

header,
main,
nav,
aside {
padding: 1rem;
margin: auto;
max-width: 1200px;
text-align: center;
}

header {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}

.header__item {
margin: 0;
padding: 1rem;
}

.header--logo {
height: 8rem;
}

h1 {
font-size: 5rem;
}

main {
background-color: #f5f5f5;
}

nav {
width: 100%;
}

ul {
list-style: none;
padding: 0;
margin: auto;
}

a {
color: #6f6f6f;
font-weight: 900;
text-decoration: none;
}

a:hover {
color: red;
font-weight: 900;
transition: 300ms;
}

nav a {
display: block;
margin: 0.5rem 0;
}

nav a:after {
content: '→';
margin-left: 0.5rem;
}

.alert {
color: red;
font-weight: 900;
}

@media (min-width: 650px) {
h1 {
font-size: 10rem;
}
}
</style>
</head>

<body>
<header>
<header>
<img class="header__item header--logo" src="https://i.imgur.com/ky9oqct.png" alt="Offline">
<h1 class="header__item header--title" title="Laragon">Laragon</h1>
</header>
<main>
</header>
<main>
<p>
<?php print($_SERVER['SERVER_SOFTWARE']); ?>
<?= $_SERVER['SERVER_SOFTWARE'] ?>
</p>
<p>
PHP version: <?php print PHP_VERSION; ?> <span><a title="phpinfo()" href="/?q=info">info</a></span>
PHP version: <?= PHP_VERSION ?> <span><a title="phpinfo()" href="/?q=info">info</a></span>
</p>
<p>
Document Root: <?php print($_SERVER['DOCUMENT_ROOT']); ?>
Document Root: <?= $_SERVER['DOCUMENT_ROOT'] ?>
</p>
<p>
<a title="Getting Started" href="https://laragon.org/docs">Getting Started</a>
<a title="Getting Started" href="https://laragon.org/docs" target="_blank">Getting Started</a>
</p>
</main>
<?php
$dirList = glob('*', GLOB_ONLYDIR);
if (!empty($dirList)) :
?>
<nav>
<ul>
<?php
foreach ($dirList as $key => $value) :
$link = 'https://' . $value . '.test';
<?php
if (!empty($dirList)) :
?>
<a href="<?php echo $link; ?>" target="_blank"><?php echo $link; ?></a>
<?php
endforeach;
<nav>
<ul>
<?php
foreach ($dirList as $key => $value) :
$link = $_SERVER['REQUEST_SCHEME'] . '://' . $value . '.' . $prettyDomain;
?>
<li>
<a href="<?= $link ?>" target="_blank"><?= $value ?></a>
</li>
<?php
endforeach;
?>
</ul>
</nav>
<?php
else :
?>
</ul>
</nav>
<?php
else :
?>
<aside>
<p class="alert">There are no directories, create your first project now</p>
<div>
<img src="https://i.imgur.com/3Sgu8XI.png" alt="Offline">
</div>
</aside>
<?php
endif;
?>
<aside>
<p class="alert">There are no directories, create your first project now</p>
<div>
<img src="https://i.imgur.com/3Sgu8XI.png" alt="Offline">
</div>
</aside>
<?php
endif;
?>
</main>
</body>

</html>