From d174f7f196147388831df12110101cb76333ecf3 Mon Sep 17 00:00:00 2001 From: Jan BELLON Date: Thu, 14 Mar 2024 23:49:12 +0000 Subject: [PATCH] Update 4 files - /include/functions.php - /html/users/index.php - /html/admin/index.php - /html/news/index.php --- html/admin/index.php | 6 +++--- html/news/index.php | 6 +++--- html/users/index.php | 12 ++++++------ include/functions.php | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/html/admin/index.php b/html/admin/index.php index 5cc572f6..529315ed 100644 --- a/html/admin/index.php +++ b/html/admin/index.php @@ -44,7 +44,7 @@ $pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlData $search = isset($_GET['search']) ? '%' . $_GET['search'] . '%' : '%%'; - $sqlRequest = "SELECT username, display_name, level, profile_picture FROM users WHERE ID LIKE :search OR username LIKE :search OR display_name LIKE :search OR email LIKE :search ORDER BY date DESC"; + $sqlRequest = "SELECT username, display_name, certification, profile_picture FROM users WHERE ID LIKE :search OR username LIKE :search OR display_name LIKE :search OR email LIKE :search ORDER BY date DESC"; $request = $pdo->prepare($sqlRequest); $request->bindParam(":search", $search); $request->execute(); @@ -56,10 +56,10 @@ $pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlData $pubDate = date('d/m/Y', $pubDateTime); $userName = $row['username']; $userDisplayName = $row['display_name']; - $userLevel = $row['level']; + $userCertification = $row['certification']; $userPPURL = $row['profile_picture'] == NULL ? "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png" : $row['profile_picture']; - userWidget($userPPURL, $userDisplayName, $userName, $userLevel, $certificationColors, $rootPageURL); + userWidget($userPPURL, $userDisplayName, $userName, $userCertification, $certificationColors, $rootPageURL); } } ?> diff --git a/html/news/index.php b/html/news/index.php index 275fa4ee..c73cafca 100644 --- a/html/news/index.php +++ b/html/news/index.php @@ -69,7 +69,7 @@ $pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlData require_once '../../include/parsedown.php'; $parsedown = new Parsedown(); - $sqlRequest = "SELECT articles.ID, articles.title, articles.date, articles.miniature, articles.resume, articles.author, users.username, users.display_name, users.level, users.profile_picture FROM articles JOIN users ON articles.author = users.ID WHERE articles.ID = :articleID AND articles.classification <= :userAccreditation"; + $sqlRequest = "SELECT articles.ID, articles.title, articles.date, articles.miniature, articles.resume, articles.author, users.username, users.display_name, users.certification, users.profile_picture FROM articles JOIN users ON articles.author = users.ID WHERE articles.ID = :articleID AND articles.classification <= :userAccreditation"; $request = $pdo->prepare($sqlRequest); $request->bindParam(":articleID", $_GET['article']); $request->bindParam(":userAccreditation", $_SESSION['userAccreditation']); @@ -85,7 +85,7 @@ $pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlData $miniatureURL = $result[0]['miniature']; $authorUsername = $result[0]['username']; $authorDisplayName = $result[0]['display_name']; - $authorLevel = $result[0]['level']; + $authorCertification = $result[0]['certification']; $authorPPURL = $result[0]['profile_picture'] == NULL ? "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png" : $result[0]['profile_picture']; $authorID = $result[0]['author']; @@ -97,7 +97,7 @@ $pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlData echo ('Editer'); } - userWidget($authorPPURL, $authorDisplayName, $authorUsername, $authorLevel, $certificationColors, $rootPageURL); + userWidget($authorPPURL, $authorDisplayName, $authorUsername, $authorCertification, $certificationColors, $rootPageURL); echo ('
'); echo (''); diff --git a/html/users/index.php b/html/users/index.php index e7a585ca..2563ed94 100644 --- a/html/users/index.php +++ b/html/users/index.php @@ -4,7 +4,7 @@ require("../../include/functions.php"); $pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass); if(isset($_GET['u']) && empty($_GET['u']) == false) { - $request = $pdo->prepare("SELECT ID, username, display_name, level, profile_picture, banner, bio FROM users WHERE username = :username"); + $request = $pdo->prepare("SELECT ID, username, display_name, profile_picture, banner, bio, certification FROM users WHERE username = :username"); $request->bindParam(":username", htmlspecialchars($_GET['u'])); $request->execute(); $result = $request->fetchAll(PDO::FETCH_ASSOC); @@ -13,27 +13,27 @@ if(isset($_GET['u']) && empty($_GET['u']) == false) { $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']; + $userCertification = $result[0]['certification']; } 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 = ""; + $userCertification = 0; } } 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 = ""; + $userCertification = 0; } ?> @@ -60,7 +60,7 @@ if(isset($_GET['u']) && empty($_GET['u']) == false) { } .certification { - fill: 0 ? $certificationColors[$userLevel] : "#000000"?>; + fill: 0 ? $certificationColors[$userCertification] : "#000000"?>; } @@ -92,7 +92,7 @@ if(isset($_GET['u']) && empty($_GET['u']) == false) {
1) { + if($userCertification > 0) { echo ''; } ?> diff --git a/include/functions.php b/include/functions.php index 70a47dd2..a225f9dd 100644 --- a/include/functions.php +++ b/include/functions.php @@ -115,7 +115,7 @@ return $pdo; } - function userWidget($userPPURL, $userDisplayName, $userName, $userLevel, $certificationColors, $rootPageURL) { + function userWidget($userPPURL, $userDisplayName, $userName, $userCertification, $certificationColors, $rootPageURL) { echo (''); echo ('
'); @@ -128,8 +128,8 @@ echo ('
'); echo ($userDisplayName); - if ($userLevel > 1) { - echo (''); + if ($userCertification > 0) { + echo (''); echo (''); echo (''); }