root/ip/tags/release_1_3_0_53/includes/bbcode.php

111163
932
			$html = '';
932
			$html = '';
933
			$params['id'] = isset($item['params']['param']) ? intval($item['params']['param']) : (isset($item['params']['id']) ? intval($item['params']['id']) : false);
933
			$params['id'] = isset($item['params']['param']) ? intval($item['params']['param']) : (isset($item['params']['id']) ? intval($item['params']['id']) : false);
934
			$params['title'] = isset($item['params']['title']) ? $this->process_text($item['params']['title']) : false;
934
			$params['title'] = isset($item['params']['title']) ? $this->process_text($item['params']['title']) : false;
935
			$params['description'] = isset($item['params']['description']) ? $this->process_text($item['params']['description']) : false;
935
			$params['description'] = isset($item['params']['description']) ? $this->process_text($item['params']['description']) : (!empty($content) ? $this->process_text($content) : false);
936
			$params['icon'] = isset($item['params']['icon']) ? $this->process_text($item['params']['icon']) : false;
936
			$params['icon'] = isset($item['params']['icon']) ? $this->process_text($item['params']['icon']) : false;
937
			$color = $this->valid_color(isset($item['params']['color']) ? $item['params']['color'] : false);
937
			$color = $this->valid_color(isset($item['params']['color']) ? $item['params']['color'] : false);
938
			$bgcolor = $this->valid_color(isset($item['params']['bgcolor']) ? $item['params']['bgcolor'] : false);
938
			$bgcolor = $this->valid_color(isset($item['params']['bgcolor']) ? $item['params']['bgcolor'] : false);
...
...
967
				if ($tag === 'attachment')
967
				if ($tag === 'attachment')
968
				{
968
				{
969
					$params['title'] = $params['title'] ? $params['title'] : (!empty($attachment_details['real_filename']) ? $attachment_details['real_filename'] :
' ');
969
					$params['title'] = $params['title'] ? $params['title'] : (!empty($attachment_details['real_filename']) ? $attachment_details['real_filename'] :
' ');
970
					$params['description'] = $params['description'] ? $params['description'] : (!empty($attachment_details['comment']) ? $attachment_details['comment'] : ' ');
970
					$params['description'] = $params['description'] ? $params['description'] : (!empty($attachment_details['comment']) ? $attachment_details['comment'] : ' ');
971
					$params['icon'] = IP_ROOT_PATH . FILES_ICONS_DIR . ($params['icon'] ? $params['icon'] : 'default.png');
971
					$params['icon'] = IP_ROOT_PATH . FILES_ICONS_DIR . ($params['icon'] ? $params['icon'] : 'default.png');
972
					$download_url = IP_ROOT_PATH . 'download.' . PHP_EXT . '?id=' . $params['id'];
972
					$download_url = IP_ROOT_PATH . 'download.' . PHP_EXT . '?id=' . $params['id'];
973
				}
973
				}
974
				else
974
				else
975
				{
975
				{
976
					$params['title'] = $params['title'] ? $params['title'] : (!empty($attachment_details['file_name']) ? $attachment_details['file_name'] : ' ');
976
					$params['title'] = $params['title'] ? $params['title'] : (!empty($attachment_details['file_name']) ? $attachment_details['file_name'] : ' ');
977
					$params['description'] = $params['description'] ? $params['description'] : (!empty($attachment_details['file_desc']) ? $attachment_details['file_desc'] : ' ');
977
					$params['description'] = $params['description'] ? $params['description'] : (!empty($attachment_details['file_desc']) ? $attachment_details['file_desc'] : ' ');
978
					$params['icon'] = IP_ROOT_PATH . FILES_ICONS_DIR . ($params['icon'] ? $params['icon'] : (!empty($attachment_details['file_posticon']) ?
$attachment_details['file_posticon'] : 'default.png'));
978
					$params['icon'] = IP_ROOT_PATH . FILES_ICONS_DIR . ($params['icon'] ? $params['icon'] : (!empty($attachment_details['file_posticon']) ?
$attachment_details['file_posticon'] : 'default.png'));
979
					$attachment_details['filesize'] = $attachment_details['file_size'];
979
					$attachment_details['filesize'] = $attachment_details['file_size'];
980
					$attachment_details['download_count'] = $attachment_details['file_dls'];
980
					$attachment_details['download_count'] = $attachment_details['file_dls'];
...
...
1278
				}
1278
				}
1279
			}
1279
			}
1280
			// generate html
1280
			// generate html
1281
			$html = '<a' . ($this->allow_styling && isset($item['params']['class']) ? '' : ' class="post-url"') . ' href="' . htmlspecialchars($url) . '"' . ($url_local ? '' : ' target="_blank"') . $this->add_extras($item['params'], $extras) . '>';
1281
			$html = '<a' . ($this->allow_styling && isset($item['params']['class']) ? '' : ' class="post-url"') . ' href="' . htmlspecialchars($url) . '"' . ($url_local ? '' : (' target="_blank"' . (!empty($item['params']['nofollow']) ? ' rel="nofollow"' : ''))) . $this->add_extras($item['params'], $extras) . '>';
1282
1282
1283
			if (($board_config['disable_html_guests'] == 1) && (!$userdata['session_logged_in']))
1283
			if ($board_config['disable_html_guests'] && !$userdata['session_logged_in'])
1284
			{
1284
			{
1285
				return array(
1285
				return array(
1286
					'valid' => true,
1286
					'valid' => true,
...
...
2718
		// get parameters
2718
		// get parameters
2719
		$pos_eq = strpos($tag, '=');
2719
		$pos_eq = strpos($tag, '=');
2720
		$pos_space = strpos($tag, ' ');
2720
		$pos_space = strpos($tag, ' ');
2721
		if($pos_space !== false && $pos_eq !== false && $pos_space < $pos_eq)
2721
		if(($pos_space !== false) && ($pos_eq !== false) && ($pos_space < $pos_eq))
2722
		{
2722
		{
2723
			// mutiple parameters
2723
			// mutiple parameters
2724
			$param_start = 0;
2724
			$param_start = 0;
...
...
2897
				}
2897
				}
2898
				else
2898
				else
2899
				{
2899
				{
2900
					if(strpos($tag, ' autourl=' . AUTOURL))
2900
					if(strpos($tag, ' autourl=' . AUTOURL . ' nofollow=1'))
2901
					{
2901
					{
2902
						$tag = str_replace(' autourl=' . AUTOURL, '', $tag);
2902
						$tag = str_replace(' autourl=' . AUTOURL . ' nofollow=1', '', $tag);
2903
					}
2903
					}
2904
					$tag = strtolower($tag);
2904
					$tag = strtolower($tag);
2905
					if(!$this->valid_tag($tag, $is_html))
2905
					if(!$this->valid_tag($tag, $is_html))
...
...
3061
	function process_text($text, $br = true, $chars = true)
3061
	function process_text($text, $br = true, $chars = true)
3062
	{
3062
	{
3063
		$search = array(
3063
		$search = array(
3064
			'[url autourl=' . AUTOURL . ']',
3064
			'[url autourl=' . AUTOURL . ' nofollow=1]',
3065
			'[/url autourl=' . AUTOURL  .']',
3065
			'[/url autourl=' . AUTOURL .' nofollow=1]',
3066
			'[email autourl=' . AUTOURL . ']',
3066
			'[email autourl=' . AUTOURL . ' nofollow=1]',
3067
			'[/email autourl=' . AUTOURL .']'
3067
			'[/email autourl=' . AUTOURL . ' nofollow=1]'
3068
		);
3068
		);
3069
		$replace = array('', '', '', '');
3069
		$replace = array('', '', '', '');
3070
		$text = str_replace($search, $replace, $text);
3070
		$text = str_replace($search, $replace, $text);
...
...
3264
			"/([\s>])([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9\-{$chars}]+(\.[a-zA-Z0-9\-{$chars}]+)*(\.[a-zA-Z]{2,}))/si",
3264
			"/([\s>])([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9\-{$chars}]+(\.[a-zA-Z0-9\-{$chars}]+)*(\.[a-zA-Z]{2,}))/si",
3265
		);
3265
		);
3266
		$replace = array(
3266
		$replace = array(
3267
			"\\1[url autourl=" . AUTOURL . "]\\2\\4[/url autourl=" . AUTOURL . "]",
3267
			"\\1[url autourl=" . AUTOURL . " nofollow=1]\\2\\4[/url autourl=" . AUTOURL . " nofollow=1]",
3268
			"\\1[email autourl=" . AUTOURL . "]\\2[/email autourl=" . AUTOURL . "]",
3268
			"\\1[email autourl=" . AUTOURL . " nofollow=1]\\2[/email autourl=" . AUTOURL . " nofollow=1]",
3269
		);
3269
		);
3270
		$this->text = preg_replace($search, $replace, ' ' . $this->text . ' ');
3270
		$this->text = preg_replace($search, $replace, ' ' . $this->text . ' ');
3271
		$this->text = substr($this->text, 1, strlen($this->text) - 2);
3271
		$this->text = substr($this->text, 1, strlen($this->text) - 2);
...
...
3319
		$this->data = array();
3319
		$this->data = array();
3320
		$this->html = '';
3320
		$this->html = '';
3321
		$this->prepare_smilies();
3321
		$this->prepare_smilies();
3322
		if ($light == false)
3322
		if (!$light)
3323
		{
3323
		{
3324
			$this->process_urls();
3324
			$this->process_urls();
3325
		}
3325
		}
...
...
3618
		return $text;
3618
		return $text;
3619
	}
3619
	}
3620
3620
3621
	function plain_message($text, $id)
3621
	function plain_message($text, $id = false)
3622
	{
3622
	{
3623
		// This function will strip from a message some BBCodes,
3623
		// This function will strip from a message some BBCodes,
3624
		// all BBCodes $uid, and some other formattings.
3624
		// all BBCodes $uid, and some other formattings.