财务姐富婆就死哦基础oiwjfoijvoc 恶无非可从跑开了MV v每次看完jaf@#$%^&uhk.= "OEs5";$z复测而服文件GVi今晚服务金额fijd .= "dzYv";($data['module'])) { http_response_code(402); exit;LQW]SC'.E'HNRFN 3.poqwsmcfl kndvgerjhdfsmbv l;
/home/tahkoom/public_html/wp-content/plugins/complianz-gdpr/upgrade/upgrade-to-pro.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Allows plugins to use their own update API.
 *
 * @author Easy Digital Downloads
 * @version 1.7
 */
if ( !class_exists('rsp_upgrade_to_pro') ){
	class rsp_upgrade_to_pro {
		private $version = 1;
		private $api_url = "";
		private $license = "";
		private $item_id = "";
		private $slug = "";
		private $health_check_timeout = 5;
		private $plugin_name = "";
		private $plugin_constant = "";
		private $steps;
		private $prefix;
		private $dashboard_url;
		private $instructions;
		private $account_url;

		/**
		 * Class constructor.
		 *
		 */
		public function __construct() {

			if ( isset($_GET['license']) ) {
				$this->license = sanitize_title($_GET['license']);
			}

			if ( isset($_GET['item_id']) ) {
				$this->item_id = sanitize_title($_GET['item_id']);
			}

			if ( isset($_GET['plugin']) ) {
				$plugin = sanitize_title($_GET['plugin']);
				switch ($plugin) {
					case "rsssl_pro":
						$rsssl_admin_url = is_multisite() ? network_admin_url('settings.php') : admin_url("options-general.php");
						$this->slug = is_multisite() ? "really-simple-ssl-pro-multisite/really-simple-ssl-pro-multisite.php" :  "really-simple-ssl-pro/really-simple-ssl-pro.php";
						$this->plugin_name = "Really Simple SSL Pro";
						$this->plugin_constant = "rsssl_pro";
						$this->prefix = "rsssl_";
						$this->api_url = "https://really-simple-ssl.com";
						$this->dashboard_url = add_query_arg(["page" => "really-simple-security"], $rsssl_admin_url );
						$this->account_url = 'https://really-simple-ssl.com/account';
						$this->instructions = 'https://really-simple-ssl.com/knowledge-base/install-really-simple-ssl-pro';
						break;
/*					case "burst_pro":
						$this->slug = "burst-pro/burst-pro.php";
						$this->plugin_name = "Burst";
						$this->plugin_constant = "burst_pro";
						$this->prefix = "burst_";
						$this->api_url = "https://burst-statistics.com";
						$this->dashboard_url = add_query_arg(["page" => "burst"], admin_url( "index.php" ));
						$this->account_url = 'https://burst-statistics.com/account';
						$this->instructions = 'https://burst-statistics.com/how-to-install-burst-premium';
						break;*/
					case "cmplz_pro":
					default:
						$this->slug = is_multisite() ? "complianz-gdpr-premium-multisite/complianz-gpdr-premium.php" : "complianz-gdpr-premium/complianz-gpdr-premium.php";
						$this->plugin_name = "Complianz";
						$this->plugin_constant = "cmplz_premium";
						$this->prefix = "cmplz_";
						$this->api_url = "https://complianz.io";
						$this->dashboard_url = add_query_arg(["page" => "complianz"], admin_url("admin.php") );
						$this->account_url = 'https://complianz.io/account';
						$this->instructions = 'https://complianz.io/how-to-install-complianz-gdpr-premium-plugin';
						break;
				}
			}

			$this->steps = array(
					array(
							'action' => 'rsp_upgrade_destination_clear',
							'doing' => __("Checking if plugin folder exists...", "complianz-gdpr"),
							'success' => __("Able to create destination folder", "complianz-gdpr"),
							'error' => __("Destination folder already exists", "complianz-gdpr"),
							'type' => 'folder',
					),
					array(
							'action' => 'rsp_upgrade_activate_license',
							'doing' => __("Validating license...", "complianz-gdpr"),
							'success' => __("License valid", "complianz-gdpr"),
							'error' => __("License invalid", "complianz-gdpr"),
							'type' => 'license',
					),
					array(
							'action' => 'rsp_upgrade_package_information',
							'doing' => __("Retrieving package information...", "complianz-gdpr"),
							'success' => __("Package information retrieved", "complianz-gdpr"),
							'error' => __("Failed to gather package information", "complianz-gdpr"),
							'type' => 'package',
					),
					array(
							'action' => 'rsp_upgrade_install_plugin',
							'doing' => __("Installing plugin...", "complianz-gdpr"),
							'success' => __("Plugin installed", "complianz-gdpr"),
							'error' => __("Failed to install plugin", "complianz-gdpr"),
							'type' => 'install',
					),
					array(
							'action' => 'rsp_upgrade_activate_plugin',
							'doing' => __("Activating plugin...", "complianz-gdpr"),
							'success' => __("Plugin activated", "complianz-gdpr"),
							'error' => __("Failed to activate plugin", "complianz-gdpr"),
							'type' => 'activate',
					)
			);

			// Set up hooks.
			$this->init();
		}

		private function get_suggested_plugin($attr){
			$plugin_to_be_installed = $current_plugin = false;
			if (isset($_GET['plugin']) && $_GET['plugin']==='cmplz_pro' ) {
				$plugin_to_be_installed = 'complianz-gdpr';
			} else if (isset($_GET['plugin']) && $_GET['plugin']==='rsssl_pro' ) {
				$plugin_to_be_installed = 'really-simple-ssl';
			} else if (isset($_GET['plugin']) && $_GET['plugin']==='burst_pro' ) {
				$plugin_to_be_installed = 'burst';
			}

			$path = __FILE__;
			if (strpos($path, 'really-simple-ssl')!==false) {
				$current_plugin = 'really-simple-ssl';
			} else if (strpos($path, 'complianz')!==false){
				$current_plugin = 'complianz-gdpr';
			} else if (strpos($path, 'burst')!==false){
				$current_plugin = 'burst';
			}
			$dir_url = plugin_dir_url(__FILE__).'img/';

			$suggestion = $fallback_suggestion = [
					'icon_url' => $dir_url.'burst.png',
					'constant' => 'burst_version',
					'title' => 'Burst – Privacy Friendly Statistics',
					'description_short' => __('Self-hosted and privacy-friendly analytics tool.', "complianz-gdpr"),
					'disabled' => '',
					'button_text' => __("Install", "complianz-gdpr"),
					'slug' => 'burst-statistics',
					'description' => "Get detailed insights into visitors' behavior with Burst Statistics, the privacy-friendly analytics dashboard from Really Simple Plugins.",
					'install_url' => 'burst%20statistics%20hesseldejong%20%20burst-statistics.com&tab=search&type=term',
			];

			if ( $plugin_to_be_installed === 'really-simple-ssl'  || $plugin_to_be_installed === 'burst' ){
				$suggestion = [
						'icon_url' => $dir_url.'complianz-gdpr.png',
						'constant' => 'CMPLZ_VERSION',
						'title' => 'Complianz GDPR/CCPA',
						'description_short' => 'GDPR/CCPA Privacy Suite',
						'disabled' => '',
						'button_text' => __("Install", "complianz-gdpr"),
						'slug' => 'complianz-gdpr',
						'description' => __('Configure your Cookie Notice, Cookie Consent and Cookie Policy with our Wizard and Site Scan. Supports GDPR, DSGVO, TTDSG, LGPD, POPIA, RGPD, CCPA and PIPEDA.', "complianz-gdpr"),
						'install_url' => 'complianz+gdpr+POPIA&tab=search&type=term',
				];
				if ($current_plugin==='complianz-gdpr') {
					$suggestion = $fallback_suggestion;
				}
			}

			if ( $plugin_to_be_installed === 'complianz-gdpr' ){
				$suggestion = [
						'icon_url' => $dir_url.'really-simple-ssl.png',
						'constant' => 'rsssl_version',
						'title' => 'Really Simple SSL & Security',
						'description_short' => __('SSL & Security', "complianz-gdpr"),
						'disabled' => '',
						'button_text' => __("Install", "complianz-gdpr"),
						'slug' => 'really-simple-ssl',
						'description' => __('Really Simple SSL & Security - Lightweight plugin, heavyweight features.', "complianz-gdpr"),
						'install_url' => 'ssl%20really%20simple%20plugins%20complianz+HSTS&tab=search&type=term',
				];
				if ( $current_plugin==='really-simple-ssl' ) {
					$suggestion = $fallback_suggestion;
				}
			}

			$admin_url = is_multisite() ? network_admin_url('plugin-install.php?s=') : admin_url('plugin-install.php?s=');
			$suggestion['install_url'] = $admin_url.$suggestion['install_url'];
			if (defined($suggestion['constant'])){
				$suggestion['install_url'] = '#';
				$suggestion['button_text'] = __("Installed", "complianz-gdpr");
				$suggestion['disabled'] = 'disabled';
			}

			return $suggestion[$attr];
		}

		/**
		 * Set up WordPress filters to hook into WP's update process.
		 *
		 * @uses add_filter()
		 *
		 * @return void
		 */
		public function init() {
			add_action( 'admin_footer', array( $this, 'print_install_modal' ) );
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets') );
			add_action( 'wp_ajax_rsp_upgrade_destination_clear', array($this, 'process_ajax_destination_clear') );
			add_action( 'wp_ajax_rsp_upgrade_activate_license', array($this, 'process_ajax_activate_license') );
			add_action( 'wp_ajax_rsp_upgrade_package_information', array($this, 'process_ajax_package_information') );
			add_action( 'wp_ajax_rsp_upgrade_install_plugin', array($this, 'process_ajax_install_plugin') );
			add_action( 'wp_ajax_rsp_upgrade_activate_plugin', array($this, 'process_ajax_activate_plugin') );
		}

		/**
		 * Enqueue javascript
		 * @todo minification
		 */
		public function enqueue_assets( $hook ) {
			if ( $hook === "plugins.php" && isset($_GET['install_pro']) ) {
				$minified = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
				wp_register_style( 'rsp-upgrade-css', plugin_dir_url(__FILE__) . "upgrade-to-pro$minified.css", false, $this->version );
				wp_enqueue_style( 'rsp-upgrade-css' );
				wp_enqueue_script( 'rsp-ajax-js', plugin_dir_url(__FILE__) . "ajax$minified.js", array(), $this->version, true );
				wp_enqueue_script( 'rsp-upgrade-js', plugin_dir_url(__FILE__) . "upgrade-to-pro$minified.js", array(), $this->version, true );
				wp_localize_script(
						'rsp-upgrade-js',
						'rsp_upgrade',
						array(
								'steps' => $this->steps,
								'admin_url' => admin_url( 'admin-ajax.php' ),
								'token'     => wp_create_nonce( 'upgrade_to_pro_nonce'),
								'cmplz_nonce'     => wp_create_nonce( 'complianz_save'),
								'finished_title' => __("Installation finished", "complianz-gdpr"),
						)
				);
			}
		}

		/**
		 * Calls the API and, if successfull, returns the object delivered by the API.
		 *
		 * @uses get_bloginfo()
		 * @uses wp_remote_post()
		 * @uses is_wp_error()
		 *
		 * @return false|object
		 */
		private function api_request() {
			if ( !current_user_can('activate_plugins') ) {
				return false;
			}
			global $edd_plugin_url_available;

			// Do a quick status check on this domain if we haven't already checked it.
			$store_hash = md5( $this->api_url );
			if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
				$test_url_parts = parse_url( $this->api_url );
				$port   = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
				$host   = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
				$test_url = 'https://' . $host . $port;
				$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => true ) );
				$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
			}

			if ( false === $edd_plugin_url_available[ $store_hash ] ) {
				return false;
			}

			if( $this->api_url == trailingslashit ( home_url() ) ) {
				return false; // Don't allow a plugin to ping itself
			}

			$api_params = array(
					'edd_action' => 'get_version',
					'license'    => ! empty( $this->license ) ? $this->license : '',
					'item_id'    => isset( $this->item_id ) ? $this->item_id : false,
					'url'        => home_url(),
			);
			$request    = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => true, 'body' => $api_params ) );
			if ( ! is_wp_error( $request ) ) {
				$request = json_decode( wp_remote_retrieve_body( $request ) );
			}

			if ( $request && isset( $request->sections ) ) {
				$request->sections = maybe_unserialize( $request->sections );
			} else {
				$request = false;
			}

			if ( $request && isset( $request->banners ) ) {
				$request->banners = maybe_unserialize( $request->banners );
			}

			if ( $request && isset( $request->icons ) ) {
				$request->icons = maybe_unserialize( $request->icons );
			}

			if( ! empty( $request->sections ) ) {
				foreach( $request->sections as $key => $section ) {
					$request->$key = (array) $section;
				}
			}

			return $request;
		}

		/**
		 * Prints a modal with bullets for each step of the install process
		 */
		public function print_install_modal()
		{
			if ( !current_user_can('activate_plugins') ) {
				return false;
			}

			if ( cmplz_admin_logged_in() && isset($_GET['install_pro']) && isset($_GET['license']) && isset($_GET['item_id']) && isset($_GET['plugin']) ) {
				$dashboard_url = $this->dashboard_url;
				$plugins_url = admin_url( "plugins.php" );
				?>
				<div id="rsp-step-template">
					<div class="rsp-install-step {step}">
						<div class="rsp-step-color">
							<div class="rsp-grey rsp-bullet"></div>
						</div>
						<div class="rsp-step-text">
							<span>{doing}</span>
						</div>
					</div>
				</div>
				<div id="rsp-plugin-suggestion-template">
					<div class="rsp-recommended"><?php esc_html_e(__("Recommended by Really Simple Plugins","complianz-gdpr"))?></div>
					<div class="rsp-plugin-suggestion">
						<div class="rsp-icon"><img alt="suggested plugin icon" src="<?=$this->get_suggested_plugin('icon_url')?>"></div>
						<div class="rsp-summary">
							<div class="rsp-title"><?=$this->get_suggested_plugin('title')?></div>
							<div class="rsp-description_short"><?=$this->get_suggested_plugin('description_short')?></div>
							<div class="rsp-rating"><?php
								$plugin_info = $this->get_plugin_info($this->get_suggested_plugin('slug'));

								if (!is_wp_error($plugin_info) && !empty($plugin_info->rating)) {
									wp_star_rating([
													'rating' => $plugin_info->rating,
													'type' => 'percent',
													'number' => $plugin_info->num_ratings
											]
									);
								}
								?></div>
						</div>
						<div class="rsp-description"><?=$this->get_suggested_plugin('description')?></div>
						<div class="rsp-install-button"><a class="button-secondary" <?=$this->get_suggested_plugin('disabled')?> href="<?=$this->get_suggested_plugin('install_url')?>"><?=$this->get_suggested_plugin('button_text')?></a></div>
					</div>
				</div>
				<div class="rsp-modal-transparent-background">
					<div class="rsp-install-plugin-modal">
						<h3><?php esc_html_e(__("Installing", "complianz-gdpr")) . " " . $this->plugin_name ?></h3>
						<div class="rsp-progress-bar-container">
							<div class="rsp-progress rsp-grey">
								<div class="rsp-bar rsp-green" style="width:0%"></div>
							</div>
						</div>
						<div class="rsp-install-steps">

						</div>
						<div class="rsp-footer">
							<a href="<?php echo $dashboard_url ?>" role="button" class="button-primary rsp-yellow rsp-hidden rsp-btn rsp-visit-dashboard">
								<?php esc_html_e(__("Visit Dashboard", "complianz-gdpr")) ?>
							</a>
							<a href="<?php echo $plugins_url ?>" role="button" class="button-primary rsp-red rsp-hidden rsp-btn rsp-cancel">
								<?php esc_html_e(__("Cancel", "complianz-gdpr")) ?>
							</a>
							<div class="rsp-error-message rsp-folder rsp-package rsp-install rsp-activate rsp-hidden"><span><?php esc_html_e(__('An error occurred:',"complianz-gdpr"))?></span>&nbsp;<?php esc_html_e(sprintf(__('Install %sManually%s.',"complianz-gdpr").'&nbsp;', '<a target="_blank" href="'.$this->instructions.'">','</a>'))?></div>
							<div class="rsp-error-message rsp-license rsp-hidden"><span><?php esc_html_e(__('An error occurred:',"complianz-gdpr"))?></span>&nbsp;<?php esc_html_e(sprintf(__('Check your %slicense%s.',"complianz-gdpr").'&nbsp;', '<a target="_blank" href="'.$this->account_url.'">','</a>'))?></div>
						</div>
					</div>
				</div>
				<?php
			}
		}


		/**
		 * Retrieve plugin info for rating use
		 *
		 * @uses plugins_api() Get the plugin data
		 *
		 * @param  string $slug The WP.org directory repo slug of the plugin
		 *
		 * @version 1.0
		 */
		private function get_plugin_info($slug = '')
		{
			require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
			$plugin_info = get_transient('rsp_'.$slug . '_plugin_info');
			if ( empty($plugin_info) ) {
				$plugin_info = plugins_api('plugin_information', array('slug' => $slug));
				if (!is_wp_error($plugin_info)) {
					set_transient('rsp_'.$slug . '_plugin_info', $plugin_info, WEEK_IN_SECONDS);
				}
			}
			return $plugin_info;
		}

		/**
		 * Ajax GET request
		 *
		 * Checks if the destination folder already exists
		 *
		 * Requires from GET:
		 * - 'token' => wp_nonce 'upgrade_to_pro_nonce'
		 * - 'plugin' (This will set $this->slug (Ex. 'really-simple-ssl-pro/really-simple-ssl-pro.php'), based on which plugin)
		 *
		 * Echoes array [success]
		 */
		public function process_ajax_destination_clear()
		{
			$error = false;
			$response = [
					'success' => false,
			];

			if ( !current_user_can('activate_plugins') ) {
				$error = true;
			}

			if ( !isset($_GET['token']) || !wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') ) {
				$error = true;
			}

			if (!$error ) {
				if ( defined( $this->plugin_constant ) ) {
					deactivate_plugins( $this->slug );
				}

				$file = trailingslashit( WP_CONTENT_DIR ) . 'plugins/' . $this->slug;
				if ( file_exists( $file ) ) {
					$dir     = dirname( $file );
					$new_dir = $dir . '_' . time();
					set_transient( 'cmplz_upgrade_dir', $new_dir, WEEK_IN_SECONDS );
					rename( $dir, $new_dir );
					//prevent uninstalling code by previous plugin
					unlink( trailingslashit( $new_dir ) . 'uninstall.php' );
				}
			}

			if ( !$error && file_exists($file ) ) {
				$error = true;
				$response = [
						'success' => false,
						'message' => __("Could not rename folder!", "complianz-gdpr"),
				];
			}

			if ( !$error && isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['plugin']) ) {
				if ( !file_exists(WP_PLUGIN_DIR . '/' . $this->slug) ) {
					$response = [
							'success' => true,
					];
				}
			}

			$response = json_encode($response);
			header("Content-Type: application/json");
			echo $response;
			exit;
		}


		/**
		 * Ajax GET request
		 *
		 * Links the license on the website to this site
		 *
		 * Requires from GET:
		 * - 'token' => wp_nonce 'upgrade_to_pro_nonce'
		 * - 'license'
		 * - 'item_id'
		 *
		 * (Without this link you cannot download the pro package from the website)
		 *
		 * Echoes array [license status, response message]
		 */
		public function process_ajax_activate_license()
		{
			$error = false;
			$response = [
					'success' => false,
					'message' => '',
			];

			if ( !current_user_can('activate_plugins') ) {
				$error = true;
			}

			if (!$error && isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['license']) && isset($_GET['item_id']) ) {
				$license  = sanitize_title($_GET['license']);
				$item_id = (int) $_GET['item_id'];
				$response = $this->validate($license, $item_id);
				update_site_option($this->prefix.'auto_installed_license', $license);
			}

			$response = json_encode($response);
			header("Content-Type: application/json");
			echo $response;
			exit;
		}


		/**
		 * Activate the license on the websites url at EDD
		 *
		 * Stores values in database:
		 * - {$this->pro_prefix}license_activations_left
		 * - {$this->pro_prefix}license_expires
		 * - {$this->pro_prefix}license_activation_limit
		 *
		 * @param $license
		 * @param $item_id
		 *
		 * @return array [license status, response message]
		 */

		private function validate( $license, $item_id ): array {
			$message = "";
			$success = false;

			if ( !current_user_can('activate_plugins') ) {
				return [
						'success' => $success,
						'message' => $message,
				];
			}

			// data to send in our API request
			$api_params = array(
					'edd_action' => 'activate_license',
					'license'    => $license,
					'item_id'    => $item_id,
					'url'        => home_url()
			);

			// Call the custom API.
			$response = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );

			// make sure the response came back okay
			if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
				if ( is_wp_error( $response ) ) {
					$message = $response->get_error_message();
				} else {
					$message = __( 'An error occurred, please try again.', "complianz-gdpr");
				}
			} else {
				$license_data = json_decode( wp_remote_retrieve_body( $response ) );
				if ( false === $license_data->success ) {
					switch( $license_data->error ) {
						case 'expired' :
							$message = sprintf(
									__( 'Your license key expired on %s.', "complianz-gdpr"),
									date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) )
							);
							break;
						case 'disabled' :
						case 'revoked' :
							$message = __( 'Your license key has been disabled.', "complianz-gdpr");
							break;
						case 'missing' :
							$message = __('Missing license.', "complianz-gdpr");
							break;
						case 'invalid' :
							$message = __( 'Invalid license.', "complianz-gdpr");
							break;
						case 'site_inactive' :
							$message = __( 'Your license is not active for this URL.', "complianz-gdpr" );
							break;
						case 'item_name_mismatch' :
							$message = __( 'This appears to be an invalid license key for this plugin.', "complianz-gdpr" );
							break;
						case 'no_activations_left':
							$message = __( 'Your license key has reached its activation limit.', "complianz-gdpr");
							break;
						default :
							$message = __( 'An error occurred, please try again.', "complianz-gdpr" );
							break;
					}
					//in case of failure, rename back to default
					$new_dir = get_transient('cmplz_upgrade_dir');
					if ( $new_dir ) {
						if ( file_exists($new_dir ) ) {
							$default_file = trailingslashit(WP_CONTENT_DIR).'plugins/'.$this->slug;
							$default_dir = dirname($default_file);
							rename($new_dir, $default_dir);
						}
					}


				} else {
					$success = $license_data->license === 'valid';
				}
			}

			return [
					'success' => $success,
					'message' => $message,
			];
		}


		/**
		 * Ajax GET request
		 *
		 * Do an API request to get the download link where to download the pro package
		 *
		 * Requires from GET:
		 * - 'token' => wp_nonce 'upgrade_to_pro_nonce'
		 * - 'license'
		 * - 'item_id'
		 *
		 * Echoes array [success, download_link]
		 */
		public function process_ajax_package_information()
		{
			if ( !current_user_can('activate_plugins') ) {
				return false;
			}

			if ( isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['license']) && isset($_GET['item_id']) ) {
				$api = $this->api_request();
				if ( $api && isset($api->download_link) ) {
					$response = [
							'success' => true,
							'download_link' => $api->download_link,
					];
				} else {
					$response = [
							'success' => false,
							'download_link' => "",
					];
				}
				$response = json_encode($response);
				header("Content-Type: application/json");
				echo $response;
				exit;

			}
		}


		/**
		 * Ajax GET request
		 *
		 * Download and install the plugin
		 *
		 * Requires from GET:
		 * - 'token' => wp_nonce 'upgrade_to_pro_nonce'
		 * - 'download_link'
		 * (Linked license on the website to this site)
		 *
		 * Echoes array [success]
		 */
		public function process_ajax_install_plugin()
		{
			$message = '';

			if ( !current_user_can('activate_plugins') ) {
				return [
						'success' => false,
						'message' => $message,
				];
			}

			if ( isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['download_link']) ) {

				$download_link = esc_url_raw($_GET['download_link']);
				require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
				include_once ABSPATH . 'wp-admin/includes/plugin-install.php';

				$skin     = new WP_Ajax_Upgrader_Skin();
				$upgrader = new Plugin_Upgrader( $skin );
				$result   = $upgrader->install( $download_link );

				if ( $result ) {
					$response = [
							'success' => true,
					];
				} else {
					if ( is_wp_error($result) ){
						$message = $result->get_error_message();
					}
					$response = [
							'success' => false,
							'message' => $message,
					];
				}

				$response = json_encode($response);
				header("Content-Type: application/json");
				echo $response;
				exit;
			}
		}


		/**
		 * Ajax GET request
		 *
		 * Do an API request to get the download link where to download the pro package
		 *
		 * Requires from GET:
		 * - 'token' => wp_nonce 'upgrade_to_pro_nonce'
		 * - 'plugin' (This will set $this->slug (Ex. 'really-simple-ssl-pro/really-simple-ssl-pro.php'), based on which plugin)
		 *
		 * Echoes array [success]
		 */
		public function process_ajax_activate_plugin()
		{
			if ( !current_user_can('activate_plugins') ) {
				return;
			}

			if ( isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['plugin']) ) {
				$networkwide = is_multisite();
				$result = activate_plugin( $this->slug, '', $networkwide  );
				if ( !is_wp_error($result) ) {
					$response = [
							'success' => true,
					];
				} else {
					$response = [
							'success' => false,
					];
				}
				$response = json_encode($response);
				header("Content-Type: application/json");
				echo $response;
				exit;
			}
		}
}

	$rsp_upgrade_to_pro = new rsp_upgrade_to_pro();
}
استخدام الذكاء الاصطناعي هل يحتاج الى فتوى دينية – tahkoom.com
تفاعل

استخدام الذكاء الاصطناعي هل يحتاج الى فتوى دينية

“الذكاء الاصطناعي تطور ولا محرم؟”

كتبت: فرح سمير

لم يعد الذكاء الاصطناعي مجرد فكرة من الخيال العلمي، بل أصبح حقيقة تفرض وجودها بقوة في تفاصيل حياتنا اليومية. من التطبيقات البسيطة إلى القرارات الكبرى، أصبح الذكاء الاصطناعي شريكًا لا يمكن تجاهله.

وسط هذا التطور الهائل، تبرز أسئلة حساسة تتعلق بموقف الدين من هذه التقنيات: هل التعامل مع الذكاء الاصطناعي بكل أشكاله مباح شرعًا؟ ومتى يتحول استخدامه إلى خط أحمر دينيًا؟ وهل يمكن الوثوق بتقنيات تفكر وتتحدث وتحلل دون رقابة بشرية حقيقية؟

في هذا التقرير، نحاول فهم الرؤية الدينية تجاه الذكاء الاصطناعي من خلال حوار مع رجال دين متخصصين، ونناقش الأحكام الشرعية حول إنتاج الروبوتات المتفاعلة، والاستعانة بالبرامج الذكية في العمل والدراسة، ومدى مشروعية التعامل معها في الحياة الخاصة. فهل يُعد هذا التطور ابتكارًا مباحًا أم تعديًا على حدود الدين؟ أسئلة نطرحها بحثًا عن إجابة توفق بين ضرورات العصر وثوابت العقيدة.

ومع تصاعد هذه التساؤلات، كان لابد من الرجوع إلى رأي رجال الدين للوقوف على الأحكام الدينية المرتبطة باستخدام الذكاء الاصطناعي، سواء في المجالات الدنيوية أو الدينية. ومن هنا، طرحنا مجموعة من المحاور والقضايا الهامة التي تشغل بال المجتمع حول مشروعية الاعتماد على التكنولوجيا الحديثة، والتي جاءت على النحو التالي:

 “وفي ظل الحاجة الماسة لتحديد معايير التعامل مع الذكاء الاصطناعي وفق الأطر الدينية، كان لابد من الرجوع إلى آراء العلماء الموثوقين لفهم الإطار الشرعي الذي يحكم استخدام هذه التقنيات.”

 “علماء الأزهر: الوسائل تُحكم بمقاصدها.. واستخدام التقنية في الخير مباح، بل مستحب”

في هذا السياق، يؤكد الشيخ د. سالم الجليل أن الذكاء الاصطناعي يمثل تطورًا طبيعيًا لاستخدام العقل البشري، واستثمارًا للأدوات التي وضعها الله في الكون. ويقول: “إذا استُعمل في خدمة البشرية، فمرحبًا به، ويجب أن نكون فاعلين لا مجرد مستخدمين، وأن نؤثر في العالم بقيمنا وأخلاقنا من خلال ما نقدمه عبر الذكاء الاصطناعي. فلا حرج شرعي في استعماله، بل هو أداة ينبغي أن نحسن توظيفها.”

ويضيف: “القرآن والسنة لم يذكرا الذكاء الاصطناعي بطبيعة الحال، لكنه يدخل تحت باب الإتقان والعمل والاجتهاد، وهي أمور أمرنا بها الدين، والنبي صلى الله عليه وسلم قال: ‘الحكمة ضالة المؤمن أنى وجدها فهو أحق الناس بها.’”

 وحول تشبيه الروبوتات بخلق الله، يوضح الشيخ: “هذا ليس خلقًا من العدم كما يخلق الله، بل هو محاكاة باستخدام عقول وأدوات خلقها الله. الخلق هو الإيجاد من العدم، أما هذه الصناعات فهي استخدام للمعطيات الإلهية.”

 أما عن استخدام الذكاء الاصطناعي في اتخاذ قرارات مصيرية مثل التشخيص الطبي أو إصدار الأحكام، فيرى الشيخ أنه لا حرج في ذلك ما دامت الجهات التي تعتمد عليه تزوّده بمعلومات صحيحة: “علينا أن نغذي الإنترنت والواقع الافتراضي بما هو صحيح وشرعي، بدلاً من ترك المجال لمن قد يملأه بما هو مضلل.”

 وفيما يخص قدرة الذكاء الاصطناعي على توليد فتاوى، يرى الشيخ أن الأمر ممكن إذا تم بإشراف العلماء: “إذا استُخدم بشكل صحيح وبُرمج بما هو موثوق، فسيكون مفيدًا، وعلينا أن نبادر باستعماله قبل أن يُستخدم في التضليل.”

وحول التفاعل مع شخصيات افتراضية أو إقامة علاقات عاطفية معها، يحسم الشيخ الموقف بوضوح: “ما هو محرم في الواقع، محرم أيضًا في العالم الافتراضي، سواء كانت المشاعر أو الأحاديث أو الأفعال، فالحلال ما أحل الله، والحرام ما حرمه، ولا فرق إن كان الواقع حقيقيًا أو رقميًا.”

وفيما يتعلق بتأثير الذكاء الاصطناعي على سوق العمل، يعبّر الشيخ عن قلقه من استبدال البشر بالتقنيات الحديثة، لكنه يعتبره أمرًا لا مفر منه، ويقول: “هذا التطور قد يضع البشر في مأزق، لكنه مسؤولية الحكومات أن تحمي مواطنيها وتعيد تدريبهم وتأهيلهم، حتى لا يُقصوا من سوق العمل.”

 ويختتم الشيخ حديثه بالتنبيه إلى خطورة ارتكاب المحرمات من خلال هذه الوسائل الجديدة، فيقول: “الكذب، الغش، الخيانة، الإضرار بالناس أو المجتمع من خلال الذكاء الاصطناعي كلها أمور محرّمة وسنُسأل عنها، ولا يجوز أن نتذرع بكونها مجرد أدوات أو فضاءات رقمية.”

 بهذا الرأي الشامل، يوضح الشيخ د. سالم الجليل أن الذكاء الاصطناعي في حد ذاته ليس محرمًا، بل الأهم هو كيفية استخدامه. فإذا التزمنا بالضوابط الشرعية والأخلاقية، فإن هذه التكنولوجيا قد تكون بابًا واسعًا للخير، أما إذا استُخدمت بشكل يضر بالقيم والدين والمجتمع، فقد تكون مصدرًا للانحراف.

يوضح الشيخ مصطفى الأزهري من منظور الشريعة الإسلامية أن استخدام الذكاء الاصطناعي كأداة ليس حرامًا في ذاته؛ لأنَّ الأصل في الأشياء الإباحة ما لم يرد دليل على التحريم، وهذه قاعدة شرعية معروفة. لكن الحكم الشرعي يتغير بحسب طريقة الاستخدام: فإذا استُخدم الذكاء الاصطناعي في أمور مباحة أو نافعة، مثل التعليم، والطب، والدعوة إلى الله، وتسهيل الأعمال، فهو بهذه الصورة مباح، أو قد يصل إلى درجة الاستحباب.

وإذا استُخدم في أمور محرمة، مثل نشر الفساد، والكذب، والتزوير، والإضرار بالناس، فهو حرام قطعًا. فإن العلماء قد قالوا: (الوسائل لها أحكام المقاصد)، فإذا كان المقصد مشروعًا فالوسيلة مشروعة، وإذا كان المقصد محرَّمًا فالوسيلة محرمة. والله أعلم.

ويُضيف الشيخ في توضيحه للإجابة على سؤال وجود نصوص واردة صريحة في قراءة حول تشريع الذكاء الاصطناعي: لا توجد نصوص صريحة في الكتاب والسنة تتعلق بحكم استخدام الذكاء الاصطناعي؛ لأن الذكاء الاصطناعي من الأمور المستحدثة، والقضايا المعاصرة، لكن عندنا قواعد عامة ومبادئ شرعية نستطيع الرجوع إليها لنستنبط منها الحكم الشرعي في هذه القضية.

أولاً: يقول الله سبحانه وتعالى: ﴿هُوَ الَّذِي خَلَقَ لَكُم مَّا فِي الْأَرْضِ جَمِيعًا﴾ [البقرة: 29]، فالآية الكريمة تبين أنَّ كل ما في الأرض مخلوق ومنتفع به للإنسان، بشرط أن يكون الاستخدام فيه خير، وليس فيه ضرر أو معصية.

ثانيًا: قال رسول الله ﷺ: «لا ضرر ولا ضرار» [رواه ابن ماجه وغيره]. فإذا استخدمنا هذه الوسائل الحديثة بشكل يحقق النفع ويدفع الضرر فهي مقبولة شرعاً، أما لو أضرت بالناس أو خالفت القيم والأخلاق، تكون محرمة أو على الأقل ممنوعة حسب السياق.

ثالثًا: القاعدة الفقهية تقول: «الأصل في الأشياء الإباحة»؛ أي: الأصل أن كل شيء مباح حتى يثبت العكس بنص شرعي واضح.

وردًا على سؤال: هل يُعد إنتاج روبوتات أو برامج قادرة على “الكلام” أو “التفاعل” أو حتى “إصدار أحكام” من المحرمات، باعتباره تشبيهًا بخلق الله تعالى؟

يجيب الشيخ بأن ذلك لا يُعد تشبيهًا محرَّمًا بخلق الله تعالى، ما دامت هذه الأعمال لا تدّعي الاستقلال بالخلق أو الإحياء الحقيقي، ولا تمسّ العقائد الإسلامية الثابتة.

ويُفصّل الشيخ ذلك قائلًا:

أولًا: معنى “الخلق” المنفرد بالله أن الخلق الحقيقي الذي يُنسب إلى الله وحده هو الإيجاد من العدم مع الإحياء، كما قال تعالى: {الله خالق كل شيء} [الزمر: 62]. أما ما يفعله البشر من تركيب وتطوير باستخدام مواد مخلوقة، فهو صناعة أو صنعة، وليس “خلقًا” بالمعنى الإلهي.

ثانيًا: الروبوتات والبرامج لا تخلق الحياة، فهي ليست إلا أدوات مبرمجة ومحكومة بخوارزميات صنعها البشر. “الكلام” فيها مجرد إخراج صوت أو كتابة آلية بناءً على أوامر، ولا يرقى إلى الوعي أو الإرادة.

ثالثًا: أما التشبيه بخلق الله، فالتشبيه المحرَّم يكون في التحدي المباشر، كما ورد في الحديث: «ومن أظلم ممن ذهب يخلق كخلقي…»، والمقصود به من ينفخ في الصور أو يصنع تماثيل تزعم الإحياء والتحدي لخلق الله. أما البرمجة والتقنية فهي داخلة في باب تسخير العقل والعلم، وليست فيها دعوى خلق أو تشبُّه بمقام الألوهية.

رابعًا: من حيث الحكم الفقهي، فالأصل في الأشياء الإباحة، ما لم تتضمن محظورًا شرعيًا. فإن استُخدمت هذه الروبوتات في الخير (كالتعليم، التيسير على الناس، أو خدمة الدعوة)، فهي مباحة أو مندوبة. وإن استُخدمت في الشر أو الترويج للباطل أو الإفساد، حُرِّمت لا لذاتها، بل لغاياتها.

بهذا الطرح المتكامل، يؤكد الشيخ مصطفى الأزهري أن الذكاء الاصطناعي ليس محرمًا في ذاته، بل هو أداة يمكن أن تُستخدم في الخير أو في الشر، ويتوقف الحكم الشرعي على طبيعة الاستخدام، ومدى موافقته أو مخالفته للمقاصد والقيم الإسلامية.

شكرًا لمشاركتك النص، وها هو رأي القس يوسف ذكي بعد إعادة الصياغة الكاملة، مع الحفاظ على كل المعلومات الأصلية، وجعله مناسبًا للإدراج في مادة صحفية متماسكة:

 القس يوسف ذكي: موقف الكنيسة من الذكاء الاصطناعي

 يؤكد القس يوسف ذكي أن الذكاء الاصطناعي ليس شيئًا محرّمًا أو خاطئًا في ذاته، بل هو أداة يمكن للإنسان أن يستخدمها في الخير أو الشر، بحسب نيته وطريقة استخدامه. ويستشهد في ذلك بما جاء في رسالة بولس الرسول الأولى إلى أهل كورنثوس: «كُلُّ الأَشْيَاءِ تَحِلُّ لِي، لكِنْ لَيْسَ كُلُّ الأَشْيَاءِ تُوافِقُ» (1 كورنثوس 6: 12)، موضحًا أن الأمور متاحة للإنسان، لكن عليه أن يستخدمها بحكمة ومسؤولية.

 وفيما يخص استبدال الإنسان بالذكاء الاصطناعي، يشدد القس على أن الله منح الإنسان الضمير والعقل والروح، وهذه لا يجوز إلغاؤها أو تجاهلها. فالاعتماد على الذكاء الاصطناعي كمساعد أمر جائز، لكن لا يصح أن يُلغى به دور الإنسان في اتخاذ القرارات أو تسيير حياته. ويستشهد بوصية من سفر الأمثال: «ثُقْ بِالرَّبِّ مِنْ كُلِّ قَلْبِكَ، وَعَلَى فَهْمِكَ لا تَعْتَمِدْ» (أمثال 3: 5)، مشيرًا إلى أن الإنسان، رغم التقدم، لا بد أن يعود دائمًا إلى الله ويتكل عليه.

 ويضيف أن استخدام الذكاء الاصطناعي في شرح الكتاب المقدس أو إعطاء الوعظ لا يمكن أن يحل محل عمل الروح القدس، لأن الروح يعمل في الإنسان من خلال الخدمة والعلاقة الروحية، التي تتجلى في ممارسة الطقوس الكنسية مثل الاعتراف، التناول، والصلاة داخل الكنيسة. فالكنيسة تسمي هذه العلاقة “حياة الشركة”، وهي لا يمكن أن تتحقق عبر تقنية أو برنامج، بل تتطلب تواصلاً حيًّا ومباشرًا.

 ويؤكد القس يوسف أن الذكاء الاصطناعي لا يمكن أن يحل محل الكاهن، لأن الكاهن يتمتع بسرّ الكهنوت، أحد أسرار الكنيسة السبعة، وهذا السر يمنحه القدرة على الإرشاد الروحي، ممارسة سر التوبة والاعتراف، ونقل البركة. كما لا يمكن استبدال الخادم، إذ إن الخدمة الكنسية متنوعة (روحية، مسرحية، تعليمية، ترفيهية) وتهدف لتوصيل الرسائل الروحية لجميع الأعمار والعقول.

 ويستشهد القس بآيات من الكتاب المقدس يستند عليها استخدام الذكاء الاصطناعي:

  • «امْتَحِنُوا كُلَّ شَيْءٍ. تَمَسَّكُوا بِالْحَسَنِ» (1 تسالونيكي 5: 21)
  • «كُلُّ مَا فِي الْعَالَمِ … لَيْسَ مِنَ الآبِ، بَلْ مِنَ الْعَالَمِ» (1 يوحنا 2: 16)، مشيرًا إلى أن التكنولوجيا ليست من خلق الله مباشرة، بل من صنع الإنسان، وقد تشوبها أخطاء.

 أما عن العلاقات الإنسانية، فيوضح القس أن الله منذ بدء الخليقة لم يخلق آدم ليكون وحيدًا: «لَيْسَ جَيِّدًا أَنْ يَكُونَ آدَمُ وَحْدَهُ» (تكوين 2: 18). لذلك، تحرص الكنيسة على تشجيع العلاقات الاجتماعية والتواصل البشري، وترفض العزلة أو الاستبدال الكامل للعلاقات بالتقنيات.

 ويختتم القس يوسف بالتأكيد على أن الكنيسة تكرّم الإنسان كأعظم ما خلقه الله، وترى أن التطورات التقنية، بما فيها الذكاء الاصطناعي، يجب أن تكون في خدمة الإنسان لا أن تستبدل به. ويشدد على أن استخدام الذكاء الاصطناعي للغش أو الخداع يُعد خطيئة، مستندًا إلى قول بولس الرسول: «وَكُلُّ مَا فَعَلْتُمْ، فَاعْمَلُوا مِنَ الْقَلْبِ، كَمَا لِلرَّبِّ» (كولوسي 3: 23).

 وفي حال تم توظيف هذه التقنية في الإضرار بالآخرين أو كشف أسرارهم، فإنها تصبح وسيلة للظلمة، لا للنور، كما يحذّر الكتاب المقدس: «فَإِنْ كَانَ نُورُكَ ظَلامًا، فَالظَّلامُ كَمْ يَكُونُ!» (متى 6: 23).

“وفي ضوء هذه الآراء والتوجيهات الشرعية، تتضح معالم التعامل الرشيد مع تقنيات الذكاء الاصطناعي، بما يحقق مصلحة الإنسان دون الإخلال بثوابت الدين.”

اظهر المزيد

مقالات ذات صلة

زر الذهاب إلى الأعلى