fix broken nginx config and other stuff that I didn't commit 2 years ago

This commit is contained in:
Floorb 2023-03-28 12:00:22 -04:00
parent 8409837689
commit aa2ac2c5a7
4 changed files with 21 additions and 18 deletions

View file

@ -34,21 +34,24 @@ server {
server_name ponepaste.org;
# Rewrites for pretty URLs
rewrite ^/([0-9]+) /paste.php?id=$1 last;
rewrite ^/page/([a-zA-Z0-9]+)/? /pages.php?page=$1 last;
rewrite ^/archive /archive.php last;
rewrite ^/discover /discover.php last;
rewrite ^/profile /profile.php last;
rewrite ^/$ /index.php last;
rewrite ^/([0-9]+)$ /paste.php?id=$1 last;
rewrite ^/page/([a-zA-Z0-9]+)/?$ /pages.php?page=$1 last;
# simple routes that just map to $1.php
rewrite ^/(archive|discover|profile|contact|report|event|captcha|login|logout)/?$ /$1.php last;
# routes for users
rewrite ^/user/([^/]+)/?$ /user.php?user=$1 last;
rewrite ^/user/([^/]+)/([^/]+)/?$ /user.php?user=$1&q=$2 last;
rewrite ^/contact /contact.php last;
rewrite ^/download/(.*)$ /paste.php?download&id=$1 last;
rewrite ^/raw/(.*)$ /paste.php?raw&id=$1 last;
rewrite ^/embed/(.*)$ /paste.php?embed&id=$1 last;
rewrite ^/report /report.php last;
rewrite ^/event /event.php last;
rewrite ^/rules /rules.php last;
# routes for pastes
rewrite ^/(download|raw|embed)/(.+)$ /paste.php?$1&id=$2 last;
# weird registration routes that use a URL parameter rather than a different page (FIXME)
rewrite ^/register$ /login.php last;
rewrite ^/forgot$ /login.php last;
location ~* \.(jpg|jpeg|png|gif|ico|css|js) {
add_header "Cache-Control" "public";

View file

@ -45,7 +45,7 @@ function calculatePasteExpiry(string $expiry) : ?string {
}
function validatePasteFields() : string|null {
if (empty($_POST["paste_data"]) || trim($_POST['paste_data'] === '')) { /* Empty paste input */
if (empty($_POST["paste_data"]) || trim($_POST['paste_data']) === '') { /* Empty paste input */
return 'You cannot post an empty paste.';
} elseif (!isset($_POST['title'])) { /* No paste title POSTed */
return 'All fields must be filled out.';

View file

@ -41,7 +41,7 @@ $total_pfav = array_sum(
$total_yfav = $profile_info->favourites->count();
// Badges
$profile_badge = match ($profile_info['badge']) {
$profile_badge = match ((int) $profile_info['badge']) {
1 => '<img src="/img/badges/donate.png" title="[Donated] Donated to Ponepaste" style="margin:5px" alt="Donated to PonePaste" />',
2 => '<img src="/img/badges/spoon.png" title="[TheWoodenSpoon] You had one job" style="margin:5px" alt="You had one job" />',
3 => '<img src="/img/badges/abadge.png" title="[>AFuckingBadge] Won a PasteJam Competition" style="margin:5px" alt="Won a PasteJam competition" />',

View file

@ -273,10 +273,10 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div class="columns">
<div class="column">
<div class="field">
<label class="label">Tags</label>
<div class="control">
<label class="label" for="field_tags">Tags</label>
<small>Type a comma to separate each tag.</small>
<div class="control">
<div class="control">
<input name="tag_input" class="input js-tag-input" id="field_tags"
value="<?= pp_html_escape($paste->tags->map(function($t) { return $t->name; })->join(',')) ?>" />