mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Failsafe (Disable Download for stations without grant)
This commit is contained in:
@@ -79,13 +79,18 @@ class Clublog extends CI_Controller {
|
||||
$response = curl_exec($request);
|
||||
$info = curl_getinfo($request);
|
||||
curl_close ($request);
|
||||
|
||||
if(curl_errno($request)) {
|
||||
echo curl_error($request);
|
||||
} elseif (preg_match_all('/Invalid callsign/',$response)) { // We're trying to download calls for a station we're not granted. Disable Clublog-Transfer for that station(s)
|
||||
$this->clublog_model->disable_sync4call($station_row->station_callsign,$station_row->station_ids);
|
||||
} else {
|
||||
$cl_qsls=json_decode($response);
|
||||
foreach ($cl_qsls as $oneqsl) {
|
||||
$this->logbook_model->clublog_update($oneqsl[2], $oneqsl[0], $oneqsl[3], 'Y', $station_row->station_callsign, $station_row->station_ids);
|
||||
try {
|
||||
$cl_qsls=json_decode($response);
|
||||
foreach ($cl_qsls as $oneqsl) {
|
||||
$this->logbook_model->clublog_update($oneqsl[2], $oneqsl[0], $oneqsl[3], 'Y', $station_row->station_callsign, $station_row->station_ids);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
log_message("Error","Something gone wrong while trying to Download for station(s) ".$station_row->station_ids." / Call: ".$station_row->station_callsign);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,12 @@ class Clublog_model extends CI_Model {
|
||||
return '19700101';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function disable_sync4call($call, $stations) {
|
||||
$sql="update station_profile set clublogignore=1 where station_callsign=? and station_id in (".$stations.")";
|
||||
$query = $this->db->query($sql,$call);
|
||||
}
|
||||
|
||||
function all_enabled($userid) {
|
||||
$sql="select sp.station_callsign, group_concat(sp.station_id) as station_ids from station_profile sp
|
||||
inner join users u on (u.user_id=sp.user_id)
|
||||
|
||||
Reference in New Issue
Block a user