mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-05 03:24:41 +00:00
uwuzu version 1.2.27
This commit is contained in:
+102
-13
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
$servernamefile = "../server/servername.txt";
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$mojisizefile = "../server/textsize.txt";
|
||||
$servericonfile = "../server/servericon.txt";
|
||||
|
||||
$banurldomainfile = "../server/banurldomain.txt";
|
||||
$banurl_info = file_get_contents($banurldomainfile);
|
||||
@@ -34,9 +38,6 @@ session_name('uwuzu_s_id');
|
||||
session_start();
|
||||
session_regenerate_id(true);
|
||||
|
||||
$userid = htmlentities($_SESSION['userid']);
|
||||
$username = htmlentities($_SESSION['username']);
|
||||
|
||||
try {
|
||||
|
||||
$option = array(
|
||||
@@ -53,7 +54,7 @@ try {
|
||||
|
||||
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$passQuery->bindValue(':userid', htmlentities($_SESSION['userid']));
|
||||
$passQuery->execute();
|
||||
$res = $passQuery->fetch();
|
||||
@@ -62,12 +63,13 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
exit;
|
||||
}elseif($_SESSION['loginid'] === $res["loginid"] && $_SESSION['userid'] === $res["userid"]){
|
||||
// セッションに値をセット
|
||||
$userid = htmlentities($_SESSION['userid']); // セッションに格納されている値をそのままセット
|
||||
$username = htmlentities($_SESSION['username']); // セッションに格納されている値をそのままセット
|
||||
$userid = htmlentities($res['userid']); // セッションに格納されている値をそのままセット
|
||||
$username = htmlentities($res['username']); // セッションに格納されている値をそのままセット
|
||||
$loginid = htmlentities($res["loginid"]);
|
||||
$role = htmlentities($res["role"]);
|
||||
$sacinfo = htmlentities($res["sacinfo"]);
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$myfollowlist = htmlentities($res["follow"]);
|
||||
$_SESSION['admin_login'] = true;
|
||||
$_SESSION['userid'] = $userid;
|
||||
$_SESSION['username'] = $username;
|
||||
@@ -100,7 +102,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
|
||||
} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
|
||||
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
|
||||
$passQuery->bindValue(':userid', htmlentities($_COOKIE['userid']));
|
||||
$passQuery->execute();
|
||||
$res = $passQuery->fetch();
|
||||
@@ -109,12 +111,13 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
exit;
|
||||
}elseif($_COOKIE['loginid'] === $res["loginid"] && $_COOKIE['userid'] === $res["userid"]){
|
||||
// セッションに値をセット
|
||||
$userid = htmlentities($_COOKIE['userid']); // クッキーから取得した値をセット
|
||||
$username = htmlentities($_COOKIE['username']); // クッキーから取得した値をセット
|
||||
$userid = htmlentities($res['userid']); // クッキーから取得した値をセット
|
||||
$username = htmlentities($res['username']); // クッキーから取得した値をセット
|
||||
$loginid = htmlentities($res["loginid"]);
|
||||
$role = htmlentities($res["role"]);
|
||||
$sacinfo = htmlentities($res["sacinfo"]);
|
||||
$myblocklist = htmlentities($res["blocklist"]);
|
||||
$myfollowlist = htmlentities($res["follow"]);
|
||||
$_SESSION['admin_login'] = true;
|
||||
$_SESSION['userid'] = $userid;
|
||||
$_SESSION['username'] = $username;
|
||||
@@ -157,7 +160,7 @@ if(empty($userid)){
|
||||
if(empty($username)){
|
||||
header("Location: ../login.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'");
|
||||
$notiQuery->bindValue(':userid', $userid);
|
||||
$notiQuery->execute();
|
||||
@@ -200,6 +203,39 @@ function get_mentions_userid($postText) {
|
||||
|
||||
return $mentionedUsers;
|
||||
}
|
||||
function rotate($image, $exif)
|
||||
{
|
||||
$orientation = $exif['Orientation'] ?? 1;
|
||||
|
||||
switch ($orientation) {
|
||||
case 1: //no rotate
|
||||
break;
|
||||
case 2: //FLIP_HORIZONTAL
|
||||
imageflip($image, IMG_FLIP_HORIZONTAL);
|
||||
break;
|
||||
case 3: //ROTATE 180
|
||||
$image = imagerotate($image, 180, 0);
|
||||
break;
|
||||
case 4: //FLIP_VERTICAL
|
||||
imageflip($image, IMG_FLIP_VERTICAL);
|
||||
break;
|
||||
case 5: //ROTATE 270 FLIP_HORIZONTAL
|
||||
$image = imagerotate($image, 270, 0);
|
||||
imageflip($image, IMG_FLIP_HORIZONTAL);
|
||||
break;
|
||||
case 6: //ROTATE 90
|
||||
$image = imagerotate($image, 270, 0);
|
||||
break;
|
||||
case 7: //ROTATE 90 FLIP_HORIZONTAL
|
||||
$image = imagerotate($image, 90, 0);
|
||||
imageflip($image, IMG_FLIP_HORIZONTAL);
|
||||
break;
|
||||
case 8: //ROTATE 270
|
||||
$image = imagerotate($image, 90, 0);
|
||||
break;
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -256,6 +292,19 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
|
||||
// ファイルを移動
|
||||
$result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath);
|
||||
|
||||
// EXIF削除
|
||||
if($extension == "jpg" || $extension == "jpeg"){
|
||||
$gd = imagecreatefromjpeg($uploadedPath);
|
||||
$w = imagesx($gd);
|
||||
$h = imagesy($gd);
|
||||
$gd_out = imagecreatetruecolor($w,$h);
|
||||
imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h);
|
||||
$exif = exif_read_data($uploadedPath);
|
||||
$gd_out = rotate($gd_out, $exif);
|
||||
imagejpeg($gd_out, $uploadedPath);
|
||||
imagedestroy($gd_out);
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$photo1 = $uploadedPath; // 保存されたファイルのパスを使用
|
||||
@@ -296,6 +345,19 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
|
||||
// ファイルを移動
|
||||
$result2 = move_uploaded_file($uploadedFile2['tmp_name'], $uploadedPath2);
|
||||
|
||||
// EXIF削除
|
||||
if($extension2 == "jpg" || $extension2 == "jpeg"){
|
||||
$gd = imagecreatefromjpeg($uploadedPath2);
|
||||
$w = imagesx($gd);
|
||||
$h = imagesy($gd);
|
||||
$gd_out = imagecreatetruecolor($w,$h);
|
||||
imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h);
|
||||
$exif = exif_read_data($uploadedPath2);
|
||||
$gd_out = rotate($gd_out, $exif);
|
||||
imagejpeg($gd_out, $uploadedPath2);
|
||||
imagedestroy($gd_out);
|
||||
}
|
||||
|
||||
if ($result2) {
|
||||
$photo2 = $uploadedPath2; // 保存されたファイルのパスを使用
|
||||
@@ -336,6 +398,19 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
|
||||
// ファイルを移動
|
||||
$result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3);
|
||||
|
||||
// EXIF削除
|
||||
if($extension3 == "jpg" || $extension3 == "jpeg"){
|
||||
$gd = imagecreatefromjpeg($uploadedPath3);
|
||||
$w = imagesx($gd);
|
||||
$h = imagesy($gd);
|
||||
$gd_out = imagecreatetruecolor($w,$h);
|
||||
imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h);
|
||||
$exif = exif_read_data($uploadedPath3);
|
||||
$gd_out = rotate($gd_out, $exif);
|
||||
imagejpeg($gd_out, $uploadedPath3);
|
||||
imagedestroy($gd_out);
|
||||
}
|
||||
|
||||
if ($result3) {
|
||||
$photo3 = $uploadedPath3; // 保存されたファイルのパスを使用
|
||||
@@ -376,6 +451,19 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
|
||||
// ファイルを移動
|
||||
$result4 = move_uploaded_file($uploadedFile4['tmp_name'], $uploadedPath4);
|
||||
|
||||
// EXIF削除
|
||||
if($extension4 == "jpg" || $extension4 == "jpeg"){
|
||||
$gd = imagecreatefromjpeg($uploadedPath4);
|
||||
$w = imagesx($gd);
|
||||
$h = imagesy($gd);
|
||||
$gd_out = imagecreatetruecolor($w,$h);
|
||||
imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h);
|
||||
$exif = exif_read_data($uploadedPath4);
|
||||
$gd_out = rotate($gd_out, $exif);
|
||||
imagejpeg($gd_out, $uploadedPath4);
|
||||
imagedestroy($gd_out);
|
||||
}
|
||||
|
||||
if ($result4) {
|
||||
$photo4 = $uploadedPath4; // 保存されたファイルのパスを使用
|
||||
@@ -475,7 +563,7 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$msg = ''.$ueuse.'';
|
||||
$title = ''.$username.'さんが返信しました!';
|
||||
$title = ''.$userid.'さんが返信しました!';
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
$userchk = 'none';
|
||||
// 通知用SQL作成
|
||||
@@ -507,7 +595,7 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
$touserid = $mentionedUser;
|
||||
$datetime = date("Y-m-d H:i:s");
|
||||
$msg = "" . $ueuse . "";
|
||||
$title = "" . $username . "さんにメンションされました!";
|
||||
$title = "" . $userid . "さんにメンションされました!";
|
||||
$url = "/!" . $uniqid . "~" . $userid . "";
|
||||
$userchk = 'none';
|
||||
|
||||
@@ -587,13 +675,14 @@ $pdo = null;
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="../css/home.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
|
||||
<script src="../js/unsupported.js"></script>
|
||||
<script src="../js/console_notice.js"></script>
|
||||
<script src="../js/nsfw_event.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">
|
||||
<link rel="icon" type="image/png" href="../favicon/icon-192x192.png">
|
||||
<title>ID <?php echo htmlentities($ueuseid, ENT_QUOTES, 'UTF-8'); ?> のユーズ - uwuzu</title>
|
||||
<title>ID <?php echo htmlentities($ueuseid, ENT_QUOTES, 'UTF-8'); ?> のユーズ - <?php echo file_get_contents($servernamefile);?></title>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user