A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/2002): Cannot assign requested address

Filename: mysqli/mysqli_driver.php

Line Number: 201

Backtrace:

File: /www/wwwroot/dash.konsole.xyz/application/core/MY_Controller.php
Line: 343
Function: __construct

File: /www/wwwroot/dash.konsole.xyz/application/controllers/Api.php
Line: 12
Function: __construct

File: /www/wwwroot/dash.konsole.xyz/index.php
Line: 316
Function: require_once

Database Error

数据库发生错误。

无法使用提供的设置连接到数据库服务器。

Filename: core/MY_Controller.php

Line Number: 343


Fatal error: Uncaught Error: Call to a member function close() on string in /www/wwwroot/dash.konsole.xyz/application/core/MY_Controller.php:349 Stack trace: #0 [internal function]: Index_Controller->__destruct() #1 {main} thrown in /www/wwwroot/dash.konsole.xyz/application/core/MY_Controller.php on line 349
HEX
HEX
Server: Apache/2
System: Linux ns1.websitegang.club 5.4.0-149-generic #166-Ubuntu SMP Tue Apr 18 16:51:45 UTC 2023 x86_64
User: kunchorn (1109)
PHP: 8.2.29
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/kunchorn/domains/kun-chorn.com/public_html/wp-content/plugins/seoplugins/includes/class.php
<?php
if(!defined('LINK_PREVIEW')) return;
$linkPreview = new linkPreview();

class linkPreview {

	/**
	 * Fetch data from LinkPreview API or locally
	 */
	public function get_url_data($url) {
		$linkpreview_settings = linkpreview_get_settings();
		$linkpreview_settings['linkpreview_max_url_size'] = ($linkpreview_settings['linkpreview_max_url_size'] == 0 || !$linkpreview_settings['linkpreview_max_url_size']) ? 128 : $linkpreview_settings['linkpreview_max_url_size'];
		if (strlen($url) > (int) $linkpreview_settings['linkpreview_max_url_size']) return false;
		if ((int)$linkpreview_settings['linkpreview_cache_time'] > 0) $json = get_transient('lp_'.md5($url));
		if (!$json) {
			if ($linkpreview_settings['linkpreview_local_curl'] == "on") $prepare = $this->get_local_data($url);
			else $prepare = $this->get_api_data($url);

			if (!$prepare) return false;
			$source_url = parse_url($url);
			$prepare->host_url = $source_url['host'];
			if ($linkpreview_settings['linkpreview_favicon'] == 'on') {
				$favicon_url = $source_url['scheme'].'://'.$source_url['host'].'/favicon.ico';
				$prepare->favicon = $favicon_url;
			}
			$json = json_encode($prepare);
			if ($linkpreview_settings['linkpreview_cache_time'] > 0 && !isset($prepare->error)) set_transient('lp_'.md5($url),$json,(int)$linkpreview_settings['linkpreview_cache_time']*60);
		}
		$object = json_decode($json);
		return $object;
	}

	/**
	 * Get remote data from API
	 */
	public function get_api_data($url) {
		$linkpreview_settings = linkpreview_get_settings();
		$query_url = 'http://api.linkpreview.net/?'.http_build_query(array('q'=>$url,'key'=>$linkpreview_settings['linkpreview_api_key'],'origin'=>'wplp'));
		if (function_exists('curl_version')) {
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_URL, $query_url);
			$json = curl_exec($ch);
			curl_close($ch);
		}
		else {
			$json = file_get_contents($query_url);
		}
		$data = json_decode($json);
		if ($data->title == '' && $data->description == '') return false;
		return $data;
	}

	/**
	 * Get remote data locally
	 */
	public function get_local_data($url) {
		$html = $this->fetch_local_url($url);
		$doc = new DOMDocument();
		@$doc->loadHTML($html);
		$nodes = $doc->getElementsByTagName('title');
		$data = new stdClass();
		$data->title = $nodes->item(0)->nodeValue;
		$metas = $doc->getElementsByTagName('meta');
		for ($i = 0; $i < $metas->length; $i++)
		{
			$meta = $metas->item($i);
			if ($meta->getAttribute('name') == 'description') $data->description = $meta->getAttribute('content');
			if ($meta->getAttribute('property') == 'og:image') $data->image = $meta->getAttribute('content');
		}
		return $data;
	}

	/**
	 * Retrieve data through curl or file_get_contents
	 */
	function fetch_local_url($url) {
		if (function_exists('curl_version')) {
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_URL, $url);
			$data = curl_exec($ch);
			curl_close($ch);
		}
		if (!isset($data) || $data == '') {
			$data = file_get_contents($url);
		}
		return $data;
	}

	/**
	 * Static view
	 */
	public function showtime($url) {
		ob_start();
		$object = $this->get_url_data($url);
		if ($object) {
			if (!is_rtl()) include(LINKPREVIEW_STATIC_VIEW);
			else include(LINKPREVIEW_STATIC_VIEW_RTL);
		}
		$html = ob_get_contents();
		ob_end_clean();
		return $html;
	}

	/**
	 * Filter out specific links
	 */
	public function is_file($url) {
		$linkpreview_settings = linkpreview_get_settings();
		$file_formats = explode(',', $linkpreview_settings['linkpreview_filter_out']);
		$path_info = pathinfo($url);
		if (isset($path_info['extension']) && in_array(strtolower($path_info['extension']), $file_formats)) {
			return true;
		}
		return false;
	}

	/**
	 * Filter out classes
	 */
	public function is_class($class) {
		$linkpreview_settings = linkpreview_get_settings();
		$classes = explode(" ", $class);
		$exclude_classes = explode(',', $linkpreview_settings['linkpreview_exclude_class']);
		foreach ($exclude_classes as $exclude_class) {
			if (in_array($exclude_class, $classes)) {
				return true;
			}
		}
		return false;
	}
}