mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-04 19:14:41 +00:00
uwuzu v1.5.0 Combeny
This commit is contained in:
+5
-1
@@ -24,7 +24,11 @@ if(safetext($serversettings["serverinfo"]["server_activitypub"]) === "true"){
|
||||
$error_message[] = $e->getMessage();
|
||||
}
|
||||
|
||||
$user = safetext($_GET['actor']);
|
||||
if(isset($_GET['actor'])){
|
||||
$user = safetext($_GET['actor']);
|
||||
}else{
|
||||
$user = null;
|
||||
}
|
||||
|
||||
$userid = str_replace('@','', str_replace('@'.$domain.'', '', $user));
|
||||
if( !empty($pdo) ) {
|
||||
|
||||
+14
-12
@@ -105,20 +105,22 @@ if(!(empty($_POST['btn_submit']))){
|
||||
}
|
||||
|
||||
if(empty($error_message)){
|
||||
$DB_Settings = "
|
||||
<?php // データベースの接続情報
|
||||
define( 'DB_HOST', '".$DataBase_Host."');
|
||||
define( 'DB_USER', '".$DataBase_User."');
|
||||
define( 'DB_PASS', '".$DataBase_Pass."');
|
||||
define( 'DB_NAME', '".$DataBase_Name."');
|
||||
$DB_Settings = "<?php // データベースの接続情報
|
||||
define( 'DB_HOST', '".$DataBase_Host."');
|
||||
define( 'DB_USER', '".$DataBase_User."');
|
||||
define( 'DB_PASS', '".$DataBase_Pass."');
|
||||
define( 'DB_NAME', '".$DataBase_Name."');
|
||||
|
||||
// ENC_KEYは操作しないでください。ユーザーデータを使用できなくなるおそれがあります。
|
||||
define( 'ENC_KEY', '".$Encryption_KEY."');
|
||||
// ENC_KEYは操作しないでください。ユーザーデータを使用できなくなるおそれがあります。
|
||||
define( 'ENC_KEY', '".$Encryption_KEY."');
|
||||
|
||||
// タイムゾーン設定
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
?>
|
||||
";
|
||||
define( 'RATE_LM', '60'); // レートリミット(ユーズ/分)
|
||||
define( 'STOP_LA', '4'); // 自動停止ロードアベレージ上限
|
||||
|
||||
// タイムゾーン設定
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
?>
|
||||
";
|
||||
|
||||
//設定上書き
|
||||
$file = fopen('../db.php', 'w');
|
||||
|
||||
@@ -6,8 +6,6 @@ require('../../db.php');
|
||||
//- Base64_mime
|
||||
require('../../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$mojisizefile = "../../server/textsize.txt";
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ require('../../db.php');
|
||||
//- Base64_mime
|
||||
require('../../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$mojisizefile = "../../server/textsize.txt";
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
$serversettings_file = "../server/serversettings.ini";
|
||||
$serversettings = parse_ini_file($serversettings_file, true);
|
||||
|
||||
header("Content-Type: application/xml; charset=UTF-8");
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$xml_text = <<<XML
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://$domain/</loc>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://$domain/new.php</loc>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://$domain/login.php</loc>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
XML;
|
||||
|
||||
$test_xml = new SimpleXMLElement($xml_text);
|
||||
|
||||
echo $test_xml->asXML();
|
||||
?>
|
||||
+159
-201
@@ -6,8 +6,6 @@ require('../../db.php');
|
||||
//- Base64_mime
|
||||
require('../../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$mojisizefile = "../../server/textsize.txt";
|
||||
|
||||
@@ -88,6 +86,14 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||
$ueuse = safetext($_GET['text']);
|
||||
}elseif(!(empty($post_json["text"]))){
|
||||
$ueuse = safetext($post_json["text"]);
|
||||
}else{
|
||||
$err = "input_not_found";
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
//リプライ先取得
|
||||
if(!(empty($_GET['replyid']))){
|
||||
@@ -97,6 +103,14 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||
}else{
|
||||
$replyid = "";
|
||||
}
|
||||
//リユーズ先取得
|
||||
if(!(empty($_GET['reuseid']))){
|
||||
$reuseid = safetext($_GET['reuseid']);
|
||||
}elseif(!(empty($post_json["reuseid"]))){
|
||||
$reuseid = safetext($post_json["reuseid"]);
|
||||
}else{
|
||||
$reuseid = "";
|
||||
}
|
||||
|
||||
//NSFWの有無
|
||||
if(!(empty($_GET['nsfw']))){
|
||||
@@ -117,211 +131,155 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||
$nsfw = "false";
|
||||
}
|
||||
|
||||
//Base64での画像送信の確認(POSTのみ&デコードは関数(Base64_mime)側でやってくれる)
|
||||
$img_uid = safetext($userData["userid"]);//UserID必須
|
||||
if(!(empty($post_json["image1"]))){
|
||||
$image1 = safetext($post_json["image1"]);
|
||||
$UploadPath1 = base64_mime($image1,$img_uid);
|
||||
if($UploadPath1 == false){
|
||||
$UploadPath1 = "none";
|
||||
}
|
||||
}else{
|
||||
$UploadPath1 = "none";
|
||||
}
|
||||
if(!(empty($post_json["image2"]))){
|
||||
$image2 = safetext($post_json["image2"]);
|
||||
$UploadPath2 = base64_mime($image2,$img_uid);
|
||||
if($UploadPath2 == false){
|
||||
$UploadPath2 = "none";
|
||||
}
|
||||
}else{
|
||||
$UploadPath2 = "none";
|
||||
}
|
||||
if(!(empty($post_json["image3"]))){
|
||||
$image3 = safetext($post_json["image3"]);
|
||||
$UploadPath3 = base64_mime($image3,$img_uid);
|
||||
if($UploadPath3 == false){
|
||||
$UploadPath3 = "none";
|
||||
}
|
||||
}else{
|
||||
$UploadPath3 = "none";
|
||||
}
|
||||
if(!(empty($post_json["image4"]))){
|
||||
$image4 = safetext($post_json["image4"]);
|
||||
$UploadPath4 = base64_mime($image4,$img_uid);
|
||||
if($UploadPath4 == false){
|
||||
$UploadPath4 = "none";
|
||||
}
|
||||
}else{
|
||||
$UploadPath4 = "none";
|
||||
}
|
||||
//ここまで-----------------------------------------
|
||||
|
||||
$old_datetime = date("Y-m-d H:i:00");
|
||||
$now_datetime = date("Y-m-d H:i:00",strtotime("+1 minute"));
|
||||
$rate_Query = $pdo->prepare("SELECT * FROM ueuse WHERE account = :userid AND TIME(datetime) BETWEEN :old_datetime AND :now_datetime");
|
||||
$rate_Query->bindValue(':userid', $userData["userid"]);
|
||||
$rate_Query->bindValue(':old_datetime', $old_datetime);
|
||||
$rate_Query->bindValue(':now_datetime', $now_datetime);
|
||||
$rate_Query->execute();
|
||||
$rate_count = $rate_Query->rowCount();
|
||||
if(!($rate_count > $max_ueuse_rate_limit-1)){
|
||||
if( empty($ueuse) ) {
|
||||
$err = "input_not_found";
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
} else {
|
||||
// 文字数を確認
|
||||
if( (int)safetext(file_get_contents($mojisizefile)) < mb_strlen($ueuse, 'UTF-8') ) {
|
||||
$err = "content_to_".safetext(file_get_contents($mojisizefile))."_characters";
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
// 禁止url確認
|
||||
for($i = 0; $i < count($banurl); $i++) {
|
||||
if(!($banurl[$i] == "")){
|
||||
if (false !== strpos($ueuse, 'https://'.$banurl[$i])) {
|
||||
$err = "contains_prohibited_url";
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!(empty($replyid))){
|
||||
$rpChkQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :rpuniqid");
|
||||
$rpChkQuery->bindValue(':rpuniqid', $replyid);
|
||||
$rpChkQuery->execute();
|
||||
$rpChkcount = $rpChkQuery->rowCount();
|
||||
if(empty($rpChkcount)){
|
||||
$err = "no_reply_destination";
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// 書き込み日時を取得
|
||||
$username = safetext($userData["username"]);
|
||||
$userid = safetext($userData["userid"]);
|
||||
$datetime = safetext(date("Y-m-d H:i:s"));
|
||||
$uniqid = safetext(createUniqId());
|
||||
$abi = "none";
|
||||
$nones = "none";
|
||||
$popularity = 0;
|
||||
|
||||
// トランザクション開始
|
||||
$pdo->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
// SQL作成
|
||||
$stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, rpuniqid, ueuse, photo1, photo2, photo3, photo4, video1, datetime, abi, nsfw, popularity) VALUES (:username, :account, :uniqid, :rpuniqid, :ueuse, :photo1, :photo2, :photo3, :photo4, :video1, :datetime, :abi, :nsfw, :popularity)");
|
||||
$imageData = base64_decode($post_json["image1"],true);
|
||||
|
||||
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':account', $userid, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':rpuniqid', $replyid, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR);
|
||||
$tmpFilePath = tempnam(sys_get_temp_dir(), 'upload_'.createUniqId());
|
||||
file_put_contents($tmpFilePath, $imageData);
|
||||
|
||||
$Img1Files = [
|
||||
'name' => 'upload.png',
|
||||
'type' => check_mime($tmpFilePath),
|
||||
'tmp_name' => $tmpFilePath,
|
||||
'error' => UPLOAD_ERR_OK,
|
||||
'size' => strlen($imageData),
|
||||
];
|
||||
} else {
|
||||
$Img1Files = array();
|
||||
}
|
||||
|
||||
$stmt->bindParam(':photo1', $UploadPath1, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':photo2', $UploadPath2, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':photo3', $UploadPath3, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':photo4', $UploadPath4, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':video1', $nones, PDO::PARAM_STR);
|
||||
if(!(empty($post_json["image2"]))){
|
||||
$imageData = base64_decode($post_json["image2"],true);
|
||||
|
||||
$tmpFilePath = tempnam(sys_get_temp_dir(), 'upload_'.createUniqId());
|
||||
file_put_contents($tmpFilePath, $imageData);
|
||||
|
||||
$Img2Files = [
|
||||
'name' => 'upload.png',
|
||||
'type' => check_mime($tmpFilePath),
|
||||
'tmp_name' => $tmpFilePath,
|
||||
'error' => UPLOAD_ERR_OK,
|
||||
'size' => strlen($imageData),
|
||||
];
|
||||
} else {
|
||||
$Img2Files = array();
|
||||
}
|
||||
|
||||
$stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR);
|
||||
if(!(empty($post_json["image3"]))){
|
||||
$imageData = base64_decode($post_json["image3"],true);
|
||||
|
||||
$tmpFilePath = tempnam(sys_get_temp_dir(), 'upload_'.createUniqId());
|
||||
file_put_contents($tmpFilePath, $imageData);
|
||||
|
||||
$Img3Files = [
|
||||
'name' => 'upload.png',
|
||||
'type' => check_mime($tmpFilePath),
|
||||
'tmp_name' => $tmpFilePath,
|
||||
'error' => UPLOAD_ERR_OK,
|
||||
'size' => strlen($imageData),
|
||||
];
|
||||
} else {
|
||||
$Img3Files = array();
|
||||
}
|
||||
|
||||
$stmt->bindParam(':abi', $abi, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':nsfw', $nsfw, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':popularity', $popularity, PDO::PARAM_INT);
|
||||
|
||||
// SQLクエリの実行
|
||||
$res = $stmt->execute();
|
||||
|
||||
// コミット
|
||||
$res = $pdo->commit();
|
||||
|
||||
$mentionedUsers = array_unique(get_mentions_userid($ueuse));
|
||||
|
||||
foreach ($mentionedUsers as $mentionedUser) {
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
try {
|
||||
$fromuserid = safetext($userid);
|
||||
$touserid = safetext($mentionedUser);
|
||||
$datetime = safetext(date("Y-m-d H:i:s"));
|
||||
$msg = "" . $ueuse . "";
|
||||
$title = "" . safetext($username) . "さんにメンションされました!";
|
||||
$url = "/!" . safetext($uniqid) . "";
|
||||
$userchk = 'none';
|
||||
|
||||
// 通知用SQL作成
|
||||
$stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)");
|
||||
|
||||
$stmt->bindParam(':fromuserid', $fromuserid, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':msg', $msg, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':url', $url, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':title', $title, PDO::PARAM_STR);
|
||||
|
||||
$stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR);
|
||||
|
||||
// SQLクエリの実行
|
||||
$res = $stmt->execute();
|
||||
|
||||
// コミット
|
||||
$res = $pdo->commit();
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
}
|
||||
|
||||
if( $res ) {
|
||||
$response = array(
|
||||
'uniqid' => decode_yajirushi(htmlspecialchars_decode($uniqid)),
|
||||
'userid' => decode_yajirushi(htmlspecialchars_decode($userid)),
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
} else {
|
||||
$err = "db_error_".$e->getMessage();
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
// プリペアドステートメントを削除
|
||||
$stmt = null;
|
||||
if(!(empty($post_json["image4"]))){
|
||||
$imageData = base64_decode($post_json["image4"],true);
|
||||
|
||||
$tmpFilePath = tempnam(sys_get_temp_dir(), 'upload_'.createUniqId());
|
||||
file_put_contents($tmpFilePath, $imageData);
|
||||
|
||||
$Img4Files = [
|
||||
'name' => 'upload.png',
|
||||
'type' => check_mime($tmpFilePath),
|
||||
'tmp_name' => $tmpFilePath,
|
||||
'error' => UPLOAD_ERR_OK,
|
||||
'size' => strlen($imageData),
|
||||
];
|
||||
} else {
|
||||
$Img4Files = array();
|
||||
}
|
||||
|
||||
$settingsJson = getUserData($pdo, $userData["userid"])["other_settings"];
|
||||
if(!(empty($settingsJson))){
|
||||
$isAIBWM = val_OtherSettings("isAIBlockWaterMark", $settingsJson);
|
||||
}else{
|
||||
$err = "over_rate_limit";
|
||||
$isAIBWM = false;
|
||||
}
|
||||
|
||||
$video1 = array();
|
||||
|
||||
$ueuse_result = send_ueuse($userData["userid"],$replyid,$reuseid,$ueuse,$Img1Files,$Img2Files,$Img3Files,$Img4Files,$video1,$nsfw,$isAIBWM, "../");
|
||||
|
||||
|
||||
if($ueuse_result[0] == true){
|
||||
$response = array(
|
||||
'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueuse_result[1])),
|
||||
'userid' => decode_yajirushi(htmlspecialchars_decode($userData["userid"])),
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$errcode = $ueuse_result[1][0];
|
||||
switch (true) {
|
||||
case strpos($errcode, 'ACCOUNT_HAS_BEEN_FROZEN' ) !==false:
|
||||
$err = "this_account_has_been_frozen";
|
||||
break;
|
||||
case strpos($errcode, 'INPUT_PLEASE' ) !==false:
|
||||
$err = "input_not_found";
|
||||
break;
|
||||
case strpos($errcode, 'INPUT_OVER_MAX_COUNT' ) !==false:
|
||||
$err = "content_to_".safetext(file_get_contents($mojisizefile))."_characters";
|
||||
break;
|
||||
case strpos($errcode, 'INPUT_CONTAINS_PROHIBITED_URL' ) !==false:
|
||||
$err = "contains_prohibited_url";
|
||||
break;
|
||||
case strpos($errcode, 'FILE_DEKASUGUI_PHP_INI_KAKUNIN' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'FILE_DEKASUGUI_HTML_KAKUNIN' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'FILE_SUKOSHIDAKE_UPLOAD' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'FILE_UPLOAD_DEKINAKATTA' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'TMP_FOLDER_NAI' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'FILE_KAKIKOMI_SIPPAI' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'PHPINFO()_KAKUNIN' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'S3ERROR' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'SORRY_FILE_HITAIOU' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'FILE_UPLOAD_DEKINAKATTA' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'PHOTO_SELECT_PLEASE' ) !==false:
|
||||
$err = "upload_error";
|
||||
break;
|
||||
case strpos($errcode, 'REGISTERED_DAME' ) !==false:
|
||||
$err = "could_not_complete";
|
||||
break;
|
||||
case strpos($errcode, 'OVER_RATE_LIMIT' ) !==false:
|
||||
$err = "over_rate_limit";
|
||||
break;
|
||||
case strpos($errcode, 'ERROR' ) !==false:
|
||||
$err = "could_not_complete";
|
||||
break;
|
||||
default:
|
||||
$err = "could_not_complete";
|
||||
break;
|
||||
}
|
||||
|
||||
$response = array(
|
||||
'error_code' => $err,
|
||||
);
|
||||
|
||||
@@ -6,8 +6,6 @@ require('../../db.php');
|
||||
//- Base64_mime
|
||||
require('../../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$mojisizefile = "../../server/textsize.txt";
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ require('../../db.php');
|
||||
//- Base64_mime
|
||||
require('../../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$mojisizefile = "../../server/textsize.txt";
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require('../db.php');
|
||||
require('../../db.php');
|
||||
require("../../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
$serversettings_file = "../../server/serversettings.ini";
|
||||
|
||||
+15
-8
@@ -93,6 +93,7 @@ $pdo = null;
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<script src="../js/nsfw_event.js"></script>
|
||||
<script src="../js/view_function.js"></script>
|
||||
<link rel="stylesheet" href="../css/home.css">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="apple-touch-icon" type="image/png" href="../favicon/apple-touch-icon-180x180.png">
|
||||
@@ -237,27 +238,33 @@ $pdo = null;
|
||||
$(document).ready(function () {
|
||||
var userid = '<?php echo $userid; ?>';
|
||||
var account_id = '<?php echo $loginid; ?>';
|
||||
|
||||
loadPosts();
|
||||
view_ueuse_init(userid, account_id);
|
||||
|
||||
var pageNumber = 1;
|
||||
var isLoading = false;
|
||||
|
||||
loadPosts();
|
||||
function loadPosts() {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
$("#loading").show();
|
||||
$.ajax({
|
||||
url: '../nextpage/bookmark.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
url: '../nextpage/bookmarktimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id },
|
||||
dataType: 'html',
|
||||
success: function (response) {
|
||||
$('#postContainer').append(response);
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
}
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -4,7 +4,7 @@
|
||||
--sub-color: #FFFAE6;
|
||||
--background-color: #F5F5F5;
|
||||
--tl-color: #F7F7F7;
|
||||
--ueuse-color:#f5f5f5;
|
||||
--ueuse-color:#F9F9F9;
|
||||
--text-color: #252525;
|
||||
--subtext-color: #999;
|
||||
--link-color: #4e4428;
|
||||
@@ -20,6 +20,7 @@
|
||||
--dark-background-color: #0c0c0c;
|
||||
--dark-subtext-color: #CCC;
|
||||
--dark-text-color: #FFF;
|
||||
--dark-border-color: #252525;
|
||||
/*HeadingFonts*/
|
||||
--Head-fonts: "Zen Maru Gothic";
|
||||
/*TextFonts*/
|
||||
|
||||
+390
-234
File diff suppressed because it is too large
Load Diff
+15
-27
@@ -195,16 +195,18 @@ body{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.textbox .cntzone .usercnt{
|
||||
margin-top: 24px;
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
width: 43%;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
width: calc(50% - 52px);
|
||||
height: 5dvh;
|
||||
border-radius: 15px;
|
||||
background-color: var(--sub-color);
|
||||
border: solid 1px var(--border-color);
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
@@ -243,8 +245,7 @@ body{
|
||||
object-fit: cover;
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
border-radius: 10px;
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05);
|
||||
border-radius: 15px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
@@ -307,7 +308,6 @@ body{
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
}
|
||||
|
||||
label > input {
|
||||
@@ -334,15 +334,12 @@ label > input {
|
||||
font-weight: normal;
|
||||
text-decoration:none;
|
||||
text-align: center;
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15);
|
||||
transition: all 250ms ease-in-out;
|
||||
}
|
||||
.irobutton:hover{
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
|
||||
padding: 8px 22%;
|
||||
}
|
||||
.irobutton:active{
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05);
|
||||
padding: 8px 18%;
|
||||
}
|
||||
|
||||
@@ -358,23 +355,20 @@ label > input {
|
||||
|
||||
|
||||
text-align: center;
|
||||
background-color: var(--sub-color);
|
||||
background-color: var(--dark-subtext-color);
|
||||
color: var(--dark-text-color);
|
||||
|
||||
border-radius: 50px;
|
||||
color:var(--main-color);
|
||||
font-size: 22px;
|
||||
font-family: var(--Head-fonts), sans-serif;
|
||||
font-weight: normal;
|
||||
text-decoration:none;
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15);
|
||||
transition: all 250ms ease-in-out;
|
||||
}
|
||||
.sirobutton:hover{
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
|
||||
padding: 8px 22%;
|
||||
}
|
||||
.sirobutton:active{
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
|
||||
padding: 8px 18%;
|
||||
}
|
||||
|
||||
@@ -464,7 +458,7 @@ label > input {
|
||||
}
|
||||
|
||||
.inbox {
|
||||
width: calc(100% - 24px);
|
||||
width: calc(100% - 20px);
|
||||
padding: 8px 10px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
@@ -474,7 +468,6 @@ label > input {
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0px 0px 25px rgba(0,0,0,0.03);
|
||||
overflow-x: scroll;
|
||||
overflow-y : scroll ;
|
||||
transition: border 350ms ease-in-out;
|
||||
@@ -846,11 +839,9 @@ main h1{
|
||||
.fbtn:hover{
|
||||
background-color: var(--main-color);
|
||||
color: var(--sub-color);
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
|
||||
width:55%;
|
||||
}
|
||||
.fbtn:active{
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05);
|
||||
width:45%;
|
||||
}
|
||||
.textbox .authzone{
|
||||
@@ -994,13 +985,9 @@ p img{
|
||||
}
|
||||
|
||||
.formarea{
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding: 12px;
|
||||
border-radius: 15px;
|
||||
background-color: none;
|
||||
border: none;
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
@@ -1073,7 +1060,6 @@ p img{
|
||||
padding-right: 12px;
|
||||
border-radius: 15px;
|
||||
background-color: var(--background-color);
|
||||
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05) inset;
|
||||
margin-top: 32px;
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
@@ -1239,6 +1225,7 @@ p img{
|
||||
}
|
||||
.textbox .cntzone .usercnt{
|
||||
background-color: var(--dark-sub-color);
|
||||
border: solid 1px var(--dark-border-color);
|
||||
}
|
||||
|
||||
.textbox .cntzone .usercnt .p1{
|
||||
@@ -1251,7 +1238,7 @@ p img{
|
||||
|
||||
.btnbox{
|
||||
background-color: var(--dark-sub-color);
|
||||
border: none;
|
||||
border: solid 1px var(--dark-border-color);
|
||||
}
|
||||
.irobutton{
|
||||
background-color: var(--main-color);
|
||||
@@ -1260,11 +1247,12 @@ p img{
|
||||
.sirobutton{
|
||||
background-color: var(--dark-background-color);
|
||||
color:var(--main-color);
|
||||
border: solid 1px var(--dark-border-color);
|
||||
}
|
||||
|
||||
.formarea{
|
||||
background-color: var(--dark-sub-color);
|
||||
border: none;
|
||||
border: 1px solid var(--dark-border-color);
|
||||
}
|
||||
.formarea label{
|
||||
color:var(--dark-text-color);
|
||||
@@ -1284,7 +1272,7 @@ p img{
|
||||
.inbox {
|
||||
background: var(--dark-background-color);
|
||||
color: var(--dark-text-color);
|
||||
border: none;
|
||||
border: 1px solid var(--dark-border-color);
|
||||
}
|
||||
|
||||
.flexbtn .irobutton{
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<?php // データベースの接続情報
|
||||
define( 'DB_HOST', '');
|
||||
define( 'DB_USER', '');
|
||||
define( 'DB_PASS', '');
|
||||
define( 'DB_NAME', '');
|
||||
|
||||
<?php // データベースの接続情報
|
||||
define( 'DB_HOST', '');
|
||||
define( 'DB_USER', '');
|
||||
define( 'DB_PASS', '');
|
||||
define( 'DB_NAME', '');
|
||||
// ENC_KEYは操作しないでください。ユーザーデータを使用できなくなるおそれがあります。
|
||||
define( 'ENC_KEY', '');
|
||||
|
||||
// ENC_KEYは操作しないでください。ユーザーデータを使用できなくなるおそれがあります。
|
||||
define( 'ENC_KEY', '');
|
||||
|
||||
// タイムゾーン設定
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
?>
|
||||
define( 'RATE_LM', '60'); // レートリミット(ユーズ/分)
|
||||
define( 'STOP_LA', '4'); // 自動停止ロードアベレージ上限
|
||||
// タイムゾーン設定
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
?>
|
||||
|
||||
@@ -16,6 +16,7 @@ if (safetext(isset($_POST['uniqid'])) && safetext(isset($_POST['userid'])) && sa
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$result = delete_ueuse($postUniqid, $postUserid, $loginid);
|
||||
if($result[0] === true){
|
||||
echo json_encode(['success' => true]);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
http_response_code(503);
|
||||
require_once(__DIR__.'/../db.php');
|
||||
require_once(__DIR__."/../function/function.php");
|
||||
|
||||
$custom503file = __DIR__."/../server/503imagepath.txt";
|
||||
$serversettings_file = __DIR__."/../server/serversettings.ini";
|
||||
$serversettings = parse_ini_file($serversettings_file, true);
|
||||
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="/css/home.css">
|
||||
<script src="../js/jquery-min.js"></script>
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="apple-touch-icon" type="image/png" href="../favicon/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="../favicon/icon-192x192.png">
|
||||
<title>503 Service Unavailable - <?php echo safetext($serversettings["serverinfo"]["server_name"]);?></title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="topbox">
|
||||
<?php if(!empty(safetext($serversettings["serverinfo"]["server_logo_login"]))){ ?>
|
||||
<div class="logo">
|
||||
<a href="/index.php"><img src=<?php echo safetext($serversettings["serverinfo"]["server_logo_login"]);?>></a>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div class="logo">
|
||||
<a href="/index.php"><img src="/img/uwuzulogo.svg"></a>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<div class="terms">
|
||||
<div class="p3"><?php echo safetext($serversettings["serverinfo"]["server_name"]);?></div>
|
||||
<div class="p2c"><?php echo $domain;?></div>
|
||||
<div class="err404">
|
||||
<?php if(!(empty(file_get_contents($custom503file)))){?>
|
||||
<img src="<?php echo file_get_contents($custom503file);?>">
|
||||
<?php } ?>
|
||||
<h1><?php echo safetext($serversettings["serverinfo"]["server_name"]);?>の処理能力の限界を超えました</h1>
|
||||
<p>ごめんなさい...!<br>
|
||||
現在<?php echo safetext($serversettings["serverinfo"]["server_name"]);?>の処理能力では対応できないほどの負荷がかかっています。<br>
|
||||
時間をおいてから再度アクセスをお願いいたします。<br>
|
||||
(503 Service Unavailable)</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+875
-150
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['emoji'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
$emoji = safetext($_POST['emoji']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => '認証に失敗しました。(AUTH_INVALID)']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
// カンマ区切りまたは1つのユーザーID文字列を処理
|
||||
$emojis = array_unique(array_filter(explode(',', $emoji)));
|
||||
|
||||
$results = [];
|
||||
|
||||
if (count($emojis) > 0) {
|
||||
// プレースホルダを作成
|
||||
$placeholders = implode(',', array_fill(0, count($emojis), '?'));
|
||||
$stmt = $pdo->prepare("SELECT emojifile, emojiname FROM emoji WHERE emojiname IN ($placeholders)");
|
||||
$stmt->execute($emojis);
|
||||
|
||||
$fetched = [];
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$fetched[$row['emojiname']] = [
|
||||
'emojipath' => filter_var($row["emojifile"], FILTER_VALIDATE_URL) ? $row["emojifile"] : "../" . $row["emojifile"],
|
||||
'emojiname' => $row['emojiname']
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($emojis as $name) {
|
||||
if (isset($fetched[$name])) {
|
||||
$results[$name] = $fetched[$name];
|
||||
} else {
|
||||
$results[$name] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
"success" => true,
|
||||
"emojis" => $results
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
} else {
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"emojipath" => null,
|
||||
"emojiname" => null,
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"emojipath" => null,
|
||||
"emojiname" => null,
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['get_account'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
$get_account = safetext($_POST['get_account']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => '認証に失敗しました。(AUTH_INVALID)']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
// カンマ区切りまたは1つのユーザーID文字列を処理
|
||||
$usernames = array_unique(array_filter(explode(',', $get_account)));
|
||||
|
||||
$results = [];
|
||||
|
||||
if (count($usernames) > 0) {
|
||||
// プレースホルダを作成
|
||||
$placeholders = implode(',', array_fill(0, count($usernames), '?'));
|
||||
$stmt = $pdo->prepare("SELECT userid, username FROM account WHERE userid IN ($placeholders)");
|
||||
$stmt->execute($usernames);
|
||||
|
||||
$fetched = [];
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$fetched[$row['userid']] = [
|
||||
'userid' => $row['userid'],
|
||||
'username' => $row['username']
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($usernames as $name) {
|
||||
if (isset($fetched[$name])) {
|
||||
$results[$name] = $fetched[$name];
|
||||
} else {
|
||||
$results[$name] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
"success" => true,
|
||||
"users" => $results
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
} else {
|
||||
echo json_encode([
|
||||
"success" => false,
|
||||
"users" => null
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"userid" => null,
|
||||
"username" => null,
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
+2
-2
@@ -60,11 +60,11 @@ if (safetext(isset($_POST['uniqid'])) && safetext(isset($_POST['reusetext'])) &&
|
||||
}
|
||||
$ueuse_result = send_ueuse($userid,$rpUniqid,$ruUniqid,$reusetext,$photo1,$photo2,$photo3,$photo4,$video1,$nsfw_chk,$AIBWM);
|
||||
|
||||
if($ueuse_result == null){
|
||||
if($ueuse_result[0] == true){
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => $ueuse_result]);
|
||||
echo json_encode(['success' => false, 'error' => $ueuse_result[1]]);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
require('../db.php');
|
||||
require("function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
if (safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey'])) && safetext(isset($_POST['settings_type']))) {
|
||||
//------------------------------------------------------
|
||||
if(file_exists("../settings_admin/plugin_settings/amazons3_settings.php")){
|
||||
require_once '../settings_admin/plugin_settings/amazons3_settings.php';
|
||||
if(AMS3_CHKS == "true"){
|
||||
if(file_exists("../plugin/aws/aws-autoloader.php")){
|
||||
require_once '../plugin/aws/aws-autoloader.php';
|
||||
}else{
|
||||
actionLog(null, "error", "settings", null, "AWS SDK for PHPが見つかりませんでした!", 4);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
actionLog(null, "error", "settings", null, "amazons3_settings.phpが見つかりませんでした!", 3);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
$userid = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => '認証に失敗しました。(AUTH_INVALID)']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$settings_type = safetext($_POST['settings_type']);
|
||||
|
||||
if($settings_type == "icon"){
|
||||
if(isset($_FILES["data"])){
|
||||
if (!(empty($_FILES['data']['name']))) {
|
||||
$uploadedFile = $_FILES['data'];
|
||||
if(check_mime($uploadedFile['tmp_name'])){
|
||||
$extension = convert_mime(check_mime($uploadedFile['tmp_name']));
|
||||
delete_exif($extension, $uploadedFile['tmp_name']);
|
||||
resizeImage($uploadedFile['tmp_name'], 512, 512);
|
||||
|
||||
if(AMS3_CHKS == "true"){
|
||||
$usericonurl = getUserData($pdo, $userid)["iconname"];
|
||||
if(filter_var($usericonurl, FILTER_VALIDATE_URL)){
|
||||
$s3delresult = deleteAmazonS3($usericonurl);
|
||||
}else{
|
||||
$s3delresult = true;
|
||||
}
|
||||
if($s3delresult == true){
|
||||
$s3result = uploadAmazonS3($uploadedFile['tmp_name']);
|
||||
}else{
|
||||
$s3result = false;
|
||||
}
|
||||
}else{
|
||||
if(check_mime($uploadedFile['tmp_name']) == "image/webp"){
|
||||
$newFilename = createUniqId() . '-'.$userid.'.webp';
|
||||
}else{
|
||||
$newFilename = createUniqId() . '-'.$userid.'.' . $extension;
|
||||
}
|
||||
$uploadedPath = 'usericons/' . $newFilename;
|
||||
$result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath);
|
||||
|
||||
if ($result) {
|
||||
$iconName = $uploadedPath; // 保存されたファイルのパスを使用
|
||||
} else {
|
||||
$errnum = $uploadedFile['error'];
|
||||
if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";}
|
||||
if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";}
|
||||
if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";}
|
||||
if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";}
|
||||
if($errnum === 6){$errcode = "TMP_FOLDER_NAI";}
|
||||
if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";}
|
||||
if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";}
|
||||
$error_message[] = 'アップロード失敗!(1)エラーコード:' .$errcode.'';
|
||||
}
|
||||
}
|
||||
if(isset($s3result)){
|
||||
if($s3result == false){
|
||||
$error_message[] = 'アップロード失敗!(1)エラーコード: S3ERROR';
|
||||
}else{
|
||||
$iconName = $s3result; // S3に保存されたファイルのパスを使用
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$error_message[] = "使用できない画像形式です。(FILE_UPLOAD_DEKINAKATTA)";
|
||||
}
|
||||
}else{
|
||||
$error_message[] = 'アイコン画像を選択してください(PHOTO_SELECT_PLEASE)';
|
||||
}
|
||||
|
||||
if(empty($error_message)) {
|
||||
$currentIconPath = getUserData($pdo, $userid)["iconname"];
|
||||
|
||||
$pdo->beginTransaction();
|
||||
try {
|
||||
$stmt = $pdo->prepare("UPDATE account SET iconname = :iconname WHERE userid = :userid");
|
||||
$stmt->bindValue(':iconname', $iconName, PDO::PARAM_STR);
|
||||
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
$res = $stmt->execute();
|
||||
$res = $pdo->commit();
|
||||
} catch (Exception $e) {
|
||||
$pdo->rollBack();
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
if ($currentIconPath) {
|
||||
unlink('../' . $currentIconPath);
|
||||
}
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => '更新に失敗しました']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// プリペアドステートメントを削除
|
||||
$stmt = null;
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => $error_message[0]]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($settings_type == "header"){
|
||||
if(isset($_FILES["data"])){
|
||||
if (!(empty($_FILES['data']['name']))) {
|
||||
$uploadedFile = $_FILES['data'];
|
||||
if(check_mime($uploadedFile['tmp_name'])){
|
||||
$extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
|
||||
delete_exif($extension, $uploadedFile['tmp_name']);
|
||||
resizeImage($uploadedFile['tmp_name'], 2048, 1024);
|
||||
|
||||
if(AMS3_CHKS == "true"){
|
||||
$userheadurl = getUserData($pdo, $userid)["headname"];
|
||||
if(filter_var($userheadurl, FILTER_VALIDATE_URL)){
|
||||
$s3delresult = deleteAmazonS3($userheadurl);
|
||||
}else{
|
||||
$s3delresult = true;
|
||||
}
|
||||
if($s3delresult == true){
|
||||
$s3result = uploadAmazonS3($uploadedFile['tmp_name']);
|
||||
}else{
|
||||
$s3result = false;
|
||||
}
|
||||
}else{
|
||||
if(check_mime($uploadedFile['tmp_name']) == "image/webp"){
|
||||
$newFilename = createUniqId() . '-'.$userid.'.webp';
|
||||
}else{
|
||||
$newFilename = createUniqId() . '-'.$userid.'.' . $extension;
|
||||
}
|
||||
$uploadedPath = 'userheads/' . $newFilename;
|
||||
$result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath);
|
||||
|
||||
if ($result) {
|
||||
$headName = $uploadedPath; // 保存されたファイルのパスを使用
|
||||
} else {
|
||||
$errnum = $uploadedFile['error'];
|
||||
if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";}
|
||||
if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";}
|
||||
if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";}
|
||||
if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";}
|
||||
if($errnum === 6){$errcode = "TMP_FOLDER_NAI";}
|
||||
if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";}
|
||||
if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";}
|
||||
$error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.'';
|
||||
}
|
||||
}
|
||||
if(isset($s3result)){
|
||||
if($s3result == false){
|
||||
$error_message[] = 'アップロード失敗!(2)エラーコード: S3ERROR';
|
||||
}else{
|
||||
$headName = $s3result; // S3に保存されたファイルのパスを使用
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$error_message[] = "使用できない画像形式です。(FILE_UPLOAD_DEKINAKATTA)";
|
||||
}
|
||||
}else{
|
||||
$error_message[] = 'アイコン画像を選択してください(PHOTO_SELECT_PLEASE)';
|
||||
}
|
||||
|
||||
if(empty($error_message)) {
|
||||
$currentHeadPath = getUserData($pdo, $userid)["headname"];
|
||||
|
||||
$pdo->beginTransaction();
|
||||
try {
|
||||
$stmt = $pdo->prepare("UPDATE account SET headname = :headname WHERE userid = :userid");
|
||||
$stmt->bindValue(':headname', $headName, PDO::PARAM_STR);
|
||||
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
$res = $stmt->execute();
|
||||
$res = $pdo->commit();
|
||||
} catch (Exception $e) {
|
||||
$pdo->rollBack();
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
if ($currentHeadPath) {
|
||||
unlink('../' . $currentHeadPath);
|
||||
}
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => '更新に失敗しました']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// プリペアドステートメントを削除
|
||||
$stmt = null;
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => $error_message[0]]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => '必要なパラメータが提供されていません。']);
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
require('../db.php');
|
||||
require("function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
if (safetext(isset($_POST['ueuse'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
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) {
|
||||
// 接続エラーのときエラー内容を取得する
|
||||
actionLog($userid, "error", "ueuse", null, $e, 4);
|
||||
}
|
||||
|
||||
$userid = safetext($_POST['userid']);
|
||||
|
||||
$ueuse = safetext($_POST['ueuse']);
|
||||
$nsfw_chk = safetext($_POST['nsfw_chk']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => '認証に失敗しました。(AUTH_INVALID)']);
|
||||
exit;
|
||||
}
|
||||
|
||||
//ユーザーの認証情報を取得
|
||||
$query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
|
||||
$query->execute(array(':userid' => $userid));
|
||||
$result2 = $query->fetch();
|
||||
if($result2["loginid"] === $loginid){
|
||||
if(!($result2["role"] == "ice")){
|
||||
if(!(empty($result2["other_settings"]))){
|
||||
$isAIBWM = val_OtherSettings("isAIBlockWaterMark", $result2["other_settings"]);
|
||||
}else{
|
||||
$isAIBWM = false;
|
||||
}
|
||||
|
||||
if(isset($nsfw_chk) && $nsfw_chk == "true"){
|
||||
$nsfw_chk = "true";
|
||||
}else{
|
||||
$nsfw_chk = "false";
|
||||
}
|
||||
|
||||
if(isset($_FILES['upload_images'])){
|
||||
$photo1 = $_FILES['upload_images'];
|
||||
}else{
|
||||
$photo1 = null;
|
||||
}
|
||||
if(isset($_FILES['upload_images2'])){
|
||||
$photo2 = $_FILES['upload_images2'];
|
||||
}else{
|
||||
$photo2 = null;
|
||||
}
|
||||
if(isset($_FILES['upload_images3'])){
|
||||
$photo3 = $_FILES['upload_images3'];
|
||||
}else{
|
||||
$photo3 = null;
|
||||
}
|
||||
if(isset($_FILES['upload_images4'])){
|
||||
$photo4 = $_FILES['upload_images4'];
|
||||
}else{
|
||||
$photo4 = null;
|
||||
}
|
||||
if(isset($_FILES['upload_videos1'])){
|
||||
$video1 = $_FILES['upload_videos1'];
|
||||
}else{
|
||||
$video1 = null;
|
||||
}
|
||||
|
||||
if(isset($_POST['rpuniqid'])){
|
||||
$rpUniqid = safetext($_POST['rpuniqid']);
|
||||
}else{
|
||||
$rpUniqid = "";
|
||||
}
|
||||
|
||||
$ruUniqid = "";
|
||||
$ueuse_result = send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$photo4,$video1,$nsfw_chk,$isAIBWM);
|
||||
|
||||
if($ueuse_result[0] == true){
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => $ueuse_result[1]]);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => 'お使いのアカウントではユーズができません。']);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => 'ユーズに失敗しました。']);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => '必要なパラメータが提供されていません。']);
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
+99
-66
@@ -10,9 +10,6 @@ $serversettings = parse_ini_file($serversettings_file, true);
|
||||
$mojisizefile = "../server/textsize.txt";
|
||||
$mojisize = (int)safetext(file_get_contents($mojisizefile));
|
||||
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$banurldomainfile = "../server/banurldomain.txt";
|
||||
$banurl_info = file_get_contents($banurldomainfile);
|
||||
$banurl = preg_split("/\r\n|\n|\r/", $banurl_info);
|
||||
@@ -87,51 +84,6 @@ if(isset($_GET['text'])) {
|
||||
$ueuse = safetext($_COOKIE['ueuse']);
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
|
||||
if( !empty($_POST['btn_submit']) ) {
|
||||
$settingsJsonQuery = $pdo->prepare("SELECT userid, other_settings FROM account WHERE userid = :userid");
|
||||
$settingsJsonQuery->bindValue(':userid', $userid);
|
||||
$settingsJsonQuery->execute();
|
||||
$settingsJson = $settingsJsonQuery->fetch();
|
||||
if(!(empty($settingsJson["other_settings"]))){
|
||||
$isAIBWM = val_OtherSettings("isAIBlockWaterMark", $settingsJson["other_settings"]);
|
||||
}else{
|
||||
$isAIBWM = false;
|
||||
}
|
||||
|
||||
$ueuse = safetext($_POST['ueuse']);
|
||||
|
||||
if(isset($_POST['nsfw_chk'])){
|
||||
$nsfw_chk = safetext($_POST['nsfw_chk']);
|
||||
}else{
|
||||
$nsfw_chk = "false";
|
||||
}
|
||||
|
||||
$photo1 = $_FILES['upload_images'];
|
||||
$photo2 = $_FILES['upload_images2'];
|
||||
$photo3 = $_FILES['upload_images3'];
|
||||
$photo4 = $_FILES['upload_images4'];
|
||||
$video1 = $_FILES['upload_videos1'];
|
||||
|
||||
$rpUniqid = "";
|
||||
$ruUniqid = "";
|
||||
$ueuse_result = send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$photo4,$video1,$nsfw_chk,$isAIBWM);
|
||||
|
||||
if($ueuse_result == null){
|
||||
//一時保存していたユーズ内容の削除
|
||||
setcookie("ueuse", "", time() - 3600);
|
||||
|
||||
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
|
||||
header("Location:".$url."");
|
||||
exit;
|
||||
}else{
|
||||
$error_message = $ueuse_result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
require('../logout/logout.php');
|
||||
|
||||
|
||||
@@ -148,6 +100,7 @@ $pdo = null;
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<script src="../js/nsfw_event.js"></script>
|
||||
<script src="../js/view_function.js"></script>
|
||||
<link rel="manifest" href="../manifest/manifest.json" />
|
||||
<script>
|
||||
if ("serviceWorker" in navigator) {
|
||||
@@ -231,6 +184,9 @@ if ("serviceWorker" in navigator) {
|
||||
<?php endif; ?>
|
||||
<?php if(!($role ==="ice")){?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="send_progress">
|
||||
<div class="per"></div>
|
||||
</div>
|
||||
<div class="sendbox">
|
||||
<textarea id="ueuse" placeholder="いまどうしてる?" name="ueuse"><?php if( !empty($ueuse) ){ echo safetext($ueuse); } ?></textarea>
|
||||
|
||||
@@ -269,7 +225,7 @@ if ("serviceWorker" in navigator) {
|
||||
|
||||
<div class="moji_cnt" id="moji_cnt"><?php echo safetext($mojisize); ?></div>
|
||||
|
||||
<input type="submit" class="ueusebtn" id='ueusebtn' name="btn_submit" value="ユーズする">
|
||||
<input type="button" class="ueusebtn" id='ueusebtn' value="ユーズする">
|
||||
</div>
|
||||
|
||||
<div class="harmful_notice" id="harmful_ueuse_warn" style="display:none;">
|
||||
@@ -368,6 +324,7 @@ if ("serviceWorker" in navigator) {
|
||||
$(document).ready(function() {
|
||||
var userid = '<?php echo $userid; ?>';
|
||||
var account_id = '<?php echo $loginid; ?>';
|
||||
view_ueuse_init(userid, account_id);
|
||||
|
||||
var pageNumber = 1;
|
||||
var isLoading = false;
|
||||
@@ -419,18 +376,18 @@ $(document).ready(function() {
|
||||
$("#loading").show();
|
||||
if (mode == "local") {
|
||||
$.ajax({
|
||||
url: '../nextpage/nextpage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
url: '../nextpage/localtimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id },
|
||||
dataType: 'html',
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
@@ -438,18 +395,18 @@ $(document).ready(function() {
|
||||
});
|
||||
} else if (mode == "follow") {
|
||||
$.ajax({
|
||||
url: '../nextpage/ftlpage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
url: '../nextpage/followtimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id },
|
||||
dataType: 'html',
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
@@ -457,18 +414,18 @@ $(document).ready(function() {
|
||||
});
|
||||
} else if (mode == "foryou") {
|
||||
$.ajax({
|
||||
url: '../nextpage/foryoupage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
url: '../nextpage/foryoutimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id },
|
||||
dataType: 'html',
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
@@ -478,6 +435,7 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
$("#timeline_foryou").on('click', function(event) {
|
||||
if (isLoading) return;
|
||||
$('#timeline_foryou').addClass('on');
|
||||
$('#timeline_local').removeClass('on');
|
||||
$('#timeline_follow').removeClass('on');
|
||||
@@ -491,6 +449,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$("#timeline_local").on('click', function(event) {
|
||||
if (isLoading) return;
|
||||
$('#timeline_foryou').removeClass('on');
|
||||
$('#timeline_local').addClass('on');
|
||||
$('#timeline_follow').removeClass('on');
|
||||
@@ -504,6 +463,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$("#timeline_follow").on('click', function(event) {
|
||||
if (isLoading) return;
|
||||
$('#timeline_foryou').removeClass('on');
|
||||
$('#timeline_local').removeClass('on');
|
||||
$('#timeline_follow').addClass('on');
|
||||
@@ -533,6 +493,77 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
var isSending = false;
|
||||
$('#ueusebtn').on('click', function() {
|
||||
if (isSending) return;
|
||||
isSending = true;
|
||||
|
||||
var percentComplete = 0;
|
||||
var scaledPercent = 0;
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('userid', userid); // ユーザーID
|
||||
formData.append('account_id', account_id); // アカウントID
|
||||
|
||||
formData.append('ueuse', $("#ueuse").val());
|
||||
formData.append('nsfw_chk', $("#nsfw_chk").is(':checked') ? "true" : "false");
|
||||
|
||||
var photo1 = $('#upload_images').prop('files')[0];
|
||||
var photo2 = $('#upload_images2').prop('files')[0];
|
||||
var photo3 = $('#upload_images3').prop('files')[0];
|
||||
var photo4 = $('#upload_images4').prop('files')[0];
|
||||
var video1 = $('#upload_videos1').prop('files')[0];
|
||||
|
||||
if (photo1) formData.append('upload_images', photo1);
|
||||
if (photo2) formData.append('upload_images2', photo2);
|
||||
if (photo3) formData.append('upload_images3', photo3);
|
||||
if (photo4) formData.append('upload_images4', photo4);
|
||||
if (video1) formData.append('upload_videos1', video1);
|
||||
$(".send_progress").show();
|
||||
$.ajax({
|
||||
url: '../function/ueuse.php',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
xhr: function() {
|
||||
var myXhr = $.ajaxSettings.xhr();
|
||||
if (myXhr.upload) {
|
||||
myXhr.upload.addEventListener('progress', function(event) {
|
||||
if (event.lengthComputable) {
|
||||
percentComplete = (event.loaded / event.total) * 100;
|
||||
scaledPercent = Math.min((percentComplete * 0.99), 99);
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
return myXhr;
|
||||
},
|
||||
success: function(response) {
|
||||
if(response.success == true){
|
||||
scaledPercent = 100;
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
|
||||
document.cookie = "ueuse=; Secure; SameSite=Lax; path=/home;";
|
||||
isSending = false;
|
||||
window.location.href = "<?php echo $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];?>";
|
||||
}else{
|
||||
scaledPercent = 0;
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
view_notify(response.error);
|
||||
isSending = false;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
scaledPercent = 0;
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
view_notify("ユーズの送信に失敗しました。");
|
||||
isSending = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.favbtn, .favbtn_after', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -640,11 +671,11 @@ $(document).ready(function() {
|
||||
if (response.success) {
|
||||
postElement.remove();
|
||||
} else {
|
||||
// 削除失敗時の処理
|
||||
view_notify("ユーズの削除に失敗しました");
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
// エラー時の処理
|
||||
view_notify("ユーズの削除に失敗しました。");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -703,9 +734,11 @@ $(document).ready(function() {
|
||||
if (response.success) {
|
||||
abimodal.style.display = 'none';
|
||||
postAbiElement.remove();
|
||||
view_notify("ユーズに追記しました");
|
||||
} else {
|
||||
abimodal.style.display = 'none';
|
||||
postAbiElement.remove();
|
||||
view_notify("追記に失敗しました");
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
|
||||
@@ -0,0 +1,774 @@
|
||||
//------------------------------------------------ユーズ表示系関数--------------------------------------------------
|
||||
var global_userid;
|
||||
var account_id;
|
||||
|
||||
function view_ueuse_init(user_id, loginid){
|
||||
global_userid = user_id;
|
||||
global_account_id = loginid;
|
||||
return true;
|
||||
}
|
||||
|
||||
const mentionCache = {};
|
||||
const fetchingMentions = false;
|
||||
|
||||
async function replaceMentions(text) {
|
||||
const mentionMatches = [...text.matchAll(/@([a-zA-Z0-9_]+)/g)];
|
||||
if (mentionMatches.length === 0) return text;
|
||||
const uniqueMentions = [...new Set(mentionMatches.map(match => match[1]))];
|
||||
const mentionsToFetch = uniqueMentions.filter(userID => !mentionCache[userID]);
|
||||
|
||||
if (mentionsToFetch.length > 0) {
|
||||
await new Promise((resolve) => {
|
||||
$.ajax({
|
||||
url: '../function/get_userid.php',
|
||||
method: 'POST',
|
||||
data: {
|
||||
get_account: mentionsToFetch.join(','),
|
||||
userid: global_userid,
|
||||
account_id: global_account_id
|
||||
},
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
if (response.success && response.users) {
|
||||
for (const [name, userInfo] of Object.entries(response.users)) {
|
||||
if (userInfo && userInfo.userid && userInfo.username) {
|
||||
mentionCache[name] = `<a href="/@${userInfo.userid}" class="mta">@${userInfo.username}</a>`;
|
||||
} else {
|
||||
mentionCache[name] = `@${name}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
},
|
||||
error: function() {
|
||||
// すべて失敗扱いでそのまま
|
||||
for (const name of mentionsToFetch) {
|
||||
mentionCache[name] = `@${name}`;
|
||||
}
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 実際の置換
|
||||
text = text.replace(/@([a-zA-Z0-9_]+)/g, (_, id) => mentionCache[id] || `@${id}`);
|
||||
return text;
|
||||
}
|
||||
|
||||
const emojiCache = {}; // 絵文字キャッシュ
|
||||
const fetchingEmojis = {}; // 同時問い合わせ防止(Promiseキャッシュ)
|
||||
|
||||
async function replaceCustomEmojis(text) {
|
||||
const emojiMatches = [...text.matchAll(/:([a-zA-Z0-9_]+):/g)];
|
||||
if (emojiMatches.length === 0) return text;
|
||||
const uniqueEmojis = [...new Set(emojiMatches.map(match => match[1]))];
|
||||
const emojisToFetch = uniqueEmojis.filter(name => !emojiCache[name] && !fetchingEmojis[name]);
|
||||
|
||||
if (emojisToFetch.length > 0) {
|
||||
const fetchPromise = new Promise((resolve) => {
|
||||
$.ajax({
|
||||
url: '../function/get_customemoji.php',
|
||||
method: 'POST',
|
||||
data: {
|
||||
emoji: emojisToFetch.join(','), // カンマ区切りで送信
|
||||
userid: global_userid,
|
||||
account_id: global_account_id
|
||||
},
|
||||
dataType: 'json',
|
||||
timeout: 30000,
|
||||
success: function(response) {
|
||||
if (response.success && response.emojis) {
|
||||
for (const name of emojisToFetch) {
|
||||
if (response.emojis[name]) {
|
||||
const emoji = response.emojis[name];
|
||||
emojiCache[name] = `<img src="${emoji.emojipath}" alt=":${emoji.emojiname}:" class="custom-emoji">`;
|
||||
} else {
|
||||
emojiCache[name] = `:${name}:`; // 存在しない場合は元のまま
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const name of emojisToFetch) {
|
||||
emojiCache[name] = `:${name}:`;
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
},
|
||||
error: function() {
|
||||
for (const name of emojisToFetch) {
|
||||
emojiCache[name] = `:${name}:`;
|
||||
}
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
emojisToFetch.forEach(name => {
|
||||
fetchingEmojis[name] = fetchPromise;
|
||||
});
|
||||
|
||||
await fetchPromise;
|
||||
}
|
||||
await Promise.all(uniqueEmojis.map(name => fetchingEmojis[name]));
|
||||
|
||||
text = text.replace(/:([a-zA-Z0-9_]+):/g, (_, name) => emojiCache[name] || `:${name}:`);
|
||||
return text;
|
||||
}
|
||||
|
||||
function a_link(text){
|
||||
text = text.replace(/(https:\/\/[\w!?\/+\-_~;.,*&@#$%()+|https:\/\/[ぁ-んァ-ヶ一ー-龠々\w\-\/?=&%.]+)/g, function(url) {
|
||||
const escapedUrl = url;
|
||||
const no_https_link = escapedUrl.replace("https://", "");
|
||||
if(no_https_link > 48) {
|
||||
const truncatedLink = no_https_link.substring(0, 48) + '...';
|
||||
return `<a href="${escapedUrl}" target="_blank" rel="noopener">${truncatedLink}</a>`;
|
||||
} else {
|
||||
return `<a href="${escapedUrl}" target="_blank" rel="noopener">${no_https_link}</a>`;
|
||||
}
|
||||
});
|
||||
|
||||
text = text.replace(/(^|[^a-zA-Z0-9_])#([a-zA-Z0-9ぁ-んァ-ン一-龥ー_]+)/gu, function(match, before, tag) {
|
||||
const encodedTag = encodeURIComponent("#"+tag);
|
||||
return `${before}<a href="/search?q=${encodedTag}" class="hashtags">#${tag}</a>`;
|
||||
});
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function formatMarkdown(text) {
|
||||
const placeholders = {};
|
||||
let placeholderIndex = 0;
|
||||
|
||||
// 複数行インラインコード(バッククォート3つ)を検出して、<pre><code>で囲む
|
||||
text = text.replace(/```([\s\S]+?)```/g, (match, code) => {
|
||||
const key = `PLACEHOLDER_${placeholderIndex++}`;
|
||||
placeholders[key] = `<pre class="codeblock"><code>${code.replace(/^\s*\n/, '')}</code></pre>`;
|
||||
return key;
|
||||
});
|
||||
|
||||
// コードブロックの退避
|
||||
text = text.replace(/`([^`\n]+)`/g, (_, code) => {
|
||||
const key = `PLACEHOLDER_${placeholderIndex++}`;
|
||||
placeholders[key] = `<span class="inline">${code}</span>`;
|
||||
return key;
|
||||
});
|
||||
|
||||
// 独自構文などの装飾
|
||||
text = text.replace(/\[\[buruburu (.+?)\]\]/g, '<span class="buruburu">$1</span>');
|
||||
text = text.replace(/\[\[time (\d+)\]\]/g, (_, ts) => {
|
||||
const d = new Date(parseInt(ts, 10) * 1000);
|
||||
return `<span class="unixtime" title="${d.toLocaleString()}">${d.toLocaleString()}</span>`;
|
||||
});
|
||||
|
||||
// マークダウン風装飾
|
||||
text = text
|
||||
.replace(/\*\*\*(.+?)\*\*\*/g, '<b><i>$1</i></b>')
|
||||
.replace(/___(.+?)___/g, '<b><i>$1</i></b>')
|
||||
.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>')
|
||||
.replace(/__(.+?)__/g, '<b>$1</b>')
|
||||
.replace(/\*(.+?)\*/g, '<i>$1</i>')
|
||||
.replace(/_(.+?)_/g, '<i>$1</i>')
|
||||
.replace(/~~(.+?)~~/g, '<s>$1</s>')
|
||||
.replace(/^>>> ?(.*)$/gm, '<span class="quote">$1</span>') // ここを修正
|
||||
.replace(/\|\|(.+?)\|\|/g, '<span class="blur">$1</span>')
|
||||
.replace(/^# (.+)/gm, '<h1>$1</h1>')
|
||||
.replace(/^## (.+)/gm, '<h2>$1</h2>')
|
||||
.replace(/^### (.+)/gm, '<h3>$1</h3>')
|
||||
.replace(/^- (.+)/gm, '・ $1');
|
||||
|
||||
// 行ごとに <p> タグで囲む
|
||||
const lines = text.split('\n').map(line => {
|
||||
line = line.trim();
|
||||
if (line === '') return '';
|
||||
return `<p>${line}</p>`;
|
||||
});
|
||||
|
||||
// プレースホルダーを戻す
|
||||
let final = lines.join('');
|
||||
for (const key in placeholders) {
|
||||
final = final.replace(key, placeholders[key]);
|
||||
}
|
||||
|
||||
return final;
|
||||
}
|
||||
|
||||
function YouTube_and_nicovideo_Links(postText) {
|
||||
const urlPattern = /(https:\/\/[^\s<>\[\]'"“”]+)/g;
|
||||
const urls = postText.match(urlPattern);
|
||||
let embedCode = '';
|
||||
|
||||
if (!urls) return null;
|
||||
|
||||
let embeddedOnce = false; // ← 埋め込みが1回されたかどうか
|
||||
|
||||
urls.forEach(url => {
|
||||
if (embeddedOnce) return; // ← すでに埋め込みしたらスキップ
|
||||
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
const host = parsed.hostname.replace(/^www\./, '');
|
||||
let videoId = '';
|
||||
let videoTime = '0';
|
||||
let iframe = false;
|
||||
|
||||
if (['youtube.com', 'youtu.be', 'm.youtube.com'].includes(host)) {
|
||||
if (parsed.hostname === 'youtu.be') {
|
||||
videoId = parsed.pathname.replace('/', '');
|
||||
iframe = true;
|
||||
} else if (parsed.searchParams.has('v')) {
|
||||
videoId = parsed.searchParams.get('v');
|
||||
iframe = true;
|
||||
} else if (parsed.pathname.startsWith('/shorts/')) {
|
||||
videoId = parsed.pathname.replace('/shorts/', '');
|
||||
iframe = true;
|
||||
}
|
||||
|
||||
if (parsed.searchParams.has('t') || parsed.searchParams.has('start')) {
|
||||
videoTime = parsed.searchParams.get('t') || parsed.searchParams.get('start') || '0';
|
||||
if (isNaN(parseInt(videoTime))) videoTime = '0';
|
||||
}
|
||||
|
||||
if (iframe && videoId) {
|
||||
embedCode = `<div class="youtube_and_nicovideo_player"><iframe src="https://www.youtube-nocookie.com/embed/${videoId}?start=${videoTime}" rel="0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></div>`;
|
||||
embeddedOnce = true;
|
||||
}
|
||||
|
||||
} else if (['nicovideo.jp', 'nico.ms'].includes(host)) {
|
||||
if (parsed.pathname.includes('/watch/')) {
|
||||
videoId = parsed.pathname.split('/watch/')[1];
|
||||
iframe = true;
|
||||
} else {
|
||||
videoId = parsed.pathname.replace('/', '');
|
||||
iframe = true;
|
||||
}
|
||||
|
||||
if (parsed.searchParams.has('from')) {
|
||||
videoTime = parsed.searchParams.get('from');
|
||||
if (isNaN(parseInt(videoTime))) videoTime = '0';
|
||||
}
|
||||
|
||||
if (iframe && videoId) {
|
||||
embedCode = `<div class="youtube_and_nicovideo_player"><iframe src="https://embed.nicovideo.jp/watch/${videoId}?from=${videoTime}" frameborder="0" allowfullscreen></iframe></div>`;
|
||||
embeddedOnce = true;
|
||||
}
|
||||
}else{
|
||||
embedCode = null
|
||||
}
|
||||
} catch (e) {
|
||||
// 無視
|
||||
}
|
||||
});
|
||||
|
||||
return embedCode;
|
||||
}
|
||||
|
||||
|
||||
function formatSmartDate(datetimeStr) {
|
||||
const date = new Date(datetimeStr.replace(" ", "T"));
|
||||
const now = new Date();
|
||||
const diffMs = now - date;
|
||||
const diffAbs = Math.abs(diffMs);
|
||||
const future = diffMs < 0;
|
||||
|
||||
const pad = (n) => n.toString().padStart(2, '0');
|
||||
const hhmm = `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
|
||||
const y = date.getFullYear();
|
||||
const m = date.getMonth();
|
||||
const d = date.getDate();
|
||||
|
||||
const nowY = now.getFullYear();
|
||||
const nowM = now.getMonth();
|
||||
const nowD = now.getDate();
|
||||
|
||||
const dayDiff = Math.floor((new Date(y, m, d) - new Date(nowY, nowM, nowD)) / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (!future && diffAbs < 30 * 1000) return "今";
|
||||
if (future && diffAbs < 60 * 1000) return "まもなく";
|
||||
if (future && diffAbs < 60 * 60 * 1000) return `${Math.floor(diffAbs / 1000 / 60)}分後`;
|
||||
|
||||
if (dayDiff === 0) return `今日 ${hhmm}`;
|
||||
if (dayDiff === 1) return `明日 ${hhmm}`;
|
||||
|
||||
if (!future && y === nowY && m === 0 && d === 1) return `元日 ${hhmm}`;
|
||||
|
||||
if (y === nowY) return `${pad(m + 1)}/${pad(d)} ${hhmm}`;
|
||||
|
||||
return `${y}/${pad(m + 1)}/${pad(d)} ${hhmm}`;
|
||||
}
|
||||
|
||||
async function createUeuseHtml(ueuse, selectedUniqid = null) {
|
||||
let html = "";
|
||||
let check = "";
|
||||
var reuse = "";
|
||||
let contentHtml = "";
|
||||
|
||||
var uniqid = "";
|
||||
var userid = "";
|
||||
var username = "";
|
||||
var iconurl = "";
|
||||
var datetime = "";
|
||||
var favoritecount = 0;
|
||||
var replycount = 0;
|
||||
var reusecount = 0;
|
||||
var is_favorite = false;
|
||||
var is_bookmark = false;
|
||||
var is_nsfw = false;
|
||||
var abi = "";
|
||||
var abi_date = "";
|
||||
var abi_html = "";
|
||||
var addabi = "";
|
||||
var inyo = "";
|
||||
var img1 = "";
|
||||
var img2 = "";
|
||||
var img3 = "";
|
||||
var img4 = "";
|
||||
var vid1 = "";
|
||||
var img_html = "";
|
||||
var vid_html = "";
|
||||
var nsfw_html = "";
|
||||
var nsfw_start_html = "";
|
||||
var nsfw_end_html = "";
|
||||
|
||||
if (ueuse["userdata"]["role"].includes("official")) {
|
||||
check = `
|
||||
<div class="checkicon">
|
||||
<div class="check"></div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
if(ueuse["type"] == "Reuse"){
|
||||
if(ueuse["ueuse"].length > 0){
|
||||
reuse = ``;
|
||||
if(ueuse["reuse"]){
|
||||
inyo = `<div class="reuse_box" data-uniqid="`+ueuse["reuse"]["uniqid"]+`" id="quote_reuse">
|
||||
<div class="reuse_flebox">
|
||||
<a href="/!`+ueuse["reuse"]["uniqid"]+`">
|
||||
<img src="`+ueuse["reuse"]["userdata"]["iconurl"]+`">
|
||||
</a>
|
||||
<a href="/!`+ueuse["reuse"]["uniqid"]+`">
|
||||
<div class="u_name">
|
||||
`+await replaceCustomEmojis(ueuse["reuse"]["userdata"]["username"])+`
|
||||
</div>
|
||||
</a>
|
||||
<div class="idbox">
|
||||
<a href="/@`+ueuse["reuse"]["userdata"]["userid"]+`">
|
||||
@`+ueuse["reuse"]["userdata"]["userid"]+`
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
`+formatMarkdown(a_link(ueuse["reuse"]["ueuse"]))+`
|
||||
</p>
|
||||
</div>`;
|
||||
}else{
|
||||
inyo = `<div class="reuse_box" id="quote_reuse">
|
||||
<p>
|
||||
リユーズ元のユーズは削除されました。
|
||||
</p>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
contentHtml = formatMarkdown(a_link(ueuse["ueuse"]));
|
||||
|
||||
uniqid = ueuse["uniqid"];
|
||||
userid = ueuse["userdata"]["userid"];
|
||||
username = ueuse["userdata"]["username"];
|
||||
iconurl = ueuse["userdata"]["iconurl"];
|
||||
datetime = ueuse["datetime"];
|
||||
favoritecount = ueuse["favoritecount"];
|
||||
replycount = ueuse["replycount"];
|
||||
reusecount = ueuse["reusecount"];
|
||||
is_favorite = ueuse["is_favorite"];
|
||||
is_bookmark = ueuse["is_bookmark"];
|
||||
|
||||
is_nsfw = ueuse["nsfw"];
|
||||
|
||||
img1 = ueuse["photo1"];
|
||||
img2 = ueuse["photo2"];
|
||||
img3 = ueuse["photo3"];
|
||||
img4 = ueuse["photo4"];
|
||||
vid1 = ueuse["video1"];
|
||||
|
||||
abi = ueuse["abi"]["abi_text"];
|
||||
abi_date = ueuse["abi"]["abi_date"];
|
||||
}else{
|
||||
if(ueuse["reuse"]){
|
||||
reuse = `<div class="ru">
|
||||
<a href="/@`+ueuse["userdata"]["userid"]+`">
|
||||
<img src="`+ueuse["userdata"]["iconurl"]+`">
|
||||
<p>`+await replaceCustomEmojis(ueuse["userdata"]["username"])+`さんがリユーズ</p>
|
||||
</a>
|
||||
</div>`;
|
||||
inyo = ``;
|
||||
contentHtml = formatMarkdown(a_link(ueuse["reuse"]["ueuse"]));
|
||||
|
||||
uniqid = ueuse["reuse"]["uniqid"];
|
||||
userid = ueuse["reuse"]["userdata"]["userid"];
|
||||
username = ueuse["reuse"]["userdata"]["username"];
|
||||
iconurl = ueuse["reuse"]["userdata"]["iconurl"];
|
||||
datetime = ueuse["reuse"]["datetime"];
|
||||
favoritecount = ueuse["reuse"]["favoritecount"];
|
||||
replycount = ueuse["reuse"]["replycount"];
|
||||
reusecount = ueuse["reuse"]["reusecount"];
|
||||
is_favorite = ueuse["reuse"]["is_favorite"];
|
||||
is_bookmark = ueuse["reuse"]["is_bookmark"];
|
||||
|
||||
is_nsfw = ueuse["reuse"]["nsfw"];
|
||||
|
||||
img1 = ueuse["reuse"]["photo1"];
|
||||
img2 = ueuse["reuse"]["photo2"];
|
||||
img3 = ueuse["reuse"]["photo3"];
|
||||
img4 = ueuse["reuse"]["photo4"];
|
||||
vid1 = ueuse["reuse"]["video1"];
|
||||
|
||||
abi = ueuse["reuse"]["abi"]["abi_text"];
|
||||
abi_date = ueuse["reuse"]["abi"]["abi_date"];
|
||||
}else{
|
||||
reuse = `<div class="ru">
|
||||
<a href="/@`+ueuse["userdata"]["userid"]+`">
|
||||
<img src="`+ueuse["userdata"]["iconurl"]+`">
|
||||
<p>`+await replaceCustomEmojis(ueuse["userdata"]["username"])+`さんがリユーズ</p>
|
||||
</a>
|
||||
</div>`;
|
||||
inyo = ``;
|
||||
contentHtml = "リユーズ元のユーズは削除されました。";
|
||||
|
||||
uniqid = ueuse["uniqid"];
|
||||
userid = ueuse["userdata"]["userid"];
|
||||
username = ueuse["userdata"]["username"];
|
||||
iconurl = ueuse["userdata"]["iconurl"];
|
||||
datetime = ueuse["datetime"];
|
||||
favoritecount = ueuse["favoritecount"];
|
||||
replycount = ueuse["replycount"];
|
||||
reusecount = ueuse["reusecount"];
|
||||
is_favorite = ueuse["is_favorite"];
|
||||
is_bookmark = ueuse["is_bookmark"];
|
||||
|
||||
is_nsfw = ueuse["nsfw"];
|
||||
|
||||
img1 = ueuse["photo1"];
|
||||
img2 = ueuse["photo2"];
|
||||
img3 = ueuse["photo3"];
|
||||
img4 = ueuse["photo4"];
|
||||
vid1 = ueuse["video1"];
|
||||
|
||||
abi = ueuse["abi"]["abi_text"];
|
||||
abi_date = ueuse["abi"]["abi_date"];
|
||||
}
|
||||
}
|
||||
|
||||
}else if(ueuse["type"] == "Reply"){
|
||||
if(selectedUniqid != null && selectedUniqid == ueuse["uniqid"]){
|
||||
reuse = `<div class="rp"><div class="here"></div><div class="totop"></div><p>一番上のユーズに返信</p></div>`;
|
||||
}else{
|
||||
reuse = `<div class="rp"><div class="totop"></div><p>一番上のユーズに返信</p></div>`;
|
||||
}
|
||||
|
||||
inyo = ``;
|
||||
contentHtml = formatMarkdown(a_link(ueuse["ueuse"]));
|
||||
|
||||
uniqid = ueuse["uniqid"];
|
||||
userid = ueuse["userdata"]["userid"];
|
||||
username = ueuse["userdata"]["username"];
|
||||
iconurl = ueuse["userdata"]["iconurl"];
|
||||
datetime = ueuse["datetime"];
|
||||
favoritecount = ueuse["favoritecount"];
|
||||
replycount = ueuse["replycount"];
|
||||
reusecount = ueuse["reusecount"];
|
||||
is_favorite = ueuse["is_favorite"];
|
||||
is_bookmark = ueuse["is_bookmark"];
|
||||
|
||||
is_nsfw = ueuse["nsfw"];
|
||||
|
||||
img1 = ueuse["photo1"];
|
||||
img2 = ueuse["photo2"];
|
||||
img3 = ueuse["photo3"];
|
||||
img4 = ueuse["photo4"];
|
||||
vid1 = ueuse["video1"];
|
||||
|
||||
abi = ueuse["abi"]["abi_text"];
|
||||
abi_date = ueuse["abi"]["abi_date"];
|
||||
}else if(ueuse["type"] == "User"){
|
||||
html = `
|
||||
<div class="ueuse">
|
||||
<div class="headbox">
|
||||
<a href="/@`+ueuse["userdata"]["userid"]+`">
|
||||
<img src="`+ueuse["userdata"]["headurl"]+`">
|
||||
</a>
|
||||
</div>
|
||||
<div class="flebox">
|
||||
<div class="user">
|
||||
<a href="/@`+ueuse["userdata"]["userid"]+`">
|
||||
<img src="`+ueuse["userdata"]["iconurl"]+`">
|
||||
</a>
|
||||
<div class="u_name">
|
||||
<a href="/@`+ueuse["userdata"]["userid"]+`">`+ueuse["userdata"]["username"]+`</a>
|
||||
</div>
|
||||
<div class="idbox">
|
||||
<a href="/@`+ueuse["userdata"]["userid"]+`">@`+ueuse["userdata"]["userid"]+`</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="profilebox">
|
||||
<p>
|
||||
`+ueuse["userdata"]["profile"]+`
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
return html;
|
||||
}else{
|
||||
reuse = ``;
|
||||
inyo = ``;
|
||||
contentHtml = formatMarkdown(a_link(ueuse["ueuse"]));
|
||||
|
||||
uniqid = ueuse["uniqid"];
|
||||
userid = ueuse["userdata"]["userid"];
|
||||
username = ueuse["userdata"]["username"];
|
||||
iconurl = ueuse["userdata"]["iconurl"];
|
||||
datetime = ueuse["datetime"];
|
||||
favoritecount = ueuse["favoritecount"];
|
||||
replycount = ueuse["replycount"];
|
||||
reusecount = ueuse["reusecount"];
|
||||
is_favorite = ueuse["is_favorite"];
|
||||
is_bookmark = ueuse["is_bookmark"];
|
||||
|
||||
is_nsfw = ueuse["nsfw"];
|
||||
|
||||
img1 = ueuse["photo1"];
|
||||
img2 = ueuse["photo2"];
|
||||
img3 = ueuse["photo3"];
|
||||
img4 = ueuse["photo4"];
|
||||
vid1 = ueuse["video1"];
|
||||
|
||||
abi = ueuse["abi"]["abi_text"];
|
||||
abi_date = ueuse["abi"]["abi_date"];
|
||||
}
|
||||
|
||||
if(abi != "" && typeof abi === "string") {
|
||||
abi = formatMarkdown(a_link(abi));
|
||||
abi = await replaceMentions(abi);
|
||||
abi = await replaceCustomEmojis(abi);
|
||||
|
||||
abi_html = `<div class="abi">
|
||||
<div class="back">
|
||||
<h1>`+await replaceCustomEmojis(username)+`さんが追記しました</h1>
|
||||
</div><p>`+abi+`</p>
|
||||
<div class="h3s">`+formatSmartDate(abi_date)+`</div>
|
||||
</div>`;
|
||||
addabi = ``;
|
||||
}else{
|
||||
abi_html = ``;
|
||||
if(global_userid == userid){
|
||||
addabi = `<button name="addabi" id="addabi" data-uniqid2="`+uniqid+`" class="addabi"><svg><use xlink:href="../img/sysimage/addabi_1.svg#addabi_1"></use></svg></button>`;
|
||||
}else{
|
||||
addabi = ``;
|
||||
}
|
||||
}
|
||||
|
||||
let is_fav = {
|
||||
"class": "favbtn",
|
||||
"icon": "../img/sysimage/favorite_1.svg#favorite"
|
||||
};
|
||||
if (is_favorite === true) {
|
||||
is_fav = {
|
||||
"class": "favbtn favbtn_after",
|
||||
"icon": "../img/sysimage/favorite_2.svg#favorite"
|
||||
};
|
||||
}
|
||||
|
||||
let is_reu = {
|
||||
"class": "reuse"
|
||||
};
|
||||
if(ueuse["type"] == "Reuse"){
|
||||
if(!(ueuse["ueuse"].length > 0)){
|
||||
if (global_userid == ueuse["userdata"]["userid"]) {
|
||||
is_reu = {
|
||||
"class": "reuse reuse_after"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let is_bok = {
|
||||
"class": "bookmark",
|
||||
"icon": "../img/sysimage/bookmark_1.svg#bookmark_1"
|
||||
};
|
||||
if (is_bookmark === true) {
|
||||
is_bok = {
|
||||
"class": "bookmark bookmark_after",
|
||||
"icon": "../img/sysimage/bookmark_1.svg#bookmark_1"
|
||||
};
|
||||
}
|
||||
|
||||
if(is_nsfw == true){
|
||||
nsfw_html = `<div class="nsfw" data-uniqid="`+uniqid+`" id="nsfw">
|
||||
<p>NSFW指定がされている投稿です!<br>職場や公共の場での表示には適さない場合があります。<br>表示ボタンを押すと表示されます。</p>
|
||||
<div class="btnzone">
|
||||
<input type="button" id="nsfw_view" class="mini_irobtn" value="表示">
|
||||
</div>
|
||||
</div>`
|
||||
nsfw_start_html = `<div class="nsfw_main" data-uniqid="`+uniqid+`"><div class="block">`
|
||||
nsfw_end_html = `</div></div>`
|
||||
}
|
||||
|
||||
if(img1.length > 0){
|
||||
if(img2.length > 0){
|
||||
if(img3.length > 0){
|
||||
if(img4.length > 0){
|
||||
img_html = `<div class="photo4">
|
||||
<a>
|
||||
<img src="`+img1+`" alt="画像1" title="画像1" data-id="1" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
<a>
|
||||
<img src="`+img2+`" alt="画像2" title="画像2" data-id="2" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
<a>
|
||||
<img src="`+img3+`" alt="画像3" title="画像3" data-id="3" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
<a>
|
||||
<img src="`+img4+`" alt="画像4" title="画像4" data-id="4" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
</div>`;
|
||||
}else{
|
||||
img_html = `<div class="photo3">
|
||||
<a>
|
||||
<img src="`+img1+`" alt="画像1" title="画像1" data-id="1" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
<a>
|
||||
<img src="`+img2+`" alt="画像2" title="画像2" data-id="2" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
<div class="photo3_btm">
|
||||
<a>
|
||||
<img src="`+img3+`" alt="画像3" title="画像3" data-id="3" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
}else{
|
||||
img_html = `<div class="photo2">
|
||||
<a>
|
||||
<img src="`+img1+`" alt="画像1" title="画像1" data-id="1" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
<a>
|
||||
<img src="`+img2+`" alt="画像2" title="画像2" data-id="2" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
}else{
|
||||
img_html = `<div class="photo1">
|
||||
<a>
|
||||
<img src="`+img1+`" alt="画像1" title="画像1" data-id="1" id="ueuse_image" onerror="this.onerror=null;this.src='../img/sysimage/errorimage/image_404.png'">
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
}else{
|
||||
img_html = ``;
|
||||
}
|
||||
|
||||
if(vid1.length > 0){
|
||||
vid_html = `<div class="video1">
|
||||
<video controls="" src="`+vid1+`"></video>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// カスタム絵文字を非同期に差し替え
|
||||
contentHtml = await replaceMentions(contentHtml);
|
||||
contentHtml = await replaceCustomEmojis(contentHtml);
|
||||
|
||||
if(ueuse["type"] == "Reuse"){
|
||||
if(ueuse["ueuse"].length > 0){
|
||||
if(YouTube_and_nicovideo_Links(ueuse["ueuse"])){
|
||||
contentHtml = contentHtml+YouTube_and_nicovideo_Links(ueuse["ueuse"]);
|
||||
}
|
||||
}else{
|
||||
if(YouTube_and_nicovideo_Links(ueuse["reuse"]["ueuse"])){
|
||||
contentHtml = contentHtml+YouTube_and_nicovideo_Links(ueuse["reuse"]["ueuse"]);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
if(YouTube_and_nicovideo_Links(ueuse["ueuse"])){
|
||||
contentHtml = contentHtml+YouTube_and_nicovideo_Links(ueuse["ueuse"]);
|
||||
}
|
||||
}
|
||||
|
||||
html = `
|
||||
<div class="ueuse" id="ueuse-`+ueuse["uniqid"]+`">
|
||||
`+reuse+`
|
||||
<div class="flebox">
|
||||
<a href="/@`+userid+`"><img src="`+iconurl+`"></a>
|
||||
<a href="/@`+userid+`"><div class="u_name">`+await replaceCustomEmojis(username)+`</div></a>
|
||||
<div class="idbox">
|
||||
<a href="/@`+userid+`">@`+userid+`</a>
|
||||
</div>
|
||||
`+ check +`
|
||||
<div class="time">`+formatSmartDate(datetime)+`</div>
|
||||
</div>
|
||||
`+nsfw_html+`
|
||||
`+nsfw_start_html+`
|
||||
<div class="content">`+contentHtml+`</div>
|
||||
`+img_html+`
|
||||
`+vid_html+`
|
||||
`+inyo+`
|
||||
`+abi_html+`
|
||||
`+nsfw_end_html+`
|
||||
<hr>
|
||||
<div class="favbox">
|
||||
<button class="`+is_fav["class"]+`" id="favbtn" data-uniqid="`+uniqid+`" data-userid2="`+userid+`"><svg><use xlink:href="`+is_fav["icon"]+`" alt="いいね"></use></svg><span class="like-count">`+favoritecount+`</span></button>
|
||||
<button name="reusebtn" id="reusebtn" class="`+is_reu["class"]+`" data-uniqid="`+ueuse["uniqid"]+`" data-userid="`+userid+`"><svg><use xlink:href="../img/sysimage/reuse_1.svg#reuse_1"></use></svg><span class="like-count">`+reusecount+`</span></button>
|
||||
<a href="/!`+uniqid+`" class="tuduki"><svg><use xlink:href="../img/sysimage/reply_1.svg#reply_1"></use></svg>`+replycount+`</a>
|
||||
|
||||
<button name="bookmark" id="bookmark" class="`+is_bok["class"]+`" data-uniqid="`+uniqid+`" data-userid="`+userid+`"><svg><use xlink:href="../img/sysimage/bookmark_1.svg#bookmark_1"></use></svg></button>
|
||||
`+addabi+`
|
||||
<button name="popup" id="popup" class="etcbtn" data-uniqid="`+uniqid+`" data-userid="`+userid+`"><svg><use xlink:href="../img/sysimage/etc_1.svg#etc_1"></use></svg></button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
return html;
|
||||
}
|
||||
function createAdsHtml(ads) {
|
||||
if(!(ads == null || ads == "")){
|
||||
var ads_html = `<div class="ads">
|
||||
<a href="`+ads["url"]+`" target="_blank">
|
||||
<img src="`+ads["imgurl"]+`" title="`+ads["memo"]+`">
|
||||
</a>
|
||||
</div>`;
|
||||
return ads_html;
|
||||
}else{
|
||||
var ads_html = ``;
|
||||
return ads_html;
|
||||
}
|
||||
}
|
||||
|
||||
// 投稿一覧を非同期で全部HTML化 → そのあと順番通りにappend
|
||||
async function renderUeuses(ueuseData, selectedUniqid = null) {
|
||||
if(ueuseData["success"] == false){
|
||||
var errmsg;
|
||||
if(ueuseData["error"] == "no_ueuse"){
|
||||
errmsg = "ユーズがありません";
|
||||
}else if(ueuseData["error"] == "bad_request"){
|
||||
errmsg = "不正なリクエストが検出されました";
|
||||
}
|
||||
$("#postContainer").append(`<div class="tokonone" id="noueuse"><p>`+errmsg+`</p></div>`);
|
||||
}else{
|
||||
var htmlList = [];
|
||||
var ueuseList = ueuseData["ueuses"];
|
||||
for (const ueuse of ueuseList) {
|
||||
const html = await createUeuseHtml(ueuse, selectedUniqid);
|
||||
htmlList.push(html);
|
||||
}
|
||||
|
||||
var ads = ueuseData["ads"];
|
||||
const ads_html = createAdsHtml(ads);
|
||||
htmlList.push(ads_html);
|
||||
|
||||
// 投稿順を保ったままDOMへ追加
|
||||
for (const html of htmlList) {
|
||||
$("#postContainer").append(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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 = safetext($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
|
||||
// フォローしているユーザーIDを取得し、カンマで区切る
|
||||
$bookmarkQuery = $pdo->prepare("SELECT bookmark FROM account WHERE userid = :userid");
|
||||
$bookmarkQuery->bindValue(':userid', $userid);
|
||||
$bookmarkQuery->execute();
|
||||
$bookmarkData = $bookmarkQuery->fetch();
|
||||
$bookmark = $bookmarkData['bookmark'];
|
||||
$bookmarkList = array_chunk(array_reverse(explode(',', $bookmark)),$itemsPerPage);
|
||||
|
||||
// フォローしているユーザーの投稿を取得し、日時順に並び替える
|
||||
$messages = array(); // 初期化
|
||||
|
||||
$list_Page = (int)$pageNumber - 1;
|
||||
|
||||
if(!(empty($bookmarkList[$list_Page]))){
|
||||
foreach ($bookmarkList[$list_Page] 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";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindValue(':bookmarkUniqId', $bookmarkUniqId, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
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 = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
|
||||
$messages = array();
|
||||
|
||||
$bookmarkQuery = $pdo->prepare("SELECT bookmark FROM account WHERE userid = :userid");
|
||||
$bookmarkQuery->bindValue(':userid', $userId);
|
||||
$bookmarkQuery->execute();
|
||||
$bookmarkData = $bookmarkQuery->fetch();
|
||||
|
||||
$allBookmarks = explode(',', $bookmarkData['bookmark'] ?? '');
|
||||
$reversedBookmarks = array_reverse($allBookmarks);
|
||||
$bookmarkList = array_chunk($reversedBookmarks, $itemsPerPage);
|
||||
|
||||
$list_Page = max(0, (int)$pageNumber - 1);
|
||||
$messages = [];
|
||||
|
||||
if (!empty($bookmarkList[$list_Page])) {
|
||||
$currentPageUniqIds = $bookmarkList[$list_Page];
|
||||
|
||||
// 名前付きプレースホルダ作成
|
||||
$placeholders = [];
|
||||
$params = [];
|
||||
foreach ($currentPageUniqIds as $i => $uniqid) {
|
||||
$key = ":uniqid$i";
|
||||
$placeholders[] = $key;
|
||||
$params[$key] = $uniqid;
|
||||
}
|
||||
$placeholderStr = implode(',', $placeholders);
|
||||
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.uniqid IN ($placeholderStr) AND account.role != 'ice'
|
||||
ORDER BY FIELD(ueuse.uniqid, $placeholderStr)";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
foreach ($params as $key => $val) {
|
||||
$stmt->bindValue($key, $val, PDO::PARAM_STR);
|
||||
}
|
||||
$stmt->execute();
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,285 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$followQuery = $pdo->prepare("SELECT follow FROM account WHERE userid = :userid");
|
||||
$followQuery->bindValue(':userid', $userId);
|
||||
$followQuery->execute();
|
||||
$followData = $followQuery->fetch();
|
||||
$follow = $followData['follow']/*.",".$userid*/;
|
||||
$followList = explode(',', $follow);
|
||||
|
||||
$messages = array(); // 初期化
|
||||
|
||||
// 空ならエラー回避
|
||||
if (!(empty($followList))){
|
||||
$placeholders = implode(',', array_fill(0, count($followList), '?'));
|
||||
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.rpuniqid = ''
|
||||
AND account.role != 'ice'
|
||||
AND ueuse.account IN ($placeholders)
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT ? OFFSET ?";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
$i = 1;
|
||||
foreach ($followList as $uid) {
|
||||
$stmt->bindValue($i++, $uid, PDO::PARAM_STR);
|
||||
}
|
||||
$stmt->bindValue($i++, $itemsPerPage, PDO::PARAM_INT);
|
||||
$stmt->bindValue($i++, $offset, PDO::PARAM_INT);
|
||||
|
||||
$stmt->execute();
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}else{
|
||||
$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,293 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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){
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
//------------------------------------------すべてのユーズを取得----------------------------------------------
|
||||
$all_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";
|
||||
|
||||
$all_stmt = $pdo->prepare($all_sql);
|
||||
$all_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$all_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$all_stmt->execute();
|
||||
|
||||
$all_messages = $all_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
if(empty($all_messages)){
|
||||
$all_messages = [];
|
||||
}
|
||||
|
||||
//------------------------------------------人気なユーズを取得(バズってるやつ)----------------------------------------------
|
||||
$day_count_sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.datetime >= NOW() - INTERVAL 7 DAY AND ueuse.rpuniqid = '' AND account.role != 'ice'
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT 1000";
|
||||
$cnt_stmt = $pdo->prepare($day_count_sql);
|
||||
$cnt_stmt->execute();
|
||||
$Before7daysPosts = $cnt_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// 結果が15件に満たない場合
|
||||
$postCount = count($Before7daysPosts);
|
||||
if($postCount < 15){
|
||||
$get_day = 90;
|
||||
}elseif($postCount > 15 && $postCount < 150){
|
||||
$get_day = 31;
|
||||
}elseif($postCount > 150 && $postCount < 750){
|
||||
$get_day = 7;
|
||||
}elseif($postCount > 750){
|
||||
$get_day = 5;
|
||||
}else{
|
||||
$get_day = 2;
|
||||
}
|
||||
|
||||
$get_day = $get_day * (2 ** floor($pageNumber / 3));
|
||||
|
||||
$pop_sql = "SELECT
|
||||
ueuse.*
|
||||
FROM
|
||||
ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE
|
||||
ueuse.datetime >= NOW() - INTERVAL :getday DAY
|
||||
AND
|
||||
ueuse.rpuniqid = ''
|
||||
AND
|
||||
account.role != 'ice'
|
||||
ORDER BY
|
||||
ueuse.popularity DESC
|
||||
LIMIT :offset, :itemsPerPage;
|
||||
";
|
||||
|
||||
$pop_stmt = $pdo->prepare($pop_sql);
|
||||
$pop_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
|
||||
$pop_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$pop_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$pop_stmt->execute();
|
||||
|
||||
$pop_messages = $pop_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
if(empty($pop_messages)){
|
||||
$pop_messages = [];
|
||||
}
|
||||
|
||||
//------------------------------------------フォローしているユーザーから取得----------------------------------------------
|
||||
$followList = explode(',', getUserData($pdo, $userid)["follow"]);
|
||||
|
||||
foreach ($followList as $followUserId) {
|
||||
$flw_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 AND ueuse.datetime >= NOW() - INTERVAL :getday DAY
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$flw_stmt = $pdo->prepare($flw_sql);
|
||||
$flw_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
|
||||
$flw_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$flw_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$flw_stmt->bindValue(':follow_account', $followUserId, PDO::PARAM_STR);
|
||||
$flw_stmt->execute();
|
||||
|
||||
while ($row = $flw_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$flw_messages[] = $row;
|
||||
}
|
||||
}
|
||||
if(!(empty($flw_messages))){
|
||||
usort($flw_messages, function($a, $b) {
|
||||
return strtotime($b['datetime']) - strtotime($a['datetime']);
|
||||
});
|
||||
}else{
|
||||
$flw_messages = [];
|
||||
}
|
||||
|
||||
//------------------------------------------いいねやリユーズを頻繁にするような好きっぽそうなユーザーの投稿を取得--------------------------------------
|
||||
$fav_sql = "SELECT ueuse.*,
|
||||
(LENGTH(ueuse.favorite) - LENGTH(REPLACE(ueuse.favorite, ',', '')) - 1) AS favorite_count
|
||||
FROM ueuse
|
||||
WHERE FIND_IN_SET(:userid, ueuse.favorite) > 0
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT 100
|
||||
";
|
||||
$fav_stmt = $pdo->prepare($fav_sql);
|
||||
$fav_stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
$fav_stmt->execute();
|
||||
$fav_ueuse_lists = $fav_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($fav_ueuse_lists)) {
|
||||
$many_fav_accounts = array_column($fav_ueuse_lists, 'account');
|
||||
$many_fav_account_counts = array_count_values($many_fav_accounts);
|
||||
arsort($many_fav_account_counts);
|
||||
$top_fav_accounts = array_slice($many_fav_account_counts, 0, 15, true);
|
||||
|
||||
$favget_messages = [];
|
||||
$favget_sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :fav_account AND ueuse.datetime >= NOW() - INTERVAL :getday DAY
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$favget_stmt = $pdo->prepare($favget_sql);
|
||||
$favget_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
|
||||
$favget_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$favget_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
|
||||
foreach ($top_fav_accounts as $favUserId => $count) {
|
||||
$favget_stmt->bindValue(':fav_account', $favUserId, PDO::PARAM_STR);
|
||||
$favget_stmt->execute();
|
||||
$favget_messages = array_merge($favget_messages, $favget_stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
}
|
||||
} else {
|
||||
$favget_messages = [];
|
||||
}
|
||||
|
||||
// 基本的には人気・フォロー中・いいねする事が多いユーザーのユーズでTLを構成するけど全部出きったらLTLと同じにする
|
||||
$messages = array_merge($pop_messages, $flw_messages, $favget_messages);
|
||||
if (empty($messages)) {
|
||||
$messages = $all_messages;
|
||||
} elseif (count($messages) < 15) {
|
||||
$messages = array_merge($messages, $all_messages);
|
||||
}
|
||||
$messages = array_slice(array_unique($messages, SORT_REGULAR), 0, 15);
|
||||
shuffle($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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,403 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
//------------------------------------------すべてのユーズを取得----------------------------------------------
|
||||
$all_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";
|
||||
|
||||
$all_stmt = $pdo->prepare($all_sql);
|
||||
$all_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$all_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$all_stmt->execute();
|
||||
|
||||
$all_messages = $all_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
if(empty($all_messages)){
|
||||
$all_messages = [];
|
||||
}
|
||||
|
||||
//------------------------------------------人気なユーズを取得(バズってるやつ)----------------------------------------------
|
||||
$day_count_sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.datetime >= NOW() - INTERVAL 7 DAY AND ueuse.rpuniqid = '' AND account.role != 'ice'
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT 1000";
|
||||
$cnt_stmt = $pdo->prepare($day_count_sql);
|
||||
$cnt_stmt->execute();
|
||||
$Before7daysPosts = $cnt_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// 結果が15件に満たない場合
|
||||
$postCount = count($Before7daysPosts);
|
||||
if($postCount < 15){
|
||||
$get_day = 90;
|
||||
}elseif($postCount > 15 && $postCount < 150){
|
||||
$get_day = 31;
|
||||
}elseif($postCount > 150 && $postCount < 750){
|
||||
$get_day = 7;
|
||||
}elseif($postCount > 750){
|
||||
$get_day = 5;
|
||||
}else{
|
||||
$get_day = 2;
|
||||
}
|
||||
|
||||
$get_day = $get_day * (2 ** floor($pageNumber / 3));
|
||||
|
||||
$pop_sql = "SELECT
|
||||
ueuse.*
|
||||
FROM
|
||||
ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE
|
||||
ueuse.datetime >= NOW() - INTERVAL :getday DAY
|
||||
AND
|
||||
ueuse.rpuniqid = ''
|
||||
AND
|
||||
account.role != 'ice'
|
||||
ORDER BY
|
||||
ueuse.popularity DESC
|
||||
LIMIT :offset, :itemsPerPage;
|
||||
";
|
||||
|
||||
$pop_stmt = $pdo->prepare($pop_sql);
|
||||
$pop_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
|
||||
$pop_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$pop_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$pop_stmt->execute();
|
||||
|
||||
$pop_messages = $pop_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
if(empty($pop_messages)){
|
||||
$pop_messages = [];
|
||||
}
|
||||
|
||||
//------------------------------------------フォローしているユーザーから取得----------------------------------------------
|
||||
$followList = explode(',', getUserData($pdo, $userId)["follow"]);
|
||||
|
||||
foreach ($followList as $followUserId) {
|
||||
$flw_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 AND ueuse.datetime >= NOW() - INTERVAL :getday DAY
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$flw_stmt = $pdo->prepare($flw_sql);
|
||||
$flw_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
|
||||
$flw_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$flw_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$flw_stmt->bindValue(':follow_account', $followUserId, PDO::PARAM_STR);
|
||||
$flw_stmt->execute();
|
||||
|
||||
while ($row = $flw_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$flw_messages[] = $row;
|
||||
}
|
||||
}
|
||||
if(!(empty($flw_messages))){
|
||||
usort($flw_messages, function($a, $b) {
|
||||
return strtotime($b['datetime']) - strtotime($a['datetime']);
|
||||
});
|
||||
}else{
|
||||
$flw_messages = [];
|
||||
}
|
||||
|
||||
//------------------------------------------いいねやリユーズを頻繁にするような好きっぽそうなユーザーの投稿を取得--------------------------------------
|
||||
$fav_sql = "SELECT ueuse.*,
|
||||
(LENGTH(ueuse.favorite) - LENGTH(REPLACE(ueuse.favorite, ',', '')) - 1) AS favorite_count
|
||||
FROM ueuse
|
||||
WHERE FIND_IN_SET(:userid, ueuse.favorite) > 0
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT 100
|
||||
";
|
||||
$fav_stmt = $pdo->prepare($fav_sql);
|
||||
$fav_stmt->bindValue(':userid', $userId, PDO::PARAM_STR);
|
||||
$fav_stmt->execute();
|
||||
$fav_ueuse_lists = $fav_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($fav_ueuse_lists)) {
|
||||
$many_fav_accounts = array_column($fav_ueuse_lists, 'account');
|
||||
$many_fav_account_counts = array_count_values($many_fav_accounts);
|
||||
arsort($many_fav_account_counts);
|
||||
$top_fav_accounts = array_slice($many_fav_account_counts, 0, 15, true);
|
||||
|
||||
$favget_messages = [];
|
||||
$favget_sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :fav_account AND ueuse.datetime >= NOW() - INTERVAL :getday DAY
|
||||
ORDER BY ueuse.datetime DESC
|
||||
LIMIT :offset, :itemsPerPage";
|
||||
|
||||
$favget_stmt = $pdo->prepare($favget_sql);
|
||||
$favget_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
|
||||
$favget_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$favget_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
|
||||
foreach ($top_fav_accounts as $favUserId => $count) {
|
||||
$favget_stmt->bindValue(':fav_account', $favUserId, PDO::PARAM_STR);
|
||||
$favget_stmt->execute();
|
||||
$favget_messages = array_merge($favget_messages, $favget_stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
}
|
||||
} else {
|
||||
$favget_messages = [];
|
||||
}
|
||||
|
||||
// 基本的には人気・フォロー中・いいねする事が多いユーザーのユーズでTLを構成するけど全部出きったらLTLと同じにする
|
||||
$messages = array_merge($pop_messages, $flw_messages, $favget_messages);
|
||||
if (empty($messages)) {
|
||||
$messages = $all_messages;
|
||||
} elseif (count($messages) < 15) {
|
||||
$messages = array_merge($messages, $all_messages);
|
||||
}
|
||||
$messages = array_slice(array_unique($messages, SORT_REGULAR), 0, 15);
|
||||
shuffle($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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,175 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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 = safetext($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
// フォローしているユーザーIDを取得し、カンマで区切る
|
||||
$followQuery = $pdo->prepare("SELECT follow FROM account WHERE userid = :userid");
|
||||
$followQuery->bindValue(':userid', $userid);
|
||||
$followQuery->execute();
|
||||
$followData = $followQuery->fetch();
|
||||
$follow = $followData['follow']/*.",".$userid*/;
|
||||
$followList = explode(',', $follow);
|
||||
|
||||
// フォローしているユーザーの投稿を取得し、日時順に並び替える
|
||||
$messages = array(); // 初期化
|
||||
|
||||
foreach ($followList as $followUserId) {
|
||||
$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 = $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;
|
||||
}
|
||||
}
|
||||
usort($messages, function($a, $b) {
|
||||
return strtotime($b['datetime']) - strtotime($a['datetime']);
|
||||
});
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
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 = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
$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)) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,159 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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){
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
|
||||
$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)) {
|
||||
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
?>
|
||||
@@ -79,7 +79,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
|
||||
$userQuery->execute();
|
||||
$user_array = $userQuery->fetch();
|
||||
if(!(empty($user_array))){
|
||||
$value['fromusericon'] = "../".$user_array["iconname"];
|
||||
$value['fromusericon'] = filter_var($user_array["iconname"], FILTER_VALIDATE_URL) ? $user_array["iconname"] : "../" . $user_array["iconname"];
|
||||
$value['fromusername'] = $user_array["username"];
|
||||
}else{
|
||||
$value['fromusericon'] = "../img/deficon/icon.png";
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
require('view.php');
|
||||
|
||||
require('user_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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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){
|
||||
$keyword = safetext(isset($_GET['keyword'])) ? safetext($_GET['keyword']) : '';
|
||||
$userid = safetext($_GET['userid']);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
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', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$keywordPattern = '/from:@(\w+)\s+(.+)/';
|
||||
if (preg_match($keywordPattern, $keyword, $matches)) {
|
||||
$username = $matches[1];
|
||||
$searchKeyword = $matches[2];
|
||||
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE account = :username AND (ueuse LIKE :searchKeyword OR abi LIKE :searchKeyword) ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':username', $username, PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':searchKeyword', '%' . $searchKeyword . '%', PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
} else {
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE ueuse LIKE :keyword OR abi LIKE :keyword ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':keyword', '%' . $keyword . '%', PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
}
|
||||
|
||||
$user_keyword = str_replace('@', '', $keyword);
|
||||
$usersQuery = $pdo->prepare("SELECT * FROM account WHERE username LIKE :keyword OR userid LIKE :keyword OR profile LIKE :keyword ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$usersQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$usersQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$usersQuery->bindValue(':keyword', '%' . $user_keyword . '%', PDO::PARAM_STR);
|
||||
$usersQuery->execute();
|
||||
$users_array = $usersQuery->fetchAll();
|
||||
|
||||
$users = array();
|
||||
foreach ($users_array as $row) {
|
||||
$users[] = $row;
|
||||
}
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($users)){
|
||||
foreach ($users as $uservalue) {
|
||||
$flw = $uservalue['follow'];
|
||||
$flwIds = explode(',', $flw);
|
||||
$uservalue["follow_cnt"] = count($flwIds)-1;
|
||||
|
||||
$flr = $uservalue['follower'];
|
||||
$flrIds = explode(',', $flr);
|
||||
$uservalue["follower_cnt"] = count($flrIds)-1;
|
||||
|
||||
$messageDisplay = new UserdataDisplay($uservalue, $userid);
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid);
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}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>';
|
||||
}
|
||||
}else{
|
||||
echo '<div class="tokonone" id="noueuse"><p>取得に失敗しました。</p></div>';
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,347 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey'])) && safetext(isset($_POST['keyword']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
$keyword = safetext($_POST['keyword']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($keyword)) {
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userId));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$keywordPattern = '/from:@(\w+)\s+(.+)/';
|
||||
if (preg_match($keywordPattern, $keyword, $matches)) {
|
||||
$username = $matches[1];
|
||||
$searchKeyword = $matches[2];
|
||||
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE account = :username AND (ueuse LIKE :searchKeyword OR abi LIKE :searchKeyword) ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':username', $username, PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':searchKeyword', '%' . $searchKeyword . '%', PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
} else {
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE ueuse LIKE :keyword OR abi LIKE :keyword ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':keyword', '%' . $keyword . '%', PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
}
|
||||
|
||||
$user_keyword = str_replace('@', '', $keyword);
|
||||
$usersQuery = $pdo->prepare("SELECT * FROM account WHERE username LIKE :keyword OR userid LIKE :keyword OR profile LIKE :keyword ORDER BY datetime DESC LIMIT :offset, :itemsPerPage");
|
||||
$usersQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$usersQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$usersQuery->bindValue(':keyword', '%' . $user_keyword . '%', PDO::PARAM_STR);
|
||||
$usersQuery->execute();
|
||||
$users_array = $usersQuery->fetchAll();
|
||||
|
||||
$users = array();
|
||||
foreach ($users_array as $row) {
|
||||
$users[] = $row;
|
||||
}
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$userItems = array();
|
||||
if(!empty($users)){
|
||||
foreach ($users as $value) {
|
||||
$follower = $value['follower'];
|
||||
$followerIds = array_reverse(array_values(array_filter(explode(',', $follower))));
|
||||
$followerCount = count($followerIds);
|
||||
|
||||
$follow = $value['follow'];
|
||||
$followIds = array_reverse(array_values(array_filter(explode(',', $follow))));
|
||||
$followCount = count($followIds);
|
||||
|
||||
$user = array(
|
||||
"type" => "User",
|
||||
"userid" => $value["userid"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["userid"],
|
||||
"username" => $value["username"],
|
||||
"headurl" => filter_var($value['headname'], FILTER_VALIDATE_URL)
|
||||
? $value['headname']
|
||||
: "../" . $value['headname'],
|
||||
"iconurl" => filter_var($value['iconname'], FILTER_VALIDATE_URL)
|
||||
? $value['iconname']
|
||||
: "../" . $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
"sacinfo" => $value["sacinfo"],
|
||||
"follower_cnt" => $followerCount,
|
||||
"follow_cnt" => $followCount,
|
||||
"datetime" => $value["datetime"],
|
||||
"profile" => $value["profile"],
|
||||
),
|
||||
);
|
||||
|
||||
$userItems[] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
$ueuses = array_merge($userItems, $ueuseItems);
|
||||
if (empty($ueuses)) {
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuses,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,172 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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 = safetext($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$ueuseid = safetext(isset($_GET['id'])) ? safetext($_GET['id']) : '';
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりの投稿数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
// 投稿内容の取得(新しい順に取得)
|
||||
$messageQuery = $pdo->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();
|
||||
|
||||
$messages = array();
|
||||
|
||||
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->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))){
|
||||
foreach ($up_messageData as $up_row) {
|
||||
$up_row["up_uniqid"] = $up_row["uniqid"];
|
||||
$messages[] = $up_row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$messages[] = $row;
|
||||
|
||||
}
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid);
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey'])) && safetext(isset($_POST['uniqid']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
$uniqid = safetext($_POST['uniqid']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid OR rpuniqid = :rpueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
|
||||
$messageQuery->bindValue(':ueuseid', $uniqid, PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':rpueuseid', $uniqid, PDO::PARAM_STR);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
$messages = array();
|
||||
|
||||
foreach ($message_array as $row) {
|
||||
if(!(empty($row["rpuniqid"]))){
|
||||
if(!($row["rpuniqid"] == $uniqid)){
|
||||
$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))){
|
||||
foreach ($up_messageData as $up_row) {
|
||||
$up_row["up_uniqid"] = $up_row["uniqid"];
|
||||
$messages[] = $up_row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
<?php
|
||||
class UserdataDisplay {
|
||||
private $value;
|
||||
private $userid;
|
||||
|
||||
public function __construct($uservalue, $userid) {
|
||||
$this->value = $uservalue;
|
||||
$this->userid = $userid;
|
||||
}
|
||||
|
||||
public function display() {
|
||||
|
||||
if (empty($this->value)) {
|
||||
echo '<div class="tokonone" id="noueuse"><p>ユーザーがいません</p></div>';
|
||||
} else {
|
||||
echo '<div class="ueuse">';
|
||||
|
||||
echo '<div class="headbox">';
|
||||
echo ' <a href="/@' . safetext($this->value['userid']) . '"><img src="'. safetext('../'.$this->value['headname']) . '"></a>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="flebox">';
|
||||
echo ' <div class="user">';
|
||||
|
||||
echo ' <a href="/@' . safetext($this->value['userid']) . '"><img src="'. safetext('../'.$this->value['iconname']) . '"></a>';
|
||||
echo ' <div class="u_name"><a href="/@' . safetext($this->value['userid']) . '">' . replaceEmojisWithImages(safetext($this->value['username'])) . '</a></div>';
|
||||
echo ' <div class="idbox">';
|
||||
echo ' <a href="/@' . safetext($this->value['userid']) . '">@' . safetext($this->value['userid']) . '</a>';
|
||||
echo ' </div>';
|
||||
if(!empty($this->value['sacinfo'])){
|
||||
if($this->value['sacinfo'] === "bot"){
|
||||
echo '<div class="bot">Bot</div>';
|
||||
}
|
||||
}
|
||||
if (false !== strpos($this->value['role'], 'official')) {
|
||||
echo ' <div class="checkicon">';
|
||||
echo ' <div class="check" />';
|
||||
echo ' </div>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="profilebox">';
|
||||
echo ' <p>' .replaceEmojisWithImages(replaceURLsWithLinks(nl2br(safetext($this->value['profile'])))) . '</h1></h2></h3></font></center></p>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,173 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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){
|
||||
$uwuzuid = safetext(isset($_GET['id'])) ? safetext($_GET['id']) : '';
|
||||
$userid = safetext($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$itemsPerPage = 15; // 取得件数の基準
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
$message_array = [];
|
||||
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE FIND_IN_SET(:userid, REPLACE(ueuse.favorite, ' ', '')) > 0
|
||||
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();
|
||||
$results = $stmt->fetchAll();
|
||||
|
||||
// 結果を追加
|
||||
$message_array = array_merge($message_array, $results);
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid);
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey'])) && safetext(isset($_POST['id']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$uwuzuid = safetext($_POST['id']) ? safetext($_POST['id']) : '';
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
$message_array = [];
|
||||
|
||||
$sql = "SELECT ueuse.*
|
||||
FROM ueuse
|
||||
LEFT JOIN account ON ueuse.account = account.userid
|
||||
WHERE FIND_IN_SET(:userid, REPLACE(ueuse.favorite, ' ', '')) > 0
|
||||
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();
|
||||
$results = $stmt->fetchAll();
|
||||
|
||||
// 結果を追加
|
||||
$message_array = array_merge($message_array, $results);
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,165 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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){
|
||||
$uwuzuid = safetext(isset($_GET['id'])) ? safetext($_GET['id']) : '';
|
||||
$userid = safetext($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = '' AND (
|
||||
(photo1 IS NOT NULL AND photo1 != '' AND photo1 != 'none') OR
|
||||
(photo2 IS NOT NULL AND photo2 != '' AND photo2 != 'none') OR
|
||||
(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");
|
||||
|
||||
$messageQuery->bindValue(':userid', $uwuzuid);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid);
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey'])) && safetext(isset($_POST['id']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$uwuzuid = safetext($_POST['id']) ? safetext($_POST['id']) : '';
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = '' AND (
|
||||
(photo1 IS NOT NULL AND photo1 != '' AND photo1 != 'none') OR
|
||||
(photo2 IS NOT NULL AND photo2 != '' AND photo2 != 'none') OR
|
||||
(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");
|
||||
|
||||
$messageQuery->bindValue(':userid', $uwuzuid);
|
||||
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
|
||||
$messageQuery->execute();
|
||||
$message_array = $messageQuery->fetchAll();
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -1,158 +0,0 @@
|
||||
<?php
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
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 = safetext($_GET['userid']);
|
||||
$loginid = safetext($_GET['account_id']);
|
||||
|
||||
$query = $pdo->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){
|
||||
$uwuzuid = safetext(isset($_GET['id'])) ? safetext($_GET['id']) : '';
|
||||
$userid = safetext($_GET['userid']);
|
||||
|
||||
$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid");
|
||||
$aduserinfoQuery->bindValue(':userid', safetext($userid));
|
||||
$aduserinfoQuery->execute();
|
||||
$res = $aduserinfoQuery->fetch();
|
||||
$myblocklist = safetext($res["blocklist"]);
|
||||
$mybookmark = safetext($res["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = safetext(isset($_GET['page'])) ? safetext(intval($_GET['page'])) : 1;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
if (!empty($pdo)) {
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$messageQuery = $pdo->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();
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_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 (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
$value["bookmark"] = $mybookmark;
|
||||
|
||||
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
|
||||
|
||||
// コンマで区切って配列に分割し、要素数を数える
|
||||
$favIds = explode(',', $fav);
|
||||
$value["favcnt"] = count($favIds)-1;
|
||||
|
||||
$messageDisplay = new MessageDisplay($value, $userid);
|
||||
$messageDisplay->display();
|
||||
}
|
||||
}
|
||||
if($message['ads'] === "true"){
|
||||
echo '<div class="ads"><a href = "' . safetext($message['ads_url']) . '" target="_blank"><img src="' . safetext($message['ads_img_url']) . '" title="' . safetext($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>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require('../db.php');
|
||||
require('../function/function.php');
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id'])) && safetext(isset($_COOKIE['loginkey'])) && safetext(isset($_POST['id']))) {
|
||||
$page = safetext($_POST['page']);
|
||||
$userId = safetext($_POST['userid']);
|
||||
$uwuzuid = safetext($_POST['id']) ? safetext($_POST['id']) : '';
|
||||
$loginid = safetext($_POST['account_id']);
|
||||
$loginkey = safetext($_COOKIE['loginkey']);
|
||||
|
||||
$is_login = uwuzuUserLoginCheck($loginid, $loginkey, "user");
|
||||
if ($is_login === false) {
|
||||
echo json_encode(['success' => false, 'error' => 'bad_request']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// データベースに接続
|
||||
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 (!empty($pdo)) {
|
||||
$myUserData = getUserData($pdo, $userId);
|
||||
$myblocklist = safetext($myUserData["blocklist"]);
|
||||
$mybookmark = safetext($myUserData["bookmark"]);
|
||||
|
||||
$itemsPerPage = 15; // 1ページあたりのユーズ数
|
||||
$pageNumber = $page;
|
||||
if($pageNumber <= 0 || (!(is_numeric($pageNumber)))){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$offset = ($pageNumber - 1) * $itemsPerPage;
|
||||
|
||||
$messages = array();
|
||||
|
||||
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
$userData = $userQuery->fetch();
|
||||
|
||||
$messageQuery = $pdo->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();
|
||||
|
||||
$messages = array();
|
||||
foreach ($message_array as $row) {
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
// ユーザー情報を取得して、$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'];
|
||||
}
|
||||
|
||||
//リユーズ数取得
|
||||
$ruQuery = $pdo->prepare("SELECT COUNT(*) as reuse_count FROM ueuse WHERE ruuniqid = :ruuniqid");
|
||||
$ruQuery->bindValue(':ruuniqid', $message['uniqid']);
|
||||
$ruQuery->execute();
|
||||
$ruData = $ruQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($ruData){
|
||||
$message['reuse_count'] = $ruData['reuse_count'];
|
||||
}
|
||||
|
||||
$fav = $message['favorite'];
|
||||
$favIds = explode(',', $fav);
|
||||
$message["favorite_conut"] = count($favIds)-1;
|
||||
}
|
||||
//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"];
|
||||
}
|
||||
//--------------------------
|
||||
|
||||
$ueuseItems = array();
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $value) {
|
||||
if (!(in_array(safetext($value['account']), explode(",", $myblocklist)))){
|
||||
if(!($value["role"] === "ice")){
|
||||
if(filter_var($value['iconname'], FILTER_VALIDATE_URL)){
|
||||
$value['iconname'] = $value['iconname'];
|
||||
}else{
|
||||
$value['iconname'] = "../" . $value['iconname'];
|
||||
}
|
||||
|
||||
// ""や"none"をnullに変換
|
||||
$value = to_null($value);
|
||||
$value = to_array_safetext($value);
|
||||
|
||||
$value["role"] = explode(',', $value["role"]);
|
||||
|
||||
if(!empty($value['rpuniqid'])){
|
||||
$value["type"] = "Reply";
|
||||
//リユーズどうするから始める
|
||||
}elseif(!empty($value['ruuniqid'])){
|
||||
$value["type"] = "Reuse";
|
||||
$reused = getUeuseData($pdo, $value['ruuniqid']); // 例:ruuniqidから元投稿を取得する関数
|
||||
if ($reused) {
|
||||
$reusedUserData = getUserData($pdo, $reused['account']); // 例:元投稿のユーザー情報を取得する関数
|
||||
$reusedUserData["role"] = explode(',', $reusedUserData["role"]);
|
||||
// ""や"none"をnullに変換
|
||||
$reused = to_null($reused);
|
||||
$reused = to_array_safetext($reused);
|
||||
// Reusedataを作成
|
||||
$value["reuse"] = array(
|
||||
"type" => "Reuse",
|
||||
"uniqid" => $reused["uniqid"],
|
||||
"datetime" => $reused["datetime"],
|
||||
"userid" => $reused["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $reusedUserData["userid"],
|
||||
"username" => $reusedUserData["username"],
|
||||
"iconurl" => filter_var($reusedUserData['iconname'], FILTER_VALIDATE_URL)
|
||||
? $reusedUserData['iconname']
|
||||
: "../" . $reusedUserData['iconname'],
|
||||
"role" => $reusedUserData["role"],
|
||||
),
|
||||
"ueuse" => $reused["ueuse"],
|
||||
"photo1" => $reused["photo1"],
|
||||
"photo2" => $reused["photo2"],
|
||||
"photo3" => $reused["photo3"],
|
||||
"photo4" => $reused["photo4"],
|
||||
"video1" => $reused["video1"],
|
||||
"rpuniqid" => $reused["rpuniqid"],
|
||||
"ruuniqid" => $reused["ruuniqid"],
|
||||
"nsfw" => filter_var($reused["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $reused["favorite_conut"],
|
||||
"replycount" => $reused["reply_count"],
|
||||
"reusecount" => $reused["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $reused['favorite'])),
|
||||
"is_bookmark" => in_array($reused["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $reused["abi"],
|
||||
"abi_date" => $reused["abidate"],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
$value["reuse"] = null;
|
||||
}
|
||||
}else{
|
||||
$value["type"] = "Ueuse";
|
||||
}
|
||||
|
||||
$ueuse = array(
|
||||
"type" => $value["type"],
|
||||
"uniqid" => $value["uniqid"],
|
||||
"datetime" => $value["datetime"],
|
||||
"userid" => $value["account"],
|
||||
"userdata" => array(
|
||||
"userid" => $value["account"],
|
||||
"username" => $value["username"],
|
||||
"iconurl" => $value['iconname'],
|
||||
"role" => $value["role"],
|
||||
),
|
||||
"ueuse" => $value["ueuse"],
|
||||
"photo1" => $value["photo1"],
|
||||
"photo2" => $value["photo2"],
|
||||
"photo3" => $value["photo3"],
|
||||
"photo4" => $value["photo4"],
|
||||
"video1" => $value["video1"],
|
||||
"rpuniqid" => $value["rpuniqid"],
|
||||
"ruuniqid" => $value["ruuniqid"],
|
||||
"nsfw" => filter_var($value["nsfw"], FILTER_VALIDATE_BOOLEAN),
|
||||
"favoritecount" => $value["favorite_conut"],
|
||||
"replycount" => $value["reply_count"],
|
||||
"reusecount" => $value["reuse_count"],
|
||||
"is_favorite" => in_array($userId, explode(',', $value['favorite'])),
|
||||
"is_bookmark" => in_array($value["uniqid"], explode(',', $mybookmark)),
|
||||
"abi" => array(
|
||||
"abi_text" => $value["abi"],
|
||||
"abi_date" => $value["abidate"],
|
||||
),
|
||||
);
|
||||
|
||||
if ($value["type"] === "Reuse") {
|
||||
$ueuse["reuse"] = $value["reuse"];
|
||||
}
|
||||
|
||||
$ueuseItems[] = $ueuse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($message['ads'] === "true"){
|
||||
$adsystem = array(
|
||||
"type" => "Ads",
|
||||
"url" => $message['ads_url'],
|
||||
"imgurl" => $message['ads_img_url'],
|
||||
"memo" => $message['ads_memo'],
|
||||
);
|
||||
}else{
|
||||
$adsystem = null;
|
||||
}
|
||||
|
||||
$item = array(
|
||||
"success" => true,
|
||||
"ueuses" => $ueuseItems,
|
||||
"ads" => $adsystem,
|
||||
);
|
||||
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "no_ueuse",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$pdo = null;
|
||||
}
|
||||
}else{
|
||||
$item = array(
|
||||
"success" => false,
|
||||
"ueuses" => null,
|
||||
"ads" => null,
|
||||
"error" => "bad_request",
|
||||
);
|
||||
echo json_encode($item, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
?>
|
||||
@@ -25,15 +25,11 @@ if(isset($_SERVER['HTTP_REFERER'])){
|
||||
<script>
|
||||
window.addEventListener('load', function(){
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.getRegistration()
|
||||
.then(registration => {
|
||||
registration.unregister();
|
||||
navigator.serviceWorker.register("../../sw.js").then(reg => {
|
||||
console.log("ServiceWorker OK", reg);
|
||||
}).catch(err => {
|
||||
console.log("ServiceWorker BAD", err);
|
||||
});
|
||||
});
|
||||
navigator.serviceWorker.ready.then(function(registration) {
|
||||
if (registration.active) {
|
||||
registration.active.postMessage({ action: 'clearCache' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.location.href = "<?php echo $back?>";
|
||||
|
||||
+1
-136
@@ -96,142 +96,7 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
$error_message[] = '確認用ユーザーIDを入力してください。(USERID_CHECK_INPUT_PLEASE)';
|
||||
} else {
|
||||
if($chkuserid === $userData["userid"]){
|
||||
$userId = $userData["userid"]; // 削除対象のユーザーID
|
||||
$folderPath = "../ueuseimages/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete = glob($folderPath . "*-$userId.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete as $file) {
|
||||
if (is_file($file)) {
|
||||
unlink($file); // ファイルを削除
|
||||
}
|
||||
}
|
||||
|
||||
$folderPath2 = "../ueusevideos/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete2 = glob($folderPath2 . "*-$userId.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete2 as $file2) {
|
||||
if (is_file($file2)) {
|
||||
unlink($file2); // ファイルを削除
|
||||
}
|
||||
}
|
||||
|
||||
$folderPath3 = "../usericons/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete3 = glob($folderPath3 . "*-$userId.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete3 as $file3) {
|
||||
if (is_file($file3)) {
|
||||
unlink($file3); // ファイルを削除
|
||||
}
|
||||
}
|
||||
|
||||
$folderPath4 = "../userheads/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete4 = glob($folderPath4 . "*-$userId.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete4 as $file4) {
|
||||
if (is_file($file4)) {
|
||||
unlink($file4); // ファイルを削除
|
||||
}
|
||||
}
|
||||
|
||||
// フォロー・フォロワー情報を削除したい全てのアカウントを取得
|
||||
$flw_query = $pdo->prepare("SELECT *
|
||||
FROM account
|
||||
WHERE follow LIKE :pattern1
|
||||
OR follow LIKE :pattern2
|
||||
OR follow LIKE :pattern3
|
||||
OR follower LIKE :pattern1
|
||||
OR follower LIKE :pattern2
|
||||
OR follower LIKE :pattern3
|
||||
");
|
||||
$flw_query->bindValue(':pattern1', "%,$userid,%", PDO::PARAM_STR); // 中間に位置する場合
|
||||
$flw_query->bindValue(':pattern2', "%,$userid", PDO::PARAM_STR); // 末尾に位置する場合
|
||||
$flw_query->bindValue(':pattern3', "$userid,%", PDO::PARAM_STR); // 先頭に位置する場合
|
||||
$flw_query->execute();
|
||||
$flw_accounts = $flw_query->fetchAll();
|
||||
|
||||
foreach ($flw_accounts as $account) {
|
||||
unfollow_user($pdo, $account['userid'], $userid);
|
||||
unfollow_user($pdo, $userid, $account['userid']);
|
||||
}
|
||||
|
||||
// ユーザーIDを削除したい全てのアカウントを取得
|
||||
$blk_query = $pdo->prepare("SELECT *
|
||||
FROM account
|
||||
WHERE blocklist LIKE :pattern1
|
||||
OR blocklist LIKE :pattern2
|
||||
OR blocklist LIKE :pattern3
|
||||
");
|
||||
$blk_query->bindValue(':pattern1', "%,$userid,%", PDO::PARAM_STR); // 中間に位置する場合
|
||||
$blk_query->bindValue(':pattern2', "%,$userid", PDO::PARAM_STR); // 末尾に位置する場合
|
||||
$blk_query->bindValue(':pattern3', "$userid,%", PDO::PARAM_STR); // 先頭に位置する場合
|
||||
$blk_query->execute();
|
||||
$blk_accounts = $blk_query->fetchAll();
|
||||
|
||||
foreach ($blk_accounts as $account) {
|
||||
unblock_user($pdo, $userid, $account['userid']);
|
||||
}
|
||||
|
||||
$pdo->beginTransaction();
|
||||
try {
|
||||
// 投稿削除クエリを実行
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE account = :userid");
|
||||
$deleteQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// 通知削除クエリを実行(自分宛ての通知)
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM notification WHERE touserid = :touserid");
|
||||
$deleteQuery->bindValue(':touserid', $userid, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// 通知削除クエリを実行(自分からの通知)
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM notification WHERE fromuserid = :fromuserid");
|
||||
$deleteQuery->bindValue(':fromuserid', $userid, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// いいねの削除
|
||||
$query = $pdo->prepare("SELECT * FROM ueuse WHERE favorite LIKE :pattern1 OR favorite LIKE :pattern2 OR favorite LIKE :pattern3");
|
||||
$query->bindValue(':pattern1', "%,$userid,%", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern2', "%,$userid", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern3', "$userid,%", PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$accounts = $query->fetchAll();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
// いいねの更新
|
||||
if (strpos($account['favorite'], ",$userid,") !== false || strpos($account['favorite'], ",$userid") !== false || strpos($account['favorite'], "$userid,") !== false) {
|
||||
$favoriteList = explode(',', $account['favorite']);
|
||||
$favoriteList = array_diff($favoriteList, array($userid));
|
||||
$newFavoriteList = implode(',', $favoriteList);
|
||||
|
||||
$updateFavoriteQuery = $pdo->prepare("UPDATE ueuse SET favorite = :favorite WHERE uniqid = :uniqid");
|
||||
$updateFavoriteQuery->bindValue(':favorite', $newFavoriteList, PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->bindValue(':uniqid', $account['uniqid'], PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->execute();
|
||||
}
|
||||
}
|
||||
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM account WHERE userid = :userid");
|
||||
$deleteQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
$pdo->commit();
|
||||
} catch (Exception $e) {
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
actionLog($userid, "error", "deleteAccount", null, $e, 4);
|
||||
}
|
||||
$res = addJob($pdo, $userData["userid"], "deleteUser", "stop_account");
|
||||
|
||||
if ($res) {
|
||||
if (isset($_SERVER['HTTP_COOKIE'])) {
|
||||
|
||||
+10
-9
@@ -95,6 +95,7 @@ $pdo = null;
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<script src="../js/nsfw_event.js"></script>
|
||||
<script src="../js/view_function.js"></script>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="apple-touch-icon" type="image/png" href="../favicon/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="../favicon/icon-192x192.png">
|
||||
@@ -230,7 +231,9 @@ $pdo = null;
|
||||
$(document).ready(function() {
|
||||
var userid = '<?php echo $userid; ?>';
|
||||
var account_id = '<?php echo $loginid; ?>';
|
||||
view_ueuse_init(userid, account_id);
|
||||
var pageNumber = 1;
|
||||
var isLoading = false;
|
||||
|
||||
if(ueusetext.value){
|
||||
$('#postContainer').empty();
|
||||
@@ -252,8 +255,6 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
|
||||
var isLoading = false;
|
||||
|
||||
function loadPosts() {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
@@ -264,18 +265,18 @@ $(document).ready(function() {
|
||||
|
||||
// 新しいキーワードで検索を実行
|
||||
$.ajax({
|
||||
url: '../nextpage/searchpage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
data: {page: pageNumber, keyword: keyword, userid: userid , account_id: account_id},
|
||||
dataType: 'html',
|
||||
url: '../nextpage/searchtimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id, keyword: keyword },
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
$("#loading").hide();
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
uwuzu
|
||||
1.4.16
|
||||
2025/03/16
|
||||
1.5.0
|
||||
2025/05/03
|
||||
daichimarukana,putonfps
|
||||
@@ -1,6 +1,46 @@
|
||||
## リリースノートだぜぇぇぇぇぇぇい!!!!!!!
|
||||
ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...)
|
||||
|
||||
## Version 1.5.0 (Combeny)
|
||||
2025/05/03
|
||||
chg: 大幅にUIを改良しました!
|
||||
chg: ブックマークページ、フォロータイムラインを大幅に高速化しました!
|
||||
chg: すべてのタイムラインを高速化しました!
|
||||
chg: すべてのタイムラインの表示プログラムをサーバーサイドからクライアントサイドへ移行しました!
|
||||
chg: アカウント削除をジョブ機能を通じて行うようにしました!
|
||||
これにより、低負荷でのアカウント削除が可能です。
|
||||
アカウント削除を実行後は、削除を実行したアカウントにはログインしないでください。
|
||||
アカウントの削除が並行で進んでいます。
|
||||
chg: ServiceWorkerの機能を更新しました!
|
||||
これにより、uwuzuを開いた際の読み込みなどが短縮されます。
|
||||
また、その他ページより行えるキャッシュクリアが確実に行われるようになります!
|
||||
chg: cssにダークモード時のボーダーカラーを追加しました。
|
||||
color.cssに以下を追加してください。
|
||||
"--dark-border-color: #252525;"(色はご自由で大丈夫です。)
|
||||
new: オブジェクトストレージに対応しました!利用するにはオブジェクトストレージプラグインを有効にする必要があります。
|
||||
new: ジョブ機能を実装しました!
|
||||
この機能を使用するにはデータベースの更新が必要となります。
|
||||
データベースに新規でjobsというテーブルを追加してください。
|
||||
- sysid(int):AUTO_INCREMENT:システムID
|
||||
- uniqid(varchar(256)):指定なし:ユニークID
|
||||
- userid(varchar(512)):指定なし:実行ユーザーID
|
||||
- job(varchar(1024)):指定なし:ジョブ名
|
||||
- step(varchar(256)):指定なし:ステップ名
|
||||
- status(varchar(256)):指定なし:ステータス
|
||||
- datetime(datetime):指定なし:ジョブ作成日時
|
||||
new: ロードアベレージ上限超過による自動停止機能を実装しました!
|
||||
db.phpに"define( 'STOP_LA', '[ロードアベレージ上限(int)]');"を追加することで、もしシステムのロードアベレージがそのロードアベレージを上回った際に、503を返し、一時的にサービスを停止します。
|
||||
なお、この機能では、管理者向けページとログインページは停止されません。
|
||||
制限をかけない場合は、"-1"を設定してください。
|
||||
new: レートリミットの可変設定を実装しました!
|
||||
db.phpに"define( 'RATE_LM', '[レートリミット(int)]');"を追加することで、そのレートリミットを超過した際にユーズができなくなります。
|
||||
制限をかけない場合は、"-1"を設定してください。
|
||||
new: サイトマップ自動設定機能を追加しました!
|
||||
/api/sitemap-api.phpから使用できます。
|
||||
new: ユーズの送信の進捗状況などを表示する機能を追加しました!
|
||||
fix: 制御文字を投稿・表示できてしまう問題を修正しました。
|
||||
fix: 存在しないロールを参照してしまう問題を修正しました!
|
||||
|
||||
## Version 1.4.16 (Funium)
|
||||
2025/03/16
|
||||
fix: モバイル向けUIで、メニューが表示されなくなる問題を修正しました!
|
||||
|
||||
+103
-224
@@ -101,6 +101,18 @@ if( !empty($pdo) ) {
|
||||
}else{
|
||||
$notification_settings_list = explode(',', $userData["notification_settings"]);
|
||||
}
|
||||
|
||||
if(filter_var($userData['iconname'], FILTER_VALIDATE_URL)){
|
||||
$userData['iconname'] = $userData['iconname'];
|
||||
}else{
|
||||
$userData['iconname'] = "../" . $userData['iconname'];
|
||||
}
|
||||
|
||||
if(filter_var($userData['headname'], FILTER_VALIDATE_URL)){
|
||||
$userData['headname'] = $userData['headname'];
|
||||
}else{
|
||||
$userData['headname'] = "../" . $userData['headname'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -347,207 +359,6 @@ if( !empty($_POST['pass_submit']) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( !empty($_POST['logout']) ) {
|
||||
if (isset($_SERVER['HTTP_COOKIE'])) {
|
||||
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
|
||||
foreach($cookies as $cookie) {
|
||||
$parts = explode('=', $cookie);
|
||||
$name = trim($parts[0]);
|
||||
setcookie($name, '', time()-1000);
|
||||
setcookie($name, '', time()-1000, '/');
|
||||
}
|
||||
}
|
||||
// リダイレクト先のURLへ転送する
|
||||
$url = '../index.php';
|
||||
header('Location: ' . $url, true, 303);
|
||||
|
||||
// すべての出力を終了
|
||||
exit;
|
||||
}
|
||||
|
||||
if( !empty($_POST['img1btn_submit']) ) {
|
||||
|
||||
if (!empty($_FILES['image2s']['name'])) {
|
||||
// アップロードされたファイル情報
|
||||
$uploadedFile = $_FILES['image2s'];
|
||||
|
||||
if(check_mime($uploadedFile['tmp_name'])){
|
||||
// アップロードされたファイルの拡張子を取得
|
||||
$extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
|
||||
|
||||
// EXIF削除
|
||||
delete_exif($extension, $uploadedFile['tmp_name']);
|
||||
// リサイズ
|
||||
resizeImage($uploadedFile['tmp_name'], 2048, 1024);
|
||||
|
||||
if(check_mime($uploadedFile['tmp_name']) == "image/webp"){
|
||||
// 新しいファイル名を生成(uniqid + 拡張子)
|
||||
$newFilename = createUniqId() . '-'.$userid.'.webp';
|
||||
}else{
|
||||
// 新しいファイル名を生成(uniqid + 拡張子)
|
||||
$newFilename = createUniqId() . '-'.$userid.'.' . $extension;
|
||||
}
|
||||
// 保存先のパスを生成
|
||||
$uploadedPath = 'userheads/' . $newFilename;
|
||||
|
||||
// ファイルを移動
|
||||
$result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath);
|
||||
|
||||
if ($result) {
|
||||
$headName = $uploadedPath; // 保存されたファイルのパスを使用
|
||||
} else {
|
||||
$errnum = $uploadedFile['error'];
|
||||
if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";}
|
||||
if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";}
|
||||
if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";}
|
||||
if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";}
|
||||
if($errnum === 6){$errcode = "TMP_FOLDER_NAI";}
|
||||
if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";}
|
||||
if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";}
|
||||
$error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.'';
|
||||
}
|
||||
}else{
|
||||
$error_message[] = "使用できない画像形式です。(FILE_UPLOAD_DEKINAKATTA)";
|
||||
}
|
||||
}else{
|
||||
$error_message[] = 'ヘッダー画像を選択してください(PHOTO_SELECT_PLEASE)';
|
||||
}
|
||||
|
||||
|
||||
if( empty($error_message) ) {
|
||||
// トランザクション開始
|
||||
$pdo->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
// SQL作成
|
||||
$stmt = $pdo->prepare("UPDATE account SET headname = :headname WHERE userid = :userid");
|
||||
|
||||
// ヘッダー画像のバインド
|
||||
$stmt->bindValue(':headname', $headName, PDO::PARAM_STR);
|
||||
|
||||
// ユーザーIDのバインド(WHERE句に必要)
|
||||
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
|
||||
// SQLクエリの実行
|
||||
$res = $stmt->execute();
|
||||
|
||||
// コミット
|
||||
$res = $pdo->commit();
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
header("Location:".$url."");
|
||||
exit;
|
||||
} else {
|
||||
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
|
||||
}
|
||||
|
||||
// プリペアドステートメントを削除
|
||||
$stmt = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( !empty($_POST['img2btn_submit']) ) {
|
||||
|
||||
if (!empty($_FILES['image']['name'])) {
|
||||
// アップロードされたファイル情報
|
||||
$uploadedFile = $_FILES['image'];
|
||||
|
||||
if(check_mime($uploadedFile['tmp_name'])){
|
||||
// アップロードされたファイルの拡張子を取得
|
||||
$extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
|
||||
|
||||
// EXIF削除
|
||||
delete_exif($extension, $uploadedFile['tmp_name']);
|
||||
// リサイズ
|
||||
resizeImage($uploadedFile['tmp_name'], 512, 512);
|
||||
|
||||
if(check_mime($uploadedFile['tmp_name']) == "image/webp"){
|
||||
// 新しいファイル名を生成(uniqid + 拡張子)
|
||||
$newFilename = createUniqId() . '-'.$userid.'.webp';
|
||||
}else{
|
||||
// 新しいファイル名を生成(uniqid + 拡張子)
|
||||
$newFilename = createUniqId() . '-'.$userid.'.' . $extension;
|
||||
}
|
||||
// 保存先のパスを生成
|
||||
$uploadedPath = 'usericons/' . $newFilename;
|
||||
|
||||
// ファイルを移動
|
||||
$result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath);
|
||||
|
||||
if ($result) {
|
||||
$iconName = $uploadedPath; // 保存されたファイルのパスを使用
|
||||
} else {
|
||||
$errnum = $uploadedFile['error'];
|
||||
if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";}
|
||||
if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";}
|
||||
if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";}
|
||||
if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";}
|
||||
if($errnum === 6){$errcode = "TMP_FOLDER_NAI";}
|
||||
if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";}
|
||||
if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";}
|
||||
$error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.'';
|
||||
}
|
||||
}else{
|
||||
$error_message[] = "使用できない画像形式です。(FILE_UPLOAD_DEKINAKATTA)";
|
||||
}
|
||||
}else{
|
||||
$error_message[] = 'アイコン画像を選択してください(PHOTO_SELECT_PLEASE)';
|
||||
}
|
||||
|
||||
if( empty($error_message) ) {
|
||||
// トランザクション開始
|
||||
$pdo->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
// SQL作成
|
||||
$stmt = $pdo->prepare("UPDATE account SET iconname = :iconname WHERE userid = :userid");
|
||||
|
||||
// アイコン画像のバインド
|
||||
$stmt->bindValue(':iconname', $iconName, PDO::PARAM_STR);
|
||||
|
||||
// ユーザーIDのバインド(WHERE句に必要)
|
||||
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
|
||||
// SQLクエリの実行
|
||||
$res = $stmt->execute();
|
||||
|
||||
// コミット
|
||||
$res = $pdo->commit();
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
header("Location:".$url."");
|
||||
exit;
|
||||
} else {
|
||||
$error_message[] = '更新に失敗しました。(REGISTERED_DAME)';
|
||||
}
|
||||
|
||||
// プリペアドステートメントを削除
|
||||
$stmt = null;
|
||||
}
|
||||
}
|
||||
|
||||
require('../logout/logout.php');
|
||||
|
||||
if( !empty($_POST['auth_on_submit']) ) {
|
||||
$_SESSION['userid'] = $userid;
|
||||
// リダイレクト先のURLへ転送する
|
||||
@@ -704,11 +515,11 @@ $pdo = null;
|
||||
<div>
|
||||
<h1>プロフィール</h1>
|
||||
<div class="hed">
|
||||
<img src="<?php echo safetext('../'.$userData['headname']); ?>">
|
||||
<img src="<?php echo safetext($userData['headname']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="iconimg">
|
||||
<img src="<?php echo safetext('../'.$userData['iconname']); ?>">
|
||||
<img src="<?php echo safetext($userData['iconname']); ?>">
|
||||
</div>
|
||||
<?php if($role === "ice"){?>
|
||||
<p>お使いのアカウントは凍結されているため設定を変更できません</p>
|
||||
@@ -721,11 +532,6 @@ $pdo = null;
|
||||
<label class="imgbtn2" for="file_upload2">ヘッダー選択
|
||||
<input type="file" id="file_upload2" name="image2s" accept="image/*">
|
||||
</label>
|
||||
|
||||
<div class="sub">
|
||||
<input type="submit" class = "imgbtn" name="img1btn_submit" value="ヘッダー画像更新">
|
||||
<input type="submit" class = "imgbtn" name="img2btn_submit" value="アイコン画像更新">
|
||||
</div>
|
||||
|
||||
<!--ユーザーネーム関係-->
|
||||
<div>
|
||||
@@ -798,7 +604,7 @@ $pdo = null;
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<input type="submit" class = "irobutton" name="btn_submit" value="情報更新">
|
||||
<input type="submit" class = "irobutton" name="btn_submit" value="保存">
|
||||
|
||||
<?php }?>
|
||||
</div>
|
||||
@@ -872,7 +678,7 @@ $pdo = null;
|
||||
<label for="notification_follow" class="switch_label"></label>
|
||||
</div>
|
||||
|
||||
<input type="submit" class = "irobutton" name="notification_submit" value="通知の設定&更新">
|
||||
<input type="submit" class = "irobutton" name="notification_submit" value="保存">
|
||||
|
||||
</form>
|
||||
</main>
|
||||
@@ -884,6 +690,10 @@ $pdo = null;
|
||||
</html>
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', function(){
|
||||
var userid = '<?php echo $userid; ?>';
|
||||
var account_id = '<?php echo $loginid; ?>';
|
||||
var is_loading = false;
|
||||
|
||||
$("#passview").click(function () {
|
||||
if ($("#passview").prop("checked") == true) {
|
||||
$('#password').get(0).type = 'text';
|
||||
@@ -917,21 +727,90 @@ window.addEventListener('DOMContentLoaded', function(){
|
||||
}
|
||||
});
|
||||
|
||||
$('#file_upload').change(function(e) {
|
||||
var file_reader = new FileReader();
|
||||
file_reader.addEventListener('load', function(e) {
|
||||
$('.iconimg').children('img').attr('src', file_reader.result);
|
||||
});
|
||||
file_reader.readAsDataURL(e.target.files[0]);
|
||||
});
|
||||
$('#file_upload').change(function(e) {
|
||||
var fileInput = $("#file_upload").prop('files')[0]; // ファイルを取得
|
||||
if (!fileInput || is_loading) return;
|
||||
|
||||
var settings_type = "icon";
|
||||
var formData = new FormData();
|
||||
formData.append('userid', userid); // ユーザーID
|
||||
formData.append('account_id', account_id); // アカウントID
|
||||
formData.append('settings_type', settings_type); // 設定タイプ
|
||||
formData.append('data', fileInput); // 画像ファイルを追加
|
||||
|
||||
// FileReaderでプレビュー画像を表示
|
||||
var fileReader = new FileReader();
|
||||
fileReader.onload = function(e) {
|
||||
$('.iconimg').children('img').attr('src', e.target.result); // プレビューを表示
|
||||
};
|
||||
fileReader.readAsDataURL(fileInput);
|
||||
|
||||
is_loading = true;
|
||||
$.ajax({
|
||||
url: '../function/settings.php',
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false, // データを自動的に処理しない
|
||||
contentType: false, // コンテンツタイプを自動で設定しない
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
is_loading = false;
|
||||
console.log("アイコンが更新されました");
|
||||
} else {
|
||||
is_loading = false;
|
||||
console.log("更新に失敗しました");
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
is_loading = false;
|
||||
console.log("エラーが発生しました");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#file_upload2').change(function(e) {
|
||||
var fileInput = $("#file_upload2").prop('files')[0]; // ファイルを取得
|
||||
if (!fileInput || is_loading) return;
|
||||
|
||||
var settings_type = "header";
|
||||
var formData = new FormData();
|
||||
formData.append('userid', userid); // ユーザーID
|
||||
formData.append('account_id', account_id); // アカウントID
|
||||
formData.append('settings_type', settings_type); // 設定タイプ
|
||||
formData.append('data', fileInput); // 画像ファイルを追加
|
||||
|
||||
// FileReaderでプレビュー画像を表示
|
||||
var fileReader = new FileReader();
|
||||
fileReader.onload = function(e) {
|
||||
$('.hed').children('img').attr('src', e.target.result);
|
||||
};
|
||||
fileReader.readAsDataURL(fileInput);
|
||||
|
||||
is_loading = true;
|
||||
$.ajax({
|
||||
url: '../function/settings.php',
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false, // データを自動的に処理しない
|
||||
contentType: false, // コンテンツタイプを自動で設定しない
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
is_loading = false;
|
||||
console.log("ヘッダーが更新されました");
|
||||
} else {
|
||||
is_loading = false;
|
||||
console.log("更新に失敗しました");
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
is_loading = false;
|
||||
console.log("エラーが発生しました");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#file_upload2').change(function(e) {
|
||||
var file_reader = new FileReader();
|
||||
file_reader.addEventListener('load', function(e) {
|
||||
$('.hed').children('img').attr('src', file_reader.result);
|
||||
});
|
||||
file_reader.readAsDataURL(e.target.files[0]);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -248,7 +248,6 @@ if (!empty($pdo)) {
|
||||
<input type="submit" class = "irobutton" name="ads_btn_submit" value="追加">
|
||||
</form>
|
||||
<div class="formarea">
|
||||
<hr>
|
||||
<h1>広告一覧</h1>
|
||||
<?php if(!(empty($adss))){?>
|
||||
<?php foreach ($adss as $value) {?>
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
|
||||
$serversettings_file = "../server/serversettings.ini";
|
||||
$serversettings = parse_ini_file($serversettings_file, true);
|
||||
|
||||
function random_code($length = 8){
|
||||
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
|
||||
}
|
||||
|
||||
require('../db.php');
|
||||
require("../function/function.php");
|
||||
|
||||
|
||||
// 変数の初期化
|
||||
$datetime = array();
|
||||
$user_name = null;
|
||||
$message = array();
|
||||
$message_data = null;
|
||||
$error_message = array();
|
||||
$pdo = null;
|
||||
$stmt = null;
|
||||
$res = null;
|
||||
$option = null;
|
||||
|
||||
session_name('uwuzu_s_id');
|
||||
session_set_cookie_params([
|
||||
'lifetime' => 0,
|
||||
'path' => '/',
|
||||
'domain' => '',
|
||||
'secure' => true,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax'
|
||||
]);
|
||||
session_start();
|
||||
session_regenerate_id(true);
|
||||
|
||||
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();
|
||||
}
|
||||
//ログイン認証---------------------------------------------------
|
||||
blockedIP($_SERVER['REMOTE_ADDR']);
|
||||
$is_login = uwuzuUserLogin($_SESSION, $_COOKIE, $_SERVER['REMOTE_ADDR'], "admin");
|
||||
if($is_login === false){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}else{
|
||||
$userid = safetext($is_login['userid']);
|
||||
$username = safetext($is_login['username']);
|
||||
$loginid = safetext($is_login["loginid"]);
|
||||
$role = safetext($is_login["role"]);
|
||||
$sacinfo = safetext($is_login["sacinfo"]);
|
||||
$myblocklist = safetext($is_login["blocklist"]);
|
||||
$myfollowlist = safetext($is_login["follow"]);
|
||||
$is_Admin = safetext($is_login["admin"]);
|
||||
}
|
||||
|
||||
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
|
||||
$notiQuery->bindValue(':userid', $userid);
|
||||
$notiQuery->execute();
|
||||
$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$notificationcount = $notiData['notification_count'];
|
||||
|
||||
require('../logout/logout.php');
|
||||
|
||||
if (!empty($pdo)) {
|
||||
$sql = "SELECT * FROM jobs ORDER BY datetime DESC LIMIT 100";
|
||||
$alljobs = $pdo->query($sql);
|
||||
|
||||
while ($row = $alljobs->fetch(PDO::FETCH_ASSOC)) {
|
||||
$jobs[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="../css/home.css">
|
||||
<script src="../js/jquery-min.js"></script>
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="apple-touch-icon" type="image/png" href="../favicon/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="../favicon/icon-192x192.png">
|
||||
<title>ログ - <?php echo safetext($serversettings["serverinfo"]["server_name"]);?></title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php require('../require/leftbox.php');?>
|
||||
<main>
|
||||
|
||||
<?php if( !empty($error_message) ): ?>
|
||||
<ul class="errmsg">
|
||||
<?php foreach( $error_message as $value ): ?>
|
||||
<p>・ <?php echo $value; ?></p>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<div class="admin_settings">
|
||||
<?php require('settings_left_menu.php');?>
|
||||
|
||||
<div class="admin_right">
|
||||
<div class="formarea">
|
||||
<h1>ジョブ</h1>
|
||||
<p>直近100件のジョブを表示します。</p>
|
||||
<div class="p2">この機能はベータ版機能であり、今後変更や削除が行われるおそれがあります。</div>
|
||||
<?php if(!(empty($jobs))){?>
|
||||
<?php foreach ($jobs as $value) {
|
||||
switch ($value["status"]){
|
||||
case "waiting":
|
||||
$status = "Waiting";
|
||||
$color = "WARNING";
|
||||
break;
|
||||
case "running":
|
||||
$status = "Running";
|
||||
$color = "NOTICE";
|
||||
break;
|
||||
case "finished":
|
||||
$status = "Finished";
|
||||
$color = "INFO";
|
||||
break;
|
||||
case "error":
|
||||
$status = "Error";
|
||||
$color = "CRITICAL";
|
||||
break;
|
||||
default:
|
||||
$status = "Waiting";
|
||||
$color = "WARNING";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<div class="actionlog">
|
||||
<details>
|
||||
<summary><span class="<?php echo safetext($color);?>"><?php echo safetext($status);?></span><?php echo safetext($value["job"]);?> | <?php echo safetext($value["step"]);?></summary>
|
||||
<p>ジョブ: <?php echo safetext($value["job"]);?></p>
|
||||
<p>ステップ: <?php echo safetext($value["step"]);?></p>
|
||||
<p>発生日時: <?php echo safetext($value["datetime"]);?></p>
|
||||
<p>実行ユーザー: <?php echo safetext($value["userid"]);?></p>
|
||||
</details>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }else{?>
|
||||
<p>ジョブはありません</p>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php require('../require/rightbox.php');?>
|
||||
<?php require('../require/botbox.php');?>
|
||||
<?php require('../require/noscript_modal.php');?>
|
||||
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
function checkForm(inputElement) {
|
||||
var str = inputElement.value;
|
||||
while (str.match(/[^A-Za-z\d_]/)) {
|
||||
str = str.replace(/[^A-Za-z\d_]/, "");
|
||||
}
|
||||
inputElement.value = str;
|
||||
}
|
||||
|
||||
var modal = document.getElementById('account_addrole_Modal');
|
||||
var deleteButton = document.getElementById('deleteButton');
|
||||
var cancelButton = document.getElementById('cancelButton'); // 追加
|
||||
var modalMain = $('.modal-content');
|
||||
|
||||
document.getElementById("addrole").addEventListener('click', function(){
|
||||
modal.style.display = 'block';
|
||||
modalMain.addClass("slideUp");
|
||||
modalMain.removeClass("slideDown");
|
||||
|
||||
deleteButton.addEventListener('click', () => {
|
||||
modalMain.removeClass("slideUp");
|
||||
modalMain.addClass("slideDown");
|
||||
window.setTimeout(function(){
|
||||
modal.style.display = 'none';
|
||||
}, 150);
|
||||
});
|
||||
|
||||
cancelButton.addEventListener('click', () => { // 追加
|
||||
modalMain.removeClass("slideUp");
|
||||
modalMain.addClass("slideDown");
|
||||
window.setTimeout(function(){
|
||||
modal.style.display = 'none';
|
||||
}, 150);
|
||||
});
|
||||
});
|
||||
|
||||
var modal2 = document.getElementById('account_delrole_Modal');
|
||||
var delrole_deleteButton = document.getElementById('delrole_deleteButton');
|
||||
var delrole_cancelButton = document.getElementById('delrole_cancelButton'); // 追加
|
||||
var modalMain = $('.modal-content');
|
||||
|
||||
document.getElementById("delrole").addEventListener('click', function(){
|
||||
modal2.style.display = 'block';
|
||||
modalMain.addClass("slideUp");
|
||||
modalMain.removeClass("slideDown");
|
||||
|
||||
delrole_deleteButton.addEventListener('click', () => {
|
||||
modalMain.removeClass("slideUp");
|
||||
modalMain.addClass("slideDown");
|
||||
window.setTimeout(function(){
|
||||
modal2.style.display = 'none';
|
||||
}, 150);
|
||||
});
|
||||
|
||||
delrole_cancelButton.addEventListener('click', () => { // 追加
|
||||
modalMain.removeClass("slideUp");
|
||||
modalMain.addClass("slideDown");
|
||||
window.setTimeout(function(){
|
||||
modal2.style.display = 'none';
|
||||
}, 150);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
@@ -317,6 +317,14 @@ require('../logout/logout.php');
|
||||
<p>過去1分間のロードアベレージ : <?php echo $loadAve?></p>
|
||||
<?php };?>
|
||||
<hr>
|
||||
<p>自動停止ロードアベレージ上限</p>
|
||||
<div class="p2">uwuzuが自動停止するロードアベレージの上限です。<br>"-1"で無制限です。</div>
|
||||
<p><?php echo safetext(STOP_LA);?></p>
|
||||
<hr>
|
||||
<p>ユーズのレートリミット</p>
|
||||
<div class="p2">1分間にユーズできる上限です。<br>"-1"で無制限です。</div>
|
||||
<p><?php echo safetext(RATE_LM);?> ueuse/min</p>
|
||||
<hr>
|
||||
<p>データベース</p>
|
||||
<div class="p2">データベースの容量情報です。</div>
|
||||
<table>
|
||||
|
||||
@@ -41,6 +41,10 @@ require('plugin_settings/phpmailer_sender.php');
|
||||
require('plugin_settings/aiblockwatermark_settings.php');
|
||||
//------------------------------------------------------
|
||||
|
||||
//AmazonS3--------------------------------------------
|
||||
require('plugin_settings/amazons3_settings.php');
|
||||
//------------------------------------------------------
|
||||
|
||||
session_name('uwuzu_s_id');
|
||||
session_set_cookie_params([
|
||||
'lifetime' => 0,
|
||||
@@ -136,6 +140,40 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
fputs($file, $data);
|
||||
fclose($file);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
$N_AMS3_CHKS = safetext($_POST['ams3chk_onoff']);
|
||||
|
||||
$N_AMS3_BASE_URLS = safetext($_POST['N_AMS3_BASE_URLS']);
|
||||
$N_AMS3_BUCKET_NM = safetext($_POST['N_AMS3_BUCKET_NM']);
|
||||
$N_AMS3_PREFIX_NM = safetext($_POST['N_AMS3_PREFIX_NM']);
|
||||
$N_AMS3_ENDPOINTS = safetext($_POST['N_AMS3_ENDPOINTS']);
|
||||
$N_AMS3_REGION_NM = safetext($_POST['N_AMS3_REGION_NM']);
|
||||
$N_AMS3_ACCESSKEY = safetext($_POST['N_AMS3_ACCESSKEY']);
|
||||
$N_AMS3_SECRETKEY = safetext($_POST['N_AMS3_SECRETKEY']);
|
||||
$N_AMS3_IS_S3FPS_ = safetext($_POST['N_AMS3_IS_S3FPS_']);
|
||||
|
||||
$New_AMS3_Settings = "
|
||||
<?php // S3の設定
|
||||
define('AMS3_CHKS', '".$N_AMS3_CHKS."'); // trueならオブジェクトストレージが有効
|
||||
|
||||
define('AMS3_BASE_URLS', '".$N_AMS3_BASE_URLS."');
|
||||
define('AMS3_BUCKET_NM', '".$N_AMS3_BUCKET_NM."');
|
||||
define('AMS3_PREFIX_NM', '".$N_AMS3_PREFIX_NM."');
|
||||
define('AMS3_ENDPOINTS', '".$N_AMS3_ENDPOINTS."');
|
||||
define('AMS3_REGION_NM', '".$N_AMS3_REGION_NM."');
|
||||
define('AMS3_ACCESSKEY', '".$N_AMS3_ACCESSKEY."');
|
||||
define('AMS3_SECRETKEY', '".$N_AMS3_SECRETKEY."');
|
||||
define('AMS3_IS_S3FPS_', '".$N_AMS3_IS_S3FPS_."');
|
||||
?>
|
||||
";
|
||||
|
||||
//設定上書き
|
||||
$file = fopen('plugin_settings/amazons3_settings.php', 'w');
|
||||
$data = $New_AMS3_Settings;
|
||||
fputs($file, $data);
|
||||
fclose($file);
|
||||
|
||||
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
header("Location:".$url."");
|
||||
exit;
|
||||
@@ -278,6 +316,45 @@ require('../logout/logout.php');
|
||||
<label for="aibwmchk_onoff" class="switch_label"></label>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>オブジェクトストレージプラグイン</p>
|
||||
<div class="p2">Amazon S3及びAmazon S3互換オブジェクトストレージが使用できるようになるプラグインです。<b>pluginフォルダに解凍済みのAWS SDK for PHPのファイル一式が入っていることが必須要件になります。</b><br>plugin/aws/README.MDなど一式</div>
|
||||
<p>オブジェクトストレージのオンオフ</p>
|
||||
<div class="switch_button">
|
||||
<?php if(!empty(AMS3_CHKS && AMS3_CHKS == "true")){?>
|
||||
<input id="ams3chk_onoff" class="switch_input" type='checkbox' name="ams3chk_onoff" value="true" checked/>
|
||||
<label for="ams3chk_onoff" class="switch_label"></label>
|
||||
<?php }else{?>
|
||||
<input id="ams3chk_onoff" class="switch_input" type='checkbox' name="ams3chk_onoff" value="true" />
|
||||
<label for="ams3chk_onoff" class="switch_label"></label>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div id="ams3_plugin">
|
||||
<p>オブジェクトストレージ - 保存先設定</p>
|
||||
<div class="p2">BaseURL</div>
|
||||
<input id="ams3_plugin" placeholder="https://example.com" class="inbox" type="text" name="N_AMS3_BASE_URLS" value="<?php if( !empty(AMS3_BASE_URLS) ){ echo safetext(AMS3_BASE_URLS); } ?>">
|
||||
<div class="p2">Bucket</div>
|
||||
<input id="ams3_plugin" placeholder="uwuzu-bucket" class="inbox" type="text" name="N_AMS3_BUCKET_NM" value="<?php if( !empty(AMS3_BUCKET_NM) ){ echo safetext(AMS3_BUCKET_NM); } ?>">
|
||||
<div class="p2">Prefix</div>
|
||||
<input id="ams3_plugin" placeholder="files" class="inbox" type="text" name="N_AMS3_PREFIX_NM" value="<?php if( !empty(AMS3_PREFIX_NM) ){ echo safetext(AMS3_PREFIX_NM); } ?>">
|
||||
<div class="p2">Endpoint</div>
|
||||
<input id="ams3_plugin" placeholder="https://example.com" class="inbox" type="text" name="N_AMS3_ENDPOINTS" value="<?php if( !empty(AMS3_ENDPOINTS) ){ echo safetext(AMS3_ENDPOINTS); } ?>">
|
||||
<div class="p2">Region</div>
|
||||
<input id="ams3_plugin" placeholder="us-east-1" class="inbox" type="text" name="N_AMS3_REGION_NM" value="<?php if( !empty(AMS3_REGION_NM) ){ echo safetext(AMS3_REGION_NM); } ?>">
|
||||
<div class="p2">Access Key</div>
|
||||
<input id="ams3_plugin" placeholder="アクセスキー" class="inbox" type="text" name="N_AMS3_ACCESSKEY" value="<?php if( !empty(AMS3_ACCESSKEY) ){ echo safetext(AMS3_ACCESSKEY); } ?>">
|
||||
<div class="p2">Secret Key</div>
|
||||
<input id="ams3_plugin" placeholder="シークレットキー" class="inbox" type="text" name="N_AMS3_SECRETKEY" style="-webkit-text-security:disc;" value="<?php if( !empty(AMS3_SECRETKEY) ){ echo safetext(AMS3_SECRETKEY); } ?>">
|
||||
|
||||
<div class="p2">s3ForcePathStyle設定</div>
|
||||
<div class="switch_button">
|
||||
<input id="ams3_plugin" class="switch_input" type='checkbox' name="N_AMS3_IS_S3FPS_" value="true" <?php if(!empty(AMS3_IS_S3FPS_ && AMS3_IS_S3FPS_ == "true")){?>checked<?php }?>/>
|
||||
<label for="N_AMS3_IS_S3FPS_" class="switch_label"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="submit" class = "irobutton" name="btn_submit" value="保存&更新">
|
||||
</form>
|
||||
@@ -324,4 +401,13 @@ require('../logout/logout.php');
|
||||
$('#mail_plugin').toggle();
|
||||
$('#mail_plugin_chk').toggle();
|
||||
});
|
||||
|
||||
if ($("#ams3chk_onoff").prop("checked")) {
|
||||
$('#ams3_plugin').show();
|
||||
}else{
|
||||
$('#ams3_plugin').hide();
|
||||
}
|
||||
$('#ams3chk_onoff').change(function(){
|
||||
$('#ams3_plugin').toggle();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
<?php // S3の設定
|
||||
define('AMS3_CHKS', ''); // trueならオブジェクトストレージが有効
|
||||
|
||||
define('AMS3_BASE_URLS', '');
|
||||
define('AMS3_BUCKET_NM', '');
|
||||
define('AMS3_PREFIX_NM', '');
|
||||
define('AMS3_ENDPOINTS', '');
|
||||
define('AMS3_REGION_NM', '');
|
||||
define('AMS3_ACCESSKEY', '');
|
||||
define('AMS3_SECRETKEY', '');
|
||||
define('AMS3_IS_S3FPS_', '');
|
||||
?>
|
||||
|
||||
@@ -401,7 +401,6 @@ if (!empty($pdo)) {
|
||||
<input type="submit" class = "irobutton" name="role_btn_submit" value="作成">
|
||||
</form>
|
||||
<div class="formarea">
|
||||
<hr>
|
||||
<h1>ロール付与</h1>
|
||||
<p>特定のユーザーにロール付与するときに使用してください。</p>
|
||||
<button id="addrole" class="irobutton">付与</button>
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
<a href="update_admin" class="admin_leftbtn">アップデート</a>
|
||||
<a href="ipblock_admin" class="admin_leftbtn">IPブロック</a>
|
||||
<a href="actionlog_admin" class="admin_leftbtn">ログ</a>
|
||||
<a href="jobs_admin" class="admin_leftbtn">ジョブ</a>
|
||||
</div>
|
||||
<?php ?>
|
||||
@@ -91,7 +91,7 @@ if (!empty($_POST['update_submit'])) {
|
||||
|
||||
copy($sourceFile, $destinationFile);
|
||||
} else {
|
||||
$error_message[] = "アップデート元のzipファイルに本来予定されていたファイルがありませんでしたが、アップデート作業は完了しました。(UPDATE_FILE_NOT_FOUND)";
|
||||
$error_message[] = "アップデート元のzipファイルに本来予定されていたファイルがありませんでしたが、アップデート作業は完了しました。(UPDATE_FILE_NOT_FOUND(".$sourceFile."))";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ if (!empty($_POST['update_submit'])) {
|
||||
if (file_exists($deleteFile)) {
|
||||
unlink($deleteFile);
|
||||
} else {
|
||||
$error_message[] = "削除予定のファイルがありませんでしたが、アップデート作業は完了しました。(DELETE_FILE_NOT_FOUND)";
|
||||
$error_message[] = "削除予定のファイルがありませんでしたが、アップデート作業は完了しました。(DELETE_FILE_NOT_FOUND(".$deleteFile."))";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,8 +215,6 @@ if (!empty($pdo)) {
|
||||
<div id="loading" class="loading" style="display: none;">
|
||||
🤔
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</form>
|
||||
<div class="formarea">
|
||||
<h1>通報</h1>
|
||||
|
||||
+35
-167
@@ -96,7 +96,7 @@ if (!empty($pdo)) {
|
||||
$view_ip_addr = $userdata["last_ip"];
|
||||
}
|
||||
|
||||
$roles = explode(',', $userdata["role"]);
|
||||
$roles = array_filter(explode(',', $userdata["role"]));
|
||||
|
||||
$roleDataArray = array();
|
||||
|
||||
@@ -118,6 +118,7 @@ if (!empty($pdo)) {
|
||||
$result->execute();
|
||||
$upload_cnt1 = $result->rowCount();
|
||||
|
||||
$userdata['iconname'] = filter_var($userdata['iconname'], FILTER_VALIDATE_URL) ? $userdata['iconname'] : "../" . $userdata['iconname'];
|
||||
}
|
||||
|
||||
if( !empty($_POST['send_notification_submit']) ) {
|
||||
@@ -344,162 +345,35 @@ if( !empty($_POST['send_water_submit']) ) {
|
||||
|
||||
|
||||
if( !empty($_POST['send_ban_submit']) ) {
|
||||
$userId2 = $userdata['userid']; // 削除対象のユーザーID
|
||||
$folderPath = "../ueuseimages/"; // フォルダのパス
|
||||
try{
|
||||
$userId2 = $userdata['userid']; // 削除対象のユーザーID
|
||||
$res = addJob($pdo, $userId2, "deleteUser", "stop_account");
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete = glob($folderPath . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete as $file) {
|
||||
if (is_file($file)) {
|
||||
unlink($file); // ファイルを削除
|
||||
}
|
||||
}
|
||||
|
||||
$folderPath2 = "../ueusevideos/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete2 = glob($folderPath2 . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete2 as $file2) {
|
||||
if (is_file($file2)) {
|
||||
unlink($file2); // ファイルを削除
|
||||
}
|
||||
}
|
||||
if ($res) {
|
||||
actionLog($userid, "info", "send_ban_submit", $userId2, $userid."さんが".$userId2."さんをBANしました", 4);
|
||||
header("Location:useradmin");
|
||||
exit;
|
||||
|
||||
$folderPath3 = "../usericons/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete3 = glob($folderPath3 . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete3 as $file3) {
|
||||
if (is_file($file3)) {
|
||||
unlink($file3); // ファイルを削除
|
||||
}
|
||||
}
|
||||
//BAN通知メール
|
||||
if(false !== strpos($userdata["mail_settings"], 'important')) {
|
||||
if(!empty(MAIL_CHKS)){
|
||||
if(MAIL_CHKS == "true"){
|
||||
if( !empty($view_mailadds) ){
|
||||
if(filter_var($view_mailadds, FILTER_VALIDATE_EMAIL)){
|
||||
$mail_title = "お使いの".safetext($serversettings["serverinfo"]["server_name"])."アカウントはBANされました";
|
||||
$mail_text = "".$userdata["username"]."(".$userdata["userid"].")さん いつもuwuzuをご利用いただきありがとうございます。 この度、ご利用のアカウント(".$userdata["userid"].")が".safetext($serversettings["serverinfo"]["server_name"])."管理者によりBAN(削除)されたためお知らせいたします。 今後は今までご利用いただいた".safetext($serversettings["serverinfo"]["server_name"])."アカウントは利用できません。 ".safetext($serversettings["serverinfo"]["server_name"])."サーバー上から今までご利用いただいていたアカウントの情報は削除されたためログインなどもできません。 ご理解とご協力のほどよろしくお願いします。";
|
||||
|
||||
$folderPath4 = "../userheads/"; // フォルダのパス
|
||||
|
||||
// 指定したフォルダ内でユーザーIDを含むファイルを検索
|
||||
$filesToDelete4 = glob($folderPath4 . "*-$userId2.*"); // 「-ユーザーID.拡張子」というパターンを検索
|
||||
|
||||
// ファイルを順に削除
|
||||
foreach ($filesToDelete4 as $file4) {
|
||||
if (is_file($file4)) {
|
||||
unlink($file4); // ファイルを削除
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// フォロー・フォロワー情報を削除したい全てのアカウントを取得
|
||||
$flw_query = $pdo->prepare("SELECT *
|
||||
FROM account
|
||||
WHERE follow LIKE :pattern1
|
||||
OR follow LIKE :pattern2
|
||||
OR follow LIKE :pattern3
|
||||
OR follower LIKE :pattern1
|
||||
OR follower LIKE :pattern2
|
||||
OR follower LIKE :pattern3
|
||||
");
|
||||
$flw_query->bindValue(':pattern1', "%,$userId2,%", PDO::PARAM_STR); // 中間に位置する場合
|
||||
$flw_query->bindValue(':pattern2', "%,$userId2", PDO::PARAM_STR); // 末尾に位置する場合
|
||||
$flw_query->bindValue(':pattern3', "$userId2,%", PDO::PARAM_STR); // 先頭に位置する場合
|
||||
$flw_query->execute();
|
||||
$flw_accounts = $flw_query->fetchAll();
|
||||
|
||||
foreach ($flw_accounts as $account) {
|
||||
unfollow_user($pdo, $account['userid'], $userId2);
|
||||
unfollow_user($pdo, $userId2, $account['userid']);
|
||||
}
|
||||
|
||||
// ユーザーIDを削除したい全てのアカウントを取得
|
||||
$blk_query = $pdo->prepare("SELECT *
|
||||
FROM account
|
||||
WHERE blocklist LIKE :pattern1
|
||||
OR blocklist LIKE :pattern2
|
||||
OR blocklist LIKE :pattern3
|
||||
");
|
||||
$blk_query->bindValue(':pattern1', "%,$userId2,%", PDO::PARAM_STR); // 中間に位置する場合
|
||||
$blk_query->bindValue(':pattern2', "%,$userId2", PDO::PARAM_STR); // 末尾に位置する場合
|
||||
$blk_query->bindValue(':pattern3', "$userId2,%", PDO::PARAM_STR); // 先頭に位置する場合
|
||||
$blk_query->execute();
|
||||
$blk_accounts = $blk_query->fetchAll();
|
||||
|
||||
foreach ($blk_accounts as $account) {
|
||||
unblock_user($pdo, $userId2, $account['userid']);
|
||||
}
|
||||
|
||||
$pdo->beginTransaction();
|
||||
try {
|
||||
// 投稿削除クエリを実行
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE account = :userid");
|
||||
$deleteQuery->bindValue(':userid', $userId2, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// 通知削除クエリを実行(自分宛ての通知)
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM notification WHERE touserid = :touserid");
|
||||
$deleteQuery->bindValue(':touserid', $userId2, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// 通知削除クエリを実行(自分からの通知)
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM notification WHERE fromuserid = :fromuserid");
|
||||
$deleteQuery->bindValue(':fromuserid', $userId2, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// いいねの削除
|
||||
$query = $pdo->prepare("SELECT * FROM ueuse WHERE favorite LIKE :pattern1 OR favorite LIKE :pattern2 OR favorite LIKE :pattern3");
|
||||
$query->bindValue(':pattern1', "%,$userId2,%", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern2', "%,$userId2", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern3', "$userId2,%", PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$accounts = $query->fetchAll();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
// いいねの更新
|
||||
if (strpos($account['favorite'], ",$userId2,") !== false || strpos($account['favorite'], ",$userId2") !== false || strpos($account['favorite'], "$userId2,") !== false) {
|
||||
$favoriteList = explode(',', $account['favorite']);
|
||||
$favoriteList = array_diff($favoriteList, array($userId2));
|
||||
$newFavoriteList = implode(',', $favoriteList);
|
||||
|
||||
$updateFavoriteQuery = $pdo->prepare("UPDATE ueuse SET favorite = :favorite WHERE uniqid = :uniqid");
|
||||
$updateFavoriteQuery->bindValue(':favorite', $newFavoriteList, PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->bindValue(':uniqid', $account['uniqid'], PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->execute();
|
||||
}
|
||||
}
|
||||
|
||||
$deleteQuery = $pdo->prepare("DELETE FROM account WHERE userid = :userid");
|
||||
$deleteQuery->bindValue(':userid', $userId2, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
$pdo->commit();
|
||||
} catch (Exception $e) {
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
actionLog($userId2, "error", "deleteAccount", null, $e, 4);
|
||||
}
|
||||
|
||||
//BAN通知メール
|
||||
if(false !== strpos($userdata["mail_settings"], 'important')) {
|
||||
if(!empty(MAIL_CHKS)){
|
||||
if(MAIL_CHKS == "true"){
|
||||
if( !empty($view_mailadds) ){
|
||||
if(filter_var($view_mailadds, FILTER_VALIDATE_EMAIL)){
|
||||
$mail_title = "お使いの".safetext($serversettings["serverinfo"]["server_name"])."アカウントはBANされました";
|
||||
$mail_text = "".$userdata["username"]."(".$userdata["userid"].")さん いつもuwuzuをご利用いただきありがとうございます。 この度、ご利用のアカウント(".$userdata["userid"].")が".safetext($serversettings["serverinfo"]["server_name"])."管理者によりBAN(削除)されたためお知らせいたします。 今後は今までご利用いただいた".safetext($serversettings["serverinfo"]["server_name"])."アカウントは利用できません。 ".safetext($serversettings["serverinfo"]["server_name"])."サーバー上から今までご利用いただいていたアカウントの情報は削除されたためログインなどもできません。 ご理解とご協力のほどよろしくお願いします。";
|
||||
|
||||
$error_message[] = send_html_mail($view_mailadds,$mail_title,$mail_text,"../");
|
||||
$error_message[] = send_html_mail($view_mailadds,$mail_title,$mail_text,"../");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------
|
||||
} else {
|
||||
$error_message[] = 'アカウント削除に失敗しました。(ACCOUNT_DELETE_DAME)';
|
||||
actionLog($userid, "error", "send_ban_submit", $userId2, $error_message[], 4);
|
||||
}
|
||||
//------------
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// エラーが発生した時はロールバック
|
||||
@@ -507,16 +381,6 @@ if( !empty($_POST['send_ban_submit']) ) {
|
||||
actionLog($userid, "error", "send_ban_submit", $userId2, $e, 4);
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
actionLog($userid, "info", "send_ban_submit", $userId2, $userid."さんが".$userId2."さんをBANしました", 4);
|
||||
header("Location:useradmin");
|
||||
exit;
|
||||
} else {
|
||||
$error_message[] = 'アカウント削除に失敗しました。(ACCOUNT_DELETE_DAME)';
|
||||
actionLog($userid, "error", "send_ban_submit", $userId2, $error_message, 4);
|
||||
}
|
||||
|
||||
|
||||
// プリペアドステートメントを削除
|
||||
$stmt = null;
|
||||
}
|
||||
@@ -555,7 +419,7 @@ require('../logout/logout.php');
|
||||
<div class="admin_right">
|
||||
<div class="admin_userinfo">
|
||||
<div class="icon">
|
||||
<img src="<?php echo safetext('../'.$userdata['iconname']); ?>">
|
||||
<img src="<?php echo safetext($userdata['iconname']); ?>">
|
||||
<div class="tatext">
|
||||
<h2><?php echo safetext($userdata['username']); ?></h2>
|
||||
<p>@<?php echo safetext($userdata['userid']); ?></p>
|
||||
@@ -566,13 +430,17 @@ require('../logout/logout.php');
|
||||
<?php foreach ($roles as $roleId): ?>
|
||||
<?php $roleData = $roleDataArray[$roleId]; ?>
|
||||
<?php
|
||||
if(safetext($roleData["roleeffect"]) == '' || safetext($roleData["roleeffect"]) == 'none'){
|
||||
$role_view_effect = "";
|
||||
}elseif(safetext($roleData["roleeffect"]) == 'shine'){
|
||||
$role_view_effect = "shine";
|
||||
}elseif(safetext($roleData["roleeffect"]) == 'rainbow'){
|
||||
$role_view_effect = "rainbow";
|
||||
}else{
|
||||
if(!(empty($roleData))){
|
||||
if (safetext($roleData["roleeffect"]) == '' || safetext($roleData["roleeffect"]) == 'none') {
|
||||
$role_view_effect = "";
|
||||
} elseif (safetext($roleData["roleeffect"]) == 'shine') {
|
||||
$role_view_effect = "shine";
|
||||
} elseif (safetext($roleData["roleeffect"]) == 'rainbow') {
|
||||
$role_view_effect = "rainbow";
|
||||
} else {
|
||||
$role_view_effect = "";
|
||||
}
|
||||
} else {
|
||||
$role_view_effect = "";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,49 +1,88 @@
|
||||
var CACHE_NAME = "app_uwuzu";
|
||||
var urlsToCache = [
|
||||
var CACHE_VERSION = 'uwuzu-cache-v1';
|
||||
|
||||
var resources = [
|
||||
"/css/color.css",
|
||||
"/css/font.css",
|
||||
"/css/home.css",
|
||||
"/home/index.php",
|
||||
"/unsupported.php",
|
||||
"/img/sysimage/menuicon/addemoji.svg",
|
||||
"/img/sysimage/menuicon/addnotice.svg",
|
||||
"/img/sysimage/menuicon/bookmark.svg",
|
||||
"/img/sysimage/menuicon/emoji.svg",
|
||||
"/img/sysimage/menuicon/home.svg",
|
||||
"/img/sysimage/menuicon/info.svg",
|
||||
"/img/sysimage/menuicon/logout.svg",
|
||||
"/img/sysimage/menuicon/menu.svg",
|
||||
"/img/sysimage/menuicon/notice.svg",
|
||||
"/img/sysimage/menuicon/notification.svg",
|
||||
"/img/sysimage/menuicon/notification2.svg",
|
||||
"/img/sysimage/menuicon/others.svg",
|
||||
"/img/sysimage/menuicon/privacypolicy.svg",
|
||||
"/img/sysimage/menuicon/profile.svg",
|
||||
"/img/sysimage/menuicon/search.svg",
|
||||
"/img/sysimage/menuicon/server.svg",
|
||||
"/img/sysimage/menuicon/settings.svg",
|
||||
"/img/sysimage/menuicon/terms.svg",
|
||||
"/img/sysimage/menuicon/useradmin.svg"
|
||||
];
|
||||
|
||||
self.addEventListener('install', function(event) {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then(function(cache) {
|
||||
return cache.addAll(urlsToCache);
|
||||
}).catch(function(error) {
|
||||
console.error("Failed to cache:", error);
|
||||
})
|
||||
self.addEventListener('install', function (e) {
|
||||
e.waitUntil(
|
||||
caches.open(CACHE_VERSION).then(function (cache) {
|
||||
return cache.addAll(resources);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
/*
|
||||
self.addEventListener('fetch', function(event) {
|
||||
event.respondWith(
|
||||
caches.match(event.request)
|
||||
.then(function(response) {
|
||||
self.addEventListener('fetch', function (e) {
|
||||
if (!(e.request.url.indexOf('http') === 0)) return;
|
||||
|
||||
if (e.request.method !== 'GET') {
|
||||
return;
|
||||
}
|
||||
|
||||
const url = new URL(e.request.url);
|
||||
const pathname = url.pathname;
|
||||
|
||||
if (resources.includes(pathname)) {
|
||||
e.respondWith(
|
||||
caches.match(e.request).then(function (response) {
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
|
||||
var url = new URL(event.request.url);
|
||||
|
||||
if (!url.pathname.includes(".")) {
|
||||
if (!url.pathname.endsWith('/')) {
|
||||
url.pathname += '/';
|
||||
}
|
||||
return caches.match(url.pathname + "index.php");
|
||||
}
|
||||
|
||||
return fetch(event.request)
|
||||
.then(function(networkResponse) {
|
||||
return caches.open("app_uwuzu").then(function(cache) {
|
||||
cache.put(event.request, networkResponse.clone());
|
||||
return networkResponse;
|
||||
});
|
||||
})
|
||||
.catch(function() {
|
||||
return caches.match('/unsupported.php');
|
||||
});
|
||||
return fetch(e.request);
|
||||
})
|
||||
);
|
||||
);
|
||||
} else {
|
||||
e.respondWith(fetch(e.request));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
self.addEventListener('message', function (e) {
|
||||
if (e.data && e.data.action === 'clearCache') {
|
||||
caches.keys().then(function (cacheNames) {
|
||||
Promise.all(
|
||||
cacheNames.map(function (cacheName) {
|
||||
if (cacheName === CACHE_VERSION) {
|
||||
return caches.delete(cacheName);
|
||||
}
|
||||
})
|
||||
).then(function (results) {
|
||||
if (results.includes(true)) {
|
||||
console.log('キャッシュを削除しました');
|
||||
caches.open(CACHE_VERSION).then(function (cache) {
|
||||
cache.addAll(resources).then(function () {
|
||||
console.log('リソースを再キャッシュしました');
|
||||
}).catch(function (error) {
|
||||
console.error('リソースの再キャッシュに失敗しました:', error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log('キャッシュ削除に失敗しました');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
*/
|
||||
+93
-60
@@ -11,8 +11,6 @@ require('../function/function.php');
|
||||
|
||||
$mojisizefile = "../server/textsize.txt";
|
||||
$mojisize = (int)safetext(file_get_contents($mojisizefile));
|
||||
//投稿及び返信レート制限↓(分):デフォで60件/分まで
|
||||
$max_ueuse_rate_limit = 60;
|
||||
|
||||
$banurldomainfile = "../server/banurldomain.txt";
|
||||
$banurl_info = file_get_contents($banurldomainfile);
|
||||
@@ -109,48 +107,6 @@ if(isset($_GET['text'])) {
|
||||
$ueuse = safetext($_COOKIE['ueuse']);
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
|
||||
if( !empty($_POST['btn_submit']) ) {
|
||||
$settingsJsonQuery = $pdo->prepare("SELECT userid, other_settings FROM account WHERE userid = :userid");
|
||||
$settingsJsonQuery->bindValue(':userid', $userid);
|
||||
$settingsJsonQuery->execute();
|
||||
$settingsJson = $settingsJsonQuery->fetch();
|
||||
if(!(empty($settingsJson["other_settings"]))){
|
||||
$isAIBWM = val_OtherSettings("isAIBlockWaterMark", $settingsJson["other_settings"]);
|
||||
}else{
|
||||
$isAIBWM = false;
|
||||
}
|
||||
|
||||
$ueuse = safetext($_POST['ueuse']);
|
||||
|
||||
if(isset($_POST['nsfw_chk'])){
|
||||
$nsfw_chk = safetext($_POST['nsfw_chk']);
|
||||
}else{
|
||||
$nsfw_chk = "false";
|
||||
}
|
||||
|
||||
$photo1 = $_FILES['upload_images'];
|
||||
$photo2 = $_FILES['upload_images2'];
|
||||
$photo3 = $_FILES['upload_images3'];
|
||||
$photo4 = $_FILES['upload_images4'];
|
||||
$video1 = $_FILES['upload_videos1'];
|
||||
|
||||
$rpUniqid = $ueuseid;
|
||||
$ruUniqid = "";
|
||||
$ueuse_result = send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$photo4,$video1,$nsfw_chk,$isAIBWM);
|
||||
|
||||
if($ueuse_result == null){
|
||||
//一時保存していたユーズ内容の削除
|
||||
setcookie("ueuse", "", time() - 3600, "/!".$ueuseid);
|
||||
|
||||
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
header("Location:".$url."");
|
||||
exit;
|
||||
}else{
|
||||
$error_message = $ueuse_result;
|
||||
}
|
||||
}
|
||||
|
||||
if( !empty($_POST['logout']) ) {
|
||||
if (isset($_SERVER['HTTP_COOKIE'])) {
|
||||
@@ -185,6 +141,7 @@ $pdo = null;
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<script src="../js/nsfw_event.js"></script>
|
||||
<script src="../js/view_function.js"></script>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link rel="apple-touch-icon" type="image/png" href="../favicon/apple-touch-icon-180x180.png">
|
||||
@@ -227,6 +184,9 @@ $pdo = null;
|
||||
</div>
|
||||
<?php if(!($role ==="ice")){?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="send_progress">
|
||||
<div class="per"></div>
|
||||
</div>
|
||||
<div class="sendbox">
|
||||
<textarea id="ueuse" placeholder="いまどうしてる?" name="ueuse"><?php if( !empty($ueuse) ){ echo safetext($ueuse); } ?></textarea>
|
||||
|
||||
@@ -265,7 +225,7 @@ $pdo = null;
|
||||
|
||||
<div class="moji_cnt" id="moji_cnt"><?php echo safetext($mojisize); ?></div>
|
||||
|
||||
<input type="submit" class="ueusebtn" id='ueusebtn' name="btn_submit" value="ユーズする">
|
||||
<input type="button" class="ueusebtn" id='ueusebtn' value="ユーズする">
|
||||
</div>
|
||||
|
||||
<div class="harmful_notice" id="harmful_ueuse_warn" style="display:none;">
|
||||
@@ -367,28 +327,29 @@ $pdo = null;
|
||||
$(document).ready(function() {
|
||||
var userid = '<?php echo $userid; ?>';
|
||||
var account_id = '<?php echo $loginid; ?>';
|
||||
|
||||
loadPosts();
|
||||
var ueuseid = "<?php echo safetext($ueuseid);?>";
|
||||
view_ueuse_init(userid, account_id);
|
||||
|
||||
var pageNumber = 1;
|
||||
var pageNumber = 1;
|
||||
var isLoading = false;
|
||||
loadPosts();
|
||||
|
||||
function loadPosts() {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
var ueuseid = '<?php echo $ueuseid; ?>';
|
||||
$.ajax({
|
||||
url: '../nextpage/ueusepage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
data: { page: pageNumber, id: ueuseid ,userid: userid ,account_id: account_id},
|
||||
dataType: 'html',
|
||||
url: '../nextpage/ueusetimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id, uniqid: ueuseid},
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
success: function(response) {
|
||||
renderUeuses(response, ueuseid);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
@@ -413,6 +374,79 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
var isSending = false;
|
||||
$('#ueusebtn').on('click', function() {
|
||||
if (isSending) return;
|
||||
isSending = true;
|
||||
|
||||
var percentComplete = 0;
|
||||
var scaledPercent = 0;
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('userid', userid); // ユーザーID
|
||||
formData.append('account_id', account_id); // アカウントID
|
||||
|
||||
formData.append('ueuse', $("#ueuse").val());
|
||||
formData.append('nsfw_chk', $("#nsfw_chk").is(':checked') ? "true" : "false");
|
||||
formData.append('rpuniqid', ueuseid);
|
||||
|
||||
var photo1 = $('#upload_images').prop('files')[0];
|
||||
var photo2 = $('#upload_images2').prop('files')[0];
|
||||
var photo3 = $('#upload_images3').prop('files')[0];
|
||||
var photo4 = $('#upload_images4').prop('files')[0];
|
||||
var video1 = $('#upload_videos1').prop('files')[0];
|
||||
|
||||
if (photo1) formData.append('upload_images', photo1);
|
||||
if (photo2) formData.append('upload_images2', photo2);
|
||||
if (photo3) formData.append('upload_images3', photo3);
|
||||
if (photo4) formData.append('upload_images4', photo4);
|
||||
if (video1) formData.append('upload_videos1', video1);
|
||||
|
||||
$(".send_progress").show();
|
||||
$.ajax({
|
||||
url: '../function/ueuse.php',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
xhr: function() {
|
||||
var myXhr = $.ajaxSettings.xhr();
|
||||
if (myXhr.upload) {
|
||||
myXhr.upload.addEventListener('progress', function(event) {
|
||||
if (event.lengthComputable) {
|
||||
percentComplete = (event.loaded / event.total) * 100;
|
||||
scaledPercent = Math.min((percentComplete * 0.99), 99);
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
return myXhr;
|
||||
},
|
||||
success: function(response) {
|
||||
if(response.success == true){
|
||||
scaledPercent = 100;
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
|
||||
document.cookie = "ueuse=; Secure; SameSite=Lax; path=/!" + ueuseid + ";";
|
||||
isSending = false;
|
||||
window.location.href = "<?php echo $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];?>";
|
||||
}else{
|
||||
scaledPercent = 0;
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
view_notify(response.error);
|
||||
isSending = false;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
scaledPercent = 0;
|
||||
$(".send_progress").children(".per").css("width", scaledPercent + "%");
|
||||
view_notify("ユーズの送信に失敗しました。");
|
||||
isSending = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.favbtn, .favbtn_after', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
@@ -883,7 +917,6 @@ $(document).ready(function() {
|
||||
$('#moji_cnt').html(mojicount);
|
||||
$('#ueusebtn').prop('disabled', true);
|
||||
}
|
||||
var ueuseid = "<?php echo safetext($ueuseid);?>";
|
||||
document.cookie = "ueuse=" + encodeURIComponent($(this).val()) + "; Secure; SameSite=Lax; path=/!" + ueuseid + ";";
|
||||
});
|
||||
loadEmojis();
|
||||
|
||||
+69
-5
@@ -1,16 +1,80 @@
|
||||
{
|
||||
"software": "uwuzu",
|
||||
"version": "1.4.16",
|
||||
"release_date": "2025/03/16",
|
||||
"release_notes": "このアップデートではモバイル表示で、下部のメニューが表示されなくなってしまう問題を修正しました!\nアップデート後はキャッシュクリアをお忘れなく!",
|
||||
"notices": "アップデート前にデータのバックアップを行うことをおすすめします!",
|
||||
"version": "1.5.0",
|
||||
"release_date": "2025/05/03",
|
||||
"release_notes": "このアップデートではユーズの表示方式の大幅更新や、タイムラインの大幅高速化、アカウント削除時の負荷軽減などの更新が行われています!また、いくつかのバグ修正も行われています。詳細はリリースノートをご覧ください。",
|
||||
"notices": "アップデート前に必ずデータベース構造の更新を行ってください!\nまた、db.phpの更新も行ってください!\n加えて、データのバックアップを行うことをおすすめします!",
|
||||
"files": {
|
||||
"overwrite": [
|
||||
"/actor/index.php",
|
||||
"/admin/setup_db_php.php",
|
||||
"/api/favorite/change.php",
|
||||
"/api/favorite/get.php",
|
||||
"/api/ueuse/create.php",
|
||||
"/api/users/follow.php",
|
||||
"/api/users/unfollow.php",
|
||||
"/api/sitemap-api.php",
|
||||
"/api/v1/instance.php",
|
||||
"/bookmark/index.php",
|
||||
"/css/style.css",
|
||||
"/css/home.css",
|
||||
"/delete/delete.php",
|
||||
"/errorpage/overcapacity.php",
|
||||
"/function/function.php",
|
||||
"/function/get_customemoji.php",
|
||||
"/function/get_userid.php",
|
||||
"/function/reuse.php",
|
||||
"/function/settings.php",
|
||||
"/function/ueuse.php",
|
||||
"/home/index.php",
|
||||
"/nextpage/bookmarktimeline.php",
|
||||
"/nextpage/followtimeline.php",
|
||||
"/nextpage/foryoutimeline.php",
|
||||
"/nextpage/localtimeline.php",
|
||||
"/nextpage/notification.php",
|
||||
"/nextpage/searchtimeline.php",
|
||||
"/nextpage/ueusetimeline.php",
|
||||
"/nextpage/userliketimeline.php",
|
||||
"/nextpage/usermediatimeline.php",
|
||||
"/nextpage/usertimeline.php",
|
||||
"/js/nsfw_event.js",
|
||||
"/js/unsupported.js",
|
||||
"/js/view_function.js",
|
||||
"/others/cache_clear.php",
|
||||
"/others/index.php",
|
||||
"/search/index.php",
|
||||
"/settings/index.php",
|
||||
"/settings_admin/ad_admin.php",
|
||||
"/settings_admin/jobs_admin.php",
|
||||
"/settings_admin/overview_admin.php",
|
||||
"/settings_admin/plugin_admin.php",
|
||||
"/settings_admin/role_admin.php",
|
||||
"/settings_admin/update_admin.php",
|
||||
"/settings_admin/settings_left_menu.php",
|
||||
"/settings_admin/useradmin.php",
|
||||
"/settings_admin/userinfo.php",
|
||||
"/settings_admin/plugin_settings/amazons3_settings.php",
|
||||
"/ueuse/index.php",
|
||||
"/user/index.php",
|
||||
"/check.php",
|
||||
"/login.php",
|
||||
"/sw.js",
|
||||
|
||||
"/server/uwuzuabout.txt",
|
||||
"/server/uwuzuinfo.txt",
|
||||
"/server/uwuzurelease.txt"
|
||||
],
|
||||
"delete": []
|
||||
"delete": [
|
||||
"/nextpage/foryoupage.php",
|
||||
"/nextpage/ftlpage.php",
|
||||
"/nextpage/nextpage.php",
|
||||
"/nextpage/userpage.php",
|
||||
"/nextpage/usermediapage.php",
|
||||
"/nextpage/userlikepage.php",
|
||||
"/nextpage/bookmark.php",
|
||||
"/nextpage/ueusepage.php",
|
||||
"/nextpage/searchpage.php",
|
||||
"/nextpage/user_view.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+47
-71
@@ -85,7 +85,7 @@ if (!empty($pdo)) {
|
||||
if (!empty($userData["userid"])) {
|
||||
|
||||
|
||||
$roles = explode(',', $userData["role"]); // カンマで区切られたロールを配列に分割
|
||||
$roles = array_filter(explode(',', $userData["role"])); // カンマで区切られたロールを配列に分割
|
||||
|
||||
$rerole = $pdo->prepare("SELECT follow, follower,blocklist, username, userid, password, mailadds, profile, iconname, headname, role, datetime, other_settings FROM account WHERE userid = :userid");
|
||||
|
||||
@@ -181,6 +181,17 @@ if (!empty($pdo)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(filter_var($userdata['iconname'], FILTER_VALIDATE_URL)){
|
||||
$userdata['iconname'] = $userdata['iconname'];
|
||||
}else{
|
||||
$userdata['iconname'] = "../" . $userdata['iconname'];
|
||||
}
|
||||
if(filter_var($userdata['headname'], FILTER_VALIDATE_URL)){
|
||||
$userdata['headname'] = $userdata['headname'];
|
||||
}else{
|
||||
$userdata['headname'] = "../" . $userdata['headname'];
|
||||
}
|
||||
} else {
|
||||
$userData["userid"] = "none";
|
||||
$userData['username'] = "でふぉると";
|
||||
@@ -252,6 +263,7 @@ $pdo = null;
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<script src="../js/nsfw_event.js"></script>
|
||||
<script src="../js/view_function.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<?php if($isAIBlock === true){?>
|
||||
@@ -328,10 +340,10 @@ $pdo = null;
|
||||
<!--ここまで!--->
|
||||
<?php } else { ?>
|
||||
<div class="hed">
|
||||
<img src="<?php echo safetext('../' . $userdata['headname']); ?>">
|
||||
<img src="<?php echo safetext($userdata['headname']); ?>">
|
||||
</div>
|
||||
<div class="icon">
|
||||
<img src="<?php echo safetext('../' . $userdata['iconname']); ?>">
|
||||
<img src="<?php echo safetext($userdata['iconname']); ?>">
|
||||
<h2><?php echo replaceProfileEmojiImages(safetext($userData['username'])); ?></h2>
|
||||
<p>@<?php echo safetext($userData['userid']); ?><!--<span>@<?php /*echo safetext($domain); */ ?></span>--></p>
|
||||
</div>
|
||||
@@ -340,12 +352,16 @@ $pdo = null;
|
||||
<?php foreach ($roles as $roleId) : ?>
|
||||
<?php $roleData = $roleDataArray[$roleId]; ?>
|
||||
<?php
|
||||
if (safetext($roleData["roleeffect"]) == '' || safetext($roleData["roleeffect"]) == 'none') {
|
||||
$role_view_effect = "";
|
||||
} elseif (safetext($roleData["roleeffect"]) == 'shine') {
|
||||
$role_view_effect = "shine";
|
||||
} elseif (safetext($roleData["roleeffect"]) == 'rainbow') {
|
||||
$role_view_effect = "rainbow";
|
||||
if(!(empty($roleData))){
|
||||
if (safetext($roleData["roleeffect"]) == '' || safetext($roleData["roleeffect"]) == 'none') {
|
||||
$role_view_effect = "";
|
||||
} elseif (safetext($roleData["roleeffect"]) == 'shine') {
|
||||
$role_view_effect = "shine";
|
||||
} elseif (safetext($roleData["roleeffect"]) == 'rainbow') {
|
||||
$role_view_effect = "rainbow";
|
||||
} else {
|
||||
$role_view_effect = "";
|
||||
}
|
||||
} else {
|
||||
$role_view_effect = "";
|
||||
}
|
||||
@@ -648,14 +664,14 @@ $pdo = null;
|
||||
$(document).ready(function() {
|
||||
var userid = '<?php echo $userid; ?>';
|
||||
var account_id = '<?php echo $loginid; ?>';
|
||||
view_ueuse_init(userid, account_id);
|
||||
|
||||
loadPosts();
|
||||
|
||||
var pageNumber = 1;
|
||||
|
||||
var isLoading = false;
|
||||
|
||||
var mode = "";
|
||||
var mode = "allueuse";
|
||||
$('#all_ueuse_btn').addClass('btmline');
|
||||
loadPosts();
|
||||
|
||||
function loadPosts() {
|
||||
if (isLoading) return;
|
||||
@@ -665,23 +681,18 @@ $pdo = null;
|
||||
var uwuzuid = '<?php echo $uwuzuid; ?>';
|
||||
if (mode == 'allueuse') {
|
||||
$.ajax({
|
||||
url: '../nextpage/userpage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
data: {
|
||||
page: pageNumber,
|
||||
id: uwuzuid,
|
||||
userid: userid,
|
||||
account_id: account_id
|
||||
},
|
||||
dataType: 'html',
|
||||
url: '../nextpage/usertimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id, id: uwuzuid,},
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
@@ -689,23 +700,18 @@ $pdo = null;
|
||||
});
|
||||
} else if (mode == 'mediaueuse') {
|
||||
$.ajax({
|
||||
url: '../nextpage/usermediapage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
data: {
|
||||
page: pageNumber,
|
||||
id: uwuzuid,
|
||||
userid: userid,
|
||||
account_id: account_id
|
||||
},
|
||||
dataType: 'html',
|
||||
url: '../nextpage/usermediatimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id, id: uwuzuid,},
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
@@ -713,48 +719,18 @@ $pdo = null;
|
||||
});
|
||||
} else if (mode == 'likeueuse') {
|
||||
$.ajax({
|
||||
url: '../nextpage/userlikepage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
data: {
|
||||
page: pageNumber,
|
||||
id: uwuzuid,
|
||||
userid: userid,
|
||||
account_id: account_id
|
||||
},
|
||||
dataType: 'html',
|
||||
url: '../nextpage/userliketimeline.php',
|
||||
method: 'POST',
|
||||
data: { page: pageNumber, userid: userid, account_id: account_id, id: uwuzuid,},
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
renderUeuses(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
$('#all_ueuse_btn').addClass('btmline');
|
||||
$.ajax({
|
||||
url: '../nextpage/userpage.php', // PHPファイルへのパス
|
||||
method: 'GET',
|
||||
data: {
|
||||
page: pageNumber,
|
||||
id: uwuzuid,
|
||||
userid: userid,
|
||||
account_id: account_id
|
||||
},
|
||||
dataType: 'html',
|
||||
timeout: 300000,
|
||||
success: function(response) {
|
||||
$('#postContainer').append(response);
|
||||
pageNumber++;
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
isLoading = false;
|
||||
$("#loading").hide();
|
||||
$("#error").show();
|
||||
|
||||
+29
-1
@@ -3,7 +3,7 @@
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- ホスト: 127.0.0.1
|
||||
-- 生成日時: 2025-01-26 07:32:55
|
||||
-- 生成日時: 2025-05-03 15:26:28
|
||||
-- サーバのバージョン: 10.4.32-MariaDB
|
||||
-- PHP のバージョン: 8.2.12
|
||||
|
||||
@@ -133,6 +133,22 @@ CREATE TABLE `ipblock` (
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- テーブルの構造 `jobs`
|
||||
--
|
||||
|
||||
CREATE TABLE `jobs` (
|
||||
`sysid` int(11) NOT NULL,
|
||||
`uniqid` varchar(256) NOT NULL,
|
||||
`userid` varchar(512) NOT NULL,
|
||||
`job` varchar(1024) NOT NULL,
|
||||
`step` varchar(256) NOT NULL,
|
||||
`status` varchar(256) NOT NULL,
|
||||
`datetime` datetime NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- テーブルの構造 `migration`
|
||||
--
|
||||
@@ -278,6 +294,12 @@ ALTER TABLE `invitation`
|
||||
ALTER TABLE `ipblock`
|
||||
ADD PRIMARY KEY (`sysid`);
|
||||
|
||||
--
|
||||
-- テーブルのインデックス `jobs`
|
||||
--
|
||||
ALTER TABLE `jobs`
|
||||
ADD PRIMARY KEY (`sysid`);
|
||||
|
||||
--
|
||||
-- テーブルのインデックス `migration`
|
||||
--
|
||||
@@ -354,6 +376,12 @@ ALTER TABLE `invitation`
|
||||
ALTER TABLE `ipblock`
|
||||
MODIFY `sysid` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- テーブルの AUTO_INCREMENT `jobs`
|
||||
--
|
||||
ALTER TABLE `jobs`
|
||||
MODIFY `sysid` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- テーブルの AUTO_INCREMENT `migration`
|
||||
--
|
||||
|
||||
@@ -28,7 +28,6 @@ migration_bad_success - アカウントの移行後に移行の完了処理が
|
||||
already_been_completed - 処理が既に完了している場合に表示されます。
|
||||
you_cant_it_to_yourself - 自分に対して行えない処理を行おうとした際に表示されます。
|
||||
could_not_complete - 処理を完了できなかった場合に表示されます。
|
||||
this_API_is_ws_only - WebsocketAPIがWebsocket以外の方法でアクセスされた場合に表示されます。
|
||||
|
||||
----------(UWUZU ERR CODE)----------
|
||||
FILE_DEKASUGUI_PHP_INI_KAKUNIN - php.iniで設定されているファイルサイズ上限を上回っている時に表示されます。
|
||||
@@ -145,7 +144,6 @@ DELETE_FILE_NOT_FOUND - アップデート作業時に、zipファイル内で
|
||||
UPDATE_FILE_NOT_FOUND - アップデート作業時に、zipファイル内にあるはずの更新用のファイルが存在しなかった際に表示されます。
|
||||
|
||||
BAD_REQUEST - 不正なリクエストが送信されてきた際に表示されます。
|
||||
AUTH_INVALID - アカウントの認証に失敗した際に表示されます。
|
||||
|
||||
DON'T_TOUCH_SYSTEM_ROLE - システムロールをべたべた触ったり削除しようとしたりすると表示されます。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user