Beispiel #1
0
 protected function reviews($event_id)
 {
     $opt = $this->nav_array(Bootstrap::$main->getConfig('reviews.limit'));
     $rate = new rateModel();
     $reviews = $rate->event_reviews($event_id, true, $opt['limit'], $opt['offset']);
     $usCtrl = new userController();
     if (is_array($reviews)) {
         foreach ($reviews as &$review) {
             $user_id = $review['user'];
             $this->clear_review($review);
             $review['user'] = $usCtrl->public_data($this->user()->get($user_id), true);
         }
     }
     $opt['add'] = 0;
     if (isset(Bootstrap::$main->user['id']) && $opt['offset'] == 0) {
         $guest = new guestModel();
         $rate = new rateModel();
         $guests = $guest->getGuestsForAllEvents($event_id) ?: [];
         foreach ($guests as $g) {
             if ($g['d_event_start'] > Bootstrap::$main->now) {
                 continue;
             }
             if ($rate->user_has_rated_event($g['event'])) {
                 continue;
             }
             $opt['add'] = $g['event'];
             break;
         }
     }
     return array('status' => is_array($reviews), 'options' => $opt, 'reviews' => $reviews);
 }
Beispiel #2
0
$sitemap = [];
$sitemap[] = ['loc' => $url, 'priority' => 1, 'lastmod' => sitemap_date(strtotime(date('Y-m-d')))];
$city = new cityController();
$cities = $city->get($country);
$rate = new rateModel();
if (isset($cities['cities'])) {
    foreach ($cities['cities'] as $city) {
        $sitemap[] = ['loc' => $url . 'events/' . $city['lat'] . '/' . $city['lng'] . '/' . round($city['distance']) . '/' . urlencode($city['name']), 'priority' => 0.9, 'lastmod' => sitemap_date(strtotime(date('Y-m-d')))];
    }
}
$event = new eventModel();
$events = $event->allEventsForCountry($country);
$hosts = [];
foreach ($events as $e) {
    $date = $e['d_change'] ?: strtotime(date('Y-m-d'));
    $reviews = $rate->event_reviews($e['event_id'], true, 1) ?: [];
    if (isset($reviews[0]) && $reviews[0]['d_create'] > $date) {
        $date = $reviews[0]['d_create'];
    }
    $sitemap[] = ['loc' => $url . $e['host_url'] . '/' . $e['event_url'], 'priority' => 0.8, 'lastmod' => sitemap_date($date)];
    if (isset($hosts[$e['host_url']])) {
        $hosts[$e['host_url']] = max($hosts[$e['host_url']], $date);
    } else {
        $hosts[$e['host_url']] = $date;
    }
}
foreach ($hosts as $host => $date) {
    $sitemap[] = ['loc' => $url . $host, 'priority' => 0.7, 'lastmod' => sitemap_date($date)];
}
if (isset($_SERVER['HTTP_USER_AGENT']) && isset($_SERVER['REQUEST_URI'])) {
    Tools::log('bots', ['agent' => $_SERVER['HTTP_USER_AGENT'], 'uri' => $_SERVER['REQUEST_URI']]);