| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /bpkd/ |
Upload File : |
<?php
require_once 'includes/init.php';
require_once 'includes/header.php';
require_once 'includes/tokenkab.php';
?>
<style>
/* ============================================
BERITA PAGE STYLES
============================================ */
/* Search Widget */
.berita-search-widget {
background: white;
border-radius: 20px;
padding: 24px;
margin-bottom: 30px;
border: 1px solid #eef2f6;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.berita-search-title {
font-size: 1.1rem;
font-weight: 700;
color: #1e293b;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.berita-search-title i {
color: #3b82f6;
}
.berita-search-title .berita-title-line {
flex: 1;
height: 2px;
background: linear-gradient(90deg, #e2e8f0, transparent);
}
.berita-search-form {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.berita-search-input-group {
flex: 1;
position: relative;
}
.berita-search-input-group input,
.berita-search-input-group select {
width: 100%;
padding: 12px 16px;
border: 1px solid #e2e8f0;
border-radius: 12px;
font-size: 0.9rem;
transition: all 0.3s;
background: white;
}
.berita-search-input-group input:focus,
.berita-search-input-group select:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.berita-search-btn {
padding: 0 24px;
background: #3b82f6;
border: none;
border-radius: 12px;
color: white;
cursor: pointer;
transition: all 0.3s;
font-weight: 600;
}
.berita-search-btn:hover {
background: #1d4ed8;
}
.berita-search-reset {
padding: 0 20px;
background: #f1f5f9;
border: 1px solid #e2e8f0;
border-radius: 12px;
color: #64748b;
cursor: pointer;
transition: all 0.3s;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 6px;
}
.berita-search-reset:hover {
background: #e2e8f0;
color: #1e293b;
}
/* Search Info */
.berita-search-info {
background: #eff6ff;
border-radius: 12px;
padding: 12px 20px;
margin-bottom: 24px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 10px;
}
.berita-search-info-text {
color: #1d4ed8;
font-size: 0.9rem;
}
/* Categories Grid */
.berita-categories-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24px;
margin-bottom: 40px;
}
.berita-category-card {
background: white;
border-radius: 20px;
padding: 25px 20px;
text-align: center;
transition: all 0.3s ease;
border: 1px solid #eef2f6;
text-decoration: none;
display: block;
}
.berita-category-card:hover {
transform: translateY(-6px);
box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.12);
border-color: #3b82f6;
}
.berita-category-icon {
width: 55px;
height: 55px;
background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 16px;
transition: all 0.3s;
}
.berita-category-card:hover .berita-category-icon {
background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}
.berita-category-icon i {
font-size: 1.5rem;
color: #3b82f6;
transition: all 0.3s;
}
.berita-category-card:hover .berita-category-icon i {
color: white;
}
.berita-category-name {
font-size: 0.95rem;
font-weight: 700;
margin: 0 0 6px 0;
color: #1e293b;
}
.berita-category-count {
font-size: 0.7rem;
color: #64748b;
margin: 0;
}
.berita-category-card:hover .berita-category-name,
.berita-category-card:hover .berita-category-count {
color: #3b82f6;
}
/* News Card */
.berita-news-card {
background: white;
border-radius: 20px;
overflow: hidden;
transition: all 0.3s;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
border: 1px solid #eef2f6;
height: 100%;
}
.berita-news-card:hover {
transform: translateY(-4px);
box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.1);
}
.berita-news-image {
position: relative;
height: 200px;
overflow: hidden;
}
.berita-news-image img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.5s;
}
.berita-news-card:hover .berita-news-image img {
transform: scale(1.05);
}
.berita-news-category {
position: absolute;
top: 15px;
left: 15px;
background: #3b82f6;
color: white;
padding: 4px 12px;
border-radius: 20px;
font-size: 0.7rem;
font-weight: 600;
}
.berita-news-content {
padding: 20px;
}
.berita-news-meta {
font-size: 0.75rem;
color: #6c7a8e;
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 8px;
}
.berita-news-title {
font-size: 1rem;
font-weight: 700;
line-height: 1.4;
margin: 0 0 10px 0;
}
.berita-news-title a {
color: #1a2c3e;
transition: color 0.3s;
text-decoration: none;
}
.berita-news-title a:hover {
color: #3b82f6;
}
.berita-news-excerpt {
font-size: 0.8rem;
color: #64748b;
line-height: 1.5;
margin-bottom: 12px;
}
.berita-news-link {
color: #3b82f6;
font-weight: 600;
font-size: 0.8rem;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 6px;
transition: gap 0.3s;
}
.berita-news-link:hover {
gap: 10px;
color: #1d4ed8;
}
/* Pagination */
.berita-pagination {
display: flex;
justify-content: center;
gap: 5px;
margin-top: 40px;
}
.berita-pagination .page-link {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 40px;
height: 40px;
padding: 0 12px;
border-radius: 10px;
color: #4a5568;
border: 1px solid #e2e8f0;
text-decoration: none;
transition: all 0.3s;
}
.berita-pagination .page-link:hover,
.berita-pagination .active .page-link {
background: #3b82f6;
color: white;
border-color: #3b82f6;
}
.berita-pagination .disabled .page-link {
opacity: 0.5;
pointer-events: none;
}
/* Empty State */
.berita-empty-state {
text-align: center;
padding: 60px 20px;
background: #f8fafc;
border-radius: 20px;
}
.berita-empty-state i {
font-size: 4rem;
color: #cbd5e1;
margin-bottom: 20px;
}
.berita-empty-state h3 {
font-size: 1.1rem;
font-weight: 600;
color: #1a2c3e;
margin-bottom: 8px;
}
.berita-empty-state p {
color: #6c7a8e;
font-size: 0.85rem;
}
mark {
background: #fef08a;
padding: 0 2px;
border-radius: 4px;
}
/* ============================================
RESPONSIVE
============================================ */
@media (max-width: 1024px) {
.berita-categories-grid {
grid-template-columns: repeat(2, 1fr);
gap: 16px;
}
}
@media (max-width: 768px) {
.berita-search-form {
flex-direction: column;
}
.berita-search-btn,
.berita-search-reset {
padding: 10px 20px;
justify-content: center;
}
.berita-search-info {
flex-direction: column;
text-align: center;
}
.berita-news-image {
height: 180px;
}
.berita-categories-grid {
grid-template-columns: repeat(2, 1fr);
gap: 16px;
}
.berita-category-card {
padding: 20px 15px;
}
.berita-news-meta {
flex-direction: column;
gap: 4px;
}
}
@media (max-width: 576px) {
.berita-categories-grid {
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.berita-category-icon {
width: 45px;
height: 45px;
}
.berita-category-icon i {
font-size: 1.2rem;
}
.berita-category-name {
font-size: 0.8rem;
}
.berita-news-title {
font-size: 0.9rem;
}
.berita-news-excerpt {
font-size: 0.75rem;
}
}
</style>
<?php
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://portalberita.lumajangkab.go.id/api/berita.php?limit=3');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch,CURLOPT_HTTPHEADER,['Lumajang-Berita:$2y$10$wALz2CBxlzBFxaA4WyHeqOexj9gvFeN3vFrQLT/1vfNhON6Pdrdla']);
$output = curl_exec($ch);
curl_close($ch);
$result = json_decode($output,true);
?>
<div class="container">
<div class="art-section py-5">
<!-- Header Section dengan Link "Lihat Semua" di kanan -->
<div class="art-header-wrapper">
<div class="art-header-left">
<h2 class="art-section-title">lumajangkab</h2>
<div class="art-header-underline"></div>
</div>
</div>
<?php
if($result['total'] > 0){?>
<div class="row g-4">
<?php
foreach($result['item'] as $key=>$value){
?>
<?php
// Cek apakah berita sudah ada di database repost
$linkAsliEsc = $conn->real_escape_string($value['link']);
$checkRepost = $conn->query("SELECT url_hash FROM repost_berita WHERE link_asli = '$linkAsliEsc' LIMIT 1");
if ($checkRepost && $checkRepost->num_rows > 0) {
// Sudah ada repost → gunakan link repost
$repostData = $checkRepost->fetch_assoc();
$article_url = BASE_URL . '/repost/' . $repostData['url_hash'];
} else {
// Belum ada → gunakan link asli
$article_url = $value['link'];
}
$image_path = !empty($value['foto']) ? $value['foto'] : BASE_URL . '/assets/images/news-default.png';
?>
<div class="col-lg-4 col-md-6">
<div class="berita-news-card">
<div class="berita-news-image">
<img src="<?php echo $image_path; ?>" alt="<?php echo htmlspecialchars($value['judul']); ?>">
<div class="berita-news-category">berita lumajangkab</div>
</div>
<div class="berita-news-content">
<div class="berita-news-meta">
<span><i class="far fa-calendar me-1"></i> <?php echo tgl_indonesia($value['tanggal']); ?></span>
<span><i class="far fa-user me-1"></i> kominfo</span>
<span><i class="fas fa-eye text-primary me-1"></i> <?php echo number_format($value['lihat'] ?? 0); ?></span>
</div>
<h3 class="berita-news-title">
<a href="<?php echo $article_url; ?>">
<?php
$title = htmlspecialchars($value['judul']);
if (!empty($search_keyword)) {
$title = preg_replace("/($search_display)/i", "<mark>$1</mark>", $title);
}
echo $title;
?>
</a>
</h3>
<p class="berita-news-excerpt">
<?php
$excerpt = substr($value['cuplik'] ?? strip_tags($article['isi']), 0, 100) . '...';
if (!empty($search_keyword)) {
$excerpt = preg_replace("/($search_display)/i", "<mark>$1</mark>", $excerpt);
}
echo $excerpt;
?>
</p>
<a href="<?php echo $article_url; ?>" class="berita-news-link">
Baca Selengkapnya <i class="fas fa-arrow-right ms-2"></i>
</a>
</div>
</div>
</div>
<?php
} ?>
</div>
<?php
}else{
echo '<h5>Berita tidak ditemukan</h5>';
}
?>
</div>
</div>