From d7f64152f65878f7394bb904670a1744f95a9112 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sat, 7 Dec 2024 17:51:05 -0500 Subject: [PATCH] embeds --- .gitignore | 3 ++- docs/css/main.css | 5 +++++ docs/index.php | 10 ++++++++-- libs/comment.php | 5 +++-- libs/markdown.php | 6 ++++-- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 3fac3d3..5f1746d 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ test_*.php -/docs/pfp \ No newline at end of file +/docs/pic +/docs/pfp diff --git a/docs/css/main.css b/docs/css/main.css index 3a9cd2d..cd0126b 100755 --- a/docs/css/main.css +++ b/docs/css/main.css @@ -13,6 +13,11 @@ font-family: var(--font) !important; } +.img { + max-width: 500px; + max-height: 500px; +} + .banner, body { display: flex; diff --git a/docs/index.php b/docs/index.php index 3e01db9..713987a 100755 --- a/docs/index.php +++ b/docs/index.php @@ -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); } diff --git a/libs/comment.php b/libs/comment.php index d4a6f24..60a7d3c 100644 --- a/libs/comment.php +++ b/libs/comment.php @@ -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'); } ?> diff --git a/libs/markdown.php b/libs/markdown.php index 5fc25fe..47ad95c 100755 --- a/libs/markdown.php +++ b/libs/markdown.php @@ -1,7 +1,8 @@ ', '$0', '@$1', '$2', @@ -30,4 +32,4 @@ return $text; } -?> \ No newline at end of file +?>