From 5c723540acec7c23c4c2fa860edeb2f598446fb8 Mon Sep 17 00:00:00 2001 From: Jan BELLON Date: Thu, 14 Mar 2024 19:56:53 +0000 Subject: [PATCH] Update 6 files - /html/editpage.php - /html/src/css/style.css - /html/upload/index.php - /html/users/index.php - /html/robots.txt - /html/index.php --- html/editpage.php | 0 html/index.php | 58 ++++++ html/robots.txt | 3 + html/src/css/style.css | 441 +++++++++++++++++++++++++++++++++++++++++ html/upload/index.php | 93 +++++++++ html/users/index.php | 148 ++++++++++++++ 6 files changed, 743 insertions(+) create mode 100644 html/editpage.php create mode 100644 html/upload/index.php create mode 100644 html/users/index.php diff --git a/html/editpage.php b/html/editpage.php new file mode 100644 index 00000000..e69de29b diff --git a/html/index.php b/html/index.php index e69de29b..e5b39886 100644 --- a/html/index.php +++ b/html/index.php @@ -0,0 +1,58 @@ + + + + + + + + + + + + +
+
+ +
+
+ + + +
+
+ +
+ +
+ +
+ prepare($sqlRequest); + $request->bindParam(":userAccreditation", $_SESSION['userAccreditation']); + $request->execute(); + $result = $request->fetchAll(PDO::FETCH_ASSOC); + if ($result) { + listArticles($result, $rootPageURL); + } + ?> +
+
+ + + \ No newline at end of file diff --git a/html/robots.txt b/html/robots.txt index e69de29b..abbfe5f8 100644 --- a/html/robots.txt +++ b/html/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +Disallow: /src/ +Disallow: /assets/ \ No newline at end of file diff --git a/html/src/css/style.css b/html/src/css/style.css index e69de29b..5ac8c578 100644 --- a/html/src/css/style.css +++ b/html/src/css/style.css @@ -0,0 +1,441 @@ +@font-face { + font-family: cfont; + src: url('/src/fonts/bahnschrift.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +/*################ GLOBAL ELEMENTS ##################*/ + +body { + font-family: cfont, Arial, sans-serif; + color: var(--text); + margin: 0; +} + +a { + text-decoration: none; + color: var(--text-color); +} + +img { + border-radius: 1em; +} + +textarea { + border: none; + background: var(--panel-background); + color: var(--text); + border-radius: 1.5em; + padding: 1em; + margin: 0.5em 0; +} + +input:focus, textarea:focus { + outline: none; + display: inline; +} + +/*################ CLASSES ##################*/ + +/* GLOBAL */ + +.panel-content { + width: 90%; + display: flex; + margin: 0 auto; +} + +.content { + width: 80%; + margin: 0 auto; + padding: 2em 0; +} + +.error-message { + margin: auto; + vertical-align: middle; + border: 3px solid #5c0606; + width: 60%; + padding: 1em; + border-radius: 1em; + margin-top: 1em; +} + +.button, button { + background-color: var(--buttons); + font-family: cfont, Arial, sans-serif; + color: var(--text); + border-radius: 10px; + padding: 0.5em 1em; + font-size: 1.2em; + display: inline-block; + border: none; + border-radius: 1.5em; + margin: 0.5em 0; +} + +.status { + color: var(--text); +} + +/* HEADER */ + +header { + justify-content: space-between; + width: 100%; + background: var(--panel-background); + display: flex; +} + +.logo-container { + margin: 2em 0; +} + +.logo-img { + height: 7em; + border-radius: 3.5em; +} + +.logo-img:hover { + box-shadow: 0 0 15px rgba(255, 255, 255, 0.322); +} + +.header-title-container { + text-align: right; + margin-top: 1em; +} + +.header-title { + font-size: 3em; +} + + +/* NAV */ + +nav { + width: 100%; + margin: 0; + background: var(--panel-background); + display: flex; +} + +.nav-link { + padding: 0.5em; + background-color: var(--buttons); + margin-right: 1em; +} + + +/* MAIN */ + +main { + font-family: Helvetica, Arial, sans-serif; + background: var(--background); + width: 100%; + margin: 0; + min-height: 100em; +} + +main h1 { + font-family: cfont, Arial, sans-serif; + font-size: 3em; + font-weight: lighter; +} + +/* FOOTER */ + +footer { + justify-content: space-between; + width: 100%; + margin: 0; + padding: 1em; + background: var(--panel-background); + display: flex; +} + +/* ARTICLES LISTING */ + +.articles-list .article-preview { + padding: 2em 0.5em; + display: flex; +} + +.articles-list .article-illustration { + padding-right: 1em; +} + +.articles-list .article-miniature { + max-width: 15em; +} + +.articles-list .article-info { + vertical-align: top; +} + +.articles-list .article-data { + font-size: 0.8em; +} + +.articles-list .article-title { + font: 1.5em cfont, Arial; + padding: 0.5em 0; +} + +/* TEXT INPUT */ + +.text-input { + display: flex; + align-items: center; + gap: 0.5em; + background-color: var(--panel-background); + width: 20em; + border-radius: 5em; + padding: 0.5em; + margin: 0.5em 0; +} + +.text-input .input-icon { + width: 1.2em; + fill: var(--text); + padding: 0 0.5em; + flex-shrink: 0; +} + +.text-input input { + width: 100%; + min-width: 5em; + height: 2em; + font-family: cfont, Arial, sans-serif; + border: none; + background: none; + color: var(--text); +} + +/* FILE INPUT */ + +.file-input { + margin: 0.5em 0; +} + +.file-input input[type='file']::file-selector-button { + margin-right: 1em; + font-family: cfont, Arial, sans-serif; + border: none; + background-color: var(--panel-background); + padding: 0.5em 1em; + border-radius: 1.5em; + color: var(--text); + cursor: pointer; +} + +.file-input input[type='file'] { + background-color: var(--buttons); + padding: 0.5em; + border-radius: 1.5em; +} + +/* SELECT INPUT */ + +.select-input { + display: flex; + align-items: center; + gap: 0.5em; + background-color: var(--panel-background); + width: 20em; + border-radius: 5em; + padding: 0.5em 1em; + margin: 0.5em 0; +} + +.select-input select { + width: 100%; + min-width: 5em; + height: 2em; + font-family: cfont, Arial, sans-serif; + border: none; + background: var(--background); + border-radius: 1em; + padding: 0.5em; + color: var(--text); +} + +/* FORM */ + +.form { + background-color: var(--panel-background); + display: block; + text-align: center; + padding: 0.2em 3em; + margin: auto; + margin-top: 5em; + border-radius: 1em; + width: 25em; +} + +.form .form-title { + font-family: cfont, Arial, sans-serif; + font-size: 2em; + margin: 1em auto; +} + +.form .text-input { + background-color: var(--background); + margin: 0.5em auto 1.5em auto; +} + +.form .text-input .input-icon, .form .text-input label { + width: 0; +} + +.form .button, .form button { + margin: 1em auto; +} + +/* USER WIDGET */ + +.user-widget { + background-color: var(--panel-background); + display: flex; + align-items: center; + gap: 1em; + padding: 0.5em 1em 0.5em 0.5em; + border-radius: 10em; + width: min-content; +} + +.user-widget .user-pp { + height: 4em; +} + +.user-widget .user-pp img { + width: 4em; + height: 4em; + border-radius: 4em; +} + +.user-widget .user-info { + margin: auto 1em; +} + +.user-widget .user-display-name { + font-weight: bold; + display: flex; +} + +.user-widget .certification { + transform: translate(0, -15%); + width: 1.5em; + margin-left: 0.5em; + +} + +/* USER PROFILE */ + +.user-profile .user-banner { + width: 100%; + height: 12em; + background-position: center; + background-repeat: no-repeat; + background-size: cover; +} + +.user-profile .user-header { + background-color: var(--panel-background); + padding-bottom: 2em; +} + +.user-profile .user-header-content { + width: 80%; + margin: 0 auto; +} + +.user-profile .user-pp { + height: 6em; +} + +.user-profile .user-pp img { + width: 10em; + height: 10em; + border-radius: 5em; + transform: translate(0, -60%); + border: 0; + background-color: var(--panel-background); +} + +.user-profile .display-name { + font-weight: bold; + display: inline; +} + +.user-profile .user-level { + display: inline; +} + +.user-profile .certification { + transform: translate(0, +22%); + width: 1.5em; +} + +.user-profile .bio { + padding: 1em 0; +} + +.user-profile .user-articles { + margin-top: 5em; +} + +.user-profile .user-content { + width: 80%; + margin: 0 auto; +} + +/* PHONE SCREEN */ + +@media(max-width: 750px) { + body { + font-size: 0.8em + } + + .articles-list { + display: block; + } + .articles-list .article-preview { + padding: 2em 0.5em; + display: block; + align-items: center; + } + + .articles-list .article-illustration { + margin: 0 auto; + padding: 2em 0; + } + + .articles-list .article-illustration img { + max-width: 100%; + margin: 0 auto; + } + + .articles-list .article-info { + margin: 0 auto; + } + + .articles-list .article-data { + font-size: 1em; + } + + .articles-list .article-title { + font-size: 2em; + } + .articles-list .article-resume { + font-size: 1.2em; + } + + .text-input { + width: 15em; + } + + .form { + width: 16em; + } +} \ No newline at end of file diff --git a/html/upload/index.php b/html/upload/index.php new file mode 100644 index 00000000..4daf800c --- /dev/null +++ b/html/upload/index.php @@ -0,0 +1,93 @@ += 1 ORDER BY ID DESC LIMIT 1"; + $request = $pdo->prepare($sqlRequest); + $request->bindParam(":userAccreditation", $_SESSION['userAccreditation']); + $request->execute(); + $result = $request->fetchAll(PDO::FETCH_ASSOC); + + $articleID = (int)$result[0]['ID'] + 1; + + file_put_contents($rootFilePath . "content/articles/" . $articleID . ".md", nl2br($_POST['article-content'])); + + $sqlRequest = "INSERT INTO articles (ID, title, author, resume, classification) VALUES (:articleID, :title, :author, :resume, :classification)"; + $request = $pdo->prepare($sqlRequest); + $request->bindParam(":articleID", $articleID); + $request->bindParam(":title", htmlspecialchars($_POST['article-title'])); + $request->bindParam(":author", $_SESSION['userID']); + $request->bindParam(":resume", htmlspecialchars($_POST['article-resume'])); + $request->bindParam(":classification", $_POST['classification'], PDO::PARAM_INT); + if($request->execute()) { + header("Location: /editor?article=" . $articleID); + } else { + $status = "Erreur SQL"; + } +} + +?> + + + + + + + + + + + +
+
+ +
+
+ + + +
+
+
+
+

Rédiger un article

+
+ +
+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/html/users/index.php b/html/users/index.php new file mode 100644 index 00000000..92923587 --- /dev/null +++ b/html/users/index.php @@ -0,0 +1,148 @@ +prepare("SELECT ID, username, display_name, level, profile_picture, banner, bio FROM users WHERE username = :username"); + $request->bindParam(":username", htmlspecialchars($_GET['u'])); + $request->execute(); + $result = $request->fetchAll(PDO::FETCH_ASSOC); + + if($result) { + $userID = $result[0]['ID']; + $userName = $result[0]['username']; + $userDisplayName = $result[0]['display_name']; + $userLevel = $result[0]['level']; + $userPPURL = $result[0]['profile_picture'] == NULL ? "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png" : $result[0]['profile_picture']; + $userBanner = $result[0]['banner'] = NULL ? "" : $result[0]['banner']; + $userBio = $result[0]['bio']; + } else { + $userID = 0; + $userName = htmlspecialchars($_GET['u']); + $userDisplayName = "Unknown"; + $userLevel = 0; + $userPPURL = "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png"; + $userBanner = ""; + $userBio = ""; + } +} else { + $userID = 0; + $userName = htmlspecialchars($_GET['u']); + $userDisplayName = "Unknown"; + $userLevel = 0; + $userPPURL = "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png"; + $userBanner = ""; + $userBio = ""; +} + +?> + + + + + + + + + + + +
+
+ +
+
+ + + +
+
+ +
+
+ + + \ No newline at end of file