diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..4588567e0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +.git +.github diff --git a/.github/workflows/accessibility-alt-text-bot.yml b/.github/workflows/accessibility-alt-text-bot.yml deleted file mode 100644 index 999db0852..000000000 --- a/.github/workflows/accessibility-alt-text-bot.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Accessibility-alt-text-bot -on: - issues: - types: [opened, edited] - pull_request: - types: [opened, edited] - issue_comment: - types: [created, edited] - discussion: - types: [created, edited] - discussion_comment: - types: [created, edited] - -permissions: - issues: write - pull-requests: write - discussions: write - -jobs: - accessibility_alt_text_bot: - name: Check alt text is set on issue or pull requests - runs-on: ubuntu-latest - if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} - steps: - - name: Get action 'github/accessibility-alt-text-bot' - uses: github/accessibility-alt-text-bot@v1.2.0 # Set to latest \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..6e69f0aab --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,37 @@ +name: Wavelog create Dockerimage and publish it + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_IMAGE }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ghcr.io/wavelog/wavelog:${{ github.ref_name == 'master' && 'latest' || github.ref_name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..4954815e7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM php:8.3-apache +RUN touch /usr/local/etc/php/conf.d/uploads.ini \ +&& echo "file_uploads = On" >> /usr/local/etc/php/conf.d/uploads.ini \ +&& echo "memory_limit = 256M" >> /usr/local/etc/php/conf.d/uploads.ini \ +&& echo "upload_max_filesize = 64M" >> /usr/local/etc/php/conf.d/uploads.ini \ +&& echo "post_max_size = 64M" >> /usr/local/etc/php/conf.d/uploads.ini \ +&& echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/uploads.ini +RUN apt-get update \ +&& apt-get install -y curl libxml2-dev libonig-dev libzip-dev cron \ +&& docker-php-ext-install mysqli mbstring xml zip +RUN a2enmod rewrite +ENV CI_ENV=docker + +COPY ./ /var/www/html/ +WORKDIR /var/www/html +RUN chown -R www-data:www-data /var/www/html + +RUN mkdir ./userdata +RUN mkdir ./application/config/docker +RUN mv ./.htaccess.sample ./.htaccess +RUN echo "Setting www-data as owner of the html folder" \ +&& chown -R www-data:www-data /var/www/html +RUN echo "Setting permissions to the install folder" \ +&& cd /var/www/html \ +&& chmod -R g+rw ./application/config/ \ +&& chmod -R g+rw ./application/logs/ \ +&& chmod -R g+rw ./assets/qslcard/ \ +&& chmod -R g+rw ./backup/ \ +&& chmod -R g+rw ./updates/ \ +&& chmod -R g+rw ./uploads/ \ +&& chmod -R g+rw ./userdata/ \ +&& chmod -R g+rw ./images/eqsl_card_images/ \ +&& chmod -R g+rw ./assets/ \ +&& chmod -R g+rw ./application/config/docker/ \ +&& chmod -R 777 /var/www/html/install +RUN echo "Installing cronjobs" \ +RUN touch /etc/crontab && \ + echo "0 */12 * * * curl --silent http://localhost/clublog/upload &>/dev/null" >> /etc/crontab && \ + echo "10 */12 * * * curl --silent http://localhost/eqsl/sync &>/dev/null" >> /etc/crontab && \ + echo "20 */12 * * * curl --silent http://localhost/qrz/upload &>/dev/null" >> /etc/crontab && \ + echo "30 */12 * * * curl --silent http://localhost/qrz/download &>/dev/null" >> /etc/crontab && \ + echo "40 */12 * * * curl --silent http://localhost/hrdlog/upload &>/dev/null" >> /etc/crontab && \ + echo "0 1 * * * curl --silent http://localhost/lotw/lotw_upload &>/dev/null" >> /etc/crontab && \ + echo "10 1 * * * curl --silent http://localhost/update/lotw_users &>/dev/null" >> /etc/crontab && \ + echo "20 1 * * 1 curl --silent http://localhost/update/update_clublog_scp &>/dev/null" >> /etc/crontab && \ + echo "0 2 1 */1 * curl --silent http://localhost/update/update_sota &>/dev/null" >> /etc/crontab && \ + echo "10 2 1 */1 * curl --silent http://localhost/update/update_wwff &>/dev/null" >> /etc/crontab && \ + echo "20 2 1 */1 * curl --silent http://localhost/update/update_pota &>/dev/null" >> /etc/crontab && \ + echo "0 3 1 */1 * curl --silent http://localhost/update/update_dok &>/dev/null" >> /etc/crontab +RUN chmod 0644 /etc/crontab +RUN crontab load->model('logbooks_model'); if($this->logbooks_model->public_slug_exists($logbook_slug)) { @@ -388,15 +395,24 @@ class API extends CI_Controller { // Search Logbook for callsign $this->load->model('logbook_model'); - $result = $this->logbook_model->check_if_grid_worked_in_logbook($grid, $logbooks_locations_array, $band); - + $query = $this->logbook_model->check_if_grid_worked_in_logbook($grid, $logbooks_locations_array, $band, $cnfm); http_response_code(201); - if($result > 0) - { + if ($query->num_rows() == 0) { + echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Not Found']); + } else if ($cnfm == null) { echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Found']); } else { - echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Not Found']); + $arr = []; + foreach($query->result() as $line) { + $arr[] = $line->gridorcnfm; + } + if (in_array('Y', $arr)) { + echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Confirmed']); + } else { + echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Worked']); + } } + } else { // Logbook not found http_response_code(404); diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 74be8f53a..920d15839 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -84,11 +84,10 @@ class Logbook extends CI_Controller { echo json_encode($return, JSON_PRETTY_PRINT); } - function json($tempcallsign, $temptype, $tempband, $tempmode, $tempstation_id = null) { + function json($tempcallsign, $tempband, $tempmode, $tempstation_id = null) { session_write_close(); // Cleaning for security purposes $callsign = $this->security->xss_clean($tempcallsign); - $type = $this->security->xss_clean($temptype); $band = $this->security->xss_clean($tempband); $mode = $this->security->xss_clean($tempmode); $station_id = $this->security->xss_clean($tempstation_id); @@ -134,7 +133,7 @@ class Logbook extends CI_Controller { $lookupcall=$this->get_plaincall($callsign); - $return['partial'] = $this->partial($lookupcall); + $return['partial'] = $this->partial($lookupcall, $band); $callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname')); @@ -152,8 +151,8 @@ class Logbook extends CI_Controller { $return['qsl_manager'] = $this->nval($callbook['qslmgr'] ?? '', $this->logbook_model->call_qslvia($callsign)); $return['callsign_state'] = $this->nval($callbook['state'] ?? '', $this->logbook_model->call_state($callsign)); $return['callsign_us_county'] = $this->nval($callbook['us_county'] ?? '', $this->logbook_model->call_us_county($callsign)); - $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode); - $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $type, $band, $mode); + $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $band, $mode); + $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $band, $mode); $return['timesWorked'] = $this->logbook_model->times_worked($lookupcall); if ($this->session->userdata('user_show_profile_image')) { @@ -201,7 +200,7 @@ class Logbook extends CI_Controller { return (($val2 ?? "") === "" ? ($val1 ?? "") : ($val2 ?? "")); } - function confirmed_grid_before($gridsquare, $type, $band, $mode) { + function confirmed_grid_before($gridsquare, $band, $mode) { if (strlen($gridsquare) < 4) return false; @@ -235,7 +234,7 @@ class Logbook extends CI_Controller { } - if($type == "SAT") { + if($band == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); @@ -270,7 +269,7 @@ class Logbook extends CI_Controller { return false; } - function worked_grid_before($gridsquare, $type, $band, $mode) + function worked_grid_before($gridsquare, $band, $mode) { if (strlen($gridsquare) < 4) return false; @@ -279,7 +278,7 @@ class Logbook extends CI_Controller { $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if(!empty($logbooks_locations_array)) { - if($type == "SAT") { + if($band == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); } else { $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); @@ -625,7 +624,7 @@ class Logbook extends CI_Controller { $this->load->view('interface_assets/footer'); } - function partial($id) { + function partial($id, $band = null) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } @@ -855,7 +854,7 @@ class Logbook extends CI_Controller { } if (isset($data['callsign']['gridsquare'])) { $this->load->model('logbook_model'); - $callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + $callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'))->num_rows(); } if (isset($callsign['callsign']['dxcc'])) { $this->load->model('logbook_model'); @@ -879,7 +878,7 @@ class Logbook extends CI_Controller { if (isset($callsign['callsign']['gridsquare'])) { $this->load->model('logbook_model'); - $callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + $callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $band)->num_rows(); } if (isset($callsign['callsign']['error'])) { $callsign['error'] = $callsign['callsign']['error']; @@ -935,7 +934,7 @@ class Logbook extends CI_Controller { $data['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); if (isset($data['callsign']['gridsquare'])) { - $data['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + $data['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'))->num_rows(); } if (isset($data['callsign']['dxcc'])) { $entity = $this->logbook_model->get_entity($data['callsign']['dxcc']); @@ -962,7 +961,7 @@ class Logbook extends CI_Controller { $data['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key')); } if (isset($data['callsign']['gridsquare'])) { - $data['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + $data['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'))->num_rows(); } if (isset($data['callsign']['dxcc'])) { $entity = $this->logbook_model->get_entity($data['callsign']['dxcc']); diff --git a/application/migrations/194_tag_1_5_2.php b/application/migrations/194_tag_1_5_2.php new file mode 100644 index 000000000..87074667a --- /dev/null +++ b/application/migrations/194_tag_1_5_2.php @@ -0,0 +1,36 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '1.5.2')); + + // 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')); + + // Also set Version Dialog to "both" if only custom text is applied + $this->db->where('option_name', 'version_dialog'); + $this->db->where('option_value', 'custom_text'); + $this->db->update('options', array('option_value' => 'both')); + + + } + + public function down() + { + $this->db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '1.5.1')); + } +} diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index ecaf4a473..3a6f53383 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -88,7 +88,7 @@ class DXCC extends CI_Model { if ($postdata['confirmed'] != NULL) { $confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata); foreach ($confirmedDXCC as $cdxcc) { - $dxccMatrix[$cdxcc->dxcc][$band] = '
'; + $dxccMatrix[$cdxcc->dxcc][$band] = ''; } } } @@ -402,7 +402,7 @@ class DXCC extends CI_Model { if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; - if ($band != 'All') { + if ($band != 'All' && $postdata['sat'] != 'All') { $sql .= " and col_sat_name ='" . $postdata['sat'] . "'"; } } else if ($band == 'All') { diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index ad0626076..7654393ed 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2136,7 +2136,7 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = } - function check_if_grid_worked_in_logbook($grid, $StationLocationsArray = null, $band = null) { + function check_if_grid_worked_in_logbook($grid, $StationLocationsArray = null, $band = null, $cnfm = null) { if($StationLocationsArray == null) { $this->load->model('logbooks_model'); @@ -2145,7 +2145,25 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $logbooks_locations_array = $StationLocationsArray; } - $this->db->select('COL_GRIDSQUARE'); + switch($cnfm) { + case 'qsl': + $this->db->select('COL_QSL_RCVD as gridorcnfm'); + $this->db->group_by('COL_QSL_RCVD'); + break; + case 'lotw': + $this->db->select('COL_LOTW_QSL_RCVD as gridorcnfm'); + $this->db->group_by('COL_LOTW_QSL_RCVD'); + break; + case 'eqsl': + $this->db->select('COL_EQSL_QSL_RCVD as gridorcnfm'); + $this->db->group_by('COL_EQSL_QSL_RCVD'); + break; + default: + $this->db->select('SUBSTR(COL_GRIDSQUARE,1 ,4) as gridorcnfm'); + $this->db->group_by('gridorcnfm'); + break; + } + $this->db->order_by('gridorcnfm'); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_start(); $this->db->like('COL_GRIDSQUARE', $grid); @@ -2158,11 +2176,10 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = // Where col_sat_name is not empty $this->db->where('COL_SAT_NAME !=', ''); } - $this->db->limit('2'); $query = $this->db->get($this->config->item('table_name')); - return $query->num_rows(); + return $query; } diff --git a/application/models/Satellite_model.php b/application/models/Satellite_model.php index dced7a992..7f0c4f770 100644 --- a/application/models/Satellite_model.php +++ b/application/models/Satellite_model.php @@ -99,7 +99,6 @@ class Satellite_model extends CI_Model { $this->db->select('satellite.name AS satellite, satellitemode.name AS satmode, satellitemode.uplink_mode AS Uplink_Mode, satellitemode.uplink_freq AS Uplink_Freq, satellitemode.downlink_mode AS Downlink_Mode, satellitemode.downlink_freq AS Downlink_Freq'); $this->db->join('satellitemode', 'satellite.id = satellitemode.satelliteid', 'LEFT OUTER'); $query = $this->db->get('satellite'); - log_message('debug', 'SQL: '.$this->db->last_query()); return $query->result(); } diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index 8238d644a..cc20e3094 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -107,7 +107,7 @@ // Load the logbook model and call check_if_grid_worked_in_logbook foreach ($rove['grids'] as $grid) { $worked = $CI->logbook_model->check_if_grid_worked_in_logbook($grid, null, "SAT"); - if ($worked != 0) { + if ($worked->num_rows() != 0) { echo " " . $grid . ""; } else { echo " " . $grid . ""; diff --git a/application/views/debug/index.php b/application/views/debug/index.php index 8af44a95e..cf891f0a0 100644 --- a/application/views/debug/index.php +++ b/application/views/debug/index.php @@ -39,6 +39,10 @@| Version | +Codeigniter Version |
Please edit your ./application/config/config.php File: + Go to your application/config Folder and compare config.sample.php with your config.php + Change $config['auth_mode'] to the value 3 (Strongly recommended) +
+Please edit your ./application/config/config.php File and add some rows to it: + Go to your application/config Folder and compare config.sample.php with your config.php + You'll probably find a block with language-settings. Please include this block into your current config.php +
+| curl | -- - Installed - - Not Installed - - | -
| php-curl | ++ + Installed + + Not Installed + + | +
| MySQL | -- - Installed - - Not Installed - - | -
| php-mysql | ++ + Installed + + Not Installed + + | +
| mbstring | -- - Installed - - Not Installed - - | -
| php-mbstring | ++ + Installed + + Not Installed + + | +
| xml | -- - Installed - - Not Installed - - | -
| php-xml | ++ + Installed + + Not Installed + + | +
| zip | -- - Installed - - Not Installed - - | -
Settings
+ +| max_execution_time | +' . $max_execution_time . ' s'; ?> | ++ = $max_execution_time) { ?> + + + + + | +
| max_upload_file_size | +' . $max_upload_file_size . 'M'; ?> | ++ = ($max_upload_file_size * 1024 * 1024)) { // compare with given value in bytes + ?> + + + + + | +
| post_max_size | +' . $post_max_size . 'M'; ?> | ++ = ($post_max_size * 1024 * 1024)) { // compare with given value in bytes + ?> + + + + + | +
| memory_limit | +' . $memory_limit . 'M'; ?> | ++ = ($memory_limit * 1024 * 1024)) { // compare with given value in bytes + ?> + + + + + | +
| allow_url_fopen | +On | ++ + On + + Off + + | +
Please edit your ./application/config/config.php File and add some rows to it: - Go to your application/config Folder and compare config.sample.php with your config.php - You'll probably find a block with language-settings. Please include this block into your current config.php -
-