From 4b0517b9b495f4035a4f2c0cfe04cd54ebcd4368 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 16 Aug 2024 10:05:59 +0200 Subject: [PATCH 01/11] show layout/messages on the dashboard --- application/controllers/Dashboard.php | 3 +++ application/controllers/User.php | 1 - application/views/dashboard/index.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php index a7231554d..8741cbf01 100644 --- a/application/controllers/Dashboard.php +++ b/application/controllers/Dashboard.php @@ -43,6 +43,9 @@ class Dashboard extends CI_Controller $data['qra'] = "none"; } + // We need the form_helper for the layout/messages + $this->load->helper('form'); + $this->load->model('stations'); $this->load->model('setup_model'); diff --git a/application/controllers/User.php b/application/controllers/User.php index a617c6389..3d355b8b4 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -865,7 +865,6 @@ class User extends CI_Controller { } else { if($this->user_model->login() == 1) { - $this->session->set_flashdata('notice', __("User logged in")); $this->user_model->update_session($data['user']->user_id); $cookie= array( diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index c426f7352..793456227 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -125,8 +125,9 @@ function echo_table_col($row, $name) { - + +load->view('layout/messages'); ?> From 5dee1b996863065932f744daf1e0e03cea18e14f Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 16 Aug 2024 10:08:44 +0200 Subject: [PATCH 02/11] You're not allowed to do that! --- application/controllers/Accumulated.php | 2 +- application/controllers/Activators.php | 2 +- application/controllers/Activatorsmap.php | 2 +- application/controllers/Adif.php | 2 +- application/controllers/Awards.php | 2 +- application/controllers/Backup.php | 6 +-- application/controllers/Band.php | 2 +- application/controllers/Bandmap.php | 2 +- application/controllers/Cabrillo.php | 8 +-- application/controllers/Calltester.php | 2 +- application/controllers/Cfdexport.php | 4 +- application/controllers/Components.php | 2 +- application/controllers/Contestcalendar.php | 2 +- application/controllers/Contesting.php | 2 +- application/controllers/Cron.php | 4 +- application/controllers/Csv.php | 4 +- application/controllers/Dayswithqso.php | 2 +- application/controllers/Debug.php | 2 +- application/controllers/Distances.php | 2 +- application/controllers/Dxatlas.php | 8 +-- application/controllers/Dxcalendar.php | 2 +- application/controllers/Dxcluster.php | 2 +- application/controllers/Eqsl.php | 20 ++++---- application/controllers/Hamsat.php | 2 +- application/controllers/Kmlexport.php | 4 +- application/controllers/Labels.php | 2 +- application/controllers/Logbookadvanced.php | 2 +- application/controllers/Lookup.php | 2 +- application/controllers/Lotw.php | 16 +++--- application/controllers/Mode.php | 2 +- application/controllers/Notes.php | 2 +- application/controllers/Options.php | 2 +- application/controllers/Oqrs.php | 4 +- application/controllers/Qrbcalc.php | 2 +- application/controllers/Qrz.php | 2 +- application/controllers/Qsl.php | 8 +-- application/controllers/Qslprint.php | 2 +- application/controllers/Qso.php | 14 +++--- application/controllers/Radio.php | 6 +-- application/controllers/Satellite.php | 2 +- application/controllers/Sattimers.php | 2 +- application/controllers/Search.php | 2 +- application/controllers/Simplefle.php | 2 +- application/controllers/Station.php | 2 +- application/controllers/Stationsetup.php | 2 +- application/controllers/Themes.php | 2 +- application/controllers/Timeline.php | 2 +- application/controllers/Timeplotter.php | 2 +- application/controllers/Update.php | 10 ++-- application/controllers/User.php | 14 +++--- application/controllers/User_options.php | 2 +- application/migrations/215_impersonators.php | 51 ++++++++++++++++++++ 52 files changed, 152 insertions(+), 101 deletions(-) create mode 100644 application/migrations/215_impersonators.php diff --git a/application/controllers/Accumulated.php b/application/controllers/Accumulated.php index 183329f73..f8616fb4b 100644 --- a/application/controllers/Accumulated.php +++ b/application/controllers/Accumulated.php @@ -10,7 +10,7 @@ class Accumulated extends CI_Controller $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Activators.php b/application/controllers/Activators.php index eb5667f6c..652833dc6 100644 --- a/application/controllers/Activators.php +++ b/application/controllers/Activators.php @@ -10,7 +10,7 @@ class Activators extends CI_Controller $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Activatorsmap.php b/application/controllers/Activatorsmap.php index 1399f4d0f..288527c7c 100644 --- a/application/controllers/Activatorsmap.php +++ b/application/controllers/Activatorsmap.php @@ -10,7 +10,7 @@ class Activatorsmap extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index 4b83bc15e..7dd8af5f7 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -10,7 +10,7 @@ class adif extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function test() { diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 823ff2777..405b8ccc9 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -13,7 +13,7 @@ class Awards extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Backup.php b/application/controllers/Backup.php index 44bf3bace..5c65e2028 100644 --- a/application/controllers/Backup.php +++ b/application/controllers/Backup.php @@ -10,7 +10,7 @@ class Backup extends CI_Controller { public function index() { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['page_title'] = __("Backup"); @@ -23,7 +23,7 @@ class Backup extends CI_Controller { public function adif($key = null){ if ($key == null) { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } $clean_key = $this->security->xss_clean($key); @@ -60,7 +60,7 @@ class Backup extends CI_Controller { public function notes($key = null) { if ($key == null) { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } $clean_key = $this->security->xss_clean($key); diff --git a/application/controllers/Band.php b/application/controllers/Band.php index 052114aab..121c10803 100644 --- a/application/controllers/Band.php +++ b/application/controllers/Band.php @@ -12,7 +12,7 @@ class Band extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Bandmap.php b/application/controllers/Bandmap.php index 55c7fef4c..8145030ca 100644 --- a/application/controllers/Bandmap.php +++ b/application/controllers/Bandmap.php @@ -6,7 +6,7 @@ class Bandmap extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('bands'); } diff --git a/application/controllers/Cabrillo.php b/application/controllers/Cabrillo.php index a8b77cf88..062c079ee 100644 --- a/application/controllers/Cabrillo.php +++ b/application/controllers/Cabrillo.php @@ -13,7 +13,7 @@ class Cabrillo extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { @@ -50,7 +50,7 @@ class Cabrillo extends CI_Controller { header('Content-Type: application/json'); echo json_encode($result); } else { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } @@ -77,7 +77,7 @@ class Cabrillo extends CI_Controller { header('Content-Type: application/json'); echo json_encode($result); } else { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } @@ -132,7 +132,7 @@ class Cabrillo extends CI_Controller { $this->load->view('cabrillo/export', $data); }else { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } } diff --git a/application/controllers/Calltester.php b/application/controllers/Calltester.php index 84afaa8b3..f5baad08e 100644 --- a/application/controllers/Calltester.php +++ b/application/controllers/Calltester.php @@ -8,7 +8,7 @@ class Calltester extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Cfdexport.php b/application/controllers/Cfdexport.php index 9e40c792d..4d15bff2b 100644 --- a/application/controllers/Cfdexport.php +++ b/application/controllers/Cfdexport.php @@ -15,7 +15,7 @@ class Cfdexport extends CI_Controller { $this->load->model('logbook_model'); $this->load->model('bands'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['page_title'] = __("CFD Export"); @@ -26,7 +26,7 @@ class Cfdexport extends CI_Controller { public function export() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('logbook_model'); $this->load->model('dxcc'); diff --git a/application/controllers/Components.php b/application/controllers/Components.php index 63d807188..283700e03 100644 --- a/application/controllers/Components.php +++ b/application/controllers/Components.php @@ -10,7 +10,7 @@ class Components extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Contestcalendar.php b/application/controllers/Contestcalendar.php index 421b42dab..a6e80a5e9 100644 --- a/application/controllers/Contestcalendar.php +++ b/application/controllers/Contestcalendar.php @@ -12,7 +12,7 @@ class Contestcalendar extends CI_Controller { public function index() { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } diff --git a/application/controllers/Contesting.php b/application/controllers/Contesting.php index b0dac9839..7aef397c9 100644 --- a/application/controllers/Contesting.php +++ b/application/controllers/Contesting.php @@ -11,7 +11,7 @@ class Contesting extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Cron.php b/application/controllers/Cron.php index a122876c1..7e31fbb7e 100644 --- a/application/controllers/Cron.php +++ b/application/controllers/Cron.php @@ -23,7 +23,7 @@ class cron extends CI_Controller { $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -142,7 +142,7 @@ class cron extends CI_Controller { public function edit() { $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } diff --git a/application/controllers/Csv.php b/application/controllers/Csv.php index 9b7c4b7dd..037de83cb 100644 --- a/application/controllers/Csv.php +++ b/application/controllers/Csv.php @@ -5,7 +5,7 @@ class Csv extends CI_Controller { public function index() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('modes'); $this->load->model('logbook_model'); @@ -28,7 +28,7 @@ class Csv extends CI_Controller { public function export() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('csv_model'); // Parameters diff --git a/application/controllers/Dayswithqso.php b/application/controllers/Dayswithqso.php index 9e1bb0862..c82567b55 100644 --- a/application/controllers/Dayswithqso.php +++ b/application/controllers/Dayswithqso.php @@ -8,7 +8,7 @@ class Dayswithqso extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Debug.php b/application/controllers/Debug.php index e9af0827a..c2c377e41 100644 --- a/application/controllers/Debug.php +++ b/application/controllers/Debug.php @@ -7,7 +7,7 @@ class Debug extends CI_Controller $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } diff --git a/application/controllers/Distances.php b/application/controllers/Distances.php index f68287ca1..5c65831fa 100644 --- a/application/controllers/Distances.php +++ b/application/controllers/Distances.php @@ -8,7 +8,7 @@ class Distances extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Dxatlas.php b/application/controllers/Dxatlas.php index 48cbf81bf..dc10fa4f9 100644 --- a/application/controllers/Dxatlas.php +++ b/application/controllers/Dxatlas.php @@ -4,7 +4,7 @@ class Dxatlas extends CI_Controller { public function index() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('modes'); $this->load->model('logbook_model'); @@ -26,7 +26,7 @@ class Dxatlas extends CI_Controller { public function export() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('dxatlas_model'); @@ -48,7 +48,7 @@ class Dxatlas extends CI_Controller { function generateFiles($wkdArray, $cfmArray, $band) { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $gridCfmArray = []; $gridWkdArray = []; @@ -105,7 +105,7 @@ class Dxatlas extends CI_Controller { function makeZip($gridWkdString, $gridCfmString, $band) { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $zipFileName = 'dxatlas_gridsquares_'. $band . '.zip'; // Prepare File $file = tempnam(".", "zip"); diff --git a/application/controllers/Dxcalendar.php b/application/controllers/Dxcalendar.php index 9a4029702..a9281c925 100644 --- a/application/controllers/Dxcalendar.php +++ b/application/controllers/Dxcalendar.php @@ -5,7 +5,7 @@ class Dxcalendar extends CI_Controller { public function index() { $this->load->model('user_model'); $this->load->model('logbook_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['page_title'] = __("DX Calendar"); diff --git a/application/controllers/Dxcluster.php b/application/controllers/Dxcluster.php index 3a642256c..4414873f5 100644 --- a/application/controllers/Dxcluster.php +++ b/application/controllers/Dxcluster.php @@ -6,7 +6,7 @@ class Dxcluster extends CI_Controller { { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('dxcluster_model'); } diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 6c70c9eee..6126a2a59 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -20,7 +20,7 @@ class eqsl extends CI_Controller { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -44,7 +44,7 @@ class eqsl extends CI_Controller { public function import() { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -141,7 +141,7 @@ class eqsl extends CI_Controller { public function export() { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -220,7 +220,7 @@ class eqsl extends CI_Controller { function generateResultTable($custom_date_format, $rows) { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -244,7 +244,7 @@ class eqsl extends CI_Controller { function writeEqslNotSent($qslsnotsent, $custom_date_format) { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $table = ''; @@ -283,7 +283,7 @@ class eqsl extends CI_Controller { function image($id) { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->library('electronicqsl'); @@ -345,7 +345,7 @@ class eqsl extends CI_Controller { function bulk_download_image($id) { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->library('electronicqsl'); @@ -408,7 +408,7 @@ class eqsl extends CI_Controller { // Check logged in $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -424,7 +424,7 @@ class eqsl extends CI_Controller { // Check logged in $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $errors = 0; @@ -484,7 +484,7 @@ class eqsl extends CI_Controller { // Check logged in $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } diff --git a/application/controllers/Hamsat.php b/application/controllers/Hamsat.php index ae9516f99..4d25a4457 100644 --- a/application/controllers/Hamsat.php +++ b/application/controllers/Hamsat.php @@ -10,7 +10,7 @@ class Hamsat extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Kmlexport.php b/application/controllers/Kmlexport.php index 7ef266e35..dcc5772eb 100644 --- a/application/controllers/Kmlexport.php +++ b/application/controllers/Kmlexport.php @@ -15,7 +15,7 @@ class Kmlexport extends CI_Controller { $this->load->model('logbook_model'); $this->load->model('bands'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select $data['modes'] = $this->modes->active(); // Used in the view for mode select @@ -30,7 +30,7 @@ class Kmlexport extends CI_Controller { public function export() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // Load Libraries if(!$this->load->is_loaded('Qra')) { $this->load->library('Qra'); diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index 42f75fe7f..53ce1a0df 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -23,7 +23,7 @@ class Labels extends CI_Controller { $this->load->helper(array('form', 'url', 'psr4_autoloader')); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index f7d5d6b02..fa3976e05 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -13,7 +13,7 @@ class Logbookadvanced extends CI_Controller { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index a56437e13..88fe726eb 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -14,7 +14,7 @@ class Lookup extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 3c4412e23..d5b90ed03 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -42,7 +42,7 @@ class Lotw extends CI_Controller { public function index() { $this->load->library('Permissions'); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // Load required models for page generation $this->load->model('Lotw_model'); @@ -74,7 +74,7 @@ class Lotw extends CI_Controller { public function cert_upload() { $this->load->model('user_model'); $this->load->model('dxcc'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // Load DXCC Countrys List $data['dxcc_list'] = $this->dxcc->list(); @@ -101,7 +101,7 @@ class Lotw extends CI_Controller { { $this->load->model('user_model'); $this->load->model('dxcc'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // create folder to store certs while processing if (!file_exists('./uploads/lotw/certs')) { @@ -375,7 +375,7 @@ class Lotw extends CI_Controller { */ public function delete_cert($cert_id) { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('Lotw_model'); @@ -398,7 +398,7 @@ class Lotw extends CI_Controller { */ public function decrypt_key($file, $password = "") { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $results = array(); $password = $password; // Only needed if 12 has a password set @@ -709,7 +709,7 @@ class Lotw extends CI_Controller { public function import() { // Is only called via frontend. Cron uses "upload". within download the download is called $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); exit(); } @@ -817,7 +817,7 @@ class Lotw extends CI_Controller { } } } else { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); exit(); } @@ -825,7 +825,7 @@ class Lotw extends CI_Controller { public function export() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['page_title'] = __("LoTW .TQ8 Upload"); diff --git a/application/controllers/Mode.php b/application/controllers/Mode.php index d0f61c120..865243d84 100644 --- a/application/controllers/Mode.php +++ b/application/controllers/Mode.php @@ -12,7 +12,7 @@ class Mode extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Notes.php b/application/controllers/Notes.php index b411a3fc9..ba27c2a00 100644 --- a/application/controllers/Notes.php +++ b/application/controllers/Notes.php @@ -7,7 +7,7 @@ class Notes extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Options.php b/application/controllers/Options.php index 9a3f5469a..821997281 100644 --- a/application/controllers/Options.php +++ b/application/controllers/Options.php @@ -12,7 +12,7 @@ class Options extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Oqrs.php b/application/controllers/Oqrs.php index 52ba6d31a..5e723d484 100644 --- a/application/controllers/Oqrs.php +++ b/application/controllers/Oqrs.php @@ -11,8 +11,8 @@ class Oqrs extends CI_Controller { parent::__construct(); // Commented out to get public access // $this->load->model('user_model'); - // if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } - if (($this->config->item('disable_oqrs') ?? false)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + // if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + if (($this->config->item('disable_oqrs') ?? false)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Qrbcalc.php b/application/controllers/Qrbcalc.php index 7ac4499cc..2056ae154 100644 --- a/application/controllers/Qrbcalc.php +++ b/application/controllers/Qrbcalc.php @@ -10,7 +10,7 @@ class Qrbcalc extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 94d5500a5..965489808 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -248,7 +248,7 @@ class Qrz extends CI_Controller { public function import_qrz() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['page_title'] = __("QRZ QSL Import"); diff --git a/application/controllers/Qsl.php b/application/controllers/Qsl.php index 68aff8681..59177e8ad 100644 --- a/application/controllers/Qsl.php +++ b/application/controllers/Qsl.php @@ -9,8 +9,8 @@ class Qsl extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } - if(($this->config->item('disable_qsl') ?? false)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); exit; } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + if(($this->config->item('disable_qsl') ?? false)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); exit; } } // Default view when loading controller. @@ -41,7 +41,7 @@ class Qsl extends CI_Controller { // Deletes QSL Card public function delete() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $id = $this->input->post('id'); $this->load->model('Qsl_model'); $this->Qsl_model->deleteQsl($id); @@ -49,7 +49,7 @@ class Qsl extends CI_Controller { public function uploadqsl() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $qsoid = $this->input->post('qsoid'); diff --git a/application/controllers/Qslprint.php b/application/controllers/Qslprint.php index 81392bef3..1491e160e 100644 --- a/application/controllers/Qslprint.php +++ b/application/controllers/Qslprint.php @@ -144,7 +144,7 @@ class QSLPrint extends CI_Controller { $this->load->model('qslprint_model'); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // Update Logbook to Mark Paper Card Sent diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 23821f9d3..028a89527 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -6,7 +6,7 @@ class QSO extends CI_Controller { { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { @@ -16,7 +16,7 @@ class QSO extends CI_Controller { $this->load->model('user_model'); $this->load->model('modes'); $this->load->model('bands'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // Getting the live/post mode from GET command // 0 = live @@ -173,7 +173,7 @@ class QSO extends CI_Controller { $this->load->model('logbook_model'); $this->load->model('user_model'); $this->load->model('modes'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $query = $this->logbook_model->qso_info($this->uri->segment(3)); $this->load->library('form_validation'); @@ -276,7 +276,7 @@ class QSO extends CI_Controller { $this->load->library('form_validation'); if(!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $id = str_replace('"', "", $this->input->post("id", TRUE)); @@ -296,7 +296,7 @@ class QSO extends CI_Controller { $this->load->model('logbook_model'); $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->logbook_model->edit(); @@ -305,7 +305,7 @@ class QSO extends CI_Controller { function qsl_rcvd($id, $method) { $this->load->model('logbook_model'); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } // Update Logbook to Mark Paper Card Received @@ -600,7 +600,7 @@ class QSO extends CI_Controller { // Return Previous QSOs Made in the active logbook public function component_past_contacts() { - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('logbook_model'); session_write_close(); diff --git a/application/controllers/Radio.php b/application/controllers/Radio.php index 577cded5a..1d9af0cfd 100644 --- a/application/controllers/Radio.php +++ b/application/controllers/Radio.php @@ -256,7 +256,7 @@ class Radio extends CI_Controller { // Check Auth $this->load->model('user_model'); if (!$this->user_model->authorize(3)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -282,7 +282,7 @@ class Radio extends CI_Controller { // Check Auth $this->load->model('user_model'); if (!$this->user_model->authorize(3)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -298,7 +298,7 @@ class Radio extends CI_Controller { // Check Auth $this->load->model('user_model'); if (!$this->user_model->authorize(3)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index d35ef170a..04860825b 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -12,7 +12,7 @@ class Satellite extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Sattimers.php b/application/controllers/Sattimers.php index dcd1a6127..053c26e3b 100644 --- a/application/controllers/Sattimers.php +++ b/application/controllers/Sattimers.php @@ -6,7 +6,7 @@ class Sattimers extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Search.php b/application/controllers/Search.php index 51c4aeef5..614bd6ae2 100644 --- a/application/controllers/Search.php +++ b/application/controllers/Search.php @@ -10,7 +10,7 @@ class Search extends CI_Controller { $this->load->helper(array('form', 'url')); if($this->optionslib->get_option('global_search') != "true") { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } } diff --git a/application/controllers/Simplefle.php b/application/controllers/Simplefle.php index d0859fcd7..b090e9afa 100644 --- a/application/controllers/Simplefle.php +++ b/application/controllers/Simplefle.php @@ -4,7 +4,7 @@ class SimpleFLE extends CI_Controller { public function index() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $this->load->model('stations'); diff --git a/application/controllers/Station.php b/application/controllers/Station.php index 7cc014b62..6ac978521 100644 --- a/application/controllers/Station.php +++ b/application/controllers/Station.php @@ -14,7 +14,7 @@ class Station extends CI_Controller $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } diff --git a/application/controllers/Stationsetup.php b/application/controllers/Stationsetup.php index 40ef64be3..1c4afd6b0 100644 --- a/application/controllers/Stationsetup.php +++ b/application/controllers/Stationsetup.php @@ -12,7 +12,7 @@ class Stationsetup extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() { diff --git a/application/controllers/Themes.php b/application/controllers/Themes.php index ba032823a..6b52aa4e7 100644 --- a/application/controllers/Themes.php +++ b/application/controllers/Themes.php @@ -14,7 +14,7 @@ class Themes extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Timeline.php b/application/controllers/Timeline.php index 24e2b78f7..d0acdbe5e 100644 --- a/application/controllers/Timeline.php +++ b/application/controllers/Timeline.php @@ -8,7 +8,7 @@ class Timeline extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Timeplotter.php b/application/controllers/Timeplotter.php index 9a74eb55d..da550db18 100644 --- a/application/controllers/Timeplotter.php +++ b/application/controllers/Timeplotter.php @@ -8,7 +8,7 @@ class Timeplotter extends CI_Controller { parent::__construct(); $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function index() diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 8c1ba2ca9..20aa07ce9 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -21,7 +21,7 @@ class Update extends CI_Controller { public function index() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['page_title'] = __("Updates"); $this->load->view('interface_assets/header', $data); @@ -270,7 +270,7 @@ class Update extends CI_Controller { public function check_missing_dxcc($all = false){ $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -281,7 +281,7 @@ class Update extends CI_Controller { public function check_missing_continent() { $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -292,7 +292,7 @@ class Update extends CI_Controller { public function update_distances() { $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } @@ -303,7 +303,7 @@ class Update extends CI_Controller { public function check_missing_grid($all = false){ $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } diff --git a/application/controllers/User.php b/application/controllers/User.php index 3d355b8b4..3cb9e4de2 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -5,7 +5,7 @@ class User extends CI_Controller { public function index() { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['results'] = $this->user_model->users(); @@ -18,7 +18,7 @@ class User extends CI_Controller { function add() { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $data['existing_languages'] = $this->config->item('languages'); @@ -203,8 +203,8 @@ class User extends CI_Controller { function edit() { $this->load->model('user_model'); - if ( ($this->session->userdata('user_id') == '') || ((!$this->user_model->authorize(99)) && ($this->session->userdata('user_id') != $this->uri->segment(3))) ) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } - if ( $this->config->item('special_callsign') && $this->session->userdata('user_type') != '99' && $this->config->item('sc_hide_usermenu') ) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if ( ($this->session->userdata('user_id') == '') || ((!$this->user_model->authorize(99)) && ($this->session->userdata('user_id') != $this->uri->segment(3))) ) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + if ( $this->config->item('special_callsign') && $this->session->userdata('user_type') != '99' && $this->config->item('sc_hide_usermenu') ) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $query = $this->user_model->get_by_id($this->uri->segment(3)); $data['existing_languages'] = $this->config->item('languages'); @@ -716,7 +716,7 @@ class User extends CI_Controller { function profile() { $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $query = $this->user_model->get_by_id($this->session->userdata('user_id')); $q = $query->row(); $data['page_title'] = __("Profile"); @@ -735,7 +735,7 @@ class User extends CI_Controller { function delete() { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $query = $this->user_model->get_by_id($this->uri->segment(3)); $this->load->library('form_validation'); @@ -1018,7 +1018,7 @@ class User extends CI_Controller { $this->load->model('user_model'); - if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } $query = $this->user_model->get_by_id($this->input->post('user_id')); diff --git a/application/controllers/User_options.php b/application/controllers/User_options.php index a74cfcec5..3312ea4b5 100644 --- a/application/controllers/User_options.php +++ b/application/controllers/User_options.php @@ -6,7 +6,7 @@ class User_Options extends CI_Controller { parent::__construct(); $this->load->model('user_model'); $this->load->model('user_options_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function add_edit_fav() { diff --git a/application/migrations/215_impersonators.php b/application/migrations/215_impersonators.php new file mode 100644 index 000000000..f97269920 --- /dev/null +++ b/application/migrations/215_impersonators.php @@ -0,0 +1,51 @@ +db->table_exists('impersonators')) { + + $this->dbforge->add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 6, + 'unsigned' => TRUE, + 'auto_increment' => TRUE, + 'null' => FALSE + ), + 'user_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE, + 'null' => FALSE + ), + 'impersonate_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE, + 'null' => FALSE + ) + )); + + $this->dbforge->add_key('id', TRUE); + + $this->dbforge->create_table('impersonators'); + + } + } + + public function down() { + + $this->dbforge->drop_table('impersonators'); + + } + +} From 75c7b97ee0de40781d3d1f45e1b2d16511cf8657 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 16 Aug 2024 10:40:49 +0200 Subject: [PATCH 03/11] wrong push branch --- application/migrations/215_impersonators.php | 51 -------------------- 1 file changed, 51 deletions(-) delete mode 100644 application/migrations/215_impersonators.php diff --git a/application/migrations/215_impersonators.php b/application/migrations/215_impersonators.php deleted file mode 100644 index f97269920..000000000 --- a/application/migrations/215_impersonators.php +++ /dev/null @@ -1,51 +0,0 @@ -db->table_exists('impersonators')) { - - $this->dbforge->add_field(array( - 'id' => array( - 'type' => 'INT', - 'constraint' => 6, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, - 'null' => FALSE - ), - 'user_id' => array( - 'type' => 'BIGINT', - 'constraint' => 20, - 'unsigned' => TRUE, - 'auto_increment' => FALSE, - 'null' => FALSE - ), - 'impersonate_id' => array( - 'type' => 'BIGINT', - 'constraint' => 20, - 'unsigned' => TRUE, - 'auto_increment' => FALSE, - 'null' => FALSE - ) - )); - - $this->dbforge->add_key('id', TRUE); - - $this->dbforge->create_table('impersonators'); - - } - } - - public function down() { - - $this->dbforge->drop_table('impersonators'); - - } - -} From c48b29c8eabe1b25845be83a882d8b001db5e554 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:05:43 +0200 Subject: [PATCH 04/11] Fixing qrg unit saving, and only load on login or change --- application/controllers/User.php | 18 +++++++++--------- application/models/User_model.php | 14 +++++++++----- application/views/bands/index.php | 4 ++-- application/views/interface_assets/footer.php | 2 +- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index a617c6389..b0dd94e4e 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -379,7 +379,7 @@ class User extends CI_Controller { $data['user_language'] = $q->user_language; } - + if($this->input->post('user_stylesheet')) { $data['user_stylesheet'] = $this->input->post('user_stylesheet', true); } else { @@ -591,12 +591,12 @@ class User extends CI_Controller { $data['user_map_'.$row->option_key.'_'.$ktype] = $this->input->post('user_map_'.$row->option_key.'_'.$ktype, true); } else { $data['user_map_'.$row->option_key.'_'.$ktype] = $vtype; - } + } } } else { $data['user_map_'.$row->option_name.'_'.$row->option_key] = $row->option_value; } - } + } } else { $data['user_map_qso_icon'] = "fas fa-dot-circle"; $data['user_map_qso_color'] = "#FF0000"; @@ -613,7 +613,7 @@ class User extends CI_Controller { $data['user_locations_quickswitch'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'locations_quickswitch'), $this->uri->segment(3))->row()->option_value ?? 'false'); $data['user_utc_headermenu'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'utc_headermenu'), $this->uri->segment(3))->row()->option_value ?? 'false'); - + $this->load->view('interface_assets/header', $data); $this->load->view('user/edit', $data); $this->load->view('interface_assets/footer'); @@ -651,7 +651,7 @@ class User extends CI_Controller { $data_options['user_map_'.$icon.'_color'] = xss_clean($this->input->post('user_map_'.$icon.'_color', true)); } if (!empty($data_options['user_map_qso_icon'])) { - foreach ($array_icon as $icon) { + foreach ($array_icon as $icon) { $json = json_encode(array('icon'=>$data_options['user_map_'.$icon.'_icon'], 'color'=>$data_options['user_map_'.$icon.'_color'])); $this->user_options_model->set_option('map_custom','icon',array($icon=>$json)); } @@ -853,7 +853,7 @@ class User extends CI_Controller { $this->session->set_flashdata('error', __("Login failed. Try again.")); redirect('user/login'); } - + } if ($this->form_validation->run() == FALSE) { @@ -866,7 +866,7 @@ class User extends CI_Controller { } else { if($this->user_model->login() == 1) { $this->session->set_flashdata('notice', __("User logged in")); - $this->user_model->update_session($data['user']->user_id); + $this->user_model->update_session($data['user']->user_id, null, true); $cookie= array( 'name' => $this->config->item('gettext_cookie', 'gettext'), @@ -934,7 +934,7 @@ class User extends CI_Controller { redirect('user/login'); } else { - + $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); @@ -1013,7 +1013,7 @@ class User extends CI_Controller { public function admin_send_password_reset() { header('Content-Type: application/json'); - + if ($this->input->is_ajax_request()) { // just additional, to make sure request is from ajax if ($this->input->post('submit_allowed')) { diff --git a/application/models/User_model.php b/application/models/User_model.php index 033d0e857..4e2a1ac06 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -407,12 +407,12 @@ class User_Model extends CI_Model { // FUNCTION: void update_session() // Updates a user's login session after they've logged in // TODO: This should return bool TRUE/FALSE or 0/1 - function update_session($id, $u = null) { + function update_session($id, $u = null, $login = false) { if ($u == null) { $u = $this->get_by_id($id); } - + $userdata = array( 'user_id' => $u->row()->user_id, 'user_name' => $u->row()->user_name, @@ -454,14 +454,18 @@ class User_Model extends CI_Model { 'isWinkeyEnabled' => $u->row()->winkey, 'hasQrzKey' => $this->hasQrzKey($u->row()->user_id) ); - + foreach (array_keys($this->frequency->defaultFrequencies) as $band) { - $qrg_unit = $this->session->userdata("qrgunit_$band") ?? ($this->user_options_model->get_options('frequency', array('option_name' => 'unit', 'option_key' => $band))->row()->option_value ?? ''); + if ($login) { + $qrg_unit = $this->user_options_model->get_options('frequency', array('option_name' => 'unit', 'option_key' => $band))->row()->option_value; + } else { + $qrg_unit = $this->session->userdata("qrgunit_$band") ?? ''; + } if ($qrg_unit !== '') { $userdata['qrgunit_'.$band] = $qrg_unit; } } - + $this->session->set_userdata($userdata); } diff --git a/application/views/bands/index.php b/application/views/bands/index.php index f431b0e06..782919631 100644 --- a/application/views/bands/index.php +++ b/application/views/bands/index.php @@ -93,7 +93,7 @@ $wwff = 0; -
ssb;?> data;?> cw;?> +