<?php
// Exit if accessed directly
if (!defined('ABSPATH')) {
	exit();
}

// 🔒 Prevent Subscribers from seeing sensitive info
if ( ! current_user_can( 'manage_options' ) ) {
    wp_die( __( 'You do not have permission to access this page.', 'gsheetconnector-formidable-forms' ) );
}

$frm_free_system_log = new GSCFRMDFORM_Main();
?>
<div class="system-statuswc">
	<div class="info-container">
		<h2 class="system-info"><?php esc_html_e('System Info', 'gsheetconnector-formidable-forms'); ?></h2>
		<button id="copySystemf"
			class="copy"><?php esc_html_e('Copy System Info to Clipboard', 'gsheetconnector-formidable-forms'); ?></button>
		<?php
		/* phpcs:disable */
		echo wp_kses_post($frm_free_system_log->gscfrmdform_system_info());
		/* phpcs:enable */
		?>
	</div>
</div>



<div class="system-error">
	<div class="error-container">
		<h2 class="system-error"><?php esc_html_e('Error Log', 'gsheetconnector-formidable-forms'); ?></h2>
		<p>
			<?php esc_html_e('If you have', 'gsheetconnector-formidable-forms'); ?>
			<a href="https://www.gsheetconnector.com/how-to-enable-debugging-in-wordpress" target="_blank">
				<?php esc_html_e('WP_DEBUG_LOG', 'gsheetconnector-formidable-forms'); ?>
			</a>
			<?php esc_html_e('enabled, errors are stored in a log file. Here you can find the last 100 lines in reversed order so that you or the GSheetConnector support team can view it easily. The file cannot be edited here.', 'gsheetconnector-formidable-forms'); ?>
		</p>
		<button id="copyerrorlogf"
			class="copy"><?php esc_html_e('Copy Error Log to Clipboard', 'gsheetconnector-formidable-forms'); ?></button>
		<button
			class="clear-content-logs-frm"><?php esc_html_e('Clear', 'gsheetconnector-formidable-forms'); ?></button>
		<span class="clear-loading-sign-logs-frm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
		<div class="clear-content-logs-msg-frm"></div>
		<input type="hidden" name="gs-ajax-nonce" id="gs-ajax-nonce"
			value="<?php echo esc_attr(wp_create_nonce('gs-ajax-nonce')); ?>" />
		<div class="copy-message" style="display: none;">
			<?php esc_html_e('Copied', 'gsheetconnector-formidable-forms'); ?>
		</div>
		<!-- Add a hidden div for the copy message -->
		<?php
		/* phpcs:disable */
		echo wp_kses_post($frm_free_system_log->display_error_log());
		/* phpcs:enable */
		?>
	</div>
</div>