BB3Spoiler

Открыть файл

adm/style/acp_users_signature.html
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
,'[size=]','[/size]'
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
,'[spoiler="{L_HIDDEN_TEXT}"]','[/spoiler]'
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
		u: '{LA_BBCODE_U_HELP}',
		q: '{LA_BBCODE_Q_HELP}',
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
		h: '{LA_BBCODE_H_HELP}',
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
			<p>{SIGNATURE_PREVIEW}</p>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
			<p><div class="signature">{SIGNATURE_PREVIEW}</div></p>
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
			<input type="button" class="button2" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" onmouseout="helpline('tip')" />
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
			<input type="button" class="button2" accesskey="h" name="addbbcode22" value="Spoiler" style="width: 50px" onclick="bbstyle(22)" title="{L_BBCODE_H_HELP}" />
//-----------------------------------------------------------------------------

Открыть файл

adm/style/overall_header.html
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
</head>
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
<!-- IF SPOILER_OPEN_TYPE eq 0 --><link rel="stylesheet" href="{PPKBB3CKER_ADDONS}css/prettyPhoto.css" type="text/css" /><!-- ENDIF -->
<link rel="stylesheet" href="{PPKBB3CKER_ADDONS}css/spoiler.css" type="text/css" media="screen" />
<style type="text/css">
.folded
{
	background: transparent url(./../tracker/addons/images/spoiler/icon_plus_1.gif) no-repeat left center;
}
.unfolded
{
	background: transparent url(./../tracker/addons/images/spoiler/icon_minus_1.gif) no-repeat left center;
}
</style>

<script src="{PPKBB3CKER_ADDONS}js/jquery-min.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
	jQuery.noConflict();
	//Spoiler image width
	//var spoilerMaxW = Math.round(screen.width - (screen.width / 1.5));
	var spoilerMaxW = {SPOILER_IMG_WIDTH};
	var hidePostImg = {SPOILER_HIDE_POSTIMG};
	var hideSigImg = {SPOILER_HIDE_SIGIMG};
	var openInNewWindow = '{L_OPEN_IN_NEW_WINDOW}';
	var bannedImageHosts = '{L_BANNED_IMAGE_HOSTS}';
	var hiddenText = '{L_HIDDEN_TEXT}';
	var spoilerClose = '{L_SPOILER_CLOSE}';
	var banned_image_hosts = {SPOILER_BANNED_IMGHOSTS};//banned image hosts
// ]]>
</script>
<!-- IF SPOILER_OPEN_TYPE eq 0 --><script src="{PPKBB3CKER_ADDONS}js/jquery.prettyPhoto.js" type="text/javascript"></script><!-- ENDIF -->
<script src="{PPKBB3CKER_ADDONS}js/spoiler.js" type="text/javascript"></script>
<!-- IF SPOILER_OPEN_TYPE eq 0 -->
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
	function($)
	{
		$("a[rel^='prettyPhoto']").prettyPhoto({'modal': false, 'show_title': false, 'social_tools': false});
	}
);
// ]]>
</script>
<!-- ENDIF -->
//-----------------------------------------------------------------------------

Открыть файл

adm/index.php
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
	$template->assign_vars(array(
		'PAGE_TITLE'			=> $page_title,
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	$ppkbb_spoiler_options=my_split_config($config['ppkbb_spoiler_options'], 6, 'my_int_val');
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
		'S_CONTENT_FLOW_BEGIN'	=> ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
		'S_CONTENT_FLOW_END'	=> ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
		'SPOILER_IMG_WIDTH' => $ppkbb_spoiler_options[0],
		'SPOILER_HIDE_POSTIMG' => $ppkbb_spoiler_options[1] ? 'true' : 'false',
		'SPOILER_HIDE_SIGIMG' => $ppkbb_spoiler_options[2] ? 'true' : 'false',
		'SPOILER_BANNED_IMGHOSTS' => $config['ppkbb_spoiler_banned_imghosts'] ? $config['ppkbb_spoiler_banned_imghosts'] : 'false',
		'SPOILER_OPEN_TYPE' => $ppkbb_spoiler_options[4],
		'PPKBB3CKER_ADDONS'	=> "{$phpbb_root_path}tracker/addons/",
//-----------------------------------------------------------------------------

Открыть файл

includes/acp/acp_board.php
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
						'max_post_font_size'	=> array('lang' => 'MAX_POST_FONT_SIZE',	'validate' => 'int:0',		'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),
						'max_quote_depth'		=> array('lang' => 'QUOTE_DEPTH_LIMIT',		'validate' => 'int:0',		'type' => 'text:4:4', 'explain' => true),
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
						'ppkbb_maxspoiler_depth'		=> array('lang' => 'SPOILER_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:1:1', 'method' => false, 'explain' => true,),
						'ppkbb_spoiler_options'		=> array('lang' => 'SPOILER_OPTIONS', 'validate' => 'string', 'type' => 'text:14:14', 'method' => false, 'explain' => true,),
						'ppkbb_spoiler_banned_imghosts'		=> array('lang' => 'SPOILER_BANNED_IMGHOSTS', 'validate' => 'string', 'type' => 'text:48:1024', 'method' => false, 'explain' => true,),
//-----------------------------------------------------------------------------

Открыть файл

includes/bbcode.php
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
				default:
					if (isset($rowset[$bbcode_id]))
					{
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
				case 13:
					$this->bbcode_cache[$bbcode_id] = array(
						'str' => array(
							'[/spoiler:$uid]'	=> $this->bbcode_tpl('spoiler_close', $bbcode_id)
						),
						'preg' => array(
							'#\[spoiler(?:=&quot;(.*?)&quot;)?:$uid\]((?!\[spoiler(?:=&quot;.*?&quot;)?:$uid\]).)?#ise'	=> "\$this->bbcode_second_pass_spoiler('\$1', '\$2')"
						)
					);
				break;
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
	function bbcode_tpl($tpl_name, $bbcode_id = -1, $skip_bitfield_check = false)
	{
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
		global $config, $user;

		$ppkbb_spoiler_options=my_split_config($config['ppkbb_spoiler_options'], 6, 'my_int_val');
		if($ppkbb_spoiler_options[3]==1)
		{
			$img_wojs=$user->lang['SPOILER_IMAGE_WOJS'];
		}
		else
		{
			$img_wojs='';
		}
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
				'b_open'	=> '<span style="font-weight: bold">',
				'b_close'	=> '</span>',
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
				'spoiler_close'	=> '</div></div>',
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
				'img'		=> '<img src="$1" alt="' . $user->lang['IMAGE'] . '" />',
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
				'img'		=> (!$ppkbb_spoiler_options[4] && $ppkbb_spoiler_options[5] ? '<a href="$1" rel="prettyPhotoSpoiler[0]">' : '').'<var title="$1" class="postImg" alt="' . $user->lang['IMAGE'] . '" />'.$img_wojs.'</var>'.(!$ppkbb_spoiler_options[4] && $ppkbb_spoiler_options[5] ? '</a>' : ''),
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
		static $replacements = array(
			'quote_username_open'	=> array('{USERNAME}'	=> '$1'),
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
			'spoiler_title_open'	=> array('{TITLE}'	=> '$1'),
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
	/**
	* Second parse code tag
	*/
	function bbcode_second_pass_code($type, $code)
	{
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	/**
	* Second parse spoiler tag
	*/
	function bbcode_second_pass_spoiler($username, $spoiler)
	{
		// when using the /e modifier, preg_replace slashes double-spoilers but does not
		// seem to slash anything else
		$spoiler = str_replace('\"', '"', $spoiler);
		$username = str_replace('\"', '"', $username);
		$username=htmlspecialchars($username);
		// remove newline at the beginning
		if ($spoiler == "\n")
		{
			$spoiler = '';
		}

		$spoiler = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('spoiler_title_open')) : $this->bbcode_tpl('spoiler_open')) . $spoiler;

		return $spoiler;
	}
//-----------------------------------------------------------------------------

Открыть файл

includes/constants.php
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
define('NUM_CORE_BBCODES', 12);
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
define('NUM_CORE_BBCODES', 13);
//-----------------------------------------------------------------------------

Открыть файл

includes/functions.php
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
/**
* Determine whether we are approaching the maximum execution time. Should be called once
* at the beginning of the script in which it's used.
* @return	bool	Either true if the maximum execution time is nearly reached, or false
*					if some time is still left.
*/
function still_on_time($extra_time = 15)
{
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
function my_int_val($v=0)
{
	if(!$v || $v < 0)
	{
		return 0;
	}

	return @number_format($v+0, 0, '', '');
}
//-----------------------------------------------------------------------------
найти
//-----------------------------------------------------------------------------
function my_split_config(
//-----------------------------------------------------------------------------
если строка не найдена, перед
//-----------------------------------------------------------------------------
function my_int_val($v=0)
{
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
function my_split_config($config, $count=0, $type=false, $split='')
{
	$count=intval($count);
	$s_config=$count > 0 ? @explode($split ? $split : ' ', $config, $count) : @explode($split ? $split : ' ', $config);
	$count=$count > 0 ? $count : sizeof($s_config);
	if($count)
	{
		for($i=0;$i<$count;$i++)
		{
			if($type)
			{
				if(is_array($type) && @function_exists(@$type[$i]))
				{
					$s_config[$i]=call_user_func($type[$i], @$s_config[$i]);
				}
				else if(@function_exists($type))
				{
					$s_config[$i]=call_user_func($type, @$s_config[$i]);
				}
				else
				{
					$s_config[$i]=@$s_config[$i];
				}
			}
			else
			{
				$s_config[$i]=@$s_config[$i];
			}
		}
	}

	return $s_config;
}
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
	$user_lang = $user->lang['USER_LANG'];
	if (strpos($user_lang, '-x-') !== false)
	{
		$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
	}
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	$ppkbb_spoiler_options=my_split_config($config['ppkbb_spoiler_options'], 6, 'my_int_val');
	$ppkbb3cker_addons="{$phpbb_root_path}tracker/addons/";
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
		'A_COOKIE_SETTINGS'		=> addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
		'PPKBB3CKER_ADDONS'	=> $ppkbb3cker_addons,
		'SPOILER_IMG_WIDTH' => $ppkbb_spoiler_options[0],
		'SPOILER_HIDE_POSTIMG' => $ppkbb_spoiler_options[1] ? 'true' : 'false',
		'SPOILER_HIDE_SIGIMG' => $ppkbb_spoiler_options[2] ? 'true' : 'false',
		'SPOILER_BANNED_IMGHOSTS' => $config['ppkbb_spoiler_banned_imghosts'] ? $config['ppkbb_spoiler_banned_imghosts'] : 'false',
		'SPOILER_OPEN_TYPE' => $ppkbb_spoiler_options[4],
//-----------------------------------------------------------------------------

Открыть файл

includes/functions_display.php
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
	$num_predefined_bbcodes = 22;
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
	$num_predefined_bbcodes = 24;
//-----------------------------------------------------------------------------

Открыть файл

includes/message_parser.php
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
			'quote'			=> array('bbcode_id' => 0,	'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#uise' => "\$this->bbcode_quote('\$0')")),
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
			'spoiler'			=> array('bbcode_id' => 13,	'regexp' => array('#\[spoiler(?:=&quot;(.*?)&quot;)?\](.+)\[/spoiler\]#uise' => "\$this->bbcode_spoiler('\$0')")),
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
	/**
	* Validate email
	*/
	function validate_email($var1, $var2)
	{
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	/**
	* Parse spoiler bbcode
	* Expects the argument to start with a tag
	*/
	function bbcode_spoiler($in)
	{
		global $config, $user;

		/**
		* If you change this code, make sure the cases described within the following reports are still working:
		* #3572 - [spoiler="[test]test"]test [ test[/spoiler] - (correct: parsed)
		* #14667 - [spoiler]test[/spoiler] test ] and [ test [spoiler]test[/spoiler] (correct: parsed)
		* #14770 - [spoiler="["]test[/spoiler] (correct: parsed)
		* [spoiler="[i]test[/i]"]test[/spoiler] (correct: parsed)
		* [spoiler="[spoiler]test[/spoiler]"]test[/spoiler] (correct: parsed - Username displayed as [spoiler]test[/spoiler])
		* #20735 - [spoiler]test[/[/b]spoiler] test [/spoiler][/spoiler] test - (correct: spoilerd: "test[/[/b]spoiler] test" / non-spoilerd: "[/spoiler] test" - also failed if layout distorted)
		* #40565 - [spoiler="a"]a[/spoiler][spoiler="a]a[/spoiler] (correct: first spoiler tag parsed, second spoiler tag unparsed)
		*/

		$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));

		if (!$in)
		{
			return '';
		}

		// To let the parser not catch tokens within spoiler_username spoilers we encode them before we start this...
		$in = preg_replace('#spoiler=&quot;(.*?)&quot;\]#ie', "'spoiler=&quot;' . str_replace(array('[', ']', '\\\"'), array('&#91;', '&#93;', '\"'), '\$1') . '&quot;]'", $in);

		$tok = ']';
		$out = '[';

		$in = substr($in, 1);
		$close_tags = $error_ary = array();
		$buffer = '';

		do
		{
			$pos = strlen($in);
			for ($i = 0, $tok_len = strlen($tok); $i < $tok_len; ++$i)
			{
				$tmp_pos = strpos($in, $tok[$i]);
				if ($tmp_pos !== false && $tmp_pos < $pos)
				{
					$pos = $tmp_pos;
				}
			}

			$buffer .= substr($in, 0, $pos);
			$tok = $in[$pos];
			$in = substr($in, $pos + 1);

			if ($tok == ']')
			{
				if (strtolower($buffer) == '/spoiler' && sizeof($close_tags) && substr($out, -1, 1) == '[')
				{
					// we have found a closing tag
					$out .= array_pop($close_tags) . ']';
					$tok = '[';
					$buffer = '';

					/* Add space at the end of the closing tag if not happened before to allow following urls/smilies to be parsed correctly
					* Do not try to think for the user. :/ Do not parse urls/smilies if there is no space - is the same as with other bbcodes too.
					* Also, we won't have any spaces within $in anyway, only adding up spaces -> #10982
					if (!$in || $in[0] !== ' ')
					{
						$out .= ' ';
					}*/
				}
				else if (preg_match('#^spoiler(?:=&quot;(.*?)&quot;)?$#is', $buffer, $m) && substr($out, -1, 1) == '[')
				{
					$this->parsed_items['spoiler']++;

					// the buffer holds a valid opening tag
					if ($config['ppkbb_maxspoiler_depth'] && sizeof($close_tags) >= $config['ppkbb_maxspoiler_depth'])
					{
						// there are too many nested spoilers
						$error_ary['spoiler_depth'] = sprintf($user->lang['SPOILER_DEPTH_EXCEEDED'], $config['ppkbb_maxspoiler_depth']);

						$out .= $buffer . $tok;
						$tok = '[]';
						$buffer = '';

						continue;
					}

					array_push($close_tags, '/spoiler:' . $this->bbcode_uid);

					if (isset($m[1]) && $m[1])
					{
						$username = str_replace(array('&#91;', '&#93;'), array('[', ']'), $m[1]);
						$username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '&#91;$1', $username);

						$end_tags = array();
						$error = false;

						preg_match_all('#\[((?:/)?(?:[a-z]+))#i', $username, $tags);
						foreach ($tags[1] as $tag)
						{
							if ($tag[0] != '/')
							{
								$end_tags[] = '/' . $tag;
							}
							else
							{
								$end_tag = array_pop($end_tags);
								$error = ($end_tag != $tag) ? true : false;
							}
						}

						if ($error)
						{
							$username = $m[1];
						}

						$out .= 'spoiler=&quot;' . $username . '&quot;:' . $this->bbcode_uid . ']';
					}
					else
					{
						$out .= 'spoiler:' . $this->bbcode_uid . ']';
					}

					$tok = '[';
					$buffer = '';
				}
				else if (preg_match('#^spoiler=&quot;(.*?)#is', $buffer, $m))
				{
					// the buffer holds an invalid opening tag
					$buffer .= ']';
				}
				else
				{
					$out .= $buffer . $tok;
					$tok = '[]';
					$buffer = '';
				}
			}
			else
			{
/**
*				Old spoiler code working fine, but having errors listed in bug #3572
*
*				$out .= $buffer . $tok;
*				$tok = ($tok == '[') ? ']' : '[]';
*				$buffer = '';
*/

				$out .= $buffer . $tok;

				if ($tok == '[')
				{
					// Search the text for the next tok... if an ending spoiler comes first, then change tok to []
					$pos1 = stripos($in, '[/spoiler');
					// If the token ] comes first, we change it to ]
					$pos2 = strpos($in, ']');
					// If the token [ comes first, we change it to [
					$pos3 = strpos($in, '[');

					if ($pos1 !== false && ($pos2 === false || $pos1 < $pos2) && ($pos3 === false || $pos1 < $pos3))
					{
						$tok = '[]';
					}
					else if ($pos3 !== false && ($pos2 === false || $pos3 < $pos2))
					{
						$tok = '[';
					}
					else
					{
						$tok = ']';
					}
				}
				else
				{
					$tok = '[]';
				}
				$buffer = '';
			}
		}
		while ($in);

		$out .= $buffer;

		if (sizeof($close_tags))
		{
			$out .= '[' . implode('][', $close_tags) . ']';
		}

		foreach ($error_ary as $error_msg)
		{
			$this->warn_msg[] = $error_msg;
		}

		return $out;
	}
//-----------------------------------------------------------------------------

Открыть файл

language/ru/acp/board.php
//-----------------------------------------------------------------------------
в самом конце, перед
//-----------------------------------------------------------------------------
));

?>
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	'SPOILER_DEPTH_LIMIT'				=> 'Максимальное количество вложенных спойлеров в сообщении',
	'SPOILER_DEPTH_LIMIT_EXPLAIN'		=> 'Максимальное количество вложенных в сообщение спойлеров. Введите 0 для снятия ограничений.',
	'SPOILER_OPTIONS'				=> 'Опции спойлера',
	'SPOILER_OPTIONS_EXPLAIN'		=> 'Шесть чисел через пробел, <br /><strong>число 1</strong> ширина изображений при отображении в спойлере или вне его (в пикселях), <br /><strong>число 2</strong> скрывать все изображения обрабатываемые спойлером, 1 - да, 0 - нет, <br /><strong>число 3</strong> скрывать все изображения в подписях пользователей обрабатываемые спойлером, 1 - да, 0 - нет, <br /><strong>число 4</strong> отображение изображений для пользователей с отключённым javascript, 0 - не отображать ничего, 1 - отображать предупреждение о необходимости включения javascript для просмотра изображения, <br /><strong>число 5</strong> метод открытия полноразмерных изображений, 0 - открывать в prettyPhoto, 1 - открывать в новом окне, 2 - открывать в текущем окне, <br /><strong>число 6</strong> значение 1 - отображать все изображения на одной странице в режиме галареи, 0 - в режиме одиночных изображений (только если число 5 в опции равно 0)',
	'SPOILER_BANNED_IMGHOSTS' => 'Забаненные хостинги изображений',
	'SPOILER_BANNED_IMGHOSTS_EXPLAIN' => 'Скрывать изображения с указанных хостингов, пример:<br />/imagebanana|hidebehind/i',
//-----------------------------------------------------------------------------

Открыть файл

language/ru/common.php
//-----------------------------------------------------------------------------
в самом конце, перед
//-----------------------------------------------------------------------------
));

?>
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	'SPOILER_IMAGE_WOJS' => '[Для просмотра изображения необходимо включить JavaScript]',
	'OPEN_IN_NEW_WINDOW' => 'Открыть в новом окне, в полном размере',
	'BANNED_IMAGE_HOSTS' => 'Изображения с данного хостинга запрещены!',
	'SPOILER_CLOSE' => 'Закрыть',
	'HIDDEN_TEXT'	=> 'Скрытый текст',
//-----------------------------------------------------------------------------

Открыть файл

language/ru/posting.php
//-----------------------------------------------------------------------------
в самом конце, перед
//-----------------------------------------------------------------------------
));

?>
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	'BBCODE_H_HELP'				=> 'Вставить скрытый текст: [spoiler]Текст[/spoiler] или [spoiler=&quot;Заголовок&quot;]текст[/spoiler]',
	'SPOILER_DEPTH_EXCEEDED'		=> 'Максимально допустимое количество вложенных друг в друга спойлеров в сообщении: %1$d.',
//-----------------------------------------------------------------------------

Открыть файл

styles/prosilver/template/attachment.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
			<dt><a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a></dt>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
			<dt><a title="{_file.DOWNLOAD_NAME}" href="{_file.U_DOWNLOAD_LINK}" rel="prettyPhoto"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a></dt>
//-----------------------------------------------------------------------------

Открыть файл

styles/prosilver/template/bbcode.html
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
<!-- BEGIN code_open --><dl class="codebox"><dt>{L_CODE}: <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></dt><dd><code><!-- END code_open -->
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
<!-- BEGIN spoiler_title_open --><div class="sp-wrap"><div class="sp-body" title="{TITLE}"><!-- END spoiler_title_open -->
<!-- BEGIN spoiler_open --><div class="sp-wrap"><div class="sp-body" title="{L_HIDDEN_TEXT}"><!-- END spoiler_open -->
<!-- BEGIN spoiler_close --></div></div><!-- END spoiler_close -->
//-----------------------------------------------------------------------------
удалить
//-----------------------------------------------------------------------------
<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" /><!-- END img -->
//-----------------------------------------------------------------------------

Открыть файл

styles/prosilver/template/overall_header.html
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
</head>
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
<!-- IF SPOILER_OPEN_TYPE eq 0 --><link rel="stylesheet" href="{PPKBB3CKER_ADDONS}css/prettyPhoto.css" type="text/css" /><!-- ENDIF -->
<link rel="stylesheet" href="{PPKBB3CKER_ADDONS}css/spoiler.css" type="text/css" />

<script src="{PPKBB3CKER_ADDONS}js/jquery-min.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
	jQuery.noConflict();

	//Spoiler image width
	//var spoilerMaxW = Math.round(screen.width - (screen.width / 1.5));
	var spoilerMaxW = {SPOILER_IMG_WIDTH};
	var hidePostImg = {SPOILER_HIDE_POSTIMG};
	var hideSigImg = {SPOILER_HIDE_SIGIMG};
	var openInNewWindow = '{L_OPEN_IN_NEW_WINDOW}';
	var bannedImageHosts = '{L_BANNED_IMAGE_HOSTS}';
	var hiddenText = '{L_HIDDEN_TEXT}';
	var spoilerClose = '{L_SPOILER_CLOSE}';
	var banned_image_hosts = {SPOILER_BANNED_IMGHOSTS};//banned image hosts
	var open_type = {SPOILER_OPEN_TYPE};
// ]]>
</script>
<!-- IF SPOILER_OPEN_TYPE eq 0 --><script src="{PPKBB3CKER_ADDONS}js/jquery.prettyPhoto.js" type="text/javascript"></script><!-- ENDIF -->
<script src="{PPKBB3CKER_ADDONS}js/spoiler.js" type="text/javascript"></script>
<!-- IF SPOILER_OPEN_TYPE eq 0 -->
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
	function($)
	{
		$("a[rel^='prettyPhoto']").prettyPhoto({'modal': false, 'show_title': false, 'social_tools': false});
	}
);
// ]]>
</script>
<!-- ENDIF -->
//-----------------------------------------------------------------------------

Открыть файл

styles/prosilver/template/posting_buttons.html
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
,'[size=]','[/size]'
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
,'[spoiler="{L_HIDDEN_TEXT}"]','[/spoiler]'
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
		u: '{LA_BBCODE_U_HELP}',
		q: '{LA_BBCODE_Q_HELP}',
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
		h: '{LA_BBCODE_H_HELP}',
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
	<!-- IF S_BBCODE_QUOTE -->
		<input type="button" class="button2" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" title="{L_BBCODE_Q_HELP}" />
	<!-- ENDIF -->
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
	<input type="button" class="button2" accesskey="h" name="addbbcode22" value="Spoiler" style="width: 50px" onclick="bbstyle(22)" title="{L_BBCODE_H_HELP}" />
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/attachment.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
			<a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" /></a><br />
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
			<a title="{_file.DOWNLOAD_NAME}" href="{_file.U_DOWNLOAD_LINK}" rel="prettyPhoto"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" /></a><br />
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/bbcode.html
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
<!-- BEGIN code_open -->
<div class="codetitle"><b>{L_CODE}:</b></div><div class="codecontent">
<!-- END code_open -->
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
<!-- BEGIN spoiler_title_open --><div class="sp-wrap"><div class="sp-body" title="{TITLE}"><!-- END spoiler_title_open -->
<!-- BEGIN spoiler_open --><div class="sp-wrap"><div class="sp-body" title="{L_HIDDEN_TEXT}"><!-- END spoiler_open -->
<!-- BEGIN spoiler_close --></div></div><!-- END spoiler_close -->
//-----------------------------------------------------------------------------
удалить
//-----------------------------------------------------------------------------
<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" /><!-- END img -->
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/memberlist_view.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
			<td class="row1" colspan="2"><div class="postbody" style="padding: 10px;">{SIGNATURE}</div></td>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
			<td class="row1" colspan="2"><div class="postbody signature" style="padding: 10px;">{SIGNATURE}</div></td>
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/overall_header.html
//-----------------------------------------------------------------------------
перед
//-----------------------------------------------------------------------------
<script type="text/javascript">
// <![CDATA[
<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
<!-- IF SPOILER_OPEN_TYPE eq 0 --><link rel="stylesheet" href="{PPKBB3CKER_ADDONS}css/prettyPhoto.css" type="text/css" /><!-- ENDIF -->
<link rel="stylesheet" href="{PPKBB3CKER_ADDONS}css/spoiler.css" type="text/css" />

<script src="{PPKBB3CKER_ADDONS}js/jquery-min.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
	jQuery.noConflict();

	//Spoiler image width
	//var spoilerMaxW = Math.round(screen.width - (screen.width / 1.5));
	var spoilerMaxW = {SPOILER_IMG_WIDTH};
	var hidePostImg = {SPOILER_HIDE_POSTIMG};
	var hideSigImg = {SPOILER_HIDE_SIGIMG};
	var openInNewWindow = '{L_OPEN_IN_NEW_WINDOW}';
	var bannedImageHosts = '{L_BANNED_IMAGE_HOSTS}';
	var hiddenText = '{L_HIDDEN_TEXT}';
	var spoilerClose = '{L_SPOILER_CLOSE}';
	var banned_image_hosts = {SPOILER_BANNED_IMGHOSTS};//banned image hosts
	var open_type = {SPOILER_OPEN_TYPE};
// ]]>
</script>
<!-- IF SPOILER_OPEN_TYPE eq 0 --><script src="{PPKBB3CKER_ADDONS}js/jquery.prettyPhoto.js" type="text/javascript"></script><!-- ENDIF -->
<script src="{PPKBB3CKER_ADDONS}js/spoiler.js" type="text/javascript"></script>
<!-- IF SPOILER_OPEN_TYPE eq 0 -->
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
	function($)
	{
		$("a[rel^='prettyPhoto']").prettyPhoto({'modal': false, 'show_title': false, 'social_tools': false});
	}
);
// ]]>
</script>
<!-- ENDIF -->
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/posting_buttons.html
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
,'[size=]','[/size]'
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
,'[spoiler="{L_HIDDEN_TEXT}"]','[/spoiler]'
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
			u: '{LA_BBCODE_U_HELP}',
			q: '{LA_BBCODE_Q_HELP}',
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
			h: '{LA_BBCODE_H_HELP}',
//-----------------------------------------------------------------------------
после
//-----------------------------------------------------------------------------
		<!-- IF S_BBCODE_QUOTE -->
			<input type="button" class="btnbbcode" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" onmouseout="helpline('tip')" />
		<!-- ENDIF -->
//-----------------------------------------------------------------------------
добавить
//-----------------------------------------------------------------------------
		<input type="button" class="btnbbcode" accesskey="h" name="addbbcode22" value="Spoiler" style="width: 55px" onclick="bbstyle(22)" title="{L_BBCODE_H_HELP}" />
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/posting_preview.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
			<!-- IF PREVIEW_SIGNATURE --><span class="postbody"><br />_________________<br />{PREVIEW_SIGNATURE}</span><!-- ENDIF --></td>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
			<!-- IF PREVIEW_SIGNATURE --><div class="postbody signature"><br />_________________<br />{PREVIEW_SIGNATURE}</div><!-- ENDIF --></td>
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/ucp_pm_viewmessage.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
					<span class="postbody"><br />_________________<br />{SIGNATURE}</span>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
					<div class="postbody signature"><br />_________________<br />{SIGNATURE}</div>
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/ucp_profile_signature.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
		<td class="row1" colspan="2"><div class="postbody" style="padding: 6px;">{SIGNATURE_PREVIEW}</div></td>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
		<td class="row1" colspan="2"><div class="postbody signature" style="padding: 6px;">{SIGNATURE_PREVIEW}</div></td>
//-----------------------------------------------------------------------------

Открыть файл

styles/subsilver2/template/viewtopic_body.html
//-----------------------------------------------------------------------------
заменить
//-----------------------------------------------------------------------------
						<div class="postbody"><br />_________________<br />{postrow.SIGNATURE}</div>
//-----------------------------------------------------------------------------
на
//-----------------------------------------------------------------------------
						<div class="postbody signature"><br />_________________<br />{postrow.SIGNATURE}</div>
//-----------------------------------------------------------------------------

Выполнить sql код (если префикс таблиц не phpbb_ - заменить на свой):
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ppkbb_maxspoiler_depth', '3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ppkbb_spoiler_options', '200 0 0 0 0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ppkbb_spoiler_banned_imghosts', '');

Скопировать содержимое директории /root/ в корневую директорию форума, очистить кеш, обновить шаблоны.

Настроить опции спойлера: адм. раздел - вкладка Общие - Размещение сообщений.
