Pk11 3 years ago committed by GitHub
parent 55e275f02b
commit 44f26c76c0

@ -69,7 +69,7 @@
// Validate and move the uploaded image file, if necessary
if(!empty($img['tmp_name'])) {
if ((($img['type'] == 'image/gif') || ($img['type'] == 'image/jpeg') || ($img['type'] == 'image/pjpeg')
if((($img['type'] == 'image/gif') || ($img['type'] == 'image/jpeg') || ($img['type'] == 'image/pjpeg')
|| ($img['type'] == 'image/png') || ($img['type'] == 'image/bmp'))
&& ($img['size'] > 0) && ($img['size'] <= MAX_FILE_SIZE)) {
if($img['error'] == 0) {
@ -142,7 +142,7 @@
// Print posts
$show_delete = FALSE;
echo '<form action="' . $_SERVER['PHP_SELF'] .'#bottom" method="post">';
while ($row = pg_fetch_array($result)) {
while($row = pg_fetch_array($result)) {
echo "<fieldset id=\"p{$row['post_id']}\">";
echo '<legend>';
@ -151,7 +151,13 @@
$show_delete = TRUE;
}
echo "<strong>{$row['name']}</strong> {$row['post_time']} ";
echo "<a href=\"#p{$row['post_id']}\">#{$row['post_id']}</a>";
echo "<a href=\"#p{$row['post_id']}\">#{$row['post_id']}</a> ";
// Find references
$post_id = pg_escape_string($row['post_id']);
$ref_query = "SELECT post_id FROM posts WHERE comment LIKE '%&gt;&gt;$post_id%'";
$ref_result = pg_query_params($ref_query, []) or die('Query failed: ' . pg_last_error());
while($ref = pg_fetch_array($ref_result))
echo "<a href=\"#p{$ref['post_id']}\">&gt;&gt;{$ref['post_id']}</a> ";
echo '</legend>';
if(!empty($row['img'])){
@ -163,9 +169,9 @@
// Process quotes, links, and newlines
if(!empty($row['comment'])) {
$comment = $row['comment'];
$comment = preg_replace('/^>[^>].*/m', '<strong>$0</strong>', $comment);
$comment = preg_replace('/^&gt;(?!&gt;\d).+/m', '<strong>$0</strong>', $comment);
$comment = preg_replace('/https?:\/\/[^\s]+/m', '<a href="$0">$0</a>', $comment);
$comment = preg_replace_callback('/>>\s*(\d+)/', quote_link, $comment);
$comment = preg_replace_callback('/&gt;&gt;\s*(\d+)/', quote_link, $comment);
$comment = str_replace("\n", "<br />", $comment);
echo "<p>$comment</p>";
}

Loading…
Cancel
Save