mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-05 03:24:41 +00:00
uwuzu version 1.2.29
This commit is contained in:
@@ -1,4 +1,29 @@
|
||||
<?php
|
||||
//Profile
|
||||
function replaceProfileEmojiImages($postText) {
|
||||
// プロフィール名で絵文字名(:emoji:)を検出して画像に置き換える
|
||||
$emojiPattern = '/:(\w+):/';
|
||||
$postTextWithImages = preg_replace_callback($emojiPattern, function($matches) {
|
||||
$emojiName = $matches[1];
|
||||
//絵文字path取得
|
||||
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
|
||||
));
|
||||
$emoji_Query = $dbh->prepare("SELECT emojifile, emojiname FROM emoji WHERE emojiname = :emojiname");
|
||||
$emoji_Query->bindValue(':emojiname', $emojiName);
|
||||
$emoji_Query->execute();
|
||||
$emoji_row = $emoji_Query->fetch();
|
||||
if(empty($emoji_row["emojifile"])){
|
||||
$emoji_path = "img/sysimage/errorimage/emoji_404.png";
|
||||
}else{
|
||||
$emoji_path = $emoji_row["emojifile"];
|
||||
}
|
||||
return "<img src='../".$emoji_path."' alt=':$emojiName:' title=':$emojiName:'>";
|
||||
}, $postText);
|
||||
return $postTextWithImages;
|
||||
}
|
||||
function replaceEmojisWithImages($postText) {
|
||||
// ユーズ内で絵文字名(:emoji:)を検出して画像に置き換える
|
||||
$emojiPattern = '/:(\w+):/';
|
||||
@@ -41,7 +66,7 @@ function replaceEmojisWithImages($postText) {
|
||||
if(empty($mentionsuserData)){
|
||||
return "@$username";
|
||||
}else{
|
||||
return "<a class = 'mta' href='/@".$mentionsuserData["userid"]."'>@".$mentionsuserData["username"]."</a>";
|
||||
return "<a class = 'mta' href='/@".htmlentities($mentionsuserData["userid"])."'>@".replaceProfileEmojiImages(htmlentities($mentionsuserData["username"]))."</a>";
|
||||
}
|
||||
}, $postTextWithImages);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user