WebAdif fixing. cron is trusted
这个提交包含在:
父节点
8e5dacea01
当前提交
bcc8bda3e5
共有 2 个文件被更改,包括 48 次插入 和 46 次删除
|
|
@ -21,7 +21,7 @@ class Webadif extends CI_Controller {
|
|||
foreach ($station_ids as $station) {
|
||||
$webadif_api_key = $station->webadifapikey;
|
||||
$webadif_api_url = $station->webadifapiurl;
|
||||
if ($this->mass_upload_qsos($station->station_id, $webadif_api_key, $webadif_api_url)) {
|
||||
if ($this->mass_upload_qsos($station->station_id, $webadif_api_key, $webadif_api_url, true)) {
|
||||
echo "QSOs have been uploaded to QO-100 Dx Club.";
|
||||
log_message('info', 'QSOs have been uploaded to QO-100 Dx Club.');
|
||||
} else {
|
||||
|
|
@ -47,9 +47,9 @@ class Webadif extends CI_Controller {
|
|||
* Function gets all QSOs from given station_id, that are not previously uploaded to webADIF consumer.
|
||||
* Adif is build for each qso, and then uploaded, one at a time
|
||||
*/
|
||||
function mass_upload_qsos($station_id, $webadif_api_key, $webadif_api_url) {
|
||||
function mass_upload_qsos($station_id, $webadif_api_key, $webadif_api_url, $trusted = false) {
|
||||
$i = 0;
|
||||
$data['qsos'] = $this->logbook_model->get_webadif_qsos($station_id);
|
||||
$data['qsos'] = $this->logbook_model->get_webadif_qsos($station_id, $trusted);
|
||||
$errormessages=array();
|
||||
|
||||
$CI =& get_instance();
|
||||
|
|
@ -91,7 +91,7 @@ class Webadif extends CI_Controller {
|
|||
|
||||
$data['page_title'] = "QO-100 Dx Club Upload";
|
||||
|
||||
$data['station_profiles'] = $this->stations->stations_with_webadif_api_key();
|
||||
$data['station_profiles'] = $this->stations->stations_with_webadif_api_key();
|
||||
$data['station_profile'] = $this->stations->stations_with_webadif_api_key();
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
|
|
@ -103,32 +103,34 @@ class Webadif extends CI_Controller {
|
|||
* Used for ajax-function when selecting log for upload to webADIF consumer
|
||||
*/
|
||||
public function upload_station() {
|
||||
$this->setOptions();
|
||||
$this->load->model('stations');
|
||||
$this->setOptions();
|
||||
$postData = $this->input->post();
|
||||
$this->load->model('stations');
|
||||
if (!$this->stations->check_station_is_accessible($postData['station_id'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$postData = $this->input->post();
|
||||
$this->load->model('logbook_model');
|
||||
$result = $this->logbook_model->exists_webadif_api_key($postData['station_id']);
|
||||
$webadif_api_key = $result->webadifapikey;
|
||||
$webadif_api_url = $result->webadifapiurl;
|
||||
header('Content-type: application/json');
|
||||
$result = $this->mass_upload_qsos($postData['station_id'], $webadif_api_key, $webadif_api_url);
|
||||
if ($result['status'] == 'OK') {
|
||||
$stationinfo = $this->stations->stations_with_webadif_api_key();
|
||||
$info = $stationinfo->result();
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
$result = $this->logbook_model->exists_webadif_api_key($postData['station_id']);
|
||||
$webadif_api_key = $result->webadifapikey;
|
||||
$webadif_api_url = $result->webadifapiurl;
|
||||
header('Content-type: application/json');
|
||||
$result = $this->mass_upload_qsos($postData['station_id'], $webadif_api_key, $webadif_api_url);
|
||||
if ($result['status'] == 'OK') {
|
||||
$stationinfo = $this->stations->stations_with_webadif_api_key();
|
||||
$info = $stationinfo->result();
|
||||
|
||||
$data['status'] = 'OK';
|
||||
$data['info'] = $info;
|
||||
$data['infomessage'] = $result['count'] . " QSOs are now uploaded to QO-100 Dx Club";
|
||||
$data['errormessages'] = $result['errormessages'];
|
||||
echo json_encode($data);
|
||||
} else {
|
||||
$data['status'] = 'Error';
|
||||
$data['info'] = 'Error: No QSOs found to upload.';
|
||||
$data['errormessages'] = $result['errormessages'];
|
||||
echo json_encode($data);
|
||||
}
|
||||
$data['status'] = 'OK';
|
||||
$data['info'] = $info;
|
||||
$data['infomessage'] = $result['count'] . " QSOs are now uploaded to QO-100 Dx Club";
|
||||
$data['errormessages'] = $result['errormessages'];
|
||||
echo json_encode($data);
|
||||
} else {
|
||||
$data['status'] = 'Error';
|
||||
$data['info'] = 'Error: No QSOs found to upload.';
|
||||
$data['errormessages'] = $result['errormessages'];
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function mark_webadif() {
|
||||
|
|
|
|||
|
|
@ -237,13 +237,13 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
if($station_id == "" || $station_id == "0") {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('stations');
|
||||
$station_id = $CI->stations->find_active();
|
||||
}
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
if (!$CI->Stations->check_station_is_accessible($station_id)) { // Hard Exit if station_profile not accessible
|
||||
$CI->load->model('stations');
|
||||
if (!$CI->stations->check_station_is_accessible($station_id)) { // Hard Exit if station_profile not accessible
|
||||
return 'Station not accessible<br>';
|
||||
}
|
||||
|
||||
|
|
@ -881,8 +881,8 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
// be sure that station belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
if (!$CI->Stations->check_station_is_accessible($stationId)) {
|
||||
$CI->load->model('stations');
|
||||
if (!$CI->stations->check_station_is_accessible($stationId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1376,8 +1376,8 @@ class Logbook_model extends CI_Model {
|
|||
function get_qsos_for_printing($station_id2 = null) {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('stations');
|
||||
$station_id = $CI->stations->find_active();
|
||||
|
||||
$sql = 'SELECT
|
||||
STATION_CALLSIGN,
|
||||
|
|
@ -1500,10 +1500,10 @@ class Logbook_model extends CI_Model {
|
|||
/*
|
||||
* Function returns the QSOs from the logbook, which have not been either marked as uploaded to webADIF
|
||||
*/
|
||||
function get_webadif_qsos($station_id,$from = null, $to = null){
|
||||
function get_webadif_qsos($station_id,$from = null, $to = null,$trusted = false){
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
if (!$CI->Stations->check_station_is_accessible($station_id)) {
|
||||
$CI->load->model('stations');
|
||||
if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) {
|
||||
return;
|
||||
}
|
||||
$sql = "
|
||||
|
|
@ -1968,8 +1968,8 @@ class Logbook_model extends CI_Model {
|
|||
/* Return QSOs for the year for the active profile */
|
||||
function map_all_qsos_for_active_station_profile() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('stations');
|
||||
$station_id = $CI->stations->find_active();
|
||||
|
||||
$this->db->where("station_id", $station_id);
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
|
|
@ -2762,12 +2762,12 @@ class Logbook_model extends CI_Model {
|
|||
function import($record, $station_id = "0", $skipDuplicate = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false,$skipexport = false, $operatorName = false, $apicall = false) {
|
||||
// be sure that station belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
if (!$CI->Stations->check_station_is_accessible($station_id) && $apicall == false ) {
|
||||
$CI->load->model('stations');
|
||||
if (!$CI->stations->check_station_is_accessible($station_id) && $apicall == false ) {
|
||||
return 'Station not accessible<br>';
|
||||
}
|
||||
|
||||
$station_profile=$CI->Stations->profile_clean($station_id);
|
||||
$station_profile=$CI->stations->profile_clean($station_id);
|
||||
$station_profile_call=$station_profile->station_callsign;
|
||||
|
||||
if (($station_id !=0 ) && (!(isset($record['station_callsign'])))) {
|
||||
|
|
@ -3078,8 +3078,8 @@ class Logbook_model extends CI_Model {
|
|||
// Get active station_id from station profile if one hasn't been provided
|
||||
if($station_id == "" || $station_id == "0") {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('stations');
|
||||
$station_id = $CI->stations->find_active();
|
||||
}
|
||||
|
||||
// Check if QSO is already in the database
|
||||
|
|
|
|||
正在加载…
在新工单中引用