?
| Current Path : /home/w/e/b/webyoo/www/leumi/site/ |
| Current File : /home/w/e/b/webyoo/www/leumi/site/agent.php |
<?php
include "start.php";
include "slug_helper.php";
// ---- Page publique du 诪转讜讜讱 (agent immobilier) ----
// Acc猫s via un slug non devinable : agent.php?a=<agent_slug>
// La page n'est disponible QUE si l'agent existe (fk_type=3) ET a un abonnement actif.
$slug = isset($_GET['a']) ? trim($_GET['a']) : '';
$agent = null;
if ($slug !== '') {
$slugEsc = mysqli_real_escape_string($link, $slug);
$aq = mysqli_query($link, "SELECT * FROM rent_users WHERE agent_slug = '".$slugEsc."' AND fk_type = 3");
$agent = $aq ? mysqli_fetch_assoc($aq) : null;
}
$active = ($agent && isset($agent['sub_status']) && $agent['sub_status'] === 'active');
$brand = ($agent && !empty($agent['agent_color'])) ? $agent['agent_color'] : '#0ec6d5';
// Nettoyage des URLs (site / facebook) : ajoute https:// si absent
function ext_url($u) {
$u = trim($u);
if ($u === '') return '';
if (!preg_match('~^https?://~i', $u)) $u = 'https://' . $u;
return $u;
}
?>
<!doctype html>
<html lang="he">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="<?= $agent ? htmlspecialchars($agent['name'], ENT_QUOTES) : '诪转讜讜讱' ?> - 讗砖讻专讛">
<title><?= $agent ? htmlspecialchars($agent['name'], ENT_QUOTES).' - 讗砖讻专讛' : '诪转讜讜讱 - 讗砖讻专讛' ?></title>
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="vendors/fontawesome-pro-5/css/all.css">
<link rel="stylesheet" href="vendors/bootstrap-select/css/bootstrap-select.min.css">
<link rel="stylesheet" href="vendors/slick/slick.min.css">
<link rel="stylesheet" href="vendors/magnific-popup/magnific-popup.min.css">
<link rel="stylesheet" href="css/themes.css">
<link rel="icon" href="images/favicon.ico">
<?php
// Aper莽u de partage (WhatsApp / Facebook) 鈥 logo + nom de l'agence
$__s = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$__h = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'www.ashkara.co';
$agImg = 'images/ashkara5.png';
if ($agent && !empty($agent['agent_logo'])) { $agImg = 'uploads/'.rawurlencode($agent['agent_logo']); }
elseif ($agent && !empty($agent['agent_cover'])) { $agImg = 'uploads/'.rawurlencode($agent['agent_cover']); }
$ogAgImg = $__s.'://'.$__h.'/'.$agImg;
$ogAgUrl = $__s.'://'.$__h.'/agent.php?a='.rawurlencode($slug);
$ogAgTitle = $agent ? ($agent['name'].' 鈥 诪转讜讜讱 | 讗砖讻专讛') : '诪转讜讜讱 | 讗砖讻专讛';
$ogAgDesc = '';
if ($agent) {
$ogAgDesc = !empty($agent['agent_about']) ? $agent['agent_about'] : ('讻诇 讛谞讻住讬诐 诇讛砖讻专讛 砖诇 '.$agent['name']);
$ogAgDesc = trim(preg_replace('/\s+/', ' ', strip_tags($ogAgDesc)));
$ogAgDesc = function_exists('mb_substr') ? mb_substr($ogAgDesc, 0, 160) : substr($ogAgDesc, 0, 160);
}
?>
<meta property="og:site_name" content="讗砖讻专讛">
<meta property="og:type" content="profile">
<meta property="og:url" content="<?= htmlspecialchars($ogAgUrl, ENT_QUOTES) ?>">
<meta property="og:title" content="<?= htmlspecialchars($ogAgTitle, ENT_QUOTES) ?>">
<meta property="og:description" content="<?= htmlspecialchars($ogAgDesc, ENT_QUOTES) ?>">
<meta property="og:image" content="<?= htmlspecialchars($ogAgImg, ENT_QUOTES) ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="<?= htmlspecialchars($ogAgTitle, ENT_QUOTES) ?>">
<meta name="twitter:description" content="<?= htmlspecialchars($ogAgDesc, ENT_QUOTES) ?>">
<meta name="twitter:image" content="<?= htmlspecialchars($ogAgImg, ENT_QUOTES) ?>">
<style>
:root { --brand: <?= htmlspecialchars($brand, ENT_QUOTES) ?>; }
.agent-hero {
background: linear-gradient(135deg, var(--brand) 0%, rgba(0,0,0,0.18) 160%);
color: #fff;
}
.agent-hero .agent-logo {
width: 110px; height: 110px; object-fit: cover; border-radius: 16px;
background: #fff; border: 3px solid rgba(255,255,255,.7); padding: 6px;
}
.agent-hero .verified { background: rgba(255,255,255,.22); color:#fff; }
.agent-contact .btn {
background:#fff; color: var(--brand); font-weight:600; border:none;
}
.agent-contact .btn:hover { opacity:.92; color: var(--brand); }
.agent-meta i { width: 20px; }
.agent-prop-card { transition: box-shadow .2s ease; height:100%; }
.agent-prop-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.10); }
.agent-prop-img { height: 210px; width:100%; object-fit: cover; }
.agent-section-title::after {
content:""; display:block; width:60px; height:3px; background:var(--brand);
margin-top:8px; border-radius:3px;
}
</style>
</head>
<body>
<?php include "header.php"; ?>
<?php if (!$agent || !$active): ?>
<!-- Page indisponible : slug inconnu ou abonnement non actif -->
<div class="container py-11 text-center" dir="rtl" style="min-height:50vh">
<div class="py-8">
<i class="fal fa-store-slash" style="font-size:64px;color:#c7ccd1"></i>
<h2 class="mt-4 text-heading">注诪讜讚 讛诪转讜讜讱 讗讬谞讜 讝诪讬谉</h2>
<p class="text-muted">讬讬转讻谉 砖讛拽讬砖讜专 砖讙讜讬 讗讜 砖讛诪谞讜讬 讗讬谞讜 驻注讬诇 讻专讙注.</p>
<a href="listing-all-properties.php" class="btn btn-primary btn-lg mt-2"><i class="fas fa-search ml-2"></i>诇讻诇 讛谞讻住讬诐 诇讛砖讻专讛</a>
</div>
</div>
<?php else: ?>
<?php
$website = ext_url(isset($agent['agent_website']) ? $agent['agent_website'] : '');
$facebook = ext_url(isset($agent['agent_facebook']) ? $agent['agent_facebook'] : '');
$phone = isset($agent['tel']) ? trim($agent['tel']) : '';
$email = isset($agent['email']) ? trim($agent['email']) : '';
$cover = (!empty($agent['agent_cover'])) ? 'uploads/'.$agent['agent_cover'] : '';
?>
<!-- HERO : image de fond si d茅finie, sinon d茅grad茅 de la couleur de marque -->
<section class="agent-hero py-7 py-lg-9" dir="rtl"<?php if ($cover !== ''): ?> style="background:linear-gradient(rgba(0,0,0,.8),rgba(0,0,0,.8)), url('<?= htmlspecialchars($cover, ENT_QUOTES) ?>') center/cover no-repeat;"<?php endif; ?>>
<div class="container">
<div class="d-flex flex-wrap align-items-center" style="gap:20px;">
<?php if (!empty($agent['agent_logo'])): ?>
<img src="uploads/<?= htmlspecialchars($agent['agent_logo'], ENT_QUOTES) ?>" alt="<?= htmlspecialchars($agent['name'], ENT_QUOTES) ?>" class="agent-logo">
<?php else: ?>
<div class="agent-logo d-flex align-items-center justify-content-center" style="color:var(--brand)"><i class="fas fa-user-tie" style="font-size:44px"></i></div>
<?php endif; ?>
<div class="flex-grow-1" style="min-width:220px">
<span class="badge verified mb-2"><i class="fas fa-check-circle ml-1"></i> 诪转讜讜讱 诪讜专砖讛 路 讗砖讻专讛</span>
<h1 class="text-white mb-2" style="font-size:30px;font-weight:700;"><?= htmlspecialchars($agent['name'], ENT_QUOTES) ?></h1>
<div class="agent-meta" style="opacity:.95">
<?php if (!empty($agent['agent_area'])): ?><span class="mr-4 d-inline-block mb-1"><i class="fal fa-map-marked-alt ml-1"></i><?= htmlspecialchars($agent['agent_area'], ENT_QUOTES) ?></span><?php endif; ?>
<?php if (!empty($agent['agent_hours'])): ?><span class="mr-4 d-inline-block mb-1"><i class="fal fa-clock ml-1"></i><?= htmlspecialchars($agent['agent_hours'], ENT_QUOTES) ?></span><?php endif; ?>
<?php if (!empty($agent['agent_address'])): ?><span class="mr-4 d-inline-block mb-1"><i class="fal fa-building ml-1"></i><?= htmlspecialchars($agent['agent_address'], ENT_QUOTES) ?></span><?php endif; ?>
<?php if (!empty($agent['agent_license'])): ?><span class="mr-4 d-inline-block mb-1"><i class="fal fa-id-badge ml-1"></i>专讬砖讬讜谉 转讬讜讜讱: <?= htmlspecialchars($agent['agent_license'], ENT_QUOTES) ?></span><?php endif; ?>
</div>
<div class="agent-contact d-flex flex-wrap mt-3" style="gap:10px;">
<?php if ($phone !== ''): ?><a href="tel:<?= htmlspecialchars($phone, ENT_QUOTES) ?>" class="btn btn-sm"><i class="fas fa-phone-alt ml-1"></i> 讛转拽砖专</a><?php endif; ?>
<?php if ($email !== ''): ?><a href="mailto:<?= htmlspecialchars($email, ENT_QUOTES) ?>" class="btn btn-sm"><i class="fas fa-envelope ml-1"></i> 诪讬讬诇</a><?php endif; ?>
<?php if ($facebook !== ''): ?><a href="<?= htmlspecialchars($facebook, ENT_QUOTES) ?>" target="_blank" rel="noopener" class="btn btn-sm"><i class="fab fa-facebook-f ml-1"></i> 驻讬讬住讘讜拽</a><?php endif; ?>
<?php if ($website !== ''): ?><a href="<?= htmlspecialchars($website, ENT_QUOTES) ?>" target="_blank" rel="noopener" class="btn btn-sm"><i class="fas fa-globe ml-1"></i> 讗转专</a><?php endif; ?>
</div>
</div>
</div>
</div>
</section>
<div class="container py-6 py-lg-8" dir="rtl" style="text-align:right">
<?php if (!empty($agent['agent_about'])): ?>
<div class="mb-8">
<h3 class="text-heading fs-22 mb-3 agent-section-title">注诇 讛诪砖专讚</h3>
<p class="mb-0" style="line-height:1.9;white-space:pre-line;"><?= htmlspecialchars($agent['agent_about'], ENT_QUOTES) ?></p>
</div>
<?php endif; ?>
<h3 class="text-heading fs-22 mb-4 agent-section-title">讛谞讻住讬诐 砖诇谞讜</h3>
<div class="row">
<?php
$pid = (int)$agent['id'];
$pq = mysqli_query($link, "SELECT * FROM rent_properties WHERE id_user = ".$pid." AND status = 3 ORDER BY date_creation DESC");
$pcount = $pq ? mysqli_num_rows($pq) : 0;
if ($pcount > 0):
while ($row = mysqli_fetch_assoc($pq)):
$img = 'uploads/ash_logo.png';
if (!empty($row['list_images'])) {
$parts = explode(',', $row['list_images']);
$first = trim($parts[0]);
if ($first !== '') { $img = 'uploads/'.$first; }
}
?>
<div class="col-lg-4 col-md-6 mb-6">
<a href="/property/<?= property_slug($row['title'], $row['id_property']) ?>" class="card agent-prop-card shadow-hover-xs-2 text-heading">
<img src="<?= htmlspecialchars($img, ENT_QUOTES) ?>" alt="<?= htmlspecialchars($row['name_property'], ENT_QUOTES) ?>" class="agent-prop-img card-img-top rounded-top">
<div class="card-body" style="text-align:right">
<h2 class="fs-16 lh-2 mb-1"><?= htmlspecialchars($row['title']) ?></h2>
<p class="font-weight-500 text-gray-light mb-2 fs-13"><i class="fal fa-map-marker-alt ml-1"></i><?= htmlspecialchars($row['region']) ?>, <?= htmlspecialchars($row['city']) ?></p>
<ul class="list-inline d-flex justify-content-between mb-0 flex-wrap fs-13 text-gray">
<li class="list-inline-item"><i class="fas fa-bed text-primary ml-1"></i> <b><?= htmlspecialchars($row['nb_rooms']) ?></b> 讞讚专讬诐</li>
<li class="list-inline-item"><i class="fas fa-bath text-primary ml-1"></i> <b><?= htmlspecialchars($row['nb_bathrooms']) ?></b> 砖讬专讜转讬诐</li>
<li class="list-inline-item"><i class="fas fa-vector-square text-primary ml-1"></i> <b><?= htmlspecialchars($row['surface']) ?></b> 诪"专</li>
</ul>
<?php if (!empty($row['price_monthly'])): ?>
<div class="mt-2 fs-18 font-weight-bold" style="color:var(--brand)"><?= number_format((float)$row['price_monthly']) ?> ₪ <span class="fs-13 text-muted font-weight-normal">/ 诇讞讜讚砖</span></div>
<?php endif; ?>
</div>
</a>
</div>
<?php endwhile; else: ?>
<div class="col-12">
<div class="alert alert-light border text-center py-6">
<i class="fal fa-home" style="font-size:36px;color:#c7ccd1"></i>
<p class="mb-0 mt-2 text-muted">讗讬谉 谞讻住讬诐 讝诪讬谞讬诐 讻专讙注.</p>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php include "footer.php"; ?>
</body>
</html>