From dbe75c8e1bd11b2c12c9e8b5e74553e19efa77c8 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Fri, 17 Oct 2025 00:19:53 +0200 Subject: [PATCH] =?UTF-8?q?Dodaj=20obs=C5=82ug=C4=99=20zablokowanych=20kon?= =?UTF-8?q?t=20u=C5=BCytkownik=C3=B3w=20w=20widokach=20oraz=20aktualizuj?= =?UTF-8?q?=20zapytania=20SQL=20w=20klasach=20zwi=C4=85zanych=20z=20og?= =?UTF-8?q?=C5=82oszeniami=20i=20firmami.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/globelus-firms/firm-preview.php | 14 +++++++ .../front/controls/class.GlobelusAdverts.php | 8 ++++ .../front/factory/class.GlobelusAdverts.php | 40 ++++++++++++------- .../front/factory/class.GlobelusFirms.php | 10 ++++- autoload/front/factory/class.GlobelusUser.php | 4 +- .../globelus/firms/_partials/menu.php | 7 +++- 6 files changed, 64 insertions(+), 19 deletions(-) diff --git a/admin/templates/globelus-firms/firm-preview.php b/admin/templates/globelus-firms/firm-preview.php index 5bc179d..7d8a3d1 100644 --- a/admin/templates/globelus-firms/firm-preview.php +++ b/admin/templates/globelus-firms/firm-preview.php @@ -38,6 +38,20 @@ ob_start(); );?> +
+
+ 'Profil zablokowany', + 'class' => 'form-edit', + 'id' => 'blocked', + 'values' => [ 0 => 'nie', 1 => 'tak' ], + 'value' => $this -> firm['blocked'], + 'params' => [ 'table' => 'globelus_users', 'column_id' => 'id', 'row_id' => $this -> firm['id'], 'column' => 'blocked', 'operation' => 'update' ] + ) + );?> +
+

diff --git a/autoload/front/controls/class.GlobelusAdverts.php b/autoload/front/controls/class.GlobelusAdverts.php index d6538e0..8992198 100644 --- a/autoload/front/controls/class.GlobelusAdverts.php +++ b/autoload/front/controls/class.GlobelusAdverts.php @@ -97,6 +97,14 @@ class GlobelusAdverts $page['language']['canonical'] = $base . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; + if ( $advert_details['blocked'] ) + { + return \Tpl::view( 'globelus/adverts/advert-not-found', [ + 'g_user' => $g_user, + 'advert_id' => \S::get( 'advert_id' ) + ] ); + } + if ( !$advert_details['id'] ) { return \Tpl::view( 'globelus/adverts/advert-not-found', [ diff --git a/autoload/front/factory/class.GlobelusAdverts.php b/autoload/front/factory/class.GlobelusAdverts.php index a742244..344f292 100644 --- a/autoload/front/factory/class.GlobelusAdverts.php +++ b/autoload/front/factory/class.GlobelusAdverts.php @@ -413,8 +413,8 @@ class GlobelusAdverts $sql = 'SELECT COUNT(0) ' . 'FROM (' . 'SELECT ' - . 'ga.id, title, title_nopl, date_add, gc.name AS country, gc.name_nopl AS country_nopl, ga.city, ga.city_nopl, firm_name_profile, firm_name_profile_nopl, gac.name AS category, text, text_nopl, visits, ga.user_id, ga.highlight, category_id, ' - . 'ga.country_id, IF ( last_refresh IS NULL, date_add, last_refresh ) AS date_active, work_type, salary, without_language, without_experience, for_couples, from_now, outside_ue, without_driving_license, travel_refund, id_voivodeship ' + . 'ga.id, title, title_nopl, date_add, gc.name AS country, gc.name_nopl AS country_nopl, ga.city, ga.city_nopl, firm_name_profile, firm_name_profile_nopl, gac.name AS category, text, text_nopl, ga.visits, ga.user_id, ga.highlight, category_id, ' + . 'ga.country_id, IF ( ga.last_refresh IS NULL, date_add, ga.last_refresh ) AS date_active, ga.last_refresh, work_type, salary, without_language, without_experience, for_couples, from_now, outside_ue, without_driving_license, travel_refund, id_voivodeship ' . 'FROM ' . 'globelus_adverts AS ga ' . 'INNER JOIN globelus_countries AS gc ON gc.id = country_id '; @@ -424,17 +424,22 @@ class GlobelusAdverts $sql .= 'INNER JOIN globelus_firms_data AS gfd ON gfd.user_id = ga.user_id ' . 'INNER JOIN globelus_adverts_categories AS gac ON gac.id = ga.category_id ' + . 'INNER JOIN globelus_users AS gu ON gu.id = ga.user_id ' . 'WHERE ' - . 'visible = 1 ' + . 'ga.visible = 1 ' + . 'AND ' + . 'gu.status = 1 ' + . 'AND ' + . 'gu.blocked = 0 ' . 'AND ' . 'disabled_by_admin = 0 ' . 'AND ' - . ' ( active_to >= \'' . date( 'Y-m-d' ) . '\' OR active_to IS NULL ) ' + . ' ( ga.active_to >= \'' . date( 'Y-m-d' ) . '\' OR ga.active_to IS NULL ) ' . 'AND ' . '( ' - . '( last_refresh IS NULL AND date_add >= \'' . date( 'Y-m-d H:i:s', strtotime( '-6 months', time() ) ) . '\' ) ' + . '( ga.last_refresh IS NULL AND ga.date_add >= \'' . date( 'Y-m-d H:i:s', strtotime( '-6 months', time() ) ) . '\' ) ' . 'OR ' - . '( last_refresh IS NOT NULL AND last_refresh >= \'' . date( 'Y-m-d', strtotime( '-6 months', time() ) ) . '\' ) ' + . '( ga.last_refresh IS NOT NULL AND ga.last_refresh >= \'' . date( 'Y-m-d', strtotime( '-6 months', time() ) ) . '\' ) ' . ') ' . ') AS q1 ' . 'WHERE ' @@ -571,8 +576,8 @@ class GlobelusAdverts $sql = 'SELECT * ' . 'FROM (' . 'SELECT ' - . 'ga.id, title, title_nopl, date_add, gc.name AS country, gc.name_nopl AS country_nopl, ga.city, ga.city_nopl, firm_name_profile, firm_name_profile_nopl, gac.name AS category, text, text_nopl, visits, ga.user_id, ga.highlight, category_id, ' - . 'ga.country_id, IF ( last_refresh IS NULL, date_add, last_refresh ) AS date_active, last_refresh, work_type, salary, without_language, without_experience, for_couples, from_now, overtime, overtime_quantity, accommodation, accommodation_cost, ' + . 'ga.id, title, title_nopl, date_add, gc.name AS country, gc.name_nopl AS country_nopl, ga.city, ga.city_nopl, firm_name_profile, firm_name_profile_nopl, gac.name AS category, text, text_nopl, ga.visits, ga.user_id, ga.highlight, category_id, ' + . 'ga.country_id, IF ( ga.last_refresh IS NULL, date_add, ga.last_refresh ) AS date_active, ga.last_refresh, work_type, salary, without_language, without_experience, for_couples, from_now, overtime, overtime_quantity, accommodation, accommodation_cost, ' . 'travel_refund, outside_ue, without_driving_license, id_voivodeship ' . 'FROM ' . 'globelus_adverts AS ga ' @@ -583,13 +588,18 @@ class GlobelusAdverts $sql .= 'INNER JOIN globelus_voivodeships AS gv ON gv.id = id_voivodeship '; $sql .= 'INNER JOIN globelus_firms_data AS gfd ON gfd.user_id = ga.user_id ' - . 'INNER JOIN globelus_adverts_categories AS gac ON gac.id = ga.category_id ' + . 'INNER JOIN globelus_adverts_categories AS gac ON gac.id = ga.category_id ' + . 'INNER JOIN globelus_users AS gu ON gu.id = ga.user_id ' . 'WHERE ' - . 'visible = 1 ' + . 'ga.visible = 1 ' + . 'AND ' + . 'gu.status = 1 ' + . 'AND ' + . 'gu.blocked = 0 ' . 'AND ' . 'disabled_by_admin = 0 ' . 'AND ' - . ' ( active_to >= \'' . date( 'Y-m-d' ) . '\' OR active_to IS NULL ) ' + . ' ( ga.active_to >= \'' . date( 'Y-m-d' ) . '\' OR ga.active_to IS NULL ) ' . ') AS q1 ' . 'WHERE ' . '1=1 ' @@ -597,7 +607,8 @@ class GlobelusAdverts . 'ORDER BY ' . $order . 'LIMIT ' . ( $values['start'] * $values['limit'] ) . ',' . $values['limit']; - +// echo $sql; +// echo '%' . \S::seo( $values['keyword'], true ) . '%'; try { $results = $mdb -> query( $sql, [ @@ -622,14 +633,15 @@ class GlobelusAdverts { global $mdb; $sql = 'SELECT - ga.id, title, ga.user_id, category_id, ga.country_id, ga.city, ga.region, text, contact_person, email, ga.phone, gfd.clauses, + ga.id, title, ga.user_id, category_id, ga.country_id, ga.city, ga.region, text, contact_person, ga.email, ga.phone, gfd.clauses, gac.name AS category_name, gc.name AS country_name, gfd.firm_name_profile, date_add, salary, work_type, without_language, without_experience, for_couples, from_now, accommodation, accommodation_cost, overtime, overtime_quantity, travel_refund, - outside_ue, without_driving_license, ga.old, ga.visible, id_voivodeship, aplication_link, id_position + outside_ue, without_driving_license, ga.old, ga.visible, id_voivodeship, aplication_link, id_position, gu.blocked FROM globelus_adverts AS ga LEFT JOIN globelus_adverts_categories AS gac ON gac.id = ga.category_id LEFT JOIN globelus_countries AS gc ON gc.id = ga.country_id LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = ga.user_id + LEFT JOIN globelus_users AS gu ON gu.id = ga.user_id WHERE ga.id = :advert_id'; return $mdb -> query( $sql, [ diff --git a/autoload/front/factory/class.GlobelusFirms.php b/autoload/front/factory/class.GlobelusFirms.php index d5a728a..f8c065b 100644 --- a/autoload/front/factory/class.GlobelusFirms.php +++ b/autoload/front/factory/class.GlobelusFirms.php @@ -1082,7 +1082,10 @@ class GlobelusFirms 'travel_refund' => $values['travel_refund'], 'outside_ue' => $values['outside_ue'], 'without_driving_license' => $values['without_driving_license'], - 'aplication_link' => $aplication_link ? $aplication_link : null + 'aplication_link' => $aplication_link ? $aplication_link : null, + 'title_nopl' => '', + 'city_nopl' => '', + 'text_nopl' => '' ]); $advert_id = $mdb->id(); } @@ -1116,7 +1119,10 @@ class GlobelusFirms 'travel_refund' => $values['travel_refund'], 'outside_ue' => $values['outside_ue'], 'without_driving_license' => $values['without_driving_license'], - 'aplication_link' => $aplication_link ? $aplication_link : null + 'aplication_link' => $aplication_link ? $aplication_link : null, + 'title_nopl' => '', + 'city_nopl' => '', + 'text_nopl' => '' ], [ 'AND' => [ 'user_id' => $values['user_id'], diff --git a/autoload/front/factory/class.GlobelusUser.php b/autoload/front/factory/class.GlobelusUser.php index 88748b3..b1580e0 100644 --- a/autoload/front/factory/class.GlobelusUser.php +++ b/autoload/front/factory/class.GlobelusUser.php @@ -306,7 +306,7 @@ class GlobelusUser if ( $hash ) { - if ( $g_user = $mdb -> get( 'globelus_users', [ 'id', 'password', 'register_date', 'oauth_uid', 'oauth_provider', 'hash', 'status' ], [ 'hash' => $hash ] ) ) + if ( $g_user = $mdb -> get( 'globelus_users', [ 'id', 'password', 'register_date', 'oauth_uid', 'oauth_provider', 'hash', 'status', 'blocked' ], [ 'hash' => $hash ] ) ) { $g_user = \front\factory\GlobelusUser::user_details( $g_user['id'] ); \S::set_session( 'g_user', $g_user ); @@ -314,7 +314,7 @@ class GlobelusUser } } - if ( !$g_user = $mdb -> get( 'globelus_users', [ 'id', 'password', 'register_date', 'oauth_uid', 'oauth_provider', 'hash', 'status' ], [ 'email' => $email ] ) ) + if ( !$g_user = $mdb -> get( 'globelus_users', [ 'id', 'password', 'register_date', 'oauth_uid', 'oauth_provider', 'hash', 'status', 'blocked' ], [ 'email' => $email ] ) ) { \S::set_alert_prompt( 'Informacja', $lang['logowanie-blad-brak-konta'] ); return false; diff --git a/templates_user/globelus/firms/_partials/menu.php b/templates_user/globelus/firms/_partials/menu.php index 2b261d7..19985d9 100644 --- a/templates_user/globelus/firms/_partials/menu.php +++ b/templates_user/globelus/firms/_partials/menu.php @@ -1,4 +1,9 @@ - + + + +