mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-05 03:24:41 +00:00
uwuzu v1.3.0 new_planet
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
function createUniqId() {
|
||||
list($msec, $sec) = explode(" ", microtime());
|
||||
$hashCreateTime = $sec . floor($msec * 1000000);
|
||||
|
||||
$hashCreateTime = strrev($hashCreateTime);
|
||||
|
||||
return base_convert($hashCreateTime, 10, 36);
|
||||
}
|
||||
|
||||
require('../db.php');
|
||||
|
||||
require('view.php');
|
||||
|
||||
// データベースに接続
|
||||
try {
|
||||
$option = array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
|
||||
);
|
||||
$pdo = new PDO('mysql:charset=utf8mb4;dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USER, DB_PASS, $option);
|
||||
} catch (PDOException $e) {
|
||||
// 接続エラーのときエラー内容を取得する
|
||||
$error_message[] = $e->getMessage();
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
$loginid = htmlentities($_GET['account_id']);
|
||||
|
||||
// データベース接続の設定
|
||||
$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,
|
||||
));
|
||||
|
||||
$query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
|
||||
|
||||
$query->execute(array(':userid' => $userid));
|
||||
|
||||
$result2 = $query->fetch();
|
||||
|
||||
if(!(empty($result2["loginid"]))){
|
||||
if($result2["loginid"] === $loginid){
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
|
||||
$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,
|
||||
));
|
||||
|
||||
// フォローしているユーザーIDを取得し、カンマで区切る
|
||||
$bookmarkQuery = $dbh->prepare("SELECT bookmark FROM account WHERE userid = :userid");
|
||||
$bookmarkQuery->bindValue(':userid', $userid);
|
||||
$bookmarkQuery->execute();
|
||||
$bookmarkData = $bookmarkQuery->fetch();
|
||||
$bookmark = $bookmarkData['bookmark'];
|
||||
$bookmarkList = explode(',', $bookmark);
|
||||
|
||||
// フォローしているユーザーの投稿を取得し、日時順に並び替える
|
||||
$messages = array(); // 初期化
|
||||
|
||||
foreach ($bookmarkList as $bookmarkUniqId) {
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE uniqid = :bookmarkUniqId AND account.role != 'ice'
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindValue(':bookmarkUniqId', $bookmarkUniqId, PDO::PARAM_STR);
|
||||
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
}
|
||||
$messages = array_reverse($messages);
|
||||
// ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える
|
||||
foreach ($messages as &$message) {
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, iconname, headname, sacinfo 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['sacinfo'] = $userData['sacinfo'];
|
||||
$message['role'] = $userData['role'];
|
||||
}
|
||||
|
||||
$rpQuery = $pdo->prepare("SELECT COUNT(*) as reply_count FROM ueuse WHERE rpuniqid = :rpuniqid");
|
||||
$rpQuery->bindValue(':rpuniqid', $message['uniqid']);
|
||||
$rpQuery->execute();
|
||||
$rpData = $rpQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($rpData){
|
||||
$message['reply_count'] = $rpData['reply_count'];
|
||||
}
|
||||
}
|
||||
//adsystem------------------
|
||||
|
||||
$message['ads'] = "false";
|
||||
|
||||
$today = date("Y-m-d H:i:s");
|
||||
|
||||
$adsQuery = $pdo->prepare("SELECT * FROM ads WHERE start_date < :today AND limit_date > :today ORDER BY rand()");
|
||||
$adsQuery->bindValue(':today', $today);
|
||||
$adsQuery->execute();
|
||||
$adsresult = $adsQuery->fetch();
|
||||
if(!(empty($adsresult))){
|
||||
$message['ads'] = "true";
|
||||
$message['ads_url'] = $adsresult["url"];
|
||||
$message['ads_img_url'] = $adsresult["image_url"];
|
||||
$message['ads_memo'] = $adsresult["memo"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
|
||||
if(!($value["role"] === "ice")){
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
|
||||
}
|
||||
}else{
|
||||
echo '<div class="tokonone" id="noueuse"><p>ユーズがありません</p></div>';
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
|
||||
}
|
||||
}else{
|
||||
echo '<div class="tokonone" id="noueuse"><p>取得に失敗しました。</p></div>';
|
||||
}
|
||||
}else{
|
||||
echo '<div class="tokonone" id="noueuse"><p>取得に失敗しました。</p></div>';
|
||||
}
|
||||
}else{
|
||||
echo '<div class="tokonone" id="noueuse"><p>取得に失敗しました。</p></div>';
|
||||
}
|
||||
?>
|
||||
+14
-3
@@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if($result2["loginid"] === $loginid){
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
|
||||
@@ -79,11 +80,19 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$messages = array(); // 初期化
|
||||
|
||||
foreach ($followList as $followUserId) {
|
||||
$sql = "SELECT * FROM ueuse WHERE rpuniqid = '' AND account = :follow_account ORDER BY datetime DESC LIMIT $offset, $itemsPerPage";
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :follow_account
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$stmt = $dbh->prepare($sql);
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':follow_account', $followUserId, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$message_array = $stmt;
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$messages[] = $row;
|
||||
@@ -138,6 +147,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
foreach ($messages as $value) {
|
||||
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
|
||||
if(!($value["role"] === "ice")){
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
function createUniqId() {
|
||||
list($msec, $sec) = explode(" ", microtime());
|
||||
$hashCreateTime = $sec . floor($msec * 1000000);
|
||||
|
||||
$hashCreateTime = strrev($hashCreateTime);
|
||||
|
||||
return base_convert($hashCreateTime, 10, 36);
|
||||
}
|
||||
|
||||
require('../db.php');
|
||||
|
||||
// データベースに接続
|
||||
try {
|
||||
$option = array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
|
||||
);
|
||||
$pdo = new PDO('mysql:charset=utf8mb4;dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USER, DB_PASS, $option);
|
||||
} catch (PDOException $e) {
|
||||
// 接続エラーのときエラー内容を取得する
|
||||
$error_message[] = $e->getMessage();
|
||||
}
|
||||
|
||||
if (isset($_POST['userid']) && isset($_POST['account_id'])) {
|
||||
$userid = htmlentities($_POST['userid']);
|
||||
$loginid = htmlentities($_POST['account_id']);
|
||||
|
||||
// データベース接続の設定
|
||||
$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,
|
||||
));
|
||||
|
||||
$query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
|
||||
|
||||
$query->execute(array(':userid' => $userid));
|
||||
|
||||
$result2 = $query->fetch();
|
||||
|
||||
if(!(empty($result2["loginid"]))){
|
||||
if($result2["loginid"] === $loginid){
|
||||
$loading_dt = htmlentities($_POST['loading_dt']);
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
|
||||
$sql = "SELECT * FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT 1";
|
||||
$message_array = $pdo->query($sql);
|
||||
|
||||
while ($row = $message_array->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
$now_time = strtotime($loading_dt);
|
||||
$loadtime = strtotime($value["datetime"]);
|
||||
$time_sa = $loadtime - $now_time;
|
||||
if($time_sa > 0){
|
||||
echo json_encode(['success' => true, 'info' => 'ueuse_true']);
|
||||
exit;
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'info' => 'ueuse_none']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'info' => 'ueuse_none']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'info' => 'not_access1']);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'info' => 'not_access2']);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'info' => 'not_access3']);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
+16
-3
@@ -45,11 +45,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if(!(empty($result2["loginid"]))){
|
||||
if($result2["loginid"] === $loginid){
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
|
||||
@@ -59,8 +60,18 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
|
||||
if (!empty($pdo)) {
|
||||
|
||||
$sql = "SELECT * FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT $offset, $itemsPerPage";
|
||||
$message_array = $pdo->query($sql);
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.rpuniqid = '' AND account.role != 'ice'
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$message_array = $stmt;
|
||||
|
||||
while ($row = $message_array->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
@@ -118,6 +129,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す
|
||||
$messageDisplay->display();
|
||||
|
||||
@@ -9,6 +9,9 @@ function createUniqId() {
|
||||
return base_convert($hashCreateTime, 10, 36);
|
||||
}
|
||||
|
||||
$serversettings_file = "../server/serversettings.ini";
|
||||
$serversettings = parse_ini_file($serversettings_file, true);
|
||||
|
||||
require('../db.php');
|
||||
|
||||
require('notificationview.php');
|
||||
@@ -59,7 +62,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
|
||||
));
|
||||
|
||||
$messageQuery = $dbh->prepare("SELECT title,msg,url,datetime,userchk FROM notification WHERE touserid = :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
|
||||
$messageQuery = $dbh->prepare("SELECT fromuserid,title,msg,url,datetime,userchk FROM notification WHERE touserid = :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
|
||||
$messageQuery->bindValue(':userid', $userid);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
@@ -77,6 +80,17 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
|
||||
if (!empty($message_array)) {
|
||||
foreach ($message_array as $value) {
|
||||
$value["servericon"] = htmlspecialchars($serversettings["serverinfo"]["server_icon"], ENT_QUOTES, 'UTF-8');
|
||||
if(!(empty($value['fromuserid']))){
|
||||
if(!($value['fromuserid'] == "uwuzu-fromsys")){
|
||||
$userQuery = $dbh->prepare("SELECT username,iconname FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $value['fromuserid']);
|
||||
$userQuery->execute();
|
||||
$user_array = $userQuery->fetch();
|
||||
$value['fromusericon'] = "../".$user_array["iconname"];
|
||||
$value['fromusername'] = $user_array["username"];
|
||||
}
|
||||
}
|
||||
$messageDisplay = new MessageDisplay($value); // userid を渡さない
|
||||
$messageDisplay->display();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,42 @@
|
||||
<?php
|
||||
function processMarkdownAndWrapEmptyLines($markdownText){
|
||||
|
||||
//\___________________[注意]__________________\
|
||||
// \____ここの順番を変えるとうまく動かなくなります___\
|
||||
// \______Markdownうまく動くところを探すべし______\
|
||||
|
||||
$markdownText = preg_replace('/\[\[buruburu (.+)\]\]/m', '<span class="buruburu">$1</span>', $markdownText);//ぶるぶる
|
||||
|
||||
$markdownText = preg_replace('/(^|[^`])`([^`\n]+)`($|[^`])/m', '$1<span class="inline">$2</span>$3', $markdownText);//Inline Code
|
||||
|
||||
$markdownText = preg_replace('/\*\*\*(.*?)\*\*\*/', '<b><i>$1</i></b>', $markdownText);//太字&斜体の全部のせセット
|
||||
$markdownText = preg_replace('/\_\_\_(.*?)\_\_\_/', '<b><i>$1</i></b>', $markdownText);//太字&斜体の全部のせセット
|
||||
|
||||
$markdownText = preg_replace('/\*\*(.*?)\*\*/', '<b>$1</b>', $markdownText);//太字
|
||||
$markdownText = preg_replace('/\_\_(.*?)\_\_/', '<b>$1</b>', $markdownText);//太字
|
||||
|
||||
$markdownText = preg_replace('/\*(.*?)\*/', '<i>$1</i>', $markdownText);//斜体
|
||||
$markdownText = preg_replace('/\_(.*?)\_/', '<i>$1</i>', $markdownText);//斜体
|
||||
|
||||
$markdownText = preg_replace('/\~\~(.*?)\~\~/m', '<s>$1</s>', $markdownText);//打ち消し線
|
||||
|
||||
$markdownText = preg_replace('/>>> (.*)/m', '<span class="quote">$1</span>', $markdownText);//>>> 引用
|
||||
|
||||
$markdownText = preg_replace('/\|\|(.*)\|\|/m', '<span class="blur">$1</span>', $markdownText);//黒塗り
|
||||
|
||||
// タイトル(#、##、###)をHTMLのhタグに変換
|
||||
$markdownText = preg_replace('/^# (.+)/m', '<h1>$1</h1>', $markdownText);
|
||||
$markdownText = preg_replace('/^## (.+)/m', '<h2>$1</h2>', $markdownText);
|
||||
$markdownText = preg_replace('/^### (.+)/m', '<h3>$1</h3>', $markdownText);
|
||||
|
||||
// 箇条書き(-)をHTMLのul/liタグに変換
|
||||
$markdownText = preg_replace('/^- (.+)/m', '<p>・ $1</p>', $markdownText);
|
||||
|
||||
// 空行の前に何もない行をHTMLのpタグに変換
|
||||
$markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1<p>$2</p>', $markdownText);
|
||||
|
||||
return $markdownText;
|
||||
}
|
||||
//Profile
|
||||
function replaceProfileEmojiImages($postText) {
|
||||
// プロフィール名で絵文字名(:emoji:)を検出して画像に置き換える
|
||||
@@ -88,7 +126,7 @@ class MessageDisplay {
|
||||
|
||||
public function display() {
|
||||
if($this->value['userchk'] === "none"){
|
||||
echo '<div class="notification2">';
|
||||
echo '<div class="notification this">';
|
||||
}else{
|
||||
echo '<div class="notification">';
|
||||
}
|
||||
@@ -106,8 +144,28 @@ class MessageDisplay {
|
||||
echo ' </div>';
|
||||
|
||||
// 投稿内のHTMLコードを表示する部分
|
||||
if(!(empty($this->value['fromuserid']))){
|
||||
echo ' <div class="flebox">';
|
||||
echo ' <div class="icon">';
|
||||
if(($this->value['fromuserid'] == "uwuzu-fromsys")){
|
||||
if(!(empty($this->value["servericon"]))){
|
||||
echo ' <a href="/rule/serverabout"><img src="'.$this->value["servericon"].'"></a>';
|
||||
}else{
|
||||
echo ' <a href="/rule/serverabout"><img src="../img/uwuzuicon.png"></a>';
|
||||
}
|
||||
}else{
|
||||
echo ' <a href="/@'.$this->value['fromuserid'].'"><img src="' . $this->value['fromusericon'] . '"></a>';
|
||||
}
|
||||
echo ' </div>';
|
||||
if(($this->value['fromuserid'] == "uwuzu-fromsys")){
|
||||
echo ' <div class="username"><a href="/rule/serverabout">uwuzu</a></div>';
|
||||
}else{
|
||||
echo ' <div class="username"><a href="/@'.$this->value['fromuserid'].'">'.$this->value['fromusername'].'</a></div>';
|
||||
}
|
||||
echo ' </div>';
|
||||
}
|
||||
echo ' <h3>' . replaceEmojisWithImages($this->value['title']) . '</h3>';
|
||||
echo ' <p>' . replaceEmojisWithImages(nl2br($this->value['msg'])) . '</p>';
|
||||
echo ' <p>' . processMarkdownAndWrapEmptyLines(replaceEmojisWithImages(nl2br($this->value['msg']))) . '</p>';
|
||||
echo ' <a href="' . htmlentities($this->value['url']) . '">詳細をみる</a>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
@@ -53,6 +53,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
|
||||
if (!empty($pdo)) {
|
||||
if (!empty($keyword)) {
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
@@ -133,6 +139,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
}
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
|
||||
+12
-5
@@ -45,11 +45,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if($result2["loginid"] === $loginid){
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$ueuseid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
|
||||
|
||||
@@ -70,9 +71,11 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
));
|
||||
|
||||
// 投稿内容の取得(新しい順に取得)
|
||||
$messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid OR rpuniqid = :rpueuseid ORDER BY datetime ASC LIMIT $offset, $itemsPerPage");
|
||||
$messageQuery->bindValue(':ueuseid', $ueuseid);
|
||||
$messageQuery->bindValue(':rpueuseid', $ueuseid);
|
||||
$messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid OR rpuniqid = :rpueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':ueuseid', $ueuseid, PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':rpueuseid', $ueuseid, PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
@@ -84,8 +87,10 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
foreach ($message_array as $row) {
|
||||
if(!(empty($row["rpuniqid"]))){
|
||||
if(!($row["rpuniqid"] == $ueuseid)){
|
||||
$up_messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid ORDER BY datetime ASC LIMIT $offset, $itemsPerPage");
|
||||
$up_messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
|
||||
$up_messageQuery->bindValue(':ueuseid', $row["rpuniqid"]);
|
||||
$up_messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$up_messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$up_messageQuery->execute();
|
||||
$up_messageData = $up_messageQuery->fetchAll();
|
||||
if(!(empty($up_messageData))){
|
||||
@@ -145,6 +150,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
|
||||
@@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
|
||||
@@ -71,12 +72,20 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE favorite LIKE :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
|
||||
$messageQuery->bindValue(':userid', '%,' . $uwuzuid . '%', PDO::PARAM_STR);
|
||||
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.favorite LIKE :userid AND account.role != 'ice'
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindValue(':userid', '%,' . $uwuzuid . '%', PDO::PARAM_STR);
|
||||
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$message_array = $stmt->fetchAll();
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
@@ -127,6 +136,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
|
||||
@@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
|
||||
@@ -78,9 +79,11 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
(photo3 IS NOT NULL AND photo3 != '' AND photo3 != 'none') OR
|
||||
(photo4 IS NOT NULL AND photo4 != '' AND photo4 != 'none') OR
|
||||
(video1 IS NOT NULL AND video1 != '' AND video1 != 'none')
|
||||
) ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
|
||||
) ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
|
||||
$messageQuery->bindValue(':userid', $uwuzuid);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
@@ -134,6 +137,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
|
||||
@@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
|
||||
$userid = htmlentities($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', htmlentities($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$mybookmark = htmlentities($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
|
||||
@@ -72,8 +73,10 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = ''ORDER BY datetime DESC LIMIT $offset, $itemsPerPage");
|
||||
$messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = ''ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':userid', $uwuzuid);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
@@ -127,6 +130,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
|
||||
+40
-3
@@ -2,7 +2,33 @@
|
||||
<?php
|
||||
function processMarkdownAndWrapEmptyLines($markdownText){
|
||||
|
||||
$markdownText = preg_replace('/^\[\[buruburu (.+)\]\]/m', '<p class="buruburu">$1</p>', $markdownText);//←ここ!!!!!!!!!!!!!!
|
||||
//\___________________[注意]__________________\
|
||||
// \____ここの順番を変えるとうまく動かなくなります___\
|
||||
// \______Markdownうまく動くところを探すべし______\
|
||||
|
||||
$markdownText = preg_replace('/\[\[buruburu (.+)\]\]/m', '<span class="buruburu">$1</span>', $markdownText);//ぶるぶる
|
||||
|
||||
$markdownText = preg_replace('/(^|[^`])`([^`\n]+)`($|[^`])/m', '$1<span class="inline">$2</span>$3', $markdownText);//Inline Code
|
||||
|
||||
/*$markdownText = preg_replace_callback('/^\[\[time (\d+)\]\]/m', function($matches) {
|
||||
$timestamp = $matches[1];
|
||||
return '<span class="unixtime">' . date("Y/m/d H:i:s", $timestamp) . '</span>';
|
||||
}, $markdownText);*/
|
||||
|
||||
$markdownText = preg_replace('/\*\*\*(.*?)\*\*\*/', '<b><i>$1</i></b>', $markdownText);//太字&斜体の全部のせセット
|
||||
$markdownText = preg_replace('/\_\_\_(.*?)\_\_\_/', '<b><i>$1</i></b>', $markdownText);//太字&斜体の全部のせセット
|
||||
|
||||
$markdownText = preg_replace('/\*\*(.*?)\*\*/', '<b>$1</b>', $markdownText);//太字
|
||||
$markdownText = preg_replace('/\_\_(.*?)\_\_/', '<b>$1</b>', $markdownText);//太字
|
||||
|
||||
$markdownText = preg_replace('/\*(.*?)\*/', '<i>$1</i>', $markdownText);//斜体
|
||||
$markdownText = preg_replace('/\_(.*?)\_/', '<i>$1</i>', $markdownText);//斜体
|
||||
|
||||
$markdownText = preg_replace('/\~\~(.*?)\~\~/m', '<s>$1</s>', $markdownText);//打ち消し線
|
||||
|
||||
$markdownText = preg_replace('/>>> (.*)/m', '<span class="quote">$1</span>', $markdownText);//>>> 引用
|
||||
|
||||
$markdownText = preg_replace('/\|\|(.*)\|\|/m', '<span class="blur">$1</span>', $markdownText);//黒塗り
|
||||
|
||||
// タイトル(#、##、###)をHTMLのhタグに変換
|
||||
$markdownText = preg_replace('/^# (.+)/m', '<h1>$1</h1>', $markdownText);
|
||||
@@ -11,7 +37,7 @@ function processMarkdownAndWrapEmptyLines($markdownText){
|
||||
|
||||
// 箇条書き(-)をHTMLのul/liタグに変換
|
||||
$markdownText = preg_replace('/^- (.+)/m', '<p>・ $1</p>', $markdownText);
|
||||
|
||||
|
||||
// 空行の前に何もない行をHTMLのpタグに変換
|
||||
$markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1<p>$2</p>', $markdownText);
|
||||
|
||||
@@ -147,7 +173,7 @@ function YouTube_and_nicovideo_Links($postText) {
|
||||
foreach ($matches[0] as $url) {
|
||||
// ドメイン部分を抽出
|
||||
$parsedUrl = parse_url($url);
|
||||
if($parsedUrl['host'] == "youtube.com" || $parsedUrl['host'] == "youtu.be" || $parsedUrl['host'] == "www.youtube.com"){
|
||||
if($parsedUrl['host'] == "youtube.com" || $parsedUrl['host'] == "youtu.be" || $parsedUrl['host'] == "www.youtube.com" || $parsedUrl['host'] == "m.youtube.com"){
|
||||
|
||||
if (isset($parsedUrl['query'])) {
|
||||
if(false !== strpos($parsedUrl['query'], 'v=')) {
|
||||
@@ -237,12 +263,15 @@ class MessageDisplay {
|
||||
echo ' <div class="time">';
|
||||
$datetime = strtotime(htmlentities($this->value['datetime']));
|
||||
$today = strtotime(date("Y-m-d"));
|
||||
$tomorrow = date('Y-m-d', strtotime('+1 day'));
|
||||
if (date("md", $datetime) == "0101") {
|
||||
if (date("Y", $datetime) == date("Y")) {
|
||||
echo "元日 " . date("H:i", $datetime);
|
||||
} else {
|
||||
echo date("Y年m月d日 H:i", $datetime);
|
||||
}
|
||||
} elseif ($datetime >= $tomorrow) {
|
||||
echo date("Y年m月d日 H:i", $datetime) . " (未来)";
|
||||
} elseif ($datetime >= $today) {
|
||||
echo "今日 " . date("H:i", $datetime);
|
||||
} elseif (date("Y", $datetime) == date("Y")) {
|
||||
@@ -325,6 +354,14 @@ class MessageDisplay {
|
||||
}
|
||||
echo '<a href="/!'.htmlentities($this->value['uniqid']). '~' . htmlentities($this->value['account']) . '" class="tuduki"><svg><use xlink:href="../img/sysimage/reply_1.svg#reply_1"></use></svg>'.htmlentities($this->value['reply_count']).'</a>';
|
||||
echo '<button name="share" id="share" class="share" data-uniqid="' . htmlentities($this->value['uniqid']) . '" data-userid="' . htmlentities($this->value['account']) . '"><svg><use xlink:href="../img/sysimage/share_1.svg#share_1"></use></svg></button>';
|
||||
|
||||
$bookmarkList = explode(',', $this->value['bookmark']);
|
||||
if (in_array($this->value['uniqid'], $bookmarkList)) {
|
||||
echo '<button name="bookmark" id="bookmark" class="bookmark bookmark_after" data-uniqid="' . htmlentities($this->value['uniqid']) . '" data-userid="' . htmlentities($this->value['account']) . '"><svg><use xlink:href="../img/sysimage/bookmark_1.svg#bookmark_1"></use></svg></button>';
|
||||
}else{
|
||||
echo '<button name="bookmark" id="bookmark" class="bookmark" data-uniqid="' . htmlentities($this->value['uniqid']) . '" data-userid="' . htmlentities($this->value['account']) . '"><svg><use xlink:href="../img/sysimage/bookmark_1.svg#bookmark_1"></use></svg></button>';
|
||||
}
|
||||
|
||||
if($this->value['account'] === $this->userid){
|
||||
if(!($this->value['role'] === "ice")){
|
||||
if($this->value['abi'] === "none"){
|
||||
|
||||
Reference in New Issue
Block a user