v1
This commit is contained in:
parent
79c41dee1e
commit
5235a9fa88
66
add_paper.php
Normal file
66
add_paper.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$title = $_POST['title'] ?? '';
|
||||||
|
$authors = $_POST['authors'] ?? '';
|
||||||
|
$publication = $_POST['publication'] ?? '';
|
||||||
|
$year = $_POST['year'] ?? null;
|
||||||
|
$notes = $_POST['notes'] ?? '';
|
||||||
|
|
||||||
|
if ($title && $authors) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO papers (title, authors, publication, year, notes) VALUES (?, ?, ?, ?, ?)");
|
||||||
|
$stmt->execute([$title, $authors, $publication, $year, $notes]);
|
||||||
|
header("Location: /?toast=" . urlencode('Paper added successfully!'));
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// In a real app, you'd log this error.
|
||||||
|
header("Location: /add_paper.php?toast=" . urlencode('Error adding paper.'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'partials/header.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="form-container">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<img src="https://picsum.photos/200" alt="Icon of a document or a book" class="mb-3">
|
||||||
|
<h2>Add a New Paper</h2>
|
||||||
|
</div>
|
||||||
|
<form action="add_paper.php" method="POST" id="add-paper-form">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="title" class="form-label">Title</label>
|
||||||
|
<input type="text" class="form-control" id="title" name="title" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="authors" class="form-label">Authors</label>
|
||||||
|
<input type="text" class="form-control" id="authors" name="authors" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="publication" class="form-label">Publication/Journal</label>
|
||||||
|
<input type="text" class="form-control" id="publication" name="publication">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="year" class="form-label">Year</label>
|
||||||
|
<input type="number" class="form-control" id="year" name="year">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="notes" class="form-label">Notes</label>
|
||||||
|
<textarea class="form-control" id="notes" name="notes" rows="4"></textarea>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Add Paper</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include 'partials/footer.php'; ?>
|
||||||
61
assets/css/custom.css
Normal file
61
assets/css/custom.css
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
/* General Body Styles */
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
color: #343a40;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Typography */
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: 'Playfair Display', serif;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Buttons */
|
||||||
|
.btn-primary {
|
||||||
|
background-image: linear-gradient(45deg, #007bff, #0056b3);
|
||||||
|
border: none;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cards */
|
||||||
|
.card {
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.hero {
|
||||||
|
background: url('https://picsum.photos/1600/400') no-repeat center center;
|
||||||
|
background-size: cover;
|
||||||
|
color: white;
|
||||||
|
padding: 4rem 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero h1 {
|
||||||
|
font-size: 3.5rem;
|
||||||
|
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Form */
|
||||||
|
.form-container {
|
||||||
|
background: white;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toast Notifications */
|
||||||
|
.toast-container {
|
||||||
|
position: fixed;
|
||||||
|
top: 1rem;
|
||||||
|
right: 1rem;
|
||||||
|
z-index: 1050;
|
||||||
|
}
|
||||||
45
assets/js/main.js
Normal file
45
assets/js/main.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
// Client-side validation for the add paper form
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const form = document.querySelector('#add-paper-form');
|
||||||
|
if (form) {
|
||||||
|
form.addEventListener('submit', (event) => {
|
||||||
|
let isValid = true;
|
||||||
|
const requiredFields = form.querySelectorAll('[required]');
|
||||||
|
requiredFields.forEach(field => {
|
||||||
|
if (!field.value) {
|
||||||
|
isValid = false;
|
||||||
|
field.classList.add('is-invalid');
|
||||||
|
} else {
|
||||||
|
field.classList.remove('is-invalid');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
event.preventDefault();
|
||||||
|
alert('Please fill out all required fields.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show toast from URL parameter
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const toastMessage = urlParams.get('toast');
|
||||||
|
if (toastMessage) {
|
||||||
|
const toastContainer = document.querySelector('.toast-container');
|
||||||
|
if (toastContainer) {
|
||||||
|
const toast = `
|
||||||
|
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="toast-header">
|
||||||
|
<strong class="me-auto">Notification</strong>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body">
|
||||||
|
${decodeURIComponent(toastMessage)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
toastContainer.innerHTML = toast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
BIN
assets/vm-shot-2025-10-07T17-01-12-455Z.jpg
Normal file
BIN
assets/vm-shot-2025-10-07T17-01-12-455Z.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@ -1,17 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
// Generated by setup_mariadb_project.sh — edit as needed.
|
|
||||||
define('DB_HOST', '127.0.0.1');
|
|
||||||
define('DB_NAME', 'app_30953');
|
|
||||||
define('DB_USER', 'app_30953');
|
|
||||||
define('DB_PASS', 'e45f2778-db1f-450c-99c6-29efb4601472');
|
|
||||||
|
|
||||||
function db() {
|
function db() {
|
||||||
static $pdo;
|
static $pdoconn = null;
|
||||||
if (!$pdo) {
|
if ($pdoconn === null) {
|
||||||
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
|
$host = '127.0.0.1';
|
||||||
|
$db = 'lamp_app';
|
||||||
|
$user = 'lamp_user';
|
||||||
|
$pass = '';
|
||||||
|
$charset = 'utf8mb4';
|
||||||
|
|
||||||
|
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
|
||||||
|
$options = [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
]);
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
$pdoconn = new PDO($dsn, $user, $pass, $options);
|
||||||
|
} catch (\PDOException $e) {
|
||||||
|
throw new \PDOException($e->getMessage(), (int)$e->getCode());
|
||||||
}
|
}
|
||||||
return $pdo;
|
|
||||||
}
|
}
|
||||||
|
return $pdoconn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_migrations() {
|
||||||
|
$pdo = db();
|
||||||
|
$migration_files = glob(__DIR__ . '/migrations/*.sql');
|
||||||
|
foreach ($migration_files as $file) {
|
||||||
|
$sql = file_get_contents($file);
|
||||||
|
$pdo->exec($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run_migrations();
|
||||||
10
db/migrations/001_create_papers_table.sql
Normal file
10
db/migrations/001_create_papers_table.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS papers (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
title VARCHAR(255) NOT NULL,
|
||||||
|
authors VARCHAR(255) NOT NULL,
|
||||||
|
publication VARCHAR(255),
|
||||||
|
year INT,
|
||||||
|
notes TEXT,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
31
delete_paper.php
Normal file
31
delete_paper.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paper_id = $_GET['id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Optional: Check if paper exists before deleting
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM papers WHERE id = ?");
|
||||||
|
$stmt->execute([$paper_id]);
|
||||||
|
if ($stmt->rowCount() === 0) {
|
||||||
|
// Paper not found, maybe already deleted
|
||||||
|
header("Location: index.php?error=notfound");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the paper
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM papers WHERE id = ?");
|
||||||
|
$stmt->execute([$paper_id]);
|
||||||
|
header("Location: index.php?success=deleted");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Log error if you have a logging system
|
||||||
|
header("Location: index.php?error=deletfailed");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
99
edit_paper.php
Normal file
99
edit_paper.php
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
include 'partials/header.php';
|
||||||
|
|
||||||
|
$pdo = db();
|
||||||
|
$feedback = [];
|
||||||
|
$paper = null;
|
||||||
|
|
||||||
|
if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paper_id = $_GET['id'];
|
||||||
|
|
||||||
|
// Fetch paper details
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM papers WHERE id = ?");
|
||||||
|
$stmt->execute([$paper_id]);
|
||||||
|
$paper = $stmt->fetch();
|
||||||
|
|
||||||
|
if (!$paper) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$title = trim($_POST['title'] ?? '');
|
||||||
|
$authors = trim($_POST['authors'] ?? '');
|
||||||
|
$publication = trim($_POST['publication'] ?? '');
|
||||||
|
$year = filter_input(INPUT_POST, 'year', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1900, 'max_range' => date('Y') + 1]]);
|
||||||
|
$notes = trim($_POST['notes'] ?? '');
|
||||||
|
|
||||||
|
if (empty($title) || empty($authors)) {
|
||||||
|
$feedback = ['type' => 'danger', 'message' => 'Title and Authors are required.'];
|
||||||
|
} elseif ($year === false) {
|
||||||
|
$feedback = ['type' => 'danger', 'message' => 'Invalid year.'];
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("UPDATE papers SET title = ?, authors = ?, publication = ?, year = ?, notes = ? WHERE id = ?");
|
||||||
|
$stmt->execute([$title, $authors, $publication, $year, $notes, $paper_id]);
|
||||||
|
header("Location: index.php?success=updated");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$feedback = ['type' => 'danger', 'message' => 'Error updating paper: ' . $e->getMessage()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// To show feedback on the same page, we need to repopulate the paper variable with submitted data
|
||||||
|
$paper['title'] = $title;
|
||||||
|
$paper['authors'] = $authors;
|
||||||
|
$paper['publication'] = $publication;
|
||||||
|
$paper['year'] = $year;
|
||||||
|
$paper['notes'] = $notes;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2>Edit Paper</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (!empty($feedback)): ?>
|
||||||
|
<div class="alert alert-<?= $feedback['type'] ?>">
|
||||||
|
<?= htmlspecialchars($feedback['message']) ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="edit_paper.php?id=<?= $paper_id ?>" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="title" class="form-label">Title</label>
|
||||||
|
<input type="text" class="form-control" id="title" name="title" value="<?= htmlspecialchars($paper['title']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="authors" class="form-label">Authors</label>
|
||||||
|
<input type="text" class="form-control" id="authors" name="authors" value="<?= htmlspecialchars($paper['authors']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="publication" class="form-label">Publication/Journal</label>
|
||||||
|
<input type="text" class="form-control" id="publication" name="publication" value="<?= htmlspecialchars($paper['publication']) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="year" class="form-label">Year</label>
|
||||||
|
<input type="number" class="form-control" id="year" name="year" value="<?= htmlspecialchars($paper['year']) ?>" min="1900" max="<?= date('Y') + 1 ?>">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="notes" class="form-label">Notes</label>
|
||||||
|
<textarea class="form-control" id="notes" name="notes" rows="5"><?= htmlspecialchars($paper['notes']) ?></textarea>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Update Paper</button>
|
||||||
|
<a href="index.php" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include 'partials/footer.php'; ?>
|
||||||
271
index.php
271
index.php
@ -1,150 +1,135 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
require_once 'db/config.php';
|
||||||
@ini_set('display_errors', '1');
|
include 'partials/header.php';
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
$pdo = db();
|
||||||
$now = date('Y-m-d H:i:s');
|
$search = $_GET['search'] ?? '';
|
||||||
|
$papers_per_page = 6;
|
||||||
|
$current_page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int)$_GET['page'] : 1;
|
||||||
|
$offset = ($current_page - 1) * $papers_per_page;
|
||||||
|
|
||||||
|
// Get total number of papers for pagination
|
||||||
|
if ($search) {
|
||||||
|
$count_stmt = $pdo->prepare("SELECT COUNT(*) FROM papers WHERE title LIKE :search OR authors LIKE :search OR publication LIKE :search");
|
||||||
|
$count_stmt->execute(['search' => "%$search%"]);
|
||||||
|
} else {
|
||||||
|
$count_stmt = $pdo->query("SELECT COUNT(*) FROM papers");
|
||||||
|
}
|
||||||
|
$total_papers = $count_stmt->fetchColumn();
|
||||||
|
$total_pages = ceil($total_papers / $papers_per_page);
|
||||||
|
|
||||||
|
// Get papers for the current page
|
||||||
|
if ($search) {
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM papers WHERE title LIKE :search OR authors LIKE :search OR publication LIKE :search ORDER BY created_at DESC LIMIT :limit OFFSET :offset");
|
||||||
|
$stmt->bindValue(':search', "%$search%", PDO::PARAM_STR);
|
||||||
|
$stmt->bindValue(':limit', $papers_per_page, PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} else {
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM papers ORDER BY created_at DESC LIMIT :limit OFFSET :offset");
|
||||||
|
$stmt->bindValue(':limit', $papers_per_page, PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
$papers = $stmt->fetchAll();
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<div class="hero">
|
||||||
<head>
|
<div class="container">
|
||||||
<meta charset="utf-8" />
|
<h1>Your Paper Collection</h1>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<p class="lead">A central place to manage all your academic papers.</p>
|
||||||
<title>New Style</title>
|
<a href="add_paper.php" class="btn btn-primary btn-lg">Add a New Paper</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
<?php
|
<?php
|
||||||
// Read project preview data from environment
|
$feedback = [];
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
if (isset($_GET['success'])) {
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
if ($_GET['success'] === 'deleted') {
|
||||||
|
$feedback = ['type' => 'success', 'message' => 'Paper deleted successfully.'];
|
||||||
|
}
|
||||||
|
if ($_GET['success'] === 'updated') {
|
||||||
|
$feedback = ['type' => 'success', 'message' => 'Paper updated successfully.'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($_GET['error'])) {
|
||||||
|
if ($_GET['error'] === 'notfound') {
|
||||||
|
$feedback = ['type' => 'danger', 'message' => 'Paper not found.'];
|
||||||
|
}
|
||||||
|
if ($_GET['error'] === 'deletfailed') {
|
||||||
|
$feedback = ['type' => 'danger', 'message' => 'Error deleting paper.'];
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($projectDescription): ?>
|
<?php if (!empty($feedback)): ?>
|
||||||
<!-- Meta description -->
|
<div class="alert alert-<?= $feedback['type'] ?> alert-dismissible fade show" role="alert">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
<?= htmlspecialchars($feedback['message']) ?>
|
||||||
<!-- Open Graph meta tags -->
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<div class="card">
|
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
|
||||||
<span class="sr-only">Loading…</span>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
<?php endif; ?>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<div class="mb-4">
|
||||||
|
<form action="index.php" method="get" class="d-flex">
|
||||||
|
<input type="text" name="search" class="form-control me-2" placeholder="Search by title, author, or publication..." value="<?= htmlspecialchars($search) ?>">
|
||||||
|
<button type="submit" class="btn btn-primary">Search</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
|
||||||
<footer>
|
<h2 class="mb-4">Recently Added</h2>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<div class="row">
|
||||||
</footer>
|
<?php if (empty($papers)): ?>
|
||||||
</body>
|
<div class="col">
|
||||||
</html>
|
<p>No papers added yet. <a href="add_paper.php">Add your first one!</a></p>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($papers as $paper): ?>
|
||||||
|
<div class="col-md-6 col-lg-4 mb-4">
|
||||||
|
<div class="card h-100">
|
||||||
|
<div class="card-body d-flex flex-column">
|
||||||
|
<h5 class="card-title"><?= htmlspecialchars($paper['title']) ?></h5>
|
||||||
|
<h6 class="card-subtitle mb-2 text-muted"><?= htmlspecialchars($paper['authors']) ?></h6>
|
||||||
|
<p class="card-text flex-grow-1">
|
||||||
|
<?php if ($paper['publication']): ?>
|
||||||
|
<strong>Publication:</strong> <?= htmlspecialchars($paper['publication']) ?><br>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($paper['year']): ?>
|
||||||
|
<strong>Year:</strong> <?= htmlspecialchars($paper['year']) ?><br>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($paper['notes']): ?>
|
||||||
|
<strong>Notes:</strong> <?= nl2br(htmlspecialchars(substr($paper['notes'], 0, 100))) . (strlen($paper['notes']) > 100 ? '...' : '') ?><br>
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
|
<div class="mt-auto">
|
||||||
|
<a href="edit_paper.php?id=<?= $paper['id'] ?>" class="btn btn-sm btn-outline-primary">Edit</a>
|
||||||
|
<a href="delete_paper.php?id=<?= $paper['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Are you sure you want to delete this paper?');">Delete</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pagination -->
|
||||||
|
<?php if ($total_pages > 1): ?>
|
||||||
|
<nav aria-label="Page navigation">
|
||||||
|
<ul class="pagination justify-content-center">
|
||||||
|
<?php if ($current_page > 1): ?>
|
||||||
|
<li class="page-item"><a class="page-link" href="?page=<?= $current_page - 1 ?>&search=<?= htmlspecialchars($search) ?>">Previous</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php for ($i = 1; $i <= $total_pages; $i++): ?>
|
||||||
|
<li class="page-item <?php if ($i === $current_page) echo 'active'; ?>"><a class="page-link" href="?page=<?= $i ?>&search=<?= htmlspecialchars($search) ?>"><?= $i ?></a></li>
|
||||||
|
<?php endfor; ?>
|
||||||
|
|
||||||
|
<?php if ($current_page < $total_pages): ?>
|
||||||
|
<li class="page-item"><a class="page-link" href="?page=<?= $current_page + 1 ?>&search=<?= htmlspecialchars($search) ?>">Next</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include 'partials/footer.php'; ?>
|
||||||
12
partials/footer.php
Normal file
12
partials/footer.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
<footer class="bg-white mt-5 p-4 text-center shadow-sm">
|
||||||
|
<div class="container">
|
||||||
|
<p class="mb-0">© <?php echo date('Y'); ?> PaperCRM. All rights reserved.</p>
|
||||||
|
<img src="https://picsum.photos/50" alt="Company logo placeholder" class="mt-2">
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
45
partials/header.php
Normal file
45
partials/header.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Paper CRM</title>
|
||||||
|
<meta name="description" content="A simple CRM for managing academic papers.">
|
||||||
|
<meta name="keywords" content="crm, papers, academic, research, flatlogic">
|
||||||
|
<meta property="og:title" content="Paper CRM">
|
||||||
|
<meta property="og:description" content="A simple CRM for managing academic papers.">
|
||||||
|
<meta property="og:image" content="<?php echo isset($_SERVER['PROJECT_IMAGE_URL']) ? $_SERVER['PROJECT_IMAGE_URL'] : '' ?>">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="<?php echo isset($_SERVER['PROJECT_IMAGE_URL']) ? $_SERVER['PROJECT_IMAGE_URL'] : '' ?>">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;500&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="/">PaperCRM</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="add_paper.php">Add Paper</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="privacy.php">Privacy</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="toast-container">
|
||||||
|
<!-- Toast notifications will be inserted here -->
|
||||||
|
</div>
|
||||||
9
privacy.php
Normal file
9
privacy.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
<?php include 'partials/header.php'; ?>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<h1>Privacy Policy</h1>
|
||||||
|
<p>This is a placeholder for your privacy policy.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include 'partials/footer.php'; ?>
|
||||||
16
sitemap.xml
Normal file
16
sitemap.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
<url>
|
||||||
|
<loc>/</loc>
|
||||||
|
<priority>1.0</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>/add_paper.php</loc>
|
||||||
|
<priority>0.8</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>/privacy.php</loc>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
</urlset>
|
||||||
Loading…
x
Reference in New Issue
Block a user