当前提交
3a28eb551d
共有 1 个文件被更改,包括 18 次插入 和 14 次删除
|
|
@ -630,14 +630,22 @@ class Lotw extends CI_Controller {
|
||||||
$query = $this->user_model->get_all_lotw_users();
|
$query = $this->user_model->get_all_lotw_users();
|
||||||
|
|
||||||
if ($query->num_rows() >= 1) {
|
if ($query->num_rows() >= 1) {
|
||||||
$results='';
|
$result = '';
|
||||||
foreach ($query->result() as $user) {
|
foreach ($query->result() as $user) {
|
||||||
if ( ($sync_user_id != null) && ($sync_user_id != $user->user_id) ) { continue; }
|
if ( ($sync_user_id != null) && ($sync_user_id != $user->user_id) ) { continue; }
|
||||||
|
|
||||||
|
// Validate that LoTW credentials are not empty
|
||||||
|
// TODO: We don't actually see the error message
|
||||||
|
if ($user->user_lotw_password == '') {
|
||||||
|
$result = "You have not defined your ARRL LoTW credentials!";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$config['upload_path'] = './uploads/';
|
$config['upload_path'] = './uploads/';
|
||||||
$file = $config['upload_path'] . 'lotwreport_download.adi';
|
$file = $config['upload_path'] . 'lotwreport_download.adi';
|
||||||
if (file_exists($file) && ! is_writable($file)) {
|
if (file_exists($file) && ! is_writable($file)) {
|
||||||
$results .= "Temporary download file ".$file." is not writable. Aborting!";
|
$result = "Temporary download file ".$file." is not writable. Aborting!";
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get credentials for LoTW
|
// Get credentials for LoTW
|
||||||
|
|
@ -649,13 +657,6 @@ class Lotw extends CI_Controller {
|
||||||
$q = $query->row();
|
$q = $query->row();
|
||||||
$lotw_url = $q->lotw_download_url;
|
$lotw_url = $q->lotw_download_url;
|
||||||
|
|
||||||
// Validate that LoTW credentials are not empty
|
|
||||||
// TODO: We don't actually see the error message
|
|
||||||
if ($data['user_lotw_name'] == '' || $data['user_lotw_password'] == '')
|
|
||||||
{
|
|
||||||
echo "You have not defined your ARRL LoTW credentials!";
|
|
||||||
}
|
|
||||||
|
|
||||||
$lotw_last_qsl_date = date('Y-m-d', strtotime($this->logbook_model->lotw_last_qsl_date($user->user_id)));
|
$lotw_last_qsl_date = date('Y-m-d', strtotime($this->logbook_model->lotw_last_qsl_date($user->user_id)));
|
||||||
|
|
||||||
// Build URL for LoTW report file
|
// Build URL for LoTW report file
|
||||||
|
|
@ -668,19 +669,22 @@ class Lotw extends CI_Controller {
|
||||||
$lotw_url .= "$lotw_last_qsl_date";
|
$lotw_url .= "$lotw_last_qsl_date";
|
||||||
|
|
||||||
if (! is_writable(dirname($file))) {
|
if (! is_writable(dirname($file))) {
|
||||||
$results.= "Temporary download directory ".dirname($file)." is not writable. Aborting!";
|
$result = "Temporary download directory ".dirname($file)." is not writable. Aborting!";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
file_put_contents($file, file_get_contents($lotw_url));
|
file_put_contents($file, file_get_contents($lotw_url));
|
||||||
if (file_get_contents($file, false, null, 0, 39) != "ARRL Logbook of the World Status Report") {
|
if (file_get_contents($file, false, null, 0, 39) != "ARRL Logbook of the World Status Report") {
|
||||||
$results.= "LoTW downloading failed for User ".$data['user_lotw_name']." either due to it being down or incorrect logins.";
|
$result = "LoTW downloading failed for User ".$data['user_lotw_name']." either due to it being down or incorrect logins.";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ini_set('memory_limit', '-1');
|
ini_set('memory_limit', '-1');
|
||||||
$results.= $this->loadFromFile($file, false);
|
$result = $this->loadFromFile($file, false);
|
||||||
}
|
}
|
||||||
return $results;
|
if ($result == '') {
|
||||||
|
$result = "You have not defined your ARRL LoTW credentials!";
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
return "No LoTW User details found to carry out matches.";
|
return "No LoTW User details found to carry out matches.";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用