mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #651 from openclassify/vedatakd
fixed exception && hide filter location for backend
This commit is contained in:
commit
865cd9a273
@ -8,6 +8,7 @@ return [
|
||||
'title' => 'visiosoft.module.advs::section.general',
|
||||
'fields' => [
|
||||
'market_place',
|
||||
'show_lang_url',
|
||||
'iban_numbers',
|
||||
'google_statistic_code',
|
||||
'ogImage',
|
||||
|
||||
@ -228,4 +228,11 @@ return [
|
||||
'default_value' => false,
|
||||
]
|
||||
],
|
||||
|
||||
'show_lang_url' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
'config' => [
|
||||
'default_value' => false,
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
@ -146,4 +146,7 @@ return [
|
||||
'hide_map_filter' => [
|
||||
'name' => 'Hide Map Filter',
|
||||
],
|
||||
'show_lang_url' => [
|
||||
'name' => 'Show Lang Parameter For URL',
|
||||
],
|
||||
];
|
||||
|
||||
@ -139,7 +139,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
$foreign_currency[$currencyIn] = $price * $rate;
|
||||
}
|
||||
}
|
||||
} catch (RequestException $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->messages->error((!is_null($e->getMessage())) ? $e->getMessage() : trans('streams::error.500.message'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
|
||||
$query = $query->leftJoin('advs_advs_translations', function ($join) {
|
||||
$join->on('advs_advs.id', '=', 'advs_advs_translations.entry_id');
|
||||
$join->where('advs_advs_translations.locale', '=', Request()->session()->get('_locale',setting_value('streams::default_locale')));
|
||||
$join->where('advs_advs_translations.locale', '=', Request()->session()->get('_locale', setting_value('streams::default_locale')));
|
||||
});
|
||||
|
||||
if (!empty($param['keyword'])) {
|
||||
@ -91,15 +91,25 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
});
|
||||
}
|
||||
}
|
||||
$country = isset($param['country']) ?
|
||||
$param['country'] : setting_value('visiosoft.module.location::default_country');
|
||||
if ($country) {
|
||||
$query = $query->where('country_id', $country);
|
||||
}
|
||||
if ($city) {
|
||||
$query = $query->where('city', $city->id);
|
||||
} elseif (isset($param['city']) and !empty($param['city']) and !empty(array_filter($param['city']))) {
|
||||
$query = $query->whereIn('city', $param['city']);
|
||||
if (!setting_value('visiosoft.module.location::hide_location_filter')) {
|
||||
$country = isset($param['country']) ? $param['country'] : setting_value('visiosoft.module.location::default_country');
|
||||
if ($country) {
|
||||
$query = $query->where('country_id', $country);
|
||||
}
|
||||
if ($city) {
|
||||
$query = $query->where('city', $city->id);
|
||||
} elseif (isset($param['city']) and !empty(array_filter($param['city']))) {
|
||||
$query = $query->whereIn('city', $param['city']);
|
||||
}
|
||||
if (isset($param['district']) and !empty(array_filter($param['district']))) {
|
||||
$query = $query->whereIn('district', $param['district']);
|
||||
}
|
||||
if (isset($param['neighborhood']) and !empty(array_filter($param['neighborhood']))) {
|
||||
$query = $query->whereIn('neighborhood', $param['neighborhood']);
|
||||
}
|
||||
if (isset($param['village']) and !empty(array_filter($param['village']))) {
|
||||
$query = $query->whereIn('village', $param['village']);
|
||||
}
|
||||
}
|
||||
if ($category) {
|
||||
$cat = new CategoryModel();
|
||||
@ -116,15 +126,6 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
if (!empty($param['user'])) {
|
||||
$query = $query->where('advs_advs.created_by_id', $param['user']);
|
||||
}
|
||||
if (isset($param['district']) and !empty(array_filter($param['district']))) {
|
||||
$query = $query->whereIn('district', $param['district']);
|
||||
}
|
||||
if (isset($param['neighborhood']) and !empty(array_filter($param['neighborhood']))) {
|
||||
$query = $query->whereIn('neighborhood', $param['neighborhood']);
|
||||
}
|
||||
if (isset($param['village']) and !empty(array_filter($param['village']))) {
|
||||
$query = $query->whereIn('village', $param['village']);
|
||||
}
|
||||
if (!empty($param['min_price'])) {
|
||||
$num = $param['min_price'];
|
||||
$int = (int)$num;
|
||||
|
||||
@ -31,26 +31,32 @@ class redirectDiffrentLang
|
||||
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$original_url = $request->server->get('ORIGINAL_REQUEST_URI');
|
||||
$setting_language = setting_value('streams::default_locale');
|
||||
$current_language = $request->session()->get('_locale', $setting_language);
|
||||
$request_url = ltrim($request->getRequestUri(), '/');
|
||||
if (setting_value('visiosoft.module.advs::show_lang_url')) {
|
||||
$original_url = $request->server->get('ORIGINAL_REQUEST_URI');
|
||||
$setting_language = setting_value('streams::default_locale');
|
||||
$current_language = $request->session()->get('_locale', $setting_language);
|
||||
$request_url = ltrim($request->getRequestUri(), '/');
|
||||
|
||||
// If the segment(1) is admin and language parameters is not null, no forwarding will be made.
|
||||
if ($request->segment(1) == "admin" and in_array($current_language, explode('/', $original_url))) {
|
||||
return $this->redirect->to($request->fullUrl());
|
||||
}
|
||||
$not_included = [
|
||||
'admin',
|
||||
'social'
|
||||
];
|
||||
|
||||
if ($current_language != $setting_language) {
|
||||
// If the segment(1) is admin and language parameters is not null, no forwarding will be made.
|
||||
if (in_array($request->segment(1), $not_included) and in_array($current_language, explode('/', $original_url))) {
|
||||
return $this->redirect->to($request->fullUrl());
|
||||
}
|
||||
|
||||
// If the method is get, no forwarding will be made.
|
||||
// If the segment(1) is admin, no forwarding will be made.
|
||||
if ($current_language != $setting_language) {
|
||||
|
||||
if ($request->method() == "GET" and $request->segment(1) != "admin" and $request_url != "" and $original_url != '/' . $current_language . '/' . $request_url) {
|
||||
return $this->redirect->to('/' . $current_language . '/' . $request_url);
|
||||
// If the method is get, no forwarding will be made.
|
||||
// If the segment(1) is admin, no forwarding will be made.
|
||||
|
||||
if ($request->method() == "GET" and !in_array($request->segment(1), $not_included) and $request_url != "" and $original_url != '/' . $current_language . '/' . $request_url) {
|
||||
return $this->redirect->to('/' . $current_language . '/' . $request_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user