上传文件至 /

Signed-off-by: admin <15630053159@163.com>
This commit is contained in:
2026-11-27 15:40:59 +08:00
commit f8d6ddd016
5 changed files with 546 additions and 0 deletions

33
square_cancel.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// 撤回广场推送:待审的取消申请,已通过的从广场下架。图片本身留在个人图库不受影响。
require_once __DIR__ . '/includes/auth.php';
require_once __DIR__ . '/includes/features.php';
header('Content-Type: application/json; charset=utf-8');
function reply($arr, $code = 200)
{
http_response_code($code);
echo json_encode($arr, JSON_UNESCAPED_UNICODE);
exit;
}
if (!SQUARE_ENABLED) {
reply(['ok' => false, 'msg' => '照片广场未开放'], 404);
}
$user = current_user($conn);
if (!$user) {
reply(['ok' => false, 'msg' => '登录已失效,请重新登录'], 401);
}
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !csrf_ok()) {
reply(['ok' => false, 'msg' => '请求校验失败'], 400);
}
$image_id = (int)($_POST['image_id'] ?? 0);
$stmt = $conn->prepare("DELETE FROM photos_square WHERE image_id = ? AND user_id = ?");
$stmt->bind_param("ii", $image_id, $user['user_id']);
$stmt->execute();
$ok = $stmt->affected_rows > 0;
$stmt->close();
reply(['ok' => $ok, 'msg' => $ok ? '已撤回' : '没有可撤回的推送']);