From db71654166b558dc3f4b9f398d9d22cb277cec78 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 2 Jan 2025 11:55:22 +0000 Subject: [PATCH 1/5] Removed fetching of users (never used) --- application/controllers/Club.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/controllers/Club.php b/application/controllers/Club.php index 99a27960a..db82733b6 100644 --- a/application/controllers/Club.php +++ b/application/controllers/Club.php @@ -56,7 +56,6 @@ class Club extends CI_Controller $data['page_title'] = __("Club Permissions"); $data['club'] = $club; $data['club_members'] = $this->club_model->get_club_members($cid); - $data['users'] = $this->user_model->users(); $data['permissions'] = $this->permissions; $footerData = []; @@ -240,4 +239,4 @@ class Club extends CI_Controller return $this->email->send(); } -} \ No newline at end of file +} From fe1d11982f8c9b22cc14dd176da3cc0aadf69953 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 2 Jan 2025 12:53:46 +0000 Subject: [PATCH 2/5] Fixes missing API-Key/Radio Bug --- application/controllers/Bandmap.php | 2 +- application/models/Cat.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/Bandmap.php b/application/controllers/Bandmap.php index 8145030ca..db75c0009 100644 --- a/application/controllers/Bandmap.php +++ b/application/controllers/Bandmap.php @@ -13,7 +13,7 @@ class Bandmap extends CI_Controller { function index() { $this->load->model('cat'); $this->load->model('bands'); - $data['radios'] = $this->cat->radios(); + $data['radios'] = $this->cat->radios(true); $data['bands'] = $this->bands->get_user_bands_for_qso_entry(); $footerData = []; diff --git a/application/models/Cat.php b/application/models/Cat.php index c7bfc3ea7..edb4da45f 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -107,7 +107,7 @@ function radios($only_operator = false) { $this->db->select('id, radio'); $this->db->where('user_id', $this->session->userdata('user_id')); - if ($only_operator || ($this->session->userdata('clubstation') == 1 && !clubaccess_check(9))) { + if ($only_operator && ($this->session->userdata('clubstation') == 1 && !clubaccess_check(9))) { $this->db->where('operator', $this->session->userdata('source_uid')); } $query = $this->db->get('cat'); From c9f1bab0f248c27ac0a1e141f0dfed07ab8021b0 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 2 Jan 2025 16:55:11 +0000 Subject: [PATCH 3/5] If operator isn't defined at record a php came up --- application/controllers/Api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Api.php b/application/controllers/Api.php index 5b0692345..0657e3ca6 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -237,7 +237,7 @@ class API extends CI_Controller { } // in case the provided op call is the same as the clubstation callsign, we need to use the creator of the API key as the operator $recorded_operator = $record['operator'] ?? ''; - if ($real_operator != null && ($record['operator'] == $record['station_callsign']) || ($recorded_operator == '')) { + if (key_exists('operator',$record) && $real_operator != null && ($record['operator'] == $record['station_callsign']) || ($recorded_operator == '')) { $record['operator'] = $real_operator; } From c050e20819f38eea2e9a43328e245ed9b0d70897 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 2 Jan 2025 21:33:05 +0100 Subject: [PATCH 4/5] Replace zeros by slashed ones for callsigns --- application/views/user/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/user/index.php b/application/views/user/index.php index 6d8b919a2..cb56c254d 100644 --- a/application/views/user/index.php +++ b/application/views/user/index.php @@ -43,7 +43,7 @@ - user_callsign; ?> + user_callsign); ?> @@ -158,7 +158,7 @@ foreach ($clubs->result() as $row) { ?> '; ?> user_id; ?>">user_name; ?> - user_callsign; ?> + user_callsign); ?> user_email; ?> lastoperator; ?> Date: Thu, 2 Jan 2025 22:02:55 +0100 Subject: [PATCH 5/5] Make mig downgrade failsafe --- application/migrations/233_clubstations.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/application/migrations/233_clubstations.php b/application/migrations/233_clubstations.php index 5690d7c39..fe88ac35d 100644 --- a/application/migrations/233_clubstations.php +++ b/application/migrations/233_clubstations.php @@ -40,12 +40,18 @@ class Migration_clubstations extends CI_Migration { $this->db->query("ALTER TABLE `cat` MODIFY operator INT(6) NOT NULL;"); } - public function down() { - // Due the risk of data loss we can't drop any new created columns or tables - // But we can drop some of the timestamp columns - $this->db->query("ALTER TABLE `users` DROP COLUMN created_at;"); - $this->db->query("ALTER TABLE `users` DROP COLUMN modified_at;"); - $this->db->query("ALTER TABLE `api` DROP COLUMN created_at;"); + public function down() { + // Due the risk of data loss we can't drop any new created columns or tables + // But we can drop some of the timestamp columns + if ($this->db->field_exists('created_at', 'users')) { + $this->db->query("ALTER TABLE `users` DROP COLUMN created_at;"); + } + if ($this->db->field_exists('modified_at', 'users')) { + $this->db->query("ALTER TABLE `users` DROP COLUMN modified_at;"); + } + if ($this->db->field_exists('created_at', 'api')) { + $this->db->query("ALTER TABLE `api` DROP COLUMN created_at;"); + } } private function add_column_if_not_exists($table, $column, $definition) { @@ -61,4 +67,4 @@ class Migration_clubstations extends CI_Migration { log_message('info', "Mig 230 - Column '$column' already exists in table '$table', skipping ALTER TABLE."); } } -} \ No newline at end of file +}