PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
corona-test-results-premium
/
premium
<?php /** * Copyright 2021 48DESIGN GmbH * All rights reserved. Redistribution of these files without prior consent is prohibited. */ /** * Enqueue our hourly cron job */ function corona_test_results_enqueue_cronjob() { if( !wp_next_scheduled( 'corona_test_results_cronjob_hourly' ) ) { wp_schedule_event( time(), 'hourly', 'corona_test_results_cronjob_hourly' ); } } add_action( 'wp', 'corona_test_results_enqueue_cronjob' ); /** * hourly cronjob */ function corona_test_results_cronjob_hourly( $location_id = null ) { global $wpdb; $do_for_all_locations = false; if ( $location_id === null ) { $location_id = 1; $do_for_all_locations = true; } $options = corona_test_results_get_options( $location_id ); // run deletion first, so the user has an hour to resurrect any codes that would otherwise // have been moved to trash and then permanently deleted in one go if ( isset( $options['assignation_autodelete'] ) && !empty( (int)$options['assignation_autodelete'] ) && is_numeric( $options['assignation_autodelete'] ) ) { $whereStatement = sprintf( "WHERE `trash` = 1 AND IF( `status_changed` IS NULL, `created_at`, `status_changed` ) < UTC_TIMESTAMP() - INTERVAL %d DAY", (int)$options['assignation_autodelete'] ); if ( corona_test_results_check_datatransfer_integration_enabled( 'cwa' ) ) { $tablename = corona_test_results_get_table_name( '', $location_id ); $dt_tableName = corona_test_results_get_table_name( 'datatransfer', $location_id ); $wpdb->query( "DELETE dt FROM `$dt_tableName` dt LEFT JOIN `$tablename` ON `$tablename`.`code` = dt.`code` $whereStatement" ); } $deleteQuery = sprintf( "DELETE FROM `%s` $whereStatement", corona_test_results_get_table_name( '', $location_id ) ); $wpdb->query( $deleteQuery ); } if ( isset( $options['assignation_autotrash'] ) && !empty( (int)$options['assignation_autotrash'] ) && is_numeric( $options['assignation_autotrash'] ) ) { $trashQuery = sprintf( 'UPDATE `%s` SET `trash` = 1 WHERE `trash` = 0 AND `status` != 0 AND IF( `status_changed` IS NULL, `created_at`, `status_changed` ) < UTC_TIMESTAMP() - INTERVAL %d DAY', corona_test_results_get_table_name( '', $location_id ), (int)$options['assignation_autotrash'] ); $wpdb->query( $trashQuery ); } if ( $do_for_all_locations === true ) { $locations = corona_test_results_locations_get(); if ( ! empty( $locations ) && count( $locations ) > 1 ) { foreach( $locations as $location_id => $location ) { if ( $location_id < 2 ) continue; corona_test_results_cronjob_hourly( $location_id ); } } } } add_action( 'corona_test_results_cronjob_hourly', 'corona_test_results_cronjob_hourly' ); /* * deactivation hook (unschedule cronjob) */ function corona_test_results_deactivation() { wp_clear_scheduled_hook( 'corona_test_results_cronjob_hourly' ); } register_deactivation_hook( corona_test_results__mainfile(), 'corona_test_results_deactivation' ); function corona_test_results_check_certificates_enabled() { $options = corona_test_results_get_options(); return is_ssl() && corona_test_results_check_crypto_activated() && corona_test_results_check_checkbox_option( 'certificates_enabled' ); } function corona_test_results_check_datatransfer_integration_enabled( $integration, $checkFiles = true ) { $options = corona_test_results_get_options(); switch( $integration ) { case 'cwa': if ( isset( $options['datatransfer_enable_cwa'] ) && ( $options['datatransfer_enable_cwa'] === 'enable_test' || $options['datatransfer_enable_cwa'] === 'enable_production' ) ) { $env = substr( $options['datatransfer_enable_cwa'], 7 ); if ( $checkFiles === false || ( isset( $options[ "datatransfer_cwa_${env}_file_cer" ] ) && ! empty( $options[ "datatransfer_cwa_${env}_file_cer" ] ) && is_file( $options[ "datatransfer_cwa_${env}_file_cer" ] ) && isset( $options[ "datatransfer_cwa_${env}_file_key" ] ) && ! empty( $options[ "datatransfer_cwa_${env}_file_key" ] ) && is_file( $options[ "datatransfer_cwa_${env}_file_key" ] ) && ( ( isset( $options[ "datatransfer_cwa_${env}_key_pass" ] ) && ! empty( $options[ "datatransfer_cwa_${env}_key_pass" ] ) ) || corona_test_results_check_checkbox_option( "datatransfer_cwa_${env}_key_pass_clientside", $options ) ) ) ) { return corona_test_results_check_certificates_enabled(); } } default: return false; } return false; } function corona_test_results_check_datatransfer_integration_getinstance( $integration ) { $options = corona_test_results_get_options(); switch( $integration ) { case 'cwa': if ( isset( $_POST['integration'] ) || corona_test_results_check_datatransfer_integration_enabled( $integration ) ) { require_once( corona_test_results_plugin_dir_path() . 'vendor/autoload.php' ); $env = isset( $_POST['env'] ) ? sanitize_text_field( $_POST['env'] ) : substr( $options["datatransfer_enable_${integration}"], 7 ); if ( isset( $_POST['key_pass'] ) ) { $options[ "datatransfer_${integration}_${env}_key_pass" ] = sanitize_textarea_field( $_POST['key_pass'] ); } if ( isset( $_POST["file_cer"] ) ) { $options["datatransfer_${integration}_${env}_file_cer" ] = sanitize_textarea_field( $_POST['file_cer'] ); } if ( isset( $_POST["file_key"] ) ) { $options["datatransfer_${integration}_${env}_file_key" ] = sanitize_textarea_field( $_POST['file_key'] ); } try { $instance = new FortyeightDesign\CWAQuicktest( $options[ "datatransfer_${integration}_${env}_file_cer" ], $options[ "datatransfer_${integration}_${env}_file_key" ], isset( $options[ "datatransfer_${integration}_${env}_key_pass" ] ) ? $options[ "datatransfer_${integration}_${env}_key_pass" ] : null, ! isset( $options[ "datatransfer_${integration}_${env}_key_pass" ] ) ); if ( $env === 'test' ) { $instance::$stage = 'WRU'; } else if ( $env === 'production' ) { $instance::$stage = 'PRODUCTION'; } return $instance; } catch(\Exception $e) { return $e; } } default: return null; } return null; }
[-] corona-test-results-admin.premium.php
[edit]
[-] corona-test-results-shortcodes.premium.php
[edit]
[+]
js
[-] corona-test-results-admin-locations.premium.php
[edit]
[-] corona-test-results-global.premium.php
[edit]
[+]
..
[-] LICENSE.txt
[edit]