180 lines
7.3 KiB
PHP
180 lines
7.3 KiB
PHP
|
|
<?php
|
||
|
|
require_once 'config.php';
|
||
|
|
|
||
|
|
$bingImage = getBingDailyImage();
|
||
|
|
|
||
|
|
try {
|
||
|
|
$stmt = $pdo->prepare("
|
||
|
|
SELECT i.*, u.username,
|
||
|
|
(SELECT COUNT(*) FROM image_feedbacks WHERE image_id = i.id AND type = 'like') as like_count
|
||
|
|
FROM images i
|
||
|
|
LEFT JOIN users u ON i.user_id = u.id
|
||
|
|
WHERE i.is_public = 1
|
||
|
|
ORDER BY i.uploaded_at DESC
|
||
|
|
LIMIT 12
|
||
|
|
");
|
||
|
|
$stmt->execute();
|
||
|
|
$publicImages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||
|
|
} catch(PDOException $e) {
|
||
|
|
$publicImages = [];
|
||
|
|
}
|
||
|
|
?>
|
||
|
|
|
||
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="<?php echo $lang; ?>" data-theme="<?php echo $currentUserSettings['dark_mode'] ? 'dark' : 'light'; ?>">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title><?php echo t('site_title'); ?></title>
|
||
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||
|
|
<link rel="stylesheet" href="css/style.css">
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<?php include 'components/navbar.php'; ?>
|
||
|
|
|
||
|
|
<div class="container">
|
||
|
|
|
||
|
|
<?php if($bingImage): ?>
|
||
|
|
<section class="bing-daily">
|
||
|
|
<div class="card">
|
||
|
|
<div class="bing-image">
|
||
|
|
<img src="<?php echo $bingImage['url']; ?>"
|
||
|
|
alt="<?php echo htmlspecialchars($bingImage['title']); ?>"
|
||
|
|
loading="lazy">
|
||
|
|
</div>
|
||
|
|
<div class="bing-info">
|
||
|
|
<h3><i class="fas fa-camera"></i> <?php echo t('bing_daily'); ?></h3>
|
||
|
|
<p><?php echo htmlspecialchars($bingImage['title']); ?></p>
|
||
|
|
<small><?php echo htmlspecialchars($bingImage['copyright']); ?></small>
|
||
|
|
<div class="bing-actions mt-2">
|
||
|
|
<button onclick="downloadBingImage('<?php echo $bingImage['url']; ?>', '<?php echo htmlspecialchars($bingImage['title']); ?>')"
|
||
|
|
class="btn btn-sm">
|
||
|
|
<i class="fas fa-download"></i> <?php echo t('download'); ?>
|
||
|
|
</button>
|
||
|
|
<?php if($bingImage['copyrightlink']): ?>
|
||
|
|
<a href="<?php echo $bingImage['copyrightlink']; ?>" target="_blank" class="btn btn-sm btn-secondary">
|
||
|
|
<i class="fas fa-info-circle"></i> <?php echo t('view_details'); ?>
|
||
|
|
</a>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
|
||
|
|
<header class="hero">
|
||
|
|
<h1><?php echo t('hero_title'); ?></h1>
|
||
|
|
<p><?php echo t('hero_subtitle'); ?></p>
|
||
|
|
<?php if(!$isLoggedIn): ?>
|
||
|
|
<div class="hero-buttons">
|
||
|
|
<a href="register.php" class="btn btn-primary">
|
||
|
|
<i class="fas fa-user-plus"></i> <?php echo t('register_now'); ?>
|
||
|
|
</a>
|
||
|
|
<a href="login.php" class="btn btn-secondary">
|
||
|
|
<i class="fas fa-sign-in-alt"></i> <?php echo t('user_login'); ?>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<a href="upload.php" class="btn btn-primary">
|
||
|
|
<i class="fas fa-cloud-upload-alt"></i> <?php echo t('upload'); ?>
|
||
|
|
</a>
|
||
|
|
<?php endif; ?>
|
||
|
|
</header>
|
||
|
|
|
||
|
|
|
||
|
|
<section class="features">
|
||
|
|
<h2 class="text-center"><?php echo t('features'); ?></h2>
|
||
|
|
<div class="feature-grid">
|
||
|
|
<div class="feature-card card">
|
||
|
|
<div class="feature-icon">
|
||
|
|
<i class="fas fa-bolt"></i>
|
||
|
|
</div>
|
||
|
|
<h3><?php echo t('fast_upload'); ?></h3>
|
||
|
|
<p><?php echo t('fast_upload_desc'); ?></p>
|
||
|
|
</div>
|
||
|
|
<div class="feature-card card">
|
||
|
|
<div class="feature-icon">
|
||
|
|
<i class="fas fa-shield-alt"></i>
|
||
|
|
</div>
|
||
|
|
<h3><?php echo t('secure'); ?></h3>
|
||
|
|
<p><?php echo t('secure_desc'); ?></p>
|
||
|
|
</div>
|
||
|
|
<div class="feature-card card">
|
||
|
|
<div class="feature-icon">
|
||
|
|
<i class="fas fa-database"></i>
|
||
|
|
</div>
|
||
|
|
<h3><?php echo t('permanent'); ?></h3>
|
||
|
|
<p><?php echo t('permanent_desc'); ?></p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
|
||
|
|
|
||
|
|
<?php if(!empty($publicImages)): ?>
|
||
|
|
<section class="gallery-section">
|
||
|
|
<h2 class="text-center"><?php echo t('gallery_showcase'); ?></h2>
|
||
|
|
<div class="gallery">
|
||
|
|
<?php foreach($publicImages as $image): ?>
|
||
|
|
<div class="gallery-item card">
|
||
|
|
<a href="view-image.php?id=<?php echo $image['id']; ?>">
|
||
|
|
<img src="uploads/<?php echo $image['filename']; ?>"
|
||
|
|
alt="<?php echo htmlspecialchars($image['title']); ?>"
|
||
|
|
loading="lazy">
|
||
|
|
</a>
|
||
|
|
<div class="image-info">
|
||
|
|
<div class="image-title">
|
||
|
|
<?php echo htmlspecialchars($image['title'] ?: t('untitled')); ?>
|
||
|
|
</div>
|
||
|
|
<div class="image-meta">
|
||
|
|
<span><i class="fas fa-user"></i> <?php echo htmlspecialchars($image['username']); ?></span>
|
||
|
|
<span><i class="fas fa-eye"></i> <?php echo $image['views']; ?></span>
|
||
|
|
<span><i class="fas fa-heart"></i> <?php echo $image['like_count']; ?></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
<footer class="footer">
|
||
|
|
<div class="footer-content">
|
||
|
|
<p>© <?php echo date('Y'); ?> <?php echo SITE_NAME; ?>. <?php echo t('all_rights_reserved'); ?></p>
|
||
|
|
<p>
|
||
|
|
<a href="feedback.php"><i class="fas fa-comment-dots"></i> <?php echo t('feedback'); ?></a> |
|
||
|
|
<a href="about.php"><i class="fas fa-info-circle"></i> <?php echo t('about'); ?></a>
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</footer>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function downloadBingImage(url, title) {
|
||
|
|
const link = document.createElement('a');
|
||
|
|
link.href = url;
|
||
|
|
link.download = `Bing_${title.replace(/[^a-z0-9]/gi, '_')}.jpg`;
|
||
|
|
document.body.appendChild(link);
|
||
|
|
link.click();
|
||
|
|
document.body.removeChild(link);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
document.addEventListener('DOMContentLoaded', function() {
|
||
|
|
const images = document.querySelectorAll('img[loading="lazy"]');
|
||
|
|
const imageObserver = new IntersectionObserver((entries, observer) => {
|
||
|
|
entries.forEach(entry => {
|
||
|
|
if (entry.isIntersecting) {
|
||
|
|
const img = entry.target;
|
||
|
|
img.src = img.src;
|
||
|
|
imageObserver.unobserve(img);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
images.forEach(img => imageObserver.observe(img));
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|