protected function may_activate($data, $model) { if ((!isset($data['name']) || !$data['name']) && !$model->name) { return $this->error(21); } if (!Bootstrap::$main->user['d_host_agreement']) { return $this->error(64); } foreach ($this->user_fields_to_copy as $uk) { if ($uk == 'payment' && !$data['price'] && !$model->price) { continue; } if (!Bootstrap::$main->user[$uk]) { return $this->error(24, $uk); } } if (!$model->img) { return $this->error(38); } if (!$data['url'] && !$model->url) { return $this->error(23); } if (!$data['d_event_start'] && !$model->d_event_start) { return $this->error(39); } if (!$data['d_event_end'] && !$model->d_event_end) { return $this->error(40); } if (!$data['d_deadline'] && !$model->d_deadline) { return $this->error(41); } $model->price += 0; $data['price'] += 0; if (!$data['about'] && !$model->about) { return $this->error(42); } if ($data['price'] < 0 && $model->price < 0) { return $this->error(48); } if (!$data['lat'] && !$model->lat) { return $this->error(46); } if (!$data['lng'] && !$model->lng) { return $this->error(46); } if (!$data['d_event_start']) { return $data['d_event_start'] = $model->d_event_start; } if ($data['d_event_start'] < Bootstrap::$main->now) { return $this->error(44); } if (Bootstrap::$main->getConfig('event.limit_to_known_cities')) { $city = new cityModel(); if (!$city->getByLocation($data['lat'] ?: $model->lat, $data['lng'] ?: $model->lng)) { return $this->error(49); } } }
$description = Tools::translate('AboutH31', $lang); $photo = $img_url . 'images/organize-3.jpg'; $img = $img_url . 'images/organize-2.png'; $url .= 'about/'; break; case 'how-it-works': $title = Tools::translate('How-it-works-H2', $lang); $description = Tools::translate('How-it-works-H3', $lang); $url .= 'how-it-works/'; case 'events': $lat = isset($parts[1]) ? $parts[1] : 0; $lng = isset($parts[2]) ? $parts[2] : 0; $distance = isset($parts[3]) ? $parts[3] : 0; if ($lat & $lng) { $city = new cityModel(); $cities = $city->getByLocation($lat, $lng) ?: []; if (isset($cities[0]['img2']) && $cities[0]['img2']) { $image = new imageModel($cities[0]['img2']); $photo = $image->url; } elseif (isset($cities[0]['img']) && $cities[0]['img']) { $image = new imageModel($cities[0]['img']); $photo = $image->url; } $itemscope = 'City'; } if (isset($parts[4])) { $title = urldecode($parts[4]); } $eventController = new eventController(0, ['lat' => $lat, 'lng' => $lng, 'distance' => $distance]); $events = $eventController->get_search(); if (isset($events['events'])) {