M activate.php +5 -5
@@ 14,7 14,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST
$errors[] = "Can't find user";
} else {
if ($App->getUser()->setRole($id, 2)) {
- $subject = "plog - Welcome!";
+ $subject = "piclog - Welcome!";
$message = "Hello $selected[name]! Your account has been activated. You can now post messages on " . URL . ".\n\nTalk to you soon!";
$App->getEmail()->send($selected['email'], $subject, $message);
}
@@ 33,12 33,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST
<table>
<?php foreach ($users as $user): ?>
<tr>
- <td><?=$user['name']?></td>
- <td><?=$user['cover']?></td>
+ <td><?= $user['name'] ?></td>
+ <td><?= $user['cover'] ?></td>
<td>
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
+ <form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
<?php include 'includes/csrf.php' ?>
- <input type="hidden" name="id" value="<?=$user['id']?>" />
+ <input type="hidden" name="id" value="<?= $user['id'] ?>"/>
<input type="submit" value="activate"/>
</form>
</td>
M +7 -1
@@ 1,2 1,8 @@
</body>
</main>
<footer class="main-footer">
<p>Host your own piclog! <a href="https://hg.sr.ht/~m15o/piclog">Source</a><br>
m15o at posteo dot net
</p>
</footer>
</body>
</html>
M +4 -7
@@ 11,11 11,13 @@
<header class="main-header">
<a href="index.php"><img src="logo.png"></a>
<nav>
<?php if ($user): ?>
<a href="index.php">home</a>
<a href="index.php">home</a>
<?php if (is_member($user)): ?>
<a href="upload.php">upload</a>
<a href="widget.php">widget</a>
<a href="profile.php?id=<?= $user['id'] ?>">profile</a>
<?php endif; ?>
<?php if ($user): ?>
<a href="settings.php">settings</a>
<a href="logout.php">logout</a>
<?php if (is_admin($user)): ?>
@@ 28,11 30,6 @@
</nav>
</header>
<main>
<?php if (is_visitor($user)): ?>
<div class="is-visitor">
You account is pending activation. You will be notified by email when activated.
</div>
<?php endif ?>
<?php if ($flash = $App->getSession()->getFlash()): ?>
<p class="flash"><?= $flash ?></p>
<?php endif; ?>
No newline at end of file
M index.php +3 -0
@@ 9,6 9,9 @@ require 'includes/app.php';
<?php include 'includes/header.php'; ?>
<h1>piclog</h1>
+<?php if (is_visitor($user)): ?>
+ <p class="is-visitor">You account is pending activation. You will be notified by email when activated.</p>
+<?php endif ?>
<p>Hi! Here you can share your JPEG pictures with your friends. You can customize the CSS of your profile, and even add
a little widget to your site! The pictures are heavily compressed to keep the file
size small.</p>
M password-lost.php +2 -2
@@ 4,7 4,7 @@ require 'includes/app.php';
$errors = [];
-$title = NAME . ' - Recover password';
+$title = 'piclog - Recover password';
function get_body($token)
{
@@ 13,7 13,7 @@ function get_body($token)
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email'];
- Validate::isEmail($email) or $errors[] = "Please provide a valide email address";
+ Validate::isEmail($email) or $errors[] = "Please provide a valid email address";
if (!count($errors)) {
$id = $App->getUser()->getIdFromEmail($email);
M settings.php +8 -6
@@ 1,17 1,17 @@
<?php
require 'includes/app.php';
-is_member($user) or redirect("login.php");
+$user or redirect("login.php");
$errors = [];
$form = $user;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $form['name'] = $_POST['name'];
+ $form['name'] = $_POST['name'];
$form['email'] = $_POST['email'];
$form['cover'] = $_POST['cover'];
- Validate::isName($form['name']) or $errors[] = "Name must be 2-20 letters using [A-z0-9\_]";
+ Validate::isName($form['name']) or $errors[] = "Name must be 2-20 letters using [A-z0-9\_]";
Validate::isEmail($form['email']) or $errors[] = "Email format not recognized";
Validate::isAcceptableHTML($form['cover']) or $errors [] = "About has a forbidden HTML tag";
!empty($form['cover']) or $errors[] = "Tell us a few words about you";
@@ 33,16 33,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST
<?php include 'includes/csrf.php' ?>
<div class="form-group">
<label for="name">Name:</label>
- <input type="text" id="name" name="name" autocomplete="off" value="<?=$form['name']?>" class="form-control" required/>
+ <input type="text" id="name" name="name" autocomplete="off" value="<?= $form['name'] ?>" class="form-control"
+ required/>
</div>
<div class="form-group">
<label for="email">Email:</label>
- <input type="email" id="email" name="email" autocomplete="off" value="<?=$form['email']?>" class="form-control" required/>
+ <input type="email" id="email" name="email" autocomplete="off" value="<?= $form['email'] ?>"
+ class="form-control" required/>
</div>
<label for="cover">About:</label>
- <textarea name="cover" id="cover" class="form-control" required"><?=$form['cover']?></textarea>
+ <textarea name="cover" id="cover" class="form-control" required"><?= $form['cover'] ?></textarea>
<input type="submit" value="Update"/></td>
</form>
M style.css +16 -1
@@ 8,7 8,7 @@ body {
background-color: midnightblue;
}
-.main-header, main {
+.main-header, main, .main-footer {
max-width: 45em;
margin: 0 auto;
background-color: aliceblue;
@@ 26,6 26,7 @@ h1, h2 {
.title {
margin-bottom: 0;
+ word-wrap: anywhere;
}
.meta {
@@ 50,3 51,17 @@ form > *:not(label, [type=submit]) {
box-sizing: border-box;
margin-bottom: 1em;
}
+
+.main-footer {
+ background-color: palegoldenrod;
+}
+
+.flash {
+ background-color: palegreen;
+ padding: 1em;
+}
+
+.is-visitor {
+ color: darkblue;
+ font-style: oblique;
+}
No newline at end of file
M widget.php +3 -2
@@ 6,7 6,8 @@ require 'includes/app.php';
<h1>Widget</h1>
<p>Add the following snippet to your site to show your latest picture. Feel free to customize how it looks like!</p>
<textarea
- style="width: 100%;"><a href="profile.php?id=<?= $user['id']; ?>"><img src="latest.php?id=<?= $user['id']; ?>"></a></textarea>
-<p><a href="profile.php?id=<?= $user['id']; ?>"><img src="latest.php?id=<?= $user['id']; ?>"></a></p>
+ style="width: 100%;"><a href="<?= URL ?>/profile.php?id=<?= $user['id']; ?>"><img src="<?= URL ?>/latest.php?id=<?= $user['id']; ?>"></a></textarea>
+<p><a href="<?= URL ?>/profile.php?id=<?= $user['id']; ?>"><img src="<?= URL ?>/latest.php?id=<?= $user['id']; ?>"></a>
+</p>
<?php include 'includes/footer.php'; ?>