mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-23 02:37:13 +00:00
* config file for directory userdata * userdir for eqsl * change name to userdata * userdata for qsl * fix name on comment * add generic function file * remove model class on view, use generic function * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay * paths libary * Dev (#2) * Added Windows, MariaDB and PHP-Versions * Release 1.0 * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay --------- Co-authored-by: int2001 <joerg@dj7nt.de> Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com> Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke <dg0tm@darc.de> Co-authored-by: Florian (DF2ET) <github@florian-wolters.de> * [eQSL] only locations with a eQSL nickname should be displayed (#74) * only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import * add proper error message * improve usability --------- Co-authored-by: Christoph Kottke <dg0tm@darc.de> * html fixes * show flashdata if no station has eqsl nick * removed openssl check, not required * accumulate stats language * multilanguage support * prettier * Prevent leaking data out of other station_location * moved qrg to first tab * Fix a PHP 8.1 deprecated bug. * [Contesting] Fix for table qso count * Fixed error when data was empty. Also clear table before inserting again. * Refactor to get the table to load * Need to clear datatable when session is deleted * Prevent Racecondition * Fixed a few null-checks which will fail on fresh accounts * Allow for longer gridsquare in station profile * Show IOTA/SOTA ref on station location tab * [LBA] Fixed mapping of selected QSOs * Trying to convert the QSO-Post to an ajax call PHP/Part * JS Part * Dev (#3) * Added Windows, MariaDB and PHP-Versions * Release 1.0 * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay * [eQSL] only locations with a eQSL nickname should be displayed (#74) * only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import * add proper error message * improve usability --------- Co-authored-by: Christoph Kottke <dg0tm@darc.de> * html fixes * show flashdata if no station has eqsl nick * removed openssl check, not required * accumulate stats language * multilanguage support * prettier * Prevent leaking data out of other station_location * moved qrg to first tab * Fix a PHP 8.1 deprecated bug. * [Contesting] Fix for table qso count * Fixed error when data was empty. Also clear table before inserting again. * Refactor to get the table to load * Need to clear datatable when session is deleted * Prevent Racecondition * Fixed a few null-checks which will fail on fresh accounts * Allow for longer gridsquare in station profile * Show IOTA/SOTA ref on station location tab * [LBA] Fixed mapping of selected QSOs --------- Co-authored-by: int2001 <joerg@dj7nt.de> Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com> Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke <dg0tm@darc.de> Co-authored-by: Florian (DF2ET) <github@florian-wolters.de> Co-authored-by: dg0tm <schieberjunge@gmx.net> * First POC * Handling of AJAX result (started) * Change qso-save to ajax-return * Added notification and reloading of QSO-Table * JS-Part * Set Focus to qso after (successful) log * Resetting timers (successful) * Info is now shown / faded * Small adjustments * More Beauty * Make consequent use of SIG-References from station_profile * Delete application/views/welcome directory Leftovers. Security Flaw! * Update Dashboard.php Remove redir to welcome * Delete application/controllers/Welcome.php security flaw * Hint for 8.3. friendly Usertest * Update config.sample.php default should be commented out * [LBA] Checkbox to turn on/off path lines in map * Styling for pathlines-checkbox * [LBA] Checkbox tweaks * updated comment in config.php (sample and installer) * Removed popup regarding unsaved changes (wasn't functional at all) * Added locking for sending a qso twice * added spinner to save button * Also include SIG and SIG_INFO * [Logbook] Removed profiler * [LBA] Added fitbounds to map * [LBA] Added CQ Zone overlay * Make clearer that overview filters on logbook rather than locations * baesURL has a trailing slash already * active logbook hint * Update .gitignore added userdata * [LBA] ITU zone overlay * Minor wording * [LBA] Added custom mapping icons * [LBA] Path line follows icon color * [LBA] Added icon anchoring * [LBA] Added easyprint for easy map saving * [LBA] Added default colors when icon settings does not exist in db * Check refs before trimming them * [LBA] Fixed another default issue with markers and colors * Removed dangerous functions where User can accidently shift profiles * Rmoeve more unused leftovers from 1.0 to 2.0. * Header refactoring (#110) * splitted up header * resorted header menu * main rebuild * header behaviour hover * dropdown toggle rotate * fix case where landscape is small menu and portrait normal view * submenu thirdparty services * removed custom maps from the header * matching search bar * border * matched border to themes * [Custom Map] Removed code * [Gridmap] Broke map by accident. Thanks @phl0 for poke. * Optical support for SAT directions and elevation * [LBA] Added coordinates at the bottom of the map * Align numbers and arrows * Reset RST after saving via AJAX * Cfd export (#117) * Added CFD Export for toplist.darc.de to Wavelog --------- Co-authored-by: phl0 <github@florian-wolters.de> * special thx to contributors * tag 1.1 * typo --------- Co-authored-by: abarrau <hesky378@gmail.com> Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke <dg0tm@darc.de> Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com> Co-authored-by: int2001 <joerg@dj7nt.de> Co-authored-by: Florian (DF2ET) <github@florian-wolters.de> Co-authored-by: dg0tm <schieberjunge@gmx.net>
243 lines
8.4 KiB
PHP
243 lines
8.4 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
/*
|
|
Handles Displaying of information for station tools.
|
|
*/
|
|
|
|
class Station extends CI_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->helper(array('form', 'url'));
|
|
|
|
$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->model('stations');
|
|
$this->load->model('Logbook_model');
|
|
$this->load->model('user_model');
|
|
|
|
$data['is_admin'] = ($this->user_model->authorize(99));
|
|
|
|
$data['stations'] = $this->stations->all_with_count();
|
|
$data['current_active'] = $this->stations->find_active();
|
|
$data['is_there_qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id();
|
|
|
|
// Render Page
|
|
$data['page_title'] = lang('station_location');
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('station_profile/index');
|
|
$this->load->view('interface_assets/footer');
|
|
}
|
|
|
|
public function create() {
|
|
$this->load->model('stations');
|
|
$this->load->model('dxcc');
|
|
$data['dxcc_list'] = $this->dxcc->list();
|
|
|
|
$this->load->model('logbook_model');
|
|
$data['iota_list'] = $this->logbook_model->fetchIota();
|
|
|
|
$this->load->library('form_validation');
|
|
|
|
$this->form_validation->set_rules('station_profile_name', 'Station Profile Name', 'required');
|
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
{
|
|
$data['page_title'] = lang('station_location_create_header');
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('station_profile/create');
|
|
$this->load->view('interface_assets/footer');
|
|
}
|
|
else
|
|
{
|
|
if (($station_id = $this->stations->add()) !== false) {
|
|
// [eQSL default msg] ADD to user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id; option_value=value) //
|
|
$eqsl_default_qslmsg = xss_clean($this->input->post('eqsl_default_qslmsg', true));
|
|
if (!empty(trim($eqsl_default_qslmsg))) {
|
|
$this->load->model('user_options_model');
|
|
$this->user_options_model->set_option('eqsl_default_qslmsg','key_station_id',array($station_id=>$eqsl_default_qslmsg));
|
|
}
|
|
}
|
|
redirect('station');
|
|
}
|
|
}
|
|
|
|
public function edit($id) {
|
|
$this->load->model('stations');
|
|
if ($this->stations->check_station_is_accessible($id)) {
|
|
$data = $this->load_station_for_editing($id);
|
|
$data['page_title'] = lang('station_location_edit') . $data['my_station_profile']->station_profile_name;
|
|
|
|
if ($this->form_validation->run() == FALSE) {
|
|
// [eQSL default msg] GET from user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id) //
|
|
$this->load->model('user_options_model');
|
|
$options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$id))->result();
|
|
$data['eqsl_default_qslmsg'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
|
|
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('station_profile/edit');
|
|
$this->load->view('interface_assets/footer');
|
|
} else {
|
|
if ($this->stations->edit() !== false) {
|
|
// [eQSL default msg] ADD to user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id; option_value=value) //
|
|
$eqsl_default_qslmsg = xss_clean($this->input->post('eqsl_default_qslmsg', true));
|
|
$this->load->model('user_options_model');
|
|
if (!empty(trim($eqsl_default_qslmsg))) {
|
|
$this->user_options_model->set_option('eqsl_default_qslmsg','key_station_id',array($id=>$eqsl_default_qslmsg));
|
|
} else {
|
|
$this->user_options_model->del_option('eqsl_default_qslmsg','key_station_id',array('option_key'=>$id));
|
|
}
|
|
}
|
|
|
|
$data['notice'] = lang('station_location') . $this->security->xss_clean($this->input->post('station_profile_name', true)) . " Updated";
|
|
|
|
redirect('station');
|
|
}
|
|
} else {
|
|
redirect('station');
|
|
}
|
|
}
|
|
|
|
public function copy($id) {
|
|
$this->load->model('stations');
|
|
if ($this->stations->check_station_is_accessible($id)) {
|
|
$data = $this->load_station_for_editing($id);
|
|
$data['page_title'] = "Duplicate Station Location: {$data['my_station_profile']->station_profile_name}";
|
|
|
|
// we NULLify station_id and station_profile_name to make sure we are creating a new station
|
|
$data['copy_from'] = $data['my_station_profile']->station_id;
|
|
$data['my_station_profile']->station_id = NULL;
|
|
$data['my_station_profile']->station_profile_name = '';
|
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
{
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('station_profile/edit');
|
|
$this->load->view('interface_assets/footer');
|
|
}
|
|
else
|
|
{
|
|
$this->stations->add();
|
|
|
|
redirect('station');
|
|
}
|
|
} else {
|
|
redirect('station');
|
|
}
|
|
}
|
|
|
|
function load_station_for_editing($id): array {
|
|
$this->load->library('form_validation');
|
|
|
|
$this->load->model('stations');
|
|
$this->load->model('dxcc');
|
|
$this->load->model('logbook_model');
|
|
|
|
$data['iota_list'] = $this->logbook_model->fetchIota();
|
|
|
|
$item_id_clean = $this->security->xss_clean($id);
|
|
|
|
$station_profile_query = $this->stations->profile($item_id_clean);
|
|
|
|
$data['my_station_profile'] = $station_profile_query->row();
|
|
|
|
$data['dxcc_list'] = $this->dxcc->list();
|
|
|
|
$this->form_validation->set_rules('station_profile_name', 'Station Profile Name', 'required');
|
|
|
|
return $data;
|
|
}
|
|
|
|
|
|
function reassign_profile($id) {
|
|
// $id is the profile that needs reassigned to QSOs // ONLY Admin can do that!
|
|
$this->load->model('stations');
|
|
if ($this->user_model->authorize(99)) {
|
|
$this->stations->reassign($id);
|
|
}
|
|
|
|
//$this->stations->logbook_session_data();
|
|
redirect('station');
|
|
}
|
|
|
|
function set_active($current, $new) {
|
|
$this->load->model('stations');
|
|
$this->stations->set_active($current, $new);
|
|
|
|
//$this->stations->logbook_session_data();
|
|
redirect('station');
|
|
}
|
|
|
|
public function delete($id) {
|
|
$this->load->model('stations');
|
|
if ($this->stations->check_station_is_accessible($id)) {
|
|
$this->stations->delete($id);
|
|
// [eQSL default msg] DELETE user options //
|
|
$this->load->model('user_options_model');
|
|
$this->user_options_model->del_option('eqsl_default_qslmsg','key_station_id',array('option_key'=>$id));
|
|
}
|
|
redirect('station');
|
|
}
|
|
|
|
public function deletelog($id) {
|
|
$this->load->model('stations');
|
|
if ($this->stations->check_station_is_accessible($id)) {
|
|
$this->stations->deletelog($id);
|
|
}
|
|
redirect('station');
|
|
}
|
|
|
|
/*
|
|
* Function is used for autocompletion of Counties in the station profile form
|
|
*/
|
|
public function get_county() {
|
|
$json = [];
|
|
|
|
if(!empty($this->input->get("query"))) {
|
|
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
|
|
$county = $this->input->get("state");
|
|
|
|
$file = 'assets/json/US_counties.csv';
|
|
|
|
if (is_readable($file)) {
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
$input = preg_quote($county, '~');
|
|
$reg = '~^'. $input .'(.*)$~';
|
|
$result = preg_grep($reg, $lines);
|
|
$json = [];
|
|
$i = 0;
|
|
foreach ($result as &$value) {
|
|
$county = explode(',', $value);
|
|
// Limit to 300 as to not slowdown browser too much
|
|
if (count($json) <= 300) {
|
|
$json[] = ["name"=>$county[1]];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode($json);
|
|
}
|
|
|
|
// [eQSL default msg] Function return options from this station (but can be general use) //
|
|
public function get_options() {
|
|
$return_json = array();
|
|
$option_type = $this->input->post('option_type');
|
|
$option_name = $this->input->post('option_name');
|
|
$option_key = $this->input->post('option_key');
|
|
if (!empty($option_type) && !empty($option_name) && ($option_key>0)) {
|
|
$this->load->model('user_options_model');
|
|
$options_object = $this->user_options_model->get_options($option_type,array('option_name'=>$option_name,'option_key'=>$option_key))->result();
|
|
$return_json[$option_type] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
|
|
}
|
|
header('Content-Type: application/json');
|
|
echo json_encode($return_json);
|
|
}
|
|
}
|