1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-05 03:24:41 +00:00

uwuzu version 1.2.11

This commit is contained in:
daichimarukana
2023-08-25 00:45:43 +09:00
parent 468536b4a8
commit 4ebbb1ca82
21 changed files with 586 additions and 466 deletions
+3 -35
View File
@@ -34,40 +34,6 @@ $offset = ($pageNumber - 1) * $itemsPerPage;
$messages = array();
if (!empty($pdo)) {
// ユーズ内の絵文字を画像に置き換える
function replaceEmojisWithImages($postText) {
// ユーズ内で絵文字名(:emoji:)を検出して画像に置き換える
$pattern = '/:(\w+):/';
$postTextWithImages = preg_replace_callback($pattern, function($matches) {
$emojiName = $matches[1];
return "<img src='../emoji/emojiimage.php?emoji=" . urlencode($emojiName) . "' alt='$emojiName'>";
}, $postText);
return $postTextWithImages;
}
function replaceURLsWithLinks($postText) {
// URLを正規表現を使って検出
$pattern = '/(https?:\/\/[^\s]+)/';
preg_match_all($pattern, $postText, $matches);
// 検出したURLごとに処理を行う
foreach ($matches[0] as $url) {
// ドメイン部分を抽出
$parsedUrl = parse_url($url);
$domain = isset($parsedUrl['host']) ? $parsedUrl['host'] : '';
// ドメインのみを表示するaタグを生成
$link = "<a href='$url' target='_blank'>$domain</a>";
// URLをドメインのみを表示するaタグで置き換え
$postText = str_replace($url, $link, $postText);
}
return $postText;
}
$sql = "SELECT account, username, uniqid, rpuniqid, ueuse, datetime, photo1, photo2, video1, favorite, abi, abidate FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT $offset, $itemsPerPage";
$message_array = $pdo->query($sql);
@@ -79,12 +45,14 @@ if (!empty($pdo)) {
// ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える
foreach ($messages as &$message) {
$userQuery = $pdo->prepare("SELECT username, userid, profile, role FROM account WHERE userid = :userid");
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, iconname, headname FROM account WHERE userid = :userid");
$userQuery->bindValue(':userid', $message["account"]);
$userQuery->execute();
$userData = $userQuery->fetch();
if ($userData) {
$message['iconname'] = $userData['iconname'];
$message['headname'] = $userData['headname'];
$message['username'] = $userData['username'];
$message['role'] = $userData['role'];
}