Files
wavelog/application/libraries/Frequency.php
HB9HIL 2df091f891 Release v1.1 (#120)
* 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>
2024-02-09 18:12:28 +01:00

208 lines
5.4 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Frequency {
public $defaultFrequencies = array(
'160m'=>array(
'SSB'=>"1900000",
'DATA'=>"1838000",
'CW'=>"1830000",
'NOMINAL'=>"1.8"),
'80m'=>array(
'SSB'=>"3700000",
'DATA'=>"3583000",
"CW"=>"3550000",
"NOMINAL"=>"3.5"),
'60m'=>array(
'SSB'=>"5330000",
'DATA'=>"5330000",
"CW"=>"5260000",
"NOMINAL"=>"5"),
'40m'=>array(
'SSB'=>"7100000",
'DATA'=>"7040000",
'CW'=>"7020000",
'NOMINAL'=>"7"),
'30m'=>array(
'SSB'=>"10120000",
'DATA'=>"10145000",
'CW'=>"10120000",
'NOMINAL'=>"10"),
'20m'=>array(
'SSB'=>"14200000",
'DATA'=>"14080000",
'CW'=>"14020000",
'NOMINAL'=>"14"),
'17m'=>array(
'SSB'=>"18130000",
'DATA'=>"18105000",
'CW'=>"18080000",
'NOMINAL'=>"18"),
'15m'=>array(
'SSB'=>"21300000",
'DATA'=>"21080000",
'CW'=>"21020000",
'NOMINAL'=>"21"),
'12m'=>array(
'SSB'=>"24950000",
'DATA'=>"24925000",
'CW'=>"24900000",
'NOMINAL'=>"24"),
'10m'=>array(
'SSB'=>"28300000",
'DATA'=>"28120000",
'CW'=>"28050000",
'NOMINAL'=>"28"),
'6m'=>array(
'SSB'=>"50150000",
'DATA'=>"50230000",
'CW'=>"50090000",
'NOMINAL'=>"50"),
'4m'=>array(
'SSB'=>"70200000",
'DATA'=>"70200000",
'CW'=>"70200000",
'NOMINAL'=>"70"),
'2m'=>array(
'SSB'=>"144300000",
'DATA'=>"144370000",
'CW'=>"144050000",
'NOMINAL'=>"144"),
'1.25m'=>array(
'SSB'=>"222100000",
'DATA'=>"222100000",
'CW'=>"222100000",
'NOMINAL'=>"222"),
'70cm'=>array(
'SSB'=>"432200000",
'DATA'=>"432088000",
'CW'=>"432050000",
'NOMINAL'=>"433"),
'33cm'=>array(
'SSB'=>"902100000",
'DATA'=>"902100000",
'CW'=>"902100000",
'NOMINAL'=>"902"),
'23cm'=>array(
'SSB'=>"1296000000",
'DATA'=>"1296138000",
'CW'=>"129600000",
'NOMINAL'=>"1296"),
'13cm'=>array(
'SSB'=>"2320800000",
'DATA'=>"2320800000",
'CW'=>"2320800000",
'NOMINAL'=>"2400"),
'9cm'=>array(
'SSB'=>"3410000000",
'DATA'=>"3410000000",
'CW'=>"3400000000",
'NOMINAL'=>"3400"),
'6cm'=>array(
'SSB'=>"5670000000",
'DATA'=>"5670000000",
'CW'=>"5670000000",
'NOMINAL'=>"5670"),
'3cm'=>array(
'SSB'=>"10225000000",
'DATA'=>"10225000000",
'CW'=>"10225000000",
'NOMINAL'=>"10225")
);
/* Class to convert band and mode into a frequency in a format based on the specifications of the database table */
public function convert_band($band, $mode='SSB') {
// Converting LSB and USB to SSB
if($mode =='LSB' or $mode =='USB'){
$mode= "SSB";
}
// Use 'DATA' for any of the data modes
if($mode !='CW' and $mode !='SSB'){
$mode= "DATA";
}
return $this->getDefaultFrequency($band, $mode);
}
function getDefaultFrequency($band, $mode) {
$CI =& get_instance();
$db =& $CI->db;
$db->from('bands');
$db->where('bands.band', $band);
$result = $db->get()->row();
$mode = strtolower($mode);
return $result->$mode;
}
public function GetBand($Frequency) {
$Band = NULL;
if ($Frequency > 1000000 && $Frequency < 2000000) {
$Band = "160m";
} else if ($Frequency > 3000000 && $Frequency < 4000000) {
$Band = "80m";
} else if ($Frequency > 6000000 && $Frequency < 8000000) {
$Band = "40m";
} else if ($Frequency > 9000000 && $Frequency < 11000000) {
$Band = "30m";
} else if ($Frequency > 13000000 && $Frequency < 15000000) {
$Band = "20m";
} else if ($Frequency > 17000000 && $Frequency < 19000000) {
$Band = "17m";
} else if ($Frequency > 20000000 && $Frequency < 22000000) {
$Band = "15m";
} else if ($Frequency > 23000000 && $Frequency < 25000000) {
$Band = "12m";
} else if ($Frequency > 27000000 && $Frequency < 30000000) {
$Band = "10m";
} else if ($Frequency > 49000000 && $Frequency < 52000000) {
$Band = "6m";
} else if ($Frequency > 69000000 && $Frequency < 71000000) {
$Band = "4m";
} else if ($Frequency > 140000000 && $Frequency < 150000000) {
$Band = "2m";
} else if ($Frequency > 218000000 && $Frequency < 226000000) {
$Band = "1.25m";
} else if ($Frequency > 430000000 && $Frequency < 440000000) {
$Band = "70cm";
} else if ($Frequency > 900000000 && $Frequency < 930000000) {
$Band = "33cm";
} else if ($Frequency > 1200000000 && $Frequency < 1300000000) {
$Band = "23cm";
} else if ($Frequency > 2200000000 && $Frequency < 2600000000) {
$Band = "13cm";
} else if ($Frequency > 3000000000 && $Frequency < 4000000000) {
$Band = "9cm";
} else if ($Frequency > 5000000000 && $Frequency < 6000000000) {
$Band = "6cm";
} else if ($Frequency > 9000000000 && $Frequency < 11000000000) {
$Band = "3cm";
} else if ($Frequency > 23000000000 && $Frequency < 25000000000) {
$Band = "1.2cm";
} else if ($Frequency > 46000000000 && $Frequency < 55000000000) {
$Band = "6mm";
} else if ($Frequency > 75000000000 && $Frequency < 82000000000) {
$Band = "4mm";
} else if ($Frequency > 120000000000 && $Frequency < 125000000000) {
$Band = "2.5mm";
} else if ($Frequency > 133000000000 && $Frequency < 150000000000) {
$Band = "2mm";
} else if ($Frequency > 240000000000 && $Frequency < 250000000000) {
$Band = "1mm";
} else if ($Frequency >= 250000000000) {
$Band = "<1mm";
}
return $Band;
}
// converts a frequency in Hz to MHz output
function hz_to_mhz($frequency)
{
return number_format (($frequency / 1000 / 1000), 3) . " MHz";
}
}
/* End of file Frequency.php */