diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index b7bcf21fb..5aa2b630d 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -6,6 +6,16 @@ class Clublog extends CI_Controller { + function __construct() + { + parent::__construct(); + + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); + } + } + // Show frontend if there is one public function index() { $this->config->load('config'); diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 9f93cbb8a..f82a1d9c8 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -4,8 +4,15 @@ class eqsl extends CI_Controller { /* Controls who can access the controller and its functions */ function __construct() { + parent::__construct(); + $this->load->helper(array('form', 'url')); + + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); + } } // Default view when loading controller. diff --git a/application/controllers/Hrdlog.php b/application/controllers/Hrdlog.php index 934cd1b2e..2b3182b49 100644 --- a/application/controllers/Hrdlog.php +++ b/application/controllers/Hrdlog.php @@ -11,6 +11,17 @@ class Hrdlog extends CI_Controller { * When called from the url wavelog/hrdlog/upload, the function loops through all station_id's with a hrdlog code defined. * All QSOs not previously uploaded, will then be uploaded, one at a time */ + + function __construct() + { + parent::__construct(); + + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); + } + } + public function upload() { $this->setOptions(); @@ -34,7 +45,6 @@ class Hrdlog extends CI_Controller { echo "No station profiles with a hrdlog Code found."; log_message('error', "No station profiles with a hrdlog Code found."); } - } function setOptions() { diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 24a569dc4..ffdea9090 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -26,6 +26,11 @@ class Lotw extends CI_Controller { // Load language files $this->lang->load('lotw'); + + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); + } } /* @@ -352,7 +357,7 @@ class Lotw extends CI_Controller { /* | Download QSO Matches from LoTW - */ + */ if ($this->user_model->authorize(2)) { echo "

"; $sync_user_id=$this->session->userdata('user_id'); diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 557a8a6b8..a4507bdd9 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -6,6 +6,16 @@ class Qrz extends CI_Controller { + function __construct() + { + parent::__construct(); + + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); + } + } + // Show frontend if there is one public function index() { $this->config->load('config'); @@ -38,7 +48,6 @@ class Qrz extends CI_Controller { echo "No station profiles with a QRZ API Key found."; log_message('error', "No station profiles with a QRZ API Key found."); } - } function setOptions() { @@ -247,7 +256,7 @@ class Qrz extends CI_Controller { } else { echo "Downloaded QRZ report contains no matches."; } - } + } } function mass_download_qsos($qrz_api_key = '', $lastqrz = '1900-01-01', $trusted = false) { diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 01ac1abc7..6ff666e4a 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -8,6 +8,16 @@ class Update extends CI_Controller { lotw_users - imports lotw users */ + function __construct() + { + parent::__construct(); + + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); + } + } + public function index() { $data['page_title'] = "Updates"; @@ -290,9 +300,9 @@ class Update extends CI_Controller { if ($nCount > 0) { echo "DONE: " . number_format($nCount) . " callsigns loaded"; - $datetime = new DateTime("now", new DateTimeZone('UTC')); - $datetime = $datetime->format('Ymd h:i'); - $this->optionslib->update('scp_update', $datetime , 'no'); + $datetime = new DateTime("now", new DateTimeZone('UTC')); + $datetime = $datetime->format('Ymd h:i'); + $this->optionslib->update('scp_update', $datetime , 'no'); } else { echo "FAILED: Empty file"; } @@ -360,9 +370,9 @@ class Update extends CI_Controller { $totaltime = ($endtime - $starttime); echo "This page was created in ".$totaltime." seconds
"; echo "Records inserted: " . $i . "
"; - $datetime = new DateTime("now", new DateTimeZone('UTC')); - $datetime = $datetime->format('Ymd h:i'); - $this->optionslib->update('lotw_users_update', $datetime , 'no'); + $datetime = new DateTime("now", new DateTimeZone('UTC')); + $datetime = $datetime->format('Ymd h:i'); + $this->optionslib->update('lotw_users_update', $datetime , 'no'); } public function lotw_check() { @@ -394,9 +404,9 @@ class Update extends CI_Controller { if ($nCount > 0) { echo "DONE: " . number_format($nCount) . " DOKs and SDOKs saved"; - $datetime = new DateTime("now", new DateTimeZone('UTC')); - $datetime = $datetime->format('Ymd h:i'); - $this->optionslib->update('dok_file_update', $datetime , 'no'); + $datetime = new DateTime("now", new DateTimeZone('UTC')); + $datetime = $datetime->format('Ymd h:i'); + $this->optionslib->update('dok_file_update', $datetime , 'no'); } else { echo"FAILED: Empty file"; } @@ -444,9 +454,9 @@ class Update extends CI_Controller { if ($nCount > 0) { echo "DONE: " . number_format($nCount) . " SOTA's saved"; - $datetime = new DateTime("now", new DateTimeZone('UTC')); - $datetime = $datetime->format('Ymd h:i'); - $this->optionslib->update('sota_file_update', $datetime , 'no'); + $datetime = new DateTime("now", new DateTimeZone('UTC')); + $datetime = $datetime->format('Ymd h:i'); + $this->optionslib->update('sota_file_update', $datetime , 'no'); } else { echo"FAILED: Empty file"; } @@ -481,12 +491,12 @@ class Update extends CI_Controller { $data = str_getcsv($csv,"\n"); $nCount = 0; foreach ($data as $idx => $row) { - if ($idx == 0) continue; // Skip line we are not interested in - $row = str_getcsv($row, ','); - if ($row[0]) { - fwrite($wwfffilehandle, $row[0].PHP_EOL); - $nCount++; - } + if ($idx == 0) continue; // Skip line we are not interested in + $row = str_getcsv($row, ','); + if ($row[0]) { + fwrite($wwfffilehandle, $row[0].PHP_EOL); + $nCount++; + } } fclose($wwfffilehandle); @@ -494,9 +504,9 @@ class Update extends CI_Controller { if ($nCount > 0) { echo "DONE: " . number_format($nCount) . " WWFF's saved"; - $datetime = new DateTime("now", new DateTimeZone('UTC')); - $datetime = $datetime->format('Ymd h:i'); - $this->optionslib->update('wwff_file_update', $datetime , 'no'); + $datetime = new DateTime("now", new DateTimeZone('UTC')); + $datetime = $datetime->format('Ymd h:i'); + $this->optionslib->update('wwff_file_update', $datetime , 'no'); } else { echo"FAILED: Empty file"; } @@ -527,12 +537,12 @@ class Update extends CI_Controller { $data = str_getcsv($csv,"\n"); $nCount = 0; foreach ($data as $idx => $row) { - if ($idx == 0) continue; // Skip line we are not interested in - $row = str_getcsv($row, ','); - if ($row[0]) { - fwrite($potafilehandle, $row[0].PHP_EOL); - $nCount++; - } + if ($idx == 0) continue; // Skip line we are not interested in + $row = str_getcsv($row, ','); + if ($row[0]) { + fwrite($potafilehandle, $row[0].PHP_EOL); + $nCount++; + } } fclose($potafilehandle); @@ -540,9 +550,9 @@ class Update extends CI_Controller { if ($nCount > 0) { echo "DONE: " . number_format($nCount) . " POTA's saved"; - $datetime = new DateTime("now", new DateTimeZone('UTC')); - $datetime = $datetime->format('Ymd h:i'); - $this->optionslib->update('pota_file_update', $datetime , 'no'); + $datetime = new DateTime("now", new DateTimeZone('UTC')); + $datetime = $datetime->format('Ymd h:i'); + $this->optionslib->update('pota_file_update', $datetime , 'no'); } else { echo"FAILED: Empty file"; }