embeds
This commit is contained in:
parent
3a34471306
commit
d7f64152f6
5 changed files with 22 additions and 7 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
test_*.php
|
||||
/docs/pfp
|
||||
/docs/pic
|
||||
/docs/pfp
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
font-family: var(--font) !important;
|
||||
}
|
||||
|
||||
.img {
|
||||
max-width: 500px;
|
||||
max-height: 500px;
|
||||
}
|
||||
|
||||
.banner,
|
||||
body {
|
||||
display: flex;
|
||||
|
|
|
@ -28,10 +28,16 @@
|
|||
if (strlen($postie) < 1 || strlen($postie) > 1024) {
|
||||
getOut($postType,$postId);
|
||||
}
|
||||
|
||||
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
$fid = bin2hex(random_bytes(16));
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . '/../docs/pic/' . $fid . '.png');
|
||||
$postie .= "\nhttps://" . $_SERVER['HTTP_HOST'] . '/pic/' . $fid . '.png';
|
||||
}
|
||||
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)");
|
||||
$stmt->execute([$username,$postType,$postId,microtime(true) - $ref,$postie,bin2hex(random_bytes(16))]);
|
||||
|
||||
|
||||
getOut($postType,$postId);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
form("Broadcast your thoughts...", '', array(
|
||||
array('key' => 'Your message', 'type' => 'textarea', 'name' => 'post', 'default' => ''),
|
||||
array('key' => '','type' => 'hidden','name' => 'type', 'default' => $typer),
|
||||
array('key' => '','type' => 'hidden','name' => 'id', 'default' => $idr)
|
||||
),'/index.php');
|
||||
array('key' => '','type' => 'hidden','name' => 'id', 'default' => $idr),
|
||||
array('key' => 'Attachments', 'type' => 'file', 'name' => 'file', 'default' => '')
|
||||
),'/index.php');
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
function markdown($text) {
|
||||
$search = array (
|
||||
'~(?:\s|^)(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
|
||||
'~(https://[^.]+\.dervland\.net/[^\s<]+)~i',
|
||||
'~(?:\s|^)(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
|
||||
'~(?:@)([^\s]+)(?:\s|$)~i',
|
||||
'~(\[b\])(.*?)(\[\/b\])~i',
|
||||
'~(\[i\])(.*?)(\[\/i\])~i',
|
||||
|
@ -14,6 +15,7 @@
|
|||
);
|
||||
|
||||
$replace = array (
|
||||
'<a class="link" href="$1" target="_blank"><img src="$1" class="img"></a>',
|
||||
'<a class="link" href="$0" target="_blank">$0</a>',
|
||||
'<a class="link" href="/user.php?id=$1" target="_blank">@$1</a>',
|
||||
'<strong>$2</strong>',
|
||||
|
@ -30,4 +32,4 @@
|
|||
|
||||
return $text;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue