Works now if QSLs are not waiting to be downloaded

这个提交包含在:
Corby Krick 2013-11-03 13:15:25 -06:00
父节点 0e348f4bb7
当前提交 e9fdc07b93
共有 2 个文件被更改,包括 63 次插入44 次删除

查看文件

@ -28,57 +28,63 @@ class eqsl extends CI_Controller {
$this->adif_parser->initialize(); $this->adif_parser->initialize();
$table = "<table>"; $records = $this->adif_parser->get_record();
while($record = $this->adif_parser->get_record()) if (count($records) > 0)
{ {
/*if(count($record) == 0) $table = "<table>";
$table .= "<tr>";
$table .= "<td>Date</td>";
$table .= "<td>Call</td>";
$table .= "<td>Mode</td>";
$table .= "<td>Log Status</td>";
$table .= "<td>eQSL Status</td>";
$table .= "<tr>";
while($record = $this->adif_parser->get_record())
{ {
break; $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on']));
};
*/ // The report from eQSL should only contain entries that have been confirmed via eQSL
$time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); // If there's a match for the QSO from the report in our log, it's confirmed via eQSL.
// The report from eQSL should only contain entries that have been confirmed via eQSL // If we have a positive match from LoTW, record it in the DB according to the user's preferences
// If there's a match for the QSO from the report in our log, it's confirmed via eQSL. if ($record['qsl_sent'] == "Y")
// If we have a positive match from LoTW, record it in the DB according to the user's preferences
if ($record['qsl_sent'] == "Y")
{
$record['qsl_sent'] = $config['eqsl_rcvd_mark'];
}
$status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']);
if ($status == "Found")
{
$dupe = $this->logbook_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']);
if ($dupe == false)
{ {
$eqsl_status = $this->logbook_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); $record['qsl_sent'] = $config['eqsl_rcvd_mark'];
}
$status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']);
if ($status == "Found")
{
$dupe = $this->logbook_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']);
if ($dupe == false)
{
$eqsl_status = $this->logbook_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']);
}
else
{
$eqsl_status = "Already received an eQSL for this QSO.";
}
} }
else else
{ {
$eqsl_status = "Already received an eQSL for this QSO."; $eqsl_status = "QSO not found";
} }
$table .= "<tr>";
$table .= "<td>".$time_on."</td>";
$table .= "<td>".$record['call']."</td>";
$table .= "<td>".$record['mode']."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>eQSL Record: ".$eqsl_status."</td>";
$table .= "<tr>";
} }
else
{ $table .= "</table>";
$eqsl_status = "QSO not found"; $data['eqsl_results_table'] = $table;
}
$table .= "<tr>"; }
$table .= "<td>".$time_on."</td>";
$table .= "<td>".$record['call']."</td>";
$table .= "<td>".$record['mode']."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>eQSL Record: ".$eqsl_status."</td>";
$table .= "<tr>";
};
$table .= "</table>"; unlink($filepath);
//unlink($filepath);
$data['eqsl_table'] = $table;
$data['page_title'] = "eQSL Import Information"; $data['page_title'] = "eQSL Import Information";
$this->load->view('layout/header', $data); $this->load->view('layout/header', $data);
@ -163,7 +169,7 @@ class eqsl extends CI_Controller {
} }
else else
{ {
if (stristr($result, "Your ADIF log file has been built")) if (stristr($input, "Your ADIF log file has been built"))
{ {
// Get all the links on the page and grab the URL for the ADI file. // Get all the links on the page and grab the URL for the ADI file.
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
@ -173,6 +179,7 @@ class eqsl extends CI_Controller {
// Look for the link that has the .adi file, and download it to $file // Look for the link that has the .adi file, and download it to $file
if (substr($match, -4, 4) == ".adi") if (substr($match, -4, 4) == ".adi")
{ {
file_put_contents($file, file_get_contents("http://eqsl.cc/qslcard/" . $match)); file_put_contents($file, file_get_contents("http://eqsl.cc/qslcard/" . $match));
ini_set('memory_limit', '-1'); ini_set('memory_limit', '-1');
$this->loadFromFile($file); $this->loadFromFile($file);

查看文件

@ -1,6 +1,18 @@
<div id="container"> <div id="container">
<h2><?php echo $page_title; ?></h2> <h2><?php echo $page_title; ?></h2>
<?php echo $eqsl_table; ?> <?php $this->load->view('layout/messages'); ?>
<?php
if (isset($eqsl_results_table))
{
echo "<p>The following QSOs have been received from eQSL.cc</p>";
echo $eqsl_results_table;
}
else
{
echo "<p>There are no QSO confirmations waiting for you at eQSL.cc</p>";
}
?>
</div> </div>