diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index f751c45ca..ae6dd403b 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -292,7 +292,9 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface ->inRandomOrder() ->first(); - $adv = $this->getLocationNames($adv); + if ($adv) { + $adv = $this->getLocationNames($adv); + } return $adv; } diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php index 604474437..3d28a3ee4 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -343,89 +343,90 @@ class AdvsController extends PublicController { $id = is_null($id) ? $seo : $id; - $categories = array(); - $categories_id = array(); - $isActiveComplaints = $this->adv_model->is_enabled('complaints'); - $isCommentActive = $this->adv_model->is_enabled('comments'); - - if ($isActiveComplaints) { - $complaints = ComplaintsComplainTypesEntryModel::all(); - } - $adv = $this->adv_repository->getListItemAdv($id); - $recommended_advs = $this->adv_repository->getRecommendedAds($adv->id); + if ($adv) { - foreach ($recommended_advs as $index => $ad) { - $recommended_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list'); - $recommended_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad); - } + if ($this->adv_model->is_enabled('complaints')) { + $complaints = ComplaintsComplainTypesEntryModel::all(); + } + + $recommended_advs = $this->adv_repository->getRecommendedAds($adv->id); + + foreach ($recommended_advs as $index => $ad) { + $recommended_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list'); + $recommended_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad); + } + + $categories = array(); + $categories_id = array(); + for ($i = 1; $i <= 10; $i++) { + $cat = "cat" . $i; + if ($adv->$cat != null) { + $item = $this->category_repository->getItem($adv->$cat); + if (!is_null($item)) { + $categories['cat' . $i] = [ + 'name' => $item->name, + 'id' => $item->id + ]; + $categories_id[] = $item->id; + } - for ($i = 1; $i <= 10; $i++) { - $cat = "cat" . $i; - if ($adv->$cat != null) { - $item = $this->category_repository->getItem($adv->$cat); - if (!is_null($item)) { - $categories['cat' . $i] = [ - 'name' => $item->name, - 'id' => $item->id - ]; - $categories_id[] = $item->id; } - } - } - if ($this->adv_model->is_enabled('customfields')) { - $features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv); - } - - //Cloudinary Module - $adv->video_url = null; - $isActiveCloudinary = $this->adv_model->is_enabled('cloudinary'); - if ($isActiveCloudinary) { - - $CloudinaryModel = new VideoModel(); - $Cloudinary = $CloudinaryModel->getVideo($id); - - if (count($Cloudinary->get()) > 0) { - $adv->video_url = $Cloudinary->first()->toArray()['url']; + if ($this->adv_model->is_enabled('customfields')) { + $features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv); } - } - $options = $this->optionRepository->findAllBy('adv_id', $id); + //Cloudinary Module + $adv->video_url = null; + if ($this->adv_model->is_enabled('cloudinary')) { - if ($isCommentActive) { - $CommentModel = new CommentModel(); - $comments = $CommentModel->getComments($adv->id)->get(); - } - $this->event->dispatch(new viewAd($adv));//view ad + $CloudinaryModel = new VideoModel(); + $Cloudinary = $CloudinaryModel->getVideo($id); - $this->template->set('meta_keywords', implode(',', explode(' ', $adv->name))); - $this->template->set('meta_description', strip_tags($adv->advs_desc, '')); - $this->template->set('showTitle', false); - $this->template->set( - 'meta_title', - $adv->name . " " . end($categories)['name'] . ' ' . setting_value('streams::domain') - ); - if (substr($adv->cover_photo, 0, 4) === "http") { - $coverPhoto = $adv->cover_photo; - } else { - if (substr($adv->cover_photo, 0, 1) === "/") { - $coverPhoto = \Illuminate\Support\Facades\Request::root() . $adv->cover_photo; + if (count($Cloudinary->get()) > 0) { + $adv->video_url = $Cloudinary->first()->toArray()['url']; + } + } + + $options = $this->optionRepository->findAllBy('adv_id', $id); + + if ($this->adv_model->is_enabled('comments')) { + $CommentModel = new CommentModel(); + $comments = $CommentModel->getComments($adv->id)->get(); + } + $this->event->dispatch(new viewAd($adv));//view ad + + $this->template->set('meta_keywords', implode(',', explode(' ', $adv->name))); + $this->template->set('meta_description', strip_tags($adv->advs_desc, '')); + $this->template->set('showTitle', false); + $this->template->set( + 'meta_title', + $adv->name . " " . end($categories)['name'] . ' ' . setting_value('streams::domain') + ); + if (substr($adv->cover_photo, 0, 4) === "http") { + $coverPhoto = $adv->cover_photo; } else { - $coverPhoto = \Illuminate\Support\Facades\Request::root() . '/' . $adv->cover_photo; + if (substr($adv->cover_photo, 0, 1) === "/") { + $coverPhoto = \Illuminate\Support\Facades\Request::root() . $adv->cover_photo; + } else { + $coverPhoto = \Illuminate\Support\Facades\Request::root() . '/' . $adv->cover_photo; + } } - } - $this->template->set('meta_image', $coverPhoto); + $this->template->set('meta_image', $coverPhoto); - if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") { - return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints', - 'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options')); + if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") { + return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints', + 'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options')); + } else { + return back(); + } } else { - return back(); + $this->messages->error(trans('visiosoft.module.advs::message.ad_doesnt_exist')); + return redirect()->route('visiosoft.module.advs::list'); } - } public function preview($id) diff --git a/addons/default/visiosoft/cats-module/resources/config/settings.php b/addons/default/visiosoft/cats-module/resources/config/settings.php index 642d1000f..f01152746 100644 --- a/addons/default/visiosoft/cats-module/resources/config/settings.php +++ b/addons/default/visiosoft/cats-module/resources/config/settings.php @@ -7,4 +7,11 @@ return [ "default_value" => 5000, ] ], + "include_cities_sitemap" => [ + "type" => "anomaly.field_type.boolean", + "config" => [ + "default_value" => true, + "mode" => "checkbox", + ] + ] ]; diff --git a/addons/default/visiosoft/cats-module/resources/lang/en/setting.php b/addons/default/visiosoft/cats-module/resources/lang/en/setting.php index ab795c85d..6f7c461d5 100644 --- a/addons/default/visiosoft/cats-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/cats-module/resources/lang/en/setting.php @@ -4,4 +4,7 @@ return [ 'sitemap_dividing_number' => [ 'name' => 'Sitemap Dividing Number', ], + 'include_cities_sitemap' => [ + 'name' => 'Include Cities in Sitemap', + ], ]; diff --git a/addons/default/visiosoft/cats-module/src/Http/Controller/SitemapController.php b/addons/default/visiosoft/cats-module/src/Http/Controller/SitemapController.php index 8c1ab5f1e..77f25287b 100644 --- a/addons/default/visiosoft/cats-module/src/Http/Controller/SitemapController.php +++ b/addons/default/visiosoft/cats-module/src/Http/Controller/SitemapController.php @@ -23,9 +23,14 @@ class SitemapController extends PublicController public function index() { $categoriesCount = $this->categoryRepository->count(); - $citiesCount = $this->cityRepository->count(); - $pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount; + if (setting_value('visiosoft.module.cats::include_cities_sitemap')) { + $citiesCount = $this->cityRepository->count(); + $pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount; + } else { + $pagesCount = $categoriesCount; + } + $pagesCount = ceil($pagesCount / setting_value('visiosoft.module.cats::sitemap_dividing_number')); return response()->view('visiosoft.module.cats::sitemap.index', [ @@ -39,8 +44,8 @@ class SitemapController extends PublicController $page = request()->page ?: 1; $skip = $page - 1; - $citiesCount = $this->cityRepository->count(); - if ($citiesCount) { + if (setting_value('visiosoft.module.cats::include_cities_sitemap') + && $citiesCount = $this->cityRepository->count()) { $categoriesCount = $this->categoryRepository->count(); $takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber); diff --git a/addons/default/visiosoft/defaultadmin-theme/resources/config/settings.php b/addons/default/visiosoft/defaultadmin-theme/resources/config/settings.php index 6661e67ed..329e91fff 100644 --- a/addons/default/visiosoft/defaultadmin-theme/resources/config/settings.php +++ b/addons/default/visiosoft/defaultadmin-theme/resources/config/settings.php @@ -18,6 +18,12 @@ return [ "default_value" => 'OpenClassify', ] ], + "footer_copyright_org_name" => [ + "type" => "anomaly.field_type.text", + "config" => [ + "default_value" => 'OpenClassify, Inc', + ] + ], "sidebar_main_color" => [ "type" => "anomaly.field_type.colorpicker", "config" => [ diff --git a/addons/default/visiosoft/defaultadmin-theme/resources/lang/en/setting.php b/addons/default/visiosoft/defaultadmin-theme/resources/lang/en/setting.php index a1d0c31d3..1ce7e1483 100644 --- a/addons/default/visiosoft/defaultadmin-theme/resources/lang/en/setting.php +++ b/addons/default/visiosoft/defaultadmin-theme/resources/lang/en/setting.php @@ -17,6 +17,9 @@ return [ "title" => [ 'name' => 'Title', ], + "footer_copyright_org_name" => [ + 'name' => 'Footer Copyright Organization Name', + ], "sidebar_main_color" => [ 'name' => 'Sidebar Main Color', ], diff --git a/addons/default/visiosoft/defaultadmin-theme/resources/views/partials/footer.twig b/addons/default/visiosoft/defaultadmin-theme/resources/views/partials/footer.twig index 977eccafb..0fd248b6b 100644 --- a/addons/default/visiosoft/defaultadmin-theme/resources/views/partials/footer.twig +++ b/addons/default/visiosoft/defaultadmin-theme/resources/views/partials/footer.twig @@ -2,7 +2,7 @@