This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
site/src/index.php
Tyler Perkins 2406df4104
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Add back posts
2022-12-23 18:23:33 -05:00

87 lines
2.9 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'common/include.php' ?>
<?php include 'common/git.php' ?>
<?php include 'common/article.php' ?>
<title>Tyler Perkins - Home</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<?php include 'common/header.php' ?>
<div class="centered top-fade dashed-bottom">
<!--<a class="clickable-div" href="about.php"> -->
<div class="index-item single-column tagline-link">
<h1>Hi, I'm Tyler</h1>
<p>I'm a software developer and tinkerer</p>
<?php
$remote_addr = $_SERVER['REMOTE_ADDR'];
$forwarded_addr = $_SERVER['REMOTE_ADDR'];
$home_addr = gethostbyname("gluttony.clortox.com");
if($remote_addr == $home_addr)
echo "<p>Hello from within the home network!</p>"
?>
</div>
<!--</a>-->
</div>
<div class="centered">
<div class="index-item soft-background articles-box">
<div class="index-column">
<h3>Projects</h3>
<div>
<?php
$giteaClient = new Gitea(getenv("GITEA_TOKEN"));
$result = $giteaClient->getRecentProjects();
array_splice($result, 6, -1);
foreach($result as $item){
if($item["private"])
continue;
$name = $item["name"];
$url = $item["html_url"];
$lang = $item["language"];
$description = $item["description"];
//build out the html
echo '<a class="list-clickable-div" href="' . $url . '">';
echo '<p>' . $name . ' - ' . $description . '</p>';
echo '</a>';
}
?>
</div>
</div>
<div class="index-column">
<h3>Articles</h3>
<div>
<?php
$articleClient = Article::makeNewClient();
$posts = $articleClient->getMostRecentPosts(5);
foreach($posts as $post){
if($post == null)
continue;
$id = $post[0];
$author = $post[1];
$title = $post[3];
echo '<a class="list-clickable-div" href="/posts/?id=' . $id . '">';
echo '<p>(' . $author . ') ' . $title . '</p>';
echo '</a>';
}
?>
</div>
</div>
</div>
</div>
<?php include 'common/footer.php' ?>
</body>
</html>