settings = new Settings(); $this->db = new SQLite3($this->settings->getSetting('db_path')); } private function getChineseTime($timestamp) { date_default_timezone_set('Asia/Shanghai'); return $timestamp; } public function getPaste($uuid) { $stmt = $this->db->prepare('SELECT * FROM notes WHERE uuid = :uuid'); $stmt->bindValue(':uuid', $uuid, SQLITE3_TEXT); $result = $stmt->execute(); if ($row = $result->fetchArray(SQLITE3_ASSOC)) { // 检查是否过期(使用中国时间) date_default_timezone_set('Asia/Shanghai'); if (time() > $row['expires_at']) { $this->deletePaste($uuid); return null; } // 检查访问次数 if ($row['max_views'] > 0 && $row['current_views'] >= $row['max_views']) { $this->deletePaste($uuid); return null; } // 更新访问次数 $stmt = $this->db->prepare('UPDATE notes SET current_views = current_views + 1 WHERE uuid = :uuid'); $stmt->bindValue(':uuid', $uuid, SQLITE3_TEXT); $stmt->execute(); return $row; } return null; } private function deletePaste($uuid) { $stmt = $this->db->prepare('DELETE FROM notes WHERE uuid = :uuid'); $stmt->bindValue(':uuid', $uuid, SQLITE3_TEXT); $stmt->execute(); } } $pasteboard = new PasteBoard(); $settings = new Settings(); $paste = null; $uuid = isset($_GET['id']) ? $_GET['id'] : null; if ($uuid) { $paste = $pasteboard->getPaste($uuid); if (!$paste) { header("HTTP/1.0 404 Not Found"); echo "Paste not found or expired"; exit; } } ?>
getSetting('site_description')); ?>
此内容已加密。解密密钥应该在URL的#后面。