diff --git a/.gitignore b/.gitignore index 39d9a71ba..b46dc164f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /images/eqsl_card_images/*.jpg /updates/clublog_scp.txt /assets/qslcard/* +/assets/sstvimages/* /assets/js/sections/custom.js .idea/* .DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..1cfcf0bcb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "cSpell.words": [ + "callsign", + "cloudlog", + "hamradio", + "qslcard", + "sstv", + "sstvimages", + "sstvtable", + "SUBMODE", + "userdata" + ] +} diff --git a/application/config/migration.php b/application/config/migration.php index fc454147d..f176f248e 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ | */ -$config['migration_version'] = 174; +$config['migration_version'] = 176; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index beae3f1c3..152588676 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -12,8 +12,9 @@ function __construct() { public function index() { $this->lang->load('qslcard'); + $this->load->helper('storage'); $folder_name = "images/eqsl_card_images"; - $data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name)); + $data['storage_used'] = sizeFormat(folderSize($folder_name)); // Render Page @@ -749,49 +750,4 @@ function uploadUser($userid, $username, $password) { $status = $this->uploadQso($adif, $qsl); } } - -// Functions for storage, these need shifted to a libary to use across Cloudlog - function folderSize($dir){ - $count_size = 0; - $count = 0; - $dir_array = scandir($dir); - foreach($dir_array as $key=>$filename){ - if($filename!=".." && $filename!="."){ - if(is_dir($dir."/".$filename)){ - $new_foldersize = $this->foldersize($dir."/".$filename); - $count_size = $count_size+ $new_foldersize; - }else if(is_file($dir."/".$filename)){ - $count_size = $count_size + filesize($dir."/".$filename); - $count++; - } - } - } - return $count_size; - } - - function sizeFormat($bytes){ - $kb = 1024; - $mb = $kb * 1024; - $gb = $mb * 1024; - $tb = $gb * 1024; - - if (($bytes >= 0) && ($bytes < $kb)) { - return $bytes . ' B'; - - } elseif (($bytes >= $kb) && ($bytes < $mb)) { - return ceil($bytes / $kb) . ' KB'; - - } elseif (($bytes >= $mb) && ($bytes < $gb)) { - return ceil($bytes / $mb) . ' MB'; - - } elseif (($bytes >= $gb) && ($bytes < $tb)) { - return ceil($bytes / $gb) . ' GB'; - - } elseif ($bytes >= $tb) { - return ceil($bytes / $tb) . ' TB'; - } else { - return $bytes . ' B'; - } - } - } // end class diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index cf0b966c3..4ee58f479 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -273,7 +273,7 @@ function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $g $qso_data[] = [ 'time' => $qso->COL_TIME_ON, 'band' => $qso->COL_BAND, - 'mode' => $qso->COL_MODE, + 'mode' => (($qso->COL_SUBMODE ?? '') == '') ? $qso->COL_MODE : $qso->COL_SUBMODE, 'rst' => $qso->COL_RST_SENT, 'mygrid' => $qso->station_gridsquare, 'via' => $qso->COL_QSL_VIA, diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 054de873a..65fbe634a 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -618,7 +618,9 @@ function view($id) { } $this->load->model('Qsl_model'); + $this->load->model('Sstv_model'); $data['qslimages'] = $this->Qsl_model->getQslForQsoId($id); + $data['sstvimages'] = $this->Sstv_model->getSstvForQsoId($id); $data['primary_subdivision'] = $this->subdivisions->get_primary_subdivision_name($data['query']->result()[0]->COL_DXCC); $data['secondary_subdivision'] = $this->subdivisions->get_secondary_subdivision_name($data['query']->result()[0]->COL_DXCC); $data['max_upload'] = ini_get('upload_max_filesize'); diff --git a/application/controllers/Qsl.php b/application/controllers/Qsl.php index 89df8947f..5037f72e9 100644 --- a/application/controllers/Qsl.php +++ b/application/controllers/Qsl.php @@ -15,7 +15,7 @@ function __construct() { // Default view when loading controller. public function index() { - + $this->load->helper('storage'); // Load the storage helper $folder_name = "assets/qslcard"; $data['storage_used'] = sizeFormat(folderSize($folder_name)); @@ -181,48 +181,4 @@ function viewQsl() { $this->load->view('qslcard/qslcarousel', $data); } -} - -// Functions for storage, these need shifted to a libary to use across Cloudlog -function folderSize($dir){ - $count_size = 0; - $count = 0; - $dir_array = scandir($dir); - foreach($dir_array as $key=>$filename){ - if($filename!=".." && $filename!="."){ - if(is_dir($dir."/".$filename)){ - $new_foldersize = foldersize($dir."/".$filename); - $count_size = $count_size+ $new_foldersize; - }else if(is_file($dir."/".$filename)){ - $count_size = $count_size + filesize($dir."/".$filename); - $count++; - } - } - } - return $count_size; -} - -function sizeFormat($bytes){ - $kb = 1024; - $mb = $kb * 1024; - $gb = $mb * 1024; - $tb = $gb * 1024; - - if (($bytes >= 0) && ($bytes < $kb)) { - return $bytes . ' B'; - - } elseif (($bytes >= $kb) && ($bytes < $mb)) { - return ceil($bytes / $kb) . ' KB'; - - } elseif (($bytes >= $mb) && ($bytes < $gb)) { - return ceil($bytes / $mb) . ' MB'; - - } elseif (($bytes >= $gb) && ($bytes < $tb)) { - return ceil($bytes / $gb) . ' GB'; - - } elseif ($bytes >= $tb) { - return ceil($bytes / $tb) . ' TB'; - } else { - return $bytes . ' B'; - } -} +} \ No newline at end of file diff --git a/application/controllers/Sattimers.php b/application/controllers/Sattimers.php index bdcfdcfd7..7906df9c3 100644 --- a/application/controllers/Sattimers.php +++ b/application/controllers/Sattimers.php @@ -15,10 +15,10 @@ public function index() { $footerData['scripts'] = [ 'assets/js/sections/sattimers.js?' ]; - $url = 'https://www.df2et.de/tevel/api2.php?grid='.strtoupper($this->stations->find_gridsquare()); + $data['gridsquare'] = substr(strtoupper($this->stations->find_gridsquare()), 0, 6); + $url = 'https://www.df2et.de/tevel/api2.php?grid=' . $data['gridsquare']; $json = file_get_contents($url); $data['activations'] = json_decode($json, true)['data']; - $data['gridsquare'] = strtoupper($this->stations->find_gridsquare()); $data['page_title'] = "Satellite Timers"; diff --git a/application/controllers/Sstv.php b/application/controllers/Sstv.php new file mode 100644 index 000000000..935b77bb1 --- /dev/null +++ b/application/controllers/Sstv.php @@ -0,0 +1,111 @@ +lang->load('sstv'); + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + } + + public function index() { + $this->load->helper('storage'); + $folder_name = "assets/sstvimages"; + $data['storage_used'] = sizeFormat(folderSize($folder_name)); + + // Render Page + $data['page_title'] = "SSTV Images"; + + $this->load->model('sstv_model'); + $data['sstvArray'] = $this->sstv_model->getQsoWithSstvImageList(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('sstv/index'); + $this->load->view('interface_assets/footer'); + } + + public function uploadSSTV() { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + + if (!file_exists('./assets/sstvimages')) { + mkdir('./assets/sstvimages', 0755, true); + } + $qsoid = $this->input->post('qsoid'); + + $results = array(); + if (isset($_FILES['sstvimages']) && $_FILES['sstvimages']['error'][0] == 0) + { + for($i=0; $i $_FILES['sstvimages']['name'][$i], + 'type' => $_FILES['sstvimages']['type'][$i], + 'tmp_name' => $_FILES['sstvimages']['tmp_name'][$i], + 'error' => $_FILES['sstvimages']['error'][$i], + 'size' => $_FILES['sstvimages']['size'][$i] + ); + $result = $this->uploadSSTVImage($qsoid, $file); + array_push($results, $result); + } + } + + header("Content-type: application/json"); + echo json_encode($results); + } + + function uploadSSTVImage($qsoid, $file) { + $config['upload_path'] = './assets/sstvimages'; + $config['allowed_types'] = 'jpg|gif|png|jpeg|JPG|PNG|bmp'; + $array = explode(".", $file['name']); + $ext = end($array); + $config['file_name'] = $qsoid . '.sstv.' . '_' . time() . '.' . $ext; + + $this->load->library('upload', $config); + + $_FILES['sstvimage'] = $file; + if ( ! $this->upload->do_upload('sstvimage')) { + // Upload of SSTV image Failed + $error = array('error' => $this->upload->display_errors()); + + return $error; + } + else { + // Load database queries + $this->load->model('Sstv_model'); + + //Upload of SSTV image was successful + $data = $this->upload->data(); + + // Now we need to insert info into database about file + $filename = $data['file_name']; + $insertid = $this->Sstv_model->saveSstvImages($qsoid, $filename); + + $result['status'] = 'Success'; + $result['insertid'] = $insertid; + $result['filename'] = $filename; + return $result; + } + } + + + // Deletes SSTV Image + public function delete() { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + + $id = $this->input->post('id'); + $this->load->model('Sstv_model'); + + $path = './assets/sstvimages/'; + $file = $this->Sstv_model->getSSTVFilename($id)->row(); + $filename = $file->filename; + unlink($path.$filename); + + $this->Sstv_model->deleteSstv($id); + } +} diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index 92fe41d30..815db34d5 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -75,6 +75,37 @@ public function index($public_slug = NULL) $this->load->model('logbook_model'); + // load config and init pagination + $this->load->library('pagination'); + + //Pagination config + $config['base_url'] = base_url().'index.php/visitor/'. $public_slug . '/index'; + $config['total_rows'] = $this->logbook_model->total_qsos($logbooks_locations_array); + $config['per_page'] = '25'; + $config['num_links'] = $this->logbook_model->total_qsos($logbooks_locations_array) / 25; + $config['full_tag_open'] = ''; + $config['attributes'] = ['class' => 'page-link']; + $config['first_link'] = false; + $config['last_link'] = false; + $config['first_tag_open'] = '
  • '; + $config['first_tag_close'] = '
  • '; + $config['prev_link'] = '«'; + $config['prev_tag_open'] = '
  • '; + $config['prev_tag_close'] = '
  • '; + $config['next_link'] = '»'; + $config['next_tag_open'] = '
  • '; + $config['next_tag_close'] = '
  • '; + $config['last_tag_open'] = '
  • '; + $config['last_tag_close'] = '
  • '; + $config['cur_tag_open'] = '
  • '; + $config['cur_tag_close'] = '(current)
  • '; + $config['num_tag_open'] = '
  • '; + $config['num_tag_close'] = '
  • '; + + $this->pagination->initialize($config); + + // Public visitor so no QRA to setup $data['qra'] = "none"; @@ -107,8 +138,9 @@ public function index($public_slug = NULL) $data['total_lotw_sent'] = $QSLStatsBreakdownArray['LoTW_Sent']; $data['total_lotw_rcvd'] = $QSLStatsBreakdownArray['LoTW_Received']; - - $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array); + + // Show paginated results + $data['results'] = $this->logbook_model->get_qsos($config['per_page'], $this->uri->segment(4), $logbooks_locations_array); $data['page_title'] = "Dashboard"; $data['slug'] = $public_slug; diff --git a/application/helpers/storage_helper.php b/application/helpers/storage_helper.php new file mode 100644 index 000000000..c84f44a97 --- /dev/null +++ b/application/helpers/storage_helper.php @@ -0,0 +1,44 @@ +$filename){ + if($filename!=".." && $filename!="."){ + if(is_dir($dir."/".$filename)){ + $new_foldersize = folderSize($dir."/".$filename); + $count_size = $count_size+ $new_foldersize; + }else if(is_file($dir."/".$filename)){ + $count_size = $count_size + filesize($dir."/".$filename); + $count++; + } + } + } + return $count_size; + } +} + +if (!function_exists('sizeFormat')) { + function sizeFormat($bytes){ + $kb = 1024; + $mb = $kb * 1024; + $gb = $mb * 1024; + $tb = $gb * 1024; + + if (($bytes >= 0) && ($bytes < $kb)) { + return $bytes . ' B'; + } elseif (($bytes >= $kb) && ($bytes < $mb)) { + return ceil($bytes / $kb) . ' KB'; + } elseif (($bytes >= $mb) && ($bytes < $gb)) { + return ceil($bytes / $mb) . ' MB'; + } elseif (($bytes >= $gb) && ($bytes < $tb)) { + return ceil($bytes / $gb) . ' GB'; + } elseif ($bytes >= $tb) { + return ceil($bytes / $tb) . ' TB'; + } else { + return $bytes . ' B'; + } + } +} diff --git a/application/language/bulgarian/contesting_lang.php b/application/language/bulgarian/contesting_lang.php index 35976bd4a..1e29be33a 100644 --- a/application/language/bulgarian/contesting_lang.php +++ b/application/language/bulgarian/contesting_lang.php @@ -28,5 +28,11 @@ $lang['contesting_title_contest_logbook'] = 'Дневник на състезанието'; $lang['contesting_copy_exch_to_dok'] = 'Copy received exchange to DOK field in the database!'; +$lang['contesting_copy_exch_to_none'] = 'Copy received exchange to no additional field in the database!'; +$lang['contesting_copy_exch_to_power'] = 'Copy received exchange to RX-Power field in the database!'; +$lang['contesting_copy_exch_to_state'] = 'Copy received exchange to US-State field in the database!'; +$lang['contesting_copy_exch_to_age'] = 'Copy received exchange to Age field in the database!'; +$lang['contesting_copy_exch_to_name'] = 'Copy received exchange to Name field in the database!'; +$lang['contesting_copy_exch_to_locator'] = 'Copy received exchange to Locator field in the database!'; diff --git a/application/language/bulgarian/menu_lang.php b/application/language/bulgarian/menu_lang.php index cdd86e6b4..f72b17e41 100644 --- a/application/language/bulgarian/menu_lang.php +++ b/application/language/bulgarian/menu_lang.php @@ -17,6 +17,7 @@ $lang['menu_bandmap'] = 'Bandmap'; $lang['menu_view_qsl'] = 'View QSL Cards'; $lang['menu_view_eqsl'] = 'View eQSL Cards'; +$lang['menu_view_sstv'] = 'View SSTV Images'; $lang['menu_notes'] = 'Notes'; diff --git a/application/language/bulgarian/sstv_lang.php b/application/language/bulgarian/sstv_lang.php new file mode 100644 index 000000000..72c4c7d0d --- /dev/null +++ b/application/language/bulgarian/sstv_lang.php @@ -0,0 +1,5 @@ +db->table_exists('sstv_images')) { + $this->dbforge->add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 5, + 'unsigned' => TRUE, + 'auto_increment' => TRUE + ), + 'qsoid' => array( + 'type' => 'VARCHAR', + 'constraint' => '250', + ), + 'filename' => array( + 'type' => 'VARCHAR', + 'constraint' => '250', + ), + 'modified' => array( + 'type' => 'timestamp', + 'null' => TRUE, + ), + )); + $this->dbforge->add_key('id', TRUE); + $this->dbforge->create_table('sstv_images'); + } + } + + public function down() + { + echo "not possible"; + } +} diff --git a/application/migrations/176_tag_2_6_8.php b/application/migrations/176_tag_2_6_8.php new file mode 100644 index 000000000..087509914 --- /dev/null +++ b/application/migrations/176_tag_2_6_8.php @@ -0,0 +1,30 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.6.8')); + + // Trigger Version Info Dialog + $this->db->where('option_type', 'version_dialog'); + $this->db->where('option_name', 'confirmed'); + $this->db->update('user_options', array('option_value' => 'false')); + + } + + public function down() + { + $this->db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.6.7')); + } +} \ No newline at end of file diff --git a/application/models/Contesting_model.php b/application/models/Contesting_model.php index 377edba53..d19b00b64 100644 --- a/application/models/Contesting_model.php +++ b/application/models/Contesting_model.php @@ -13,6 +13,7 @@ function getSessionQsos($qso) { $contestid = $qsoarray[2]; $date = DateTime::createFromFormat('d-m-Y H:i:s', $qsoarray[0]); + if ($date == false) $date = DateTime::createFromFormat('d-m-Y H:i', $qsoarray[0]); $date = $date->format('Y-m-d H:i:s'); $sql = "SELECT date_format(col_time_on, '%d-%m-%Y %H:%i:%s') as col_time_on, col_call, col_band, col_mode, @@ -65,6 +66,7 @@ function getSession() { $sql = "SELECT * from contest_session where station_id = " . $station_id; $data = $this->db->query($sql); + return $data->row(); } @@ -102,6 +104,10 @@ function setSession() { 'station_id' => $station_id, ); + if ($this->input->post('copyexchangeto')) { + $data['copytodok'] = xss_clean($this->input->post('copyexchangeto')); + } + $sql = "SELECT * from contest_session where station_id = " . $station_id; $querydata = $this->db->query($sql); @@ -246,6 +252,7 @@ function checkIfWorkedBefore($call, $band, $mode, $contest) { $qsoarray = explode(',', $contest_session->qso); $date = DateTime::createFromFormat('d-m-Y H:i:s', $qsoarray[0]); + if ($date == false) $date = DateTime::createFromFormat('d-m-Y H:i', $qsoarray[0]); $date = $date->format('Y-m-d H:i:s'); $this->db->select('timediff(UTC_TIMESTAMP(),col_time_off) b4, COL_TIME_OFF'); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index a9c77bb0f..02d8fbc24 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -157,6 +157,44 @@ function create_qso() $darc_dok = $this->input->post('darc_dok'); } + //$darc_dok = $this->input->post('darc_dok'); + $qso_locator = strtoupper(trim(xss_clean($this->input->post('locator')) ?? '')); + $qso_name = $this->input->post('name'); + $qso_age = null; + $qso_usa_state = $this->input->post('usa_state') == null ? '' : $this->input->post('usa_state'); + $qso_rx_power = null; + + if ($this->input->post('copyexchangeto')) { + switch($this->input->post('copyexchangeto')) { + case 'dok': + $darc_dok = $srx_string; + break; + case 'locator': + $qso_locator = strtoupper(trim(xss_clean($srx_string))); + break; + case 'name': + $qso_name = $srx_string; + break; + case 'age': + $qso_age = $srx_string; + break; + case 'state': + $qso_usa_state = $srx_string; + break; + case 'power': + $qso_rx_power = $srx_string; + break; + // Example for more sophisticated exchanges and their split into the db: + //case 'name/power': + // if (strlen($srx_string) == 0) break; + // $exch_pt = explode(" ",$srx_string); + // $qso_name = $exch_pt[0]; + // if (count($exch_pt)>1) $qso_power = $exch_pt[1]; + // break; + default: + } + } + if ($this->input->post('qsl_sent')) { $qsl_sent = $this->input->post('qsl_sent'); } else { @@ -193,7 +231,7 @@ function create_qso() 'COL_SUBMODE' => $submode, 'COL_RST_RCVD' => $this->input->post('rst_rcvd'), 'COL_RST_SENT' => $this->input->post('rst_sent'), - 'COL_NAME' => $this->input->post('name'), + 'COL_NAME' => $qso_name, 'COL_COMMENT' => $this->input->post('comment'), 'COL_SAT_NAME' => $this->input->post('sat_name') == null ? '' : strtoupper($this->input->post('sat_name')), 'COL_SAT_MODE' => $this->input->post('sat_mode') == null ? '' : strtoupper($this->input->post('sat_mode')), @@ -216,7 +254,7 @@ function create_qso() 'COL_ANT_AZ' => null, 'COL_ANT_EL' => null, 'COL_A_INDEX' => null, - 'COL_AGE' => null, + 'COL_AGE' => $qso_age, 'COL_TEN_TEN' => null, 'COL_TX_PWR' => $tx_power, 'COL_STX' => $stx, @@ -229,12 +267,12 @@ function create_qso() 'COL_MAX_BURSTS' => null, 'COL_K_INDEX' => null, 'COL_SFI' => null, - 'COL_RX_PWR' => null, + 'COL_RX_PWR' => $qso_rx_power, 'COL_LAT' => null, 'COL_LON' => null, 'COL_DXCC' => $dxcc_id, 'COL_CQZ' => $cqz, - 'COL_STATE' => $this->input->post('usa_state') == null ? '' : trim($this->input->post('usa_state')), + 'COL_STATE' => $qso_usa_state, 'COL_CNTY' => $clean_county_input, 'COL_SOTA_REF' => $this->input->post('sota_ref') == null ? '' : trim($this->input->post('sota_ref')), 'COL_WWFF_REF' => $this->input->post('wwff_ref') == null ? '' : trim($this->input->post('wwff_ref')), @@ -302,10 +340,10 @@ function create_qso() } // Decide whether its single gridsquare or a multi which makes it vucc_grids - if (strpos(trim(xss_clean($this->input->post('locator')) ?? ''), ',') !== false) { - $data['COL_VUCC_GRIDS'] = strtoupper(preg_replace('/\s+/', '', xss_clean($this->input->post('locator')) ?? '')); + if (strpos($qso_locator, ',') !== false) { + $data['COL_VUCC_GRIDS'] = strtoupper(preg_replace('/\s+/', '', $qso_locator)); } else { - $data['COL_GRIDSQUARE'] = strtoupper(trim(xss_clean($this->input->post('locator')) ?? '')); + $data['COL_GRIDSQUARE'] = $qso_locator; } // if eQSL username set, default SENT & RCVD to 'N' else leave as null diff --git a/application/models/Sstv_model.php b/application/models/Sstv_model.php new file mode 100644 index 000000000..4b3dbcfac --- /dev/null +++ b/application/models/Sstv_model.php @@ -0,0 +1,110 @@ +security->xss_clean($qsoid); + + // be sure that QSO belongs to user + $CI = &get_instance(); + $CI->load->model('logbook_model'); + if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) { + return; + } + + $data = array( + 'qsoid' => $clean_id, + 'filename' => $filename + ); + + $this->db->insert('sstv_images', $data); + + return $this->db->insert_id(); + } + + function getSSTVFilename($id) + { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + // be sure that QSO belongs to user + $CI = &get_instance(); + $CI->load->model('logbook_model'); + $this->db->select('qsoid'); + $this->db->from('sstv_images'); + $this->db->where('id', $clean_id); + $qsoid = $this->db->get()->row()->qsoid; + if (!$CI->logbook_model->check_qso_is_accessible($qsoid)) { + return; + } + + $this->db->select('filename'); + $this->db->from('sstv_images'); + $this->db->where('id', $clean_id); + + return $this->db->get(); + } + + + function deleteSstv($id) + { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + // be sure that QSO belongs to user + $CI = &get_instance(); + $CI->load->model('logbook_model'); + $this->db->select('qsoid'); + $this->db->from('sstv_images'); + $this->db->where('id', $clean_id); + $qsoid = $this->db->get()->row()->qsoid; + if (!$CI->logbook_model->check_qso_is_accessible($qsoid)) { + return; + } + + // Delete Mode + $this->db->delete('sstv_images', array('id' => $clean_id)); + } + + + function getSstvForQsoId($id) + { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + // be sure that QSO belongs to user + $CI = &get_instance(); + $CI->load->model('logbook_model'); + if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) { + return; + } + + $this->db->select('*'); + $this->db->from('sstv_images'); + $this->db->where('qsoid', $clean_id); + + return $this->db->get()->result(); + } + + function getQsoWithSstvImageList() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (is_array($logbooks_locations_array) && !empty($logbooks_locations_array)) { + $this->db->select('*'); + $this->db->from($this->config->item('table_name')); + $this->db->join('sstv_images', 'sstv_images.qsoid = ' . $this->config->item('table_name') . '.col_primary_key'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->order_by("id", "desc"); + + return $this->db->get(); + } else { + return false; + } + } + +} diff --git a/application/views/awards/wwff/index.php b/application/views/awards/wwff/index.php index 885ce7355..300a5ab12 100644 --- a/application/views/awards/wwff/index.php +++ b/application/views/awards/wwff/index.php @@ -4,10 +4,10 @@

    diff --git a/application/views/contesting/index.php b/application/views/contesting/index.php index c85e90664..e1e3cc5f5 100644 --- a/application/views/contesting/index.php +++ b/application/views/contesting/index.php @@ -1,6 +1,6 @@
    -

    +

    LIVE" : " POST"); ?>
    @@ -115,7 +115,7 @@
    - + - +