diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 920d15839..a80ef2c2c 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -656,7 +656,7 @@ class Logbook extends CI_Controller { if (!empty($logbooks_locations_array) && $query->num_rows() > 0) { $html .= "
"; - $html .= ""; + $html .= "
"; $html .= ""; $html .= ""; $html .= ""; diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index 86e953614..35990fb0a 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -27,30 +27,40 @@ class Lookup extends CI_Controller { } public function search() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $location_list = "'".implode("','",$logbooks_locations_array)."'"; $this->load->model('lookup_model'); - $this->load->model('bands'); - - $data['bands'] = $this->bands->get_worked_bands(xss_clean($this->input->post('type'))); $data['type'] = xss_clean($this->input->post('type')); - $data['dxcc'] = xss_clean($this->input->post('dxcc')); - $data['was'] = xss_clean($this->input->post('was')); - $data['sota'] = xss_clean($this->input->post('sota')); - $data['grid'] = xss_clean($this->input->post('grid')); - $data['iota'] = xss_clean($this->input->post('iota')); - $data['cqz'] = xss_clean($this->input->post('cqz')); - $data['wwff'] = xss_clean($this->input->post('wwff')); - $data['location_list'] = $location_list; - $data['result'] = $this->lookup_model->getSearchResult($data); + if ($data['type'] == "lotw") { + $this->load->model('logbook_model'); + $data['callsign'] = xss_clean($this->input->post('lotw')); + $data['lotw_lastupload'] = $this->logbook_model->check_last_lotw($data['callsign']); + + $this->load->view('lookup/lotwuser', $data); + } else { + $this->load->model('bands'); + + $data['bands'] = $this->bands->get_worked_bands(xss_clean($this->input->post('type'))); + + + $data['dxcc'] = xss_clean($this->input->post('dxcc')); + $data['was'] = xss_clean($this->input->post('was')); + $data['sota'] = xss_clean($this->input->post('sota')); + $data['grid'] = xss_clean($this->input->post('grid')); + $data['iota'] = xss_clean($this->input->post('iota')); + $data['cqz'] = xss_clean($this->input->post('cqz')); + $data['wwff'] = xss_clean($this->input->post('wwff')); + $data['location_list'] = $location_list; + + $data['result'] = $this->lookup_model->getSearchResult($data); + $this->load->view('lookup/result', $data); + } - $this->load->view('lookup/result', $data); } public function scp() { @@ -131,11 +141,11 @@ class Lookup extends CI_Controller { public function get_state_list() { $this->load->library('subdivisions'); - + $dxcc = xss_clean($this->input->post('dxcc')); $states_result = $this->subdivisions->get_state_list($dxcc); $subdivision_name = $this->subdivisions->get_primary_subdivision_name($dxcc); - + if ($states_result->num_rows() > 0) { $states_array = $states_result->result_array(); $result = array( @@ -150,7 +160,7 @@ class Lookup extends CI_Controller { echo json_encode(array('status' => 'No States for this DXCC in Database')); } } - + public function get_county() { $json = []; diff --git a/application/controllers/Update.php b/application/controllers/Update.php index d0c4acece..b355b0342 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -30,27 +30,14 @@ class Update extends CI_Controller { } - /* - * Create a path to a file in the updates folder, respecting the datadir - * configuration option. - */ - private function make_update_path($path) { - $path = "updates/" . $path; - $datadir = $this->config->item('datadir'); - if(!$datadir) { - return $path; - } - return $datadir . "/" . $path; - } - /* * Load the dxcc entities */ public function dxcc_entities() { - // Load Database connectors - // Load the cty file - $xml_data = simplexml_load_file($this->make_update_path("cty.xml")); + // Load the cty file + $this->load->library('Paths'); + $xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml")); //$xml_data->entities->entity->count(); @@ -98,9 +85,10 @@ class Update extends CI_Controller { * Load the dxcc exceptions */ public function dxcc_exceptions() { - // Load Database connectors - // Load the cty file - $xml_data = simplexml_load_file($this->make_update_path("cty.xml")); + + // Load the cty file + $this->load->library('Paths'); + $xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml")); $count = 0; $a_data=[]; @@ -139,9 +127,10 @@ class Update extends CI_Controller { * Load the dxcc prefixes */ public function dxcc_prefixes() { - // Load Database connectors + // Load the cty file - $xml_data = simplexml_load_file($this->make_update_path("cty.xml")); + $this->load->library('Paths'); + $xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml")); $count = 0; $a_data=[]; @@ -180,59 +169,63 @@ class Update extends CI_Controller { // Updates the DXCC & Exceptions from the Club Log Cty.xml file. public function dxcc() { + $this->load->library('Paths'); + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); + $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); - $this->update_status("Downloading file"); + $this->update_status("Downloading file"); - // give it 10 minutes... - set_time_limit(600); + // give it 10 minutes... + set_time_limit(600); - // Load Migration data if any. - $this->load->library('migration'); - $this->fix_migrations(); - $this->migration->latest(); + // Load Migration data if any. + $this->load->library('migration'); + $this->fix_migrations(); + $this->migration->latest(); - // Download latest file. - $url = "https://cdn.clublog.org/cty.php?api=608df94896cb9c5421ae748235492b43815610c9"; + // Download latest file. + $url = "https://cdn.clublog.org/cty.php?api=608df94896cb9c5421ae748235492b43815610c9"; - $gz = gzopen($url, 'r'); - if ($gz === FALSE) { - $this->update_status("FAILED: Could not download from clublog.org"); - log_message('error', 'FAILED: Could not download exceptions from clublog.org'); - return; - } + $gz = gzopen($url, 'r'); + if ($gz === FALSE) { + $this->update_status("FAILED: Could not download from clublog.org"); + log_message('error', 'FAILED: Could not download exceptions from clublog.org'); + return; + } - $data = ""; - while (!gzeof($gz)) { - $data .= gzgetc($gz); - } - gzclose($gz); + $data = ""; + while (!gzeof($gz)) { + $data .= gzgetc($gz); + } + gzclose($gz); - if (file_put_contents($this->make_update_path("cty.xml"), $data) === FALSE) { - $this->update_status("FAILED: Could not write to cty.xml file"); - return; - } + if (file_put_contents($this->paths->make_update_path("cty.xml"), $data) === FALSE) { + $this->update_status("FAILED: Could not write to cty.xml file"); + return; + } - // Clear the tables, ready for new data - $this->db->empty_table("dxcc_entities"); - $this->db->empty_table("dxcc_exceptions"); - $this->db->empty_table("dxcc_prefixes"); - $this->update_status(); + // Clear the tables, ready for new data + $this->db->empty_table("dxcc_entities"); + $this->db->empty_table("dxcc_exceptions"); + $this->db->empty_table("dxcc_prefixes"); + $this->update_status(); - // Parse the three sections of the file and update the tables - $this->db->trans_start(); - $this->dxcc_entities(); - $this->dxcc_exceptions(); - $this->dxcc_prefixes(); - $this->db->trans_complete(); + // Parse the three sections of the file and update the tables + $this->db->trans_start(); + $this->dxcc_entities(); + $this->dxcc_exceptions(); + $this->dxcc_prefixes(); + $this->db->trans_complete(); - $this->update_status("DONE"); + $this->update_status("DONE"); } public function update_status($done=""){ + $this->load->library('Paths'); + if ($done != "Downloading file"){ // Check that everything is done? if ($done == ""){ @@ -246,18 +239,18 @@ class Update extends CI_Controller { $html = $done."....
"; } - file_put_contents($this->make_update_path("status.html"), $html); + file_put_contents($this->paths->make_update_path("status.html"), $html); } private function fix_migrations(){ - $res = $this->db->query("select version from migrations"); + $res = $this->db->query("SELECT version FROM migrations"); if ($res->num_rows() >0){ $row = $res->row(); $version = $row->version; if ($version < 7){ - $this->db->query("update migrations set version=7"); + $this->db->query("UPDATE migrations SET version=7"); } } } @@ -308,37 +301,10 @@ class Update extends CI_Controller { public function update_clublog_scp() { - // set the last run in cron table for the correct cron id - $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); + $this->load->model('Update_model'); + $result = $this->Update_model->clublog_scp(); + echo $result; - $strFile = $this->make_update_path("clublog_scp.txt"); - $url = "https://cdn.clublog.org/clublog.scp.gz"; - set_time_limit(300); - echo "Downloading Club Log SCP file...
"; - $gz = gzopen($url, 'r'); - if ($gz) - { - $data = ""; - while (!gzeof($gz)) { - $data .= gzgetc($gz); - } - gzclose($gz); - if (file_put_contents($strFile, $data) !== FALSE) - { - $nCount = count(file($strFile)); - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " callsigns loaded"; - } else { - echo "FAILED: Empty file"; - } - } else { - echo "FAILED: Could not write to Club Log SCP file"; - } - } else { - echo "FAILED: Could not connect to Club Log"; - } } public function download_lotw_users() { @@ -360,48 +326,10 @@ class Update extends CI_Controller { public function lotw_users() { - // set the last run in cron table for the correct cron id - $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); + $this->load->model('Update_model'); + $result = $this->Update_model->lotw_users(); + echo $result; - $mtime = microtime(); - $mtime = explode(" ",$mtime); - $mtime = $mtime[1] + $mtime[0]; - $starttime = $mtime; - - $file = 'https://lotw.arrl.org/lotw-user-activity.csv'; - - $handle = fopen($file, "r"); - if ($handle === FALSE) { - echo "Something went wrong with fetching the LoTW uses file"; - return; - } - $this->db->empty_table("lotw_users"); - $i = 0; - $data = fgetcsv($handle,1000,","); - do { - if ($data[0]) { - $lotwdata[$i]['callsign'] = $data[0]; - $lotwdata[$i]['lastupload'] = $data[1] . ' ' . $data[2]; - if (($i % 2000) == 0) { - $this->db->insert_batch('lotw_users', $lotwdata); - unset($lotwdata); - // echo 'Record ' . $i . '
'; - } - $i++; - } - } while ($data = fgetcsv($handle,1000,",")); - fclose($handle); - - $this->db->insert_batch('lotw_users', $lotwdata); - - $mtime = microtime(); - $mtime = explode(" ",$mtime); - $mtime = $mtime[1] + $mtime[0]; - $endtime = $mtime; - $totaltime = ($endtime - $starttime); - echo "This page was created in ".$totaltime." seconds
"; - echo "Records inserted: " . $i . "
"; } public function lotw_check() { @@ -422,29 +350,10 @@ class Update extends CI_Controller { */ public function update_dok() { - // set the last run in cron table for the correct cron id - $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); - - $contents = file_get_contents('https://www.df2et.de/cqrlog/dok_and_sdok.txt', true); - - if($contents === FALSE) { - echo "Something went wrong with fetching the DOK file."; - } else { - $file = './assets/json/dok.txt'; - - if (file_put_contents($file, $contents) !== FALSE) { // Save our content to the file. - $nCount = count(file($file)); - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " DOKs and SDOKs saved"; - } else { - echo"FAILED: Empty file"; - } - } else { - echo"FAILED: Could not write to dok.txt file"; - } - } + $this->load->model('Update_model'); + $result = $this->Update_model->dok(); + echo $result; + } /* @@ -452,47 +361,10 @@ class Update extends CI_Controller { */ public function update_sota() { - // set the last run in cron table for the correct cron id - $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); - - $csvfile = 'https://www.sotadata.org.uk/summitslist.csv'; - - $sotafile = './assets/json/sota.txt'; - - $csvhandle = fopen($csvfile,"r"); - if ($csvhandle === FALSE) { - echo "Something went wrong with fetching the SOTA file"; - return; - } - - $data = fgetcsv($csvhandle,1000,","); // Skip line we are not interested in - $data = fgetcsv($csvhandle,1000,","); // Skip line we are not interested in - $data = fgetcsv($csvhandle,1000,","); - $sotafilehandle = fopen($sotafile, 'w'); - - if ($sotafilehandle === FALSE) { - echo"FAILED: Could not write to sota.txt file"; - return; - } - - $nCount = 0; - do { - if ($data[0]) { - fwrite($sotafilehandle, $data[0].PHP_EOL); - $nCount++; - } - } while ($data = fgetcsv($csvhandle,1000,",")); - - fclose($csvhandle); - fclose($sotafilehandle); - - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " SOTA's saved"; - } else { - echo"FAILED: Empty file"; - } + $this->load->model('Update_model'); + $result = $this->Update_model->sota(); + echo $result; + } /* @@ -500,99 +372,18 @@ class Update extends CI_Controller { */ public function update_wwff() { - // set the last run in cron table for the correct cron id - $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); + $this->load->model('Update_model'); + $result = $this->Update_model->wwff(); + echo $result; - $csvfile = 'https://wwff.co/wwff-data/wwff_directory.csv'; - - $wwfffile = './assets/json/wwff.txt'; - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $csvfile); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog Updater'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $csv = curl_exec($ch); - curl_close($ch); - if ($csv === FALSE) { - echo "Something went wrong with fetching the WWFF file"; - return; - } - - $wwfffilehandle = fopen($wwfffile, 'w'); - if ($wwfffilehandle === FALSE) { - echo"FAILED: Could not write to wwff.txt file"; - return; - } - - $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++; - } - } - - fclose($wwfffilehandle); - - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " WWFF's saved"; - } else { - echo"FAILED: Empty file"; - } } public function update_pota() { - // set the last run in cron table for the correct cron id - $this->load->model('cron_model'); - $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); - - $csvfile = 'https://pota.app/all_parks.csv'; - - $potafile = './assets/json/pota.txt'; - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $csvfile); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog Updater'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $csv = curl_exec($ch); - curl_close($ch); - if ($csv === FALSE) { - echo "Something went wrong with fetching the POTA file"; - return; - } - - $potafilehandle = fopen($potafile, 'w'); - if ($potafilehandle === FALSE) { - echo"FAILED: Could not write to pota.txt file"; - return; - } - $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++; - } - } - - fclose($potafilehandle); - - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " POTA's saved"; - } else { - echo"FAILED: Empty file"; - } + $this->load->model('Update_model'); + $result = $this->Update_model->pota(); + echo $result; + } } diff --git a/application/controllers/User.php b/application/controllers/User.php index c344ca598..2ca5bcad9 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -149,7 +149,14 @@ class User extends CI_Controller { $this->input->post('user_wwff_to_qso_tab'), $this->input->post('user_pota_to_qso_tab'), $this->input->post('user_sig_to_qso_tab'), - $this->input->post('user_dok_to_qso_tab') + $this->input->post('user_dok_to_qso_tab'), + $this->input->post('user_lotw_name'), + $this->input->post('user_lotw_password'), + $this->input->post('user_eqsl_name'), + $this->input->post('user_eqsl_password'), + $this->input->post('user_clublog_name'), + $this->input->post('user_clublog_password'), + $this->input->post('user_winkey') )) { // Check for errors case EUSERNAMEEXISTS: @@ -227,6 +234,7 @@ class User extends CI_Controller { $query = $this->user_model->get_by_id($this->uri->segment(3)); $data['existing_languages'] = $this->find(); + $pwd_placeholder = '**********'; $this->load->model('bands'); $this->load->library('form_validation'); @@ -275,7 +283,11 @@ class User extends CI_Controller { if($this->input->post('user_password', true)) { $data['user_password'] = $this->input->post('user_password',true); } else { - $data['user_password'] = $q->user_password; + if ($q->user_password !== '' && $q->user_password !== null) { + $data['user_password'] = $pwd_placeholder; + } else { + $data['user_password'] = ''; + } } if($this->input->post('user_type', true)) { @@ -341,13 +353,21 @@ class User extends CI_Controller { if($this->input->post('user_clublog_password')) { $data['user_clublog_password'] = $this->input->post('user_clublog_password', true); } else { - $data['user_clublog_password'] = $q->user_clublog_password; + if ($q->user_clublog_password !== '' && $q->user_clublog_password !== null) { + $data['user_clublog_password'] = $pwd_placeholder; + } else { + $data['user_clublog_password'] = ''; + } } if($this->input->post('user_lotw_password')) { $data['user_lotw_password'] = $this->input->post('user_lotw_password', true); } else { - $data['user_lotw_password'] = $q->user_lotw_password; + if ($q->user_lotw_password !== '' && $q->user_lotw_password !== null) { + $data['user_lotw_password'] = $pwd_placeholder; + } else { + $data['user_lotw_password'] = ''; + } } if($this->input->post('user_eqsl_name')) { @@ -359,7 +379,11 @@ class User extends CI_Controller { if($this->input->post('user_eqsl_password')) { $data['user_eqsl_password'] = $this->input->post('user_eqsl_password', true); } else { - $data['user_eqsl_password'] = $q->user_eqsl_password; + if ($q->user_eqsl_password !== '' && $q->user_eqsl_password !== null) { + $data['user_eqsl_password'] = $pwd_placeholder; + } else { + $data['user_eqsl_password'] = ''; + } } if($this->input->post('user_measurement_base')) { @@ -510,7 +534,7 @@ class User extends CI_Controller { if($this->input->post('user_hamsat_key', true)) { $data['user_hamsat_key'] = $this->input->post('user_hamsat_key', true); } else { - $hkey_opt=$this->user_options_model->get_options('hamsat',array('option_name'=>'hamsat_key','option_key'=>'api'))->result(); + $hkey_opt=$this->user_options_model->get_options('hamsat',array('option_name'=>'hamsat_key','option_key'=>'api'), $this->uri->segment(3))->result(); if (count($hkey_opt)>0) { $data['user_hamsat_key'] = $hkey_opt[0]->option_value; } else { @@ -521,7 +545,7 @@ class User extends CI_Controller { if($this->input->post('user_hamsat_workable_only')) { $data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only', false); } else { - $hkey_opt=$this->user_options_model->get_options('hamsat',array('option_name'=>'hamsat_key','option_key'=>'workable'))->result(); + $hkey_opt=$this->user_options_model->get_options('hamsat',array('option_name'=>'hamsat_key','option_key'=>'workable'), $this->uri->segment(3))->result(); if (count($hkey_opt)>0) { $data['user_hamsat_workable_only'] = $hkey_opt[0]->option_value; } @@ -530,7 +554,7 @@ class User extends CI_Controller { if($this->input->post('user_iota_to_qso_tab')) { $data['user_iota_to_qso_tab'] = $this->input->post('user_iota_to_qso_tab', false); } else { - $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'iota','option_key'=>'show'))->result(); + $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'iota','option_key'=>'show'), $this->uri->segment(3))->result(); if (count($qkey_opt)>0) { $data['user_iota_to_qso_tab'] = $qkey_opt[0]->option_value; } @@ -539,7 +563,7 @@ class User extends CI_Controller { if($this->input->post('user_sota_to_qso_tab')) { $data['user_sota_to_qso_tab'] = $this->input->post('user_sota_to_qso_tab', false); } else { - $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'sota','option_key'=>'show'))->result(); + $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'sota','option_key'=>'show'), $this->uri->segment(3))->result(); if (count($qkey_opt)>0) { $data['user_sota_to_qso_tab'] = $qkey_opt[0]->option_value; } @@ -548,7 +572,7 @@ class User extends CI_Controller { if($this->input->post('user_wwff_to_qso_tab')) { $data['user_wwff_to_qso_tab'] = $this->input->post('user_wwff_to_qso_tab', false); } else { - $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'wwff','option_key'=>'show'))->result(); + $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'wwff','option_key'=>'show'), $this->uri->segment(3))->result(); if (count($qkey_opt)>0) { $data['user_wwff_to_qso_tab'] = $qkey_opt[0]->option_value; } @@ -557,7 +581,7 @@ class User extends CI_Controller { if($this->input->post('user_pota_to_qso_tab')) { $data['user_pota_to_qso_tab'] = $this->input->post('user_pota_to_qso_tab', false); } else { - $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'pota','option_key'=>'show'))->result(); + $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'pota','option_key'=>'show'), $this->uri->segment(3))->result(); if (count($qkey_opt)>0) { $data['user_pota_to_qso_tab'] = $qkey_opt[0]->option_value; } @@ -566,7 +590,7 @@ class User extends CI_Controller { if($this->input->post('user_sig_to_qso_tab')) { $data['user_sig_to_qso_tab'] = $this->input->post('user_sig_to_qso_tab', false); } else { - $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'sig','option_key'=>'show'))->result(); + $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'sig','option_key'=>'show'), $this->uri->segment(3))->result(); if (count($qkey_opt)>0) { $data['user_sig_to_qso_tab'] = $qkey_opt[0]->option_value; } @@ -575,7 +599,7 @@ class User extends CI_Controller { if($this->input->post('user_dok_to_qso_tab')) { $data['user_dok_to_qso_tab'] = $this->input->post('user_dok_to_qso_tab', false); } else { - $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'dok','option_key'=>'show'))->result(); + $qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'dok','option_key'=>'show'), $this->uri->segment(3))->result(); if (count($qkey_opt)>0) { $data['user_dok_to_qso_tab'] = $qkey_opt[0]->option_value; } @@ -612,8 +636,8 @@ class User extends CI_Controller { 'qso'=>array('fas fa-broadcast-tower', 'fas fa-user', 'fas fa-dot-circle' ), 'qsoconfirm'=>array('0', 'fas fa-broadcast-tower', 'fas fa-user', 'fas fa-dot-circle', 'fas fa-check-circle' )); - $data['user_locations_quickswitch'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'locations_quickswitch'))->row()->option_value ?? 'false'); - $data['user_utc_headermenu'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'utc_headermenu'))->row()->option_value ?? 'false'); + $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); diff --git a/application/language/bulgarian/account_lang.php b/application/language/bulgarian/account_lang.php index 7543b566c..a95925125 100644 --- a/application/language/bulgarian/account_lang.php +++ b/application/language/bulgarian/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/chinese_simplified/account_lang.php b/application/language/chinese_simplified/account_lang.php index 5884a1cf8..91056caad 100644 --- a/application/language/chinese_simplified/account_lang.php +++ b/application/language/chinese_simplified/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = '上传卫星状态到'; $lang['account_logbook_of_the_world'] = 'Logbook of the World(LoTW)'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) 用户名'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) 密码'; -$lang['account_leave_blank_to_keep_existing_password'] = '留空以保留现有密码'; $lang['account_clublog'] = 'Clublog'; $lang['account_clublog_email_callsign'] = 'Clublog 邮件地址/呼号'; diff --git a/application/language/czech/account_lang.php b/application/language/czech/account_lang.php index 5ac22ac49..a816dadfd 100644 --- a/application/language/czech/account_lang.php +++ b/application/language/czech/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Nahrávání stavu SAT QSOs na' $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Přihlašovací jméno Logbook of The World (LoTW)'; $lang['account_logbook_of_the_world_lotw_password'] = 'Heslo Logbook of The World (LoTW)'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Ponechte prázdné, pokud chcete zachovat stávající heslo'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Email nebo značka volacího znaku Club Logu'; diff --git a/application/language/dutch/account_lang.php b/application/language/dutch/account_lang.php index 955e00c93..ef2d9d3b9 100644 --- a/application/language/dutch/account_lang.php +++ b/application/language/dutch/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/english/account_lang.php b/application/language/english/account_lang.php index e1a1543e4..ee38d4384 100644 --- a/application/language/english/account_lang.php +++ b/application/language/english/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/finnish/account_lang.php b/application/language/finnish/account_lang.php index cfa9bfe54..931993338 100644 --- a/application/language/finnish/account_lang.php +++ b/application/language/finnish/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Käyttäjänimi'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Salasana'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Jätä tyhjäksi säilyttääksesi tietokannan nykyisen salasanan'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Sähköposti/Kutsu'; diff --git a/application/language/french/account_lang.php b/application/language/french/account_lang.php index d6d50ccd5..2eb5ac9e1 100644 --- a/application/language/french/account_lang.php +++ b/application/language/french/account_lang.php @@ -73,7 +73,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = "Envoi des statuts des QSO par S $lang['account_logbook_of_the_world'] = "Logbook of the World"; $lang['account_logbook_of_the_world_lotw_username'] = "Utilisateur"; $lang['account_logbook_of_the_world_lotw_password'] = "Mot de passe"; -$lang['account_leave_blank_to_keep_existing_password'] = "(Laisser vide pour conserver le mot de passe existant)"; $lang['account_clublog'] = "Club Log"; $lang['account_clublog_email_callsign'] = "Email/Callsign"; diff --git a/application/language/german/account_lang.php b/application/language/german/account_lang.php index 9cec4eeb5..17c7d3ef8 100644 --- a/application/language/german/account_lang.php +++ b/application/language/german/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Status von SAT QSOs hochladen a $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Benutzername'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Passwort'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leer lassen um das existierende Passwort zu übernehmen'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Rufzeichen'; diff --git a/application/language/greek/account_lang.php b/application/language/greek/account_lang.php index 00158661b..1b1d89f66 100644 --- a/application/language/greek/account_lang.php +++ b/application/language/greek/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/italian/account_lang.php b/application/language/italian/account_lang.php index 1137c86db..38d9cfd18 100644 --- a/application/language/italian/account_lang.php +++ b/application/language/italian/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/polish/account_lang.php b/application/language/polish/account_lang.php index 23ed747aa..02ba7fb1f 100644 --- a/application/language/polish/account_lang.php +++ b/application/language/polish/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/russian/account_lang.php b/application/language/russian/account_lang.php index 224fead36..72d46dc85 100644 --- a/application/language/russian/account_lang.php +++ b/application/language/russian/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Загружать статус $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Логин'; $lang['account_logbook_of_the_world_lotw_password'] = 'Пароль'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Оставьте пустым для сохранения текущего пароля'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Емэйл/позывной'; diff --git a/application/language/spanish/account_lang.php b/application/language/spanish/account_lang.php index f9f6178ea..e0afbe24d 100644 --- a/application/language/spanish/account_lang.php +++ b/application/language/spanish/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Subir los estados de QSOs de SA $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Nombre de Usuario Logbook of The World (LoTW)'; $lang['account_logbook_of_the_world_lotw_password'] = 'Contraseña Logbook of The World (LoTW)'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Deje la contraseña en blanco para mantener la contraseña actual'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Correo/Indicativo de Club Log'; diff --git a/application/language/swedish/account_lang.php b/application/language/swedish/account_lang.php index eb77aa2d3..51f95b8d9 100644 --- a/application/language/swedish/account_lang.php +++ b/application/language/swedish/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Ladda upp status för SAT QSOs $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Användarnamn'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Lösenord'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Lämna tomt om du vill behålla befintligt lösenord'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/language/turkish/account_lang.php b/application/language/turkish/account_lang.php index 8b250f043..84084966d 100644 --- a/application/language/turkish/account_lang.php +++ b/application/language/turkish/account_lang.php @@ -75,7 +75,6 @@ $lang['account_upload_status_of_sat_qsos_to'] = 'Upload status of SAT QSOs to'; $lang['account_logbook_of_the_world'] = 'Logbook of the World'; $lang['account_logbook_of_the_world_lotw_username'] = 'Logbook of The World (LoTW) Username'; $lang['account_logbook_of_the_world_lotw_password'] = 'Logbook of The World (LoTW) Password'; -$lang['account_leave_blank_to_keep_existing_password'] = 'Leave blank to keep existing password'; $lang['account_clublog'] = 'Club Log'; $lang['account_clublog_email_callsign'] = 'Club Log Email/Callsign'; diff --git a/application/libraries/Paths.php b/application/libraries/Paths.php index 35e69919b..9d4d262aa 100644 --- a/application/libraries/Paths.php +++ b/application/libraries/Paths.php @@ -20,4 +20,16 @@ class Paths $CI->load->model('Qsl_model'); return $CI->Qsl_model->get_imagePath(); } + + function make_update_path($path) { + + $CI = & get_instance(); + + $path = "updates/" . $path; + $datadir = $CI->config->item('datadir'); + if(!$datadir) { + return $path; + } + return $datadir . "/" . $path; + } } diff --git a/application/models/Update_model.php b/application/models/Update_model.php new file mode 100644 index 000000000..6e54a3a19 --- /dev/null +++ b/application/models/Update_model.php @@ -0,0 +1,237 @@ +load->model('cron_model'); + $this->load->library('Paths'); + + $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); + + $strFile = $this->paths->make_update_path("clublog_scp.txt"); + + $url = "https://cdn.clublog.org/clublog.scp.gz"; + set_time_limit(300); + + $gz = gzopen($url, 'r'); + if ($gz) { + $data = ""; + while (!gzeof($gz)) { + $data .= gzgetc($gz); + } + gzclose($gz); + if (file_put_contents($strFile, $data) !== FALSE) { + $nCount = count(file($strFile)); + if ($nCount > 0) { + return "DONE: " . number_format($nCount) . " callsigns loaded"; + } else { + return "FAILED: Empty file"; + } + } else { + return "FAILED: Could not write to Club Log SCP file"; + } + } else { + return "FAILED: Could not connect to Club Log"; + } + } + + function dok() { + // set the last run in cron table for the correct cron id + $this->load->model('cron_model'); + $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); + + $contents = file_get_contents('https://www.df2et.de/cqrlog/dok_and_sdok.txt', true); + + if ($contents === FALSE) { + return "Something went wrong with fetching the DOK file."; + } else { + $file = './assets/json/dok.txt'; + + if (file_put_contents($file, $contents) !== FALSE) { // Save our content to the file. + $nCount = count(file($file)); + if ($nCount > 0) { + return "DONE: " . number_format($nCount) . " DOKs and SDOKs saved"; + } else { + return "FAILED: Empty file"; + } + } else { + return "FAILED: Could not write to dok.txt file"; + } + } + } + + function sota() { + // set the last run in cron table for the correct cron id + $this->load->model('cron_model'); + $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); + + $csvfile = 'https://www.sotadata.org.uk/summitslist.csv'; + + $sotafile = './assets/json/sota.txt'; + + $csvhandle = fopen($csvfile, "r"); + if ($csvhandle === FALSE) { + return "Something went wrong with fetching the SOTA file"; + } + + $data = fgetcsv($csvhandle, 1000, ","); // Skip line we are not interested in + $data = fgetcsv($csvhandle, 1000, ","); // Skip line we are not interested in + $data = fgetcsv($csvhandle, 1000, ","); + $sotafilehandle = fopen($sotafile, 'w'); + + if ($sotafilehandle === FALSE) { + return "FAILED: Could not write to sota.txt file"; + } + + $nCount = 0; + do { + if ($data[0]) { + fwrite($sotafilehandle, $data[0] . PHP_EOL); + $nCount++; + } + } while ($data = fgetcsv($csvhandle, 1000, ",")); + + fclose($csvhandle); + fclose($sotafilehandle); + + if ($nCount > 0) { + return "DONE: " . number_format($nCount) . " SOTA's saved"; + } else { + return "FAILED: Empty file"; + } + } + + function wwff() { + // set the last run in cron table for the correct cron id + $this->load->model('cron_model'); + $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); + + $csvfile = 'https://wwff.co/wwff-data/wwff_directory.csv'; + + $wwfffile = './assets/json/wwff.txt'; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $csvfile); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog Updater'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $csv = curl_exec($ch); + curl_close($ch); + if ($csv === FALSE) { + return "Something went wrong with fetching the WWFF file"; + } + + $wwfffilehandle = fopen($wwfffile, 'w'); + if ($wwfffilehandle === FALSE) { + return "FAILED: Could not write to wwff.txt file"; + } + + $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++; + } + } + + fclose($wwfffilehandle); + + if ($nCount > 0) { + return "DONE: " . number_format($nCount) . " WWFF's saved"; + } else { + return "FAILED: Empty file"; + } + } + + function pota() { + // set the last run in cron table for the correct cron id + $this->load->model('cron_model'); + $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); + + $csvfile = 'https://pota.app/all_parks.csv'; + + $potafile = './assets/json/pota.txt'; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $csvfile); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog Updater'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $csv = curl_exec($ch); + curl_close($ch); + if ($csv === FALSE) { + return "Something went wrong with fetching the POTA file"; + } + + $potafilehandle = fopen($potafile, 'w'); + if ($potafilehandle === FALSE) { + return "FAILED: Could not write to pota.txt file"; + } + $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++; + } + } + + fclose($potafilehandle); + + if ($nCount > 0) { + return "DONE: " . number_format($nCount) . " POTA's saved"; + } else { + return "FAILED: Empty file"; + } + } + + function lotw_users() { + // set the last run in cron table for the correct cron id + $this->load->model('cron_model'); + $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); + + $mtime = microtime(); + $mtime = explode(" ", $mtime); + $mtime = $mtime[1] + $mtime[0]; + $starttime = $mtime; + + $file = 'https://lotw.arrl.org/lotw-user-activity.csv'; + + $handle = fopen($file, "r"); + if ($handle === FALSE) { + return "Something went wrong with fetching the LoTW uses file"; + } + $this->db->empty_table("lotw_users"); + $i = 0; + $data = fgetcsv($handle, 1000, ","); + do { + if ($data[0]) { + $lotwdata[$i]['callsign'] = $data[0]; + $lotwdata[$i]['lastupload'] = $data[1] . ' ' . $data[2]; + if (($i % 2000) == 0) { + $this->db->insert_batch('lotw_users', $lotwdata); + unset($lotwdata); + // echo 'Record ' . $i . '
'; + } + $i++; + } + } while ($data = fgetcsv($handle, 1000, ",")); + fclose($handle); + + $this->db->insert_batch('lotw_users', $lotwdata); + + $mtime = microtime(); + $mtime = explode(" ", $mtime); + $mtime = $mtime[1] + $mtime[0]; + $endtime = $mtime; + $totaltime = ($endtime - $starttime); + return "Records inserted: " . $i . " in " . $totaltime . " seconds
"; + } +} diff --git a/application/models/User_model.php b/application/models/User_model.php index cd29c6e20..6d01343c3 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -151,7 +151,9 @@ class User_Model extends CI_Model { $user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url, $user_default_band, $user_default_confirmation, $user_qso_end_times, $user_quicklog, $user_quicklog_enter, $language, $user_hamsat_key, $user_hamsat_workable_only, $user_iota_to_qso_tab, $user_sota_to_qso_tab, - $user_wwff_to_qso_tab, $user_pota_to_qso_tab, $user_sig_to_qso_tab, $user_dok_to_qso_tab) { + $user_wwff_to_qso_tab, $user_pota_to_qso_tab, $user_sig_to_qso_tab, $user_dok_to_qso_tab, + $user_lotw_name, $user_lotw_password, $user_eqsl_name, $user_eqsl_password, $user_clublog_name, $user_clublog_password, + $user_winkey) { // Check that the user isn't already used if(!$this->exists($username)) { $data = array( @@ -186,7 +188,14 @@ class User_Model extends CI_Model { 'user_qso_end_times' => xss_clean($user_qso_end_times), 'user_quicklog' => xss_clean($user_quicklog), 'user_quicklog_enter' => xss_clean($user_quicklog_enter), - 'language' => xss_clean($language) + 'language' => xss_clean($language), + 'user_lotw_name' => xss_clean($user_lotw_name), + 'user_lotw_password' => xss_clean($user_lotw_password), + 'user_eqsl_name' => xss_clean($user_eqsl_name), + 'user_eqsl_password' => xss_clean($user_eqsl_password), + 'user_clublog_name' => xss_clean($user_clublog_name), + 'user_clublog_password' => xss_clean($user_clublog_password), + 'winkey' => xss_clean($user_winkey) ); // Check the password is valid @@ -291,28 +300,44 @@ class User_Model extends CI_Model { return EEMAILEXISTS; } + $pwd_placeholder = '**********'; + // Hash password if($fields['user_password'] != NULL) { - $data['user_password'] = $this->_hash($fields['user_password']); - if($data['user_password'] == EPASSWORDINVALID) { - return EPASSWORDINVALID; + if ($fields['user_password'] !== $pwd_placeholder) { + $data['user_password'] = $this->_hash($fields['user_password']); + if($data['user_password'] == EPASSWORDINVALID) { + return EPASSWORDINVALID; + } } } - if($fields['user_lotw_password'] != NULL) + if($fields['user_lotw_password'] != '') { - $data['user_lotw_password'] = $fields['user_lotw_password']; + if ($fields['user_lotw_password'] !== $pwd_placeholder) { + $data['user_lotw_password'] = $fields['user_lotw_password']; + } + } else { + $data['user_lotw_password'] = NULL; } - if($fields['user_clublog_password'] != NULL) + if($fields['user_clublog_password'] != '') { - $data['user_clublog_password'] = $fields['user_clublog_password']; + if ($fields['user_clublog_password'] !== $pwd_placeholder) { + $data['user_clublog_password'] = $fields['user_clublog_password']; + } + } else { + $data['user_clublog_password'] = NULL; } - if($fields['user_eqsl_password'] != NULL) + if($fields['user_eqsl_password'] != '') { - $data['user_eqsl_password'] = $fields['user_eqsl_password']; + if ($fields['user_eqsl_password'] !== $pwd_placeholder) { + $data['user_eqsl_password'] = $fields['user_eqsl_password']; + } + } else { + $data['user_eqsl_password'] = NULL; } // Update the user diff --git a/application/views/activated_gridmap/index.php b/application/views/activated_gridmap/index.php index 1b9c28335..0c2da4145 100644 --- a/application/views/activated_gridmap/index.php +++ b/application/views/activated_gridmap/index.php @@ -1,4 +1,4 @@ -
+

@@ -96,7 +96,7 @@
-
+
diff --git a/application/views/awards/ffma/index.php b/application/views/awards/ffma/index.php index ba4b8c7b2..e9baf3c0b 100644 --- a/application/views/awards/ffma/index.php +++ b/application/views/awards/ffma/index.php @@ -1,21 +1,5 @@ - - -
+

@@ -40,7 +24,7 @@
-
+
:
diff --git a/application/views/awards/gridmaster/index.php b/application/views/awards/gridmaster/index.php index 5dcab8ace..37bfab1e9 100644 --- a/application/views/awards/gridmaster/index.php +++ b/application/views/awards/gridmaster/index.php @@ -1,4 +1,4 @@ -
+

@@ -23,7 +23,7 @@
-
+
:
diff --git a/application/views/debug/index.php b/application/views/debug/index.php index 75aeae2b5..086ac8ae5 100644 --- a/application/views/debug/index.php +++ b/application/views/debug/index.php @@ -66,7 +66,15 @@
- + @@ -587,4 +595,4 @@ var local_branch = 'n/a'; - \ No newline at end of file + diff --git a/application/views/gridmap/index.php b/application/views/gridmap/index.php index 93a292a94..d9c46718f 100644 --- a/application/views/gridmap/index.php +++ b/application/views/gridmap/index.php @@ -1,4 +1,4 @@ -
+

@@ -140,7 +140,7 @@
-
+
diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index a05b1f72b..efad26ebe 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -1,67 +1,67 @@ -
- session->flashdata('message')) { ?> - -
-

session->flashdata('message'); ?>

-
- -
+
+
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ +
-
" - method="post"> + " method="post">
@@ -112,8 +112,7 @@ $options = json_decode($options);
- +
@@ -392,13 +391,13 @@ $options = json_decode($options);
- - - -
DateCallsign
PHP Version + = 0) { + echo phpversion()." OK"; + } else { + echo phpversion()." Deprecated"; + } + ?> +
+ + + + datetime->show ?? "true") == "true") { + echo ''; + } ?> + de->show ?? "true") == "true") { + echo ''; + } ?> + dx->show ?? "true") == "true") { + echo ''; + } ?> + mode->show ?? "true") == "true") { + echo ''; + } ?> + rsts->show ?? "true") == "true") { + echo ''; + } ?> + rstr->show ?? "true") == "true") { + echo ''; + } ?> + band->show ?? "true") == "true") { + echo ''; + } ?> + myrefs->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + } ?> + name->show ?? "true") == "true") { + echo ''; + } ?> + qslvia->show ?? "true") == "true") { + echo ''; + } ?> + qsl->show ?? "true") == "true") { + echo ''; + } ?> + session->userdata('user_eqsl_name') != "" && ($options->eqsl->show ?? "true") == "true") { + echo ''; + } ?> + session->userdata('user_lotw_name') != "" && ($options->lotw->show ?? "true") == "true") { + echo ''; + } ?> + qslmsg->show ?? "true") == "true") { + echo ''; + } ?> + dxcc->show ?? "true") == "true") { + echo ''; + } ?> + state->show ?? "true") == "true") { + echo ''; + } ?> + cqzone->show ?? "true") == "true") { + echo ''; + } ?> + ituzone->show ?? "true") == "true") { + echo ''; + } ?> + iota->show ?? "true") == "true") { + echo ''; + } ?> + pota->show ?? "true") == "true") { + echo ''; + } ?> + operator->show ?? "true") == "true") { + echo ''; + } ?> + comment->show ?? "true") == "true") { + echo ''; + } ?> + + + + +
+
+
' . lang('general_word_datetime') . '' . lang('gen_hamradio_de') . '' . lang('gen_hamradio_dx') . '' . lang('gen_hamradio_mode') . '' . lang('gen_hamradio_rsts') . '' . lang('gen_hamradio_rstr') . '' . lang('gen_hamradio_band') . '' . lang('gen_hamradio_myrefs') . '' . lang('gen_hamradio_refs') . '' . lang('general_word_name') . '' . lang('gen_hamradio_qslvia') . '' . lang('gen_hamradio_qsl') . 'eQSLLoTW' . lang('gen_hamradio_qslmsg') . '' . lang('gen_hamradio_dxcc') . '' . lang('gen_hamradio_state') . '' . lang('gen_hamradio_cq_zone') . '' . lang('gen_hamradio_itu_zone') . '' . lang('gen_hamradio_iota') . '' . lang('gen_hamradio_pota') . '' . lang('gen_hamradio_operator') . '' . lang('general_word_comment') . '
- - - - - - - datetime->show ?? "true") == "true") { - echo ''; - } ?> - de->show ?? "true") == "true") { - echo ''; - } ?> - dx->show ?? "true") == "true") { - echo ''; - } ?> - mode->show ?? "true") == "true") { - echo ''; - } ?> - rsts->show ?? "true") == "true") { - echo ''; - } ?> - rstr->show ?? "true") == "true") { - echo ''; - } ?> - band->show ?? "true") == "true") { - echo ''; - } ?> - myrefs->show ?? "true") == "true") { - echo ''; - } ?> - refs->show ?? "true") == "true") { - echo ''; - } ?> - name->show ?? "true") == "true") { - echo ''; - } ?> - qslvia->show ?? "true") == "true") { - echo ''; - } ?> - qsl->show ?? "true") == "true") { - echo ''; - } ?> - session->userdata('user_eqsl_name') != "" && ($options->eqsl->show ?? "true") == "true"){ - echo ''; - } ?> - session->userdata('user_lotw_name') != "" && ($options->lotw->show ?? "true") == "true"){ - echo ''; - } ?> - qslmsg->show ?? "true") == "true") { - echo ''; - } ?> - dxcc->show ?? "true") == "true") { - echo ''; - } ?> - state->show ?? "true") == "true") { - echo ''; - } ?> - cqzone->show ?? "true") == "true") { - echo ''; - } ?> - ituzone->show ?? "true") == "true") { - echo ''; - } ?> - iota->show ?? "true") == "true") { - echo ''; - } ?> - pota->show ?? "true") == "true") { - echo ''; - } ?> - operator->show ?? "true") == "true") { - echo ''; - } ?> - comment->show ?? "true") == "true") { - echo ''; - } ?> - - - - -
-
-
' . lang('general_word_datetime') . '' . lang('gen_hamradio_de') . '' . lang('gen_hamradio_dx') . '' . lang('gen_hamradio_mode') . '' . lang('gen_hamradio_rsts') . '' . lang('gen_hamradio_rstr') . '' . lang('gen_hamradio_band') . '' . lang('gen_hamradio_myrefs') . '' . lang('gen_hamradio_refs') . '' . lang('general_word_name') . '' . lang('gen_hamradio_qslvia') . '' . lang('gen_hamradio_qsl') . 'eQSLLoTW' . lang('gen_hamradio_qslmsg') . '' . lang('gen_hamradio_dxcc') . '' . lang('gen_hamradio_state') . '' . lang('gen_hamradio_cq_zone') . '' . lang('gen_hamradio_itu_zone') . '' . lang('gen_hamradio_iota') . '' . lang('gen_hamradio_pota') . '' . lang('gen_hamradio_operator') . '' . lang('general_word_comment') . '
- + \ No newline at end of file diff --git a/application/views/lookup/index.php b/application/views/lookup/index.php index d1572cf5d..c454e729b 100644 --- a/application/views/lookup/index.php +++ b/application/views/lookup/index.php @@ -7,6 +7,7 @@ +
 
@@ -63,4 +64,4 @@
-
\ No newline at end of file + diff --git a/application/views/lookup/lotwuser.php b/application/views/lookup/lotwuser.php new file mode 100644 index 000000000..eaa4fa431 --- /dev/null +++ b/application/views/lookup/lotwuser.php @@ -0,0 +1,16 @@ + 365) { + $lotw_hint = ' lotw_info_red'; + } elseif ($lotw_lastupload > 30) { + $lotw_hint = ' lotw_info_orange'; + } elseif ($lotw_lastupload > 7) { + $lotw_hint = ' lotw_info_yellow'; + } + echo 'Yes last upload '.$lotw_lastupload.' days ago'; +} else { + echo "No"; +} +?> diff --git a/application/views/qso/components/previous_contacts.php b/application/views/qso/components/previous_contacts.php index f4cf26494..283818269 100644 --- a/application/views/qso/components/previous_contacts.php +++ b/application/views/qso/components/previous_contacts.php @@ -1,7 +1,7 @@
- +
@@ -61,13 +61,13 @@ function echo_table_col($row, $name) { case 'SOTA': echo ''; break; case 'WWFF': echo ''; break; case 'POTA': echo ''; break; - case 'Grid': - $ci->load->library('qra'); + case 'Grid': + $ci->load->library('qra'); echo ''; break; case 'Distance': echo ''; break; case 'Band': echo ''; } else { echo strtolower($row->COL_BAND); } echo ''; break; - case 'Frequency': - $ci->load->library('frequency'); + case 'Frequency': + $ci->load->library('frequency'); echo ''; } else { if($row->COL_FREQ != null) { echo $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { echo strtolower($row->COL_BAND); } } echo ''; break; case 'State': echo ''; break; case 'Operator': echo ''; break; diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 7671ffc5c..39cdc4e43 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -694,7 +694,13 @@
-
+ optionslib->get_option('disable_refresh_past_contacts'); + if($result === null) { ?> +
+ +
+
diff --git a/application/views/user/edit.php b/application/views/user/edit.php index e2647a90d..c5dbd7959 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -63,13 +63,12 @@
- +
".$password_error.""; } else if (!isset($user_add)) { ?> -
@@ -81,7 +80,7 @@ config->item('auth_level'); foreach ($levels as $key => $value) { - echo ''; + echo ''; } ?> @@ -708,13 +707,12 @@
- +
".$lotwpassword_error.""; } else if (!isset($user_add)) { ?> -
@@ -735,13 +733,12 @@
- +
".$eqslpassword_error.""; } else if (!isset($user_add)) { ?> -
@@ -763,13 +760,12 @@
- +
".$clublogpassword_error.""; } else if (!isset($user_add)) { ?> -
diff --git a/application/views/visitor/layout/footer.php b/application/views/visitor/layout/footer.php index 3b37372db..d4a767cf0 100644 --- a/application/views/visitor/layout/footer.php +++ b/application/views/visitor/layout/footer.php @@ -59,6 +59,32 @@ + +
/ ' . ($row->COL_SOTA_REF) . '' . ($row->COL_WWFF_REF) . '' . ($row->COL_POTA_REF) . '' . ($ci->qra->echoQrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE)) . '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : '') . ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.'' . ($row->COL_STATE) . '' . ($row->COL_OPERATOR) . '