phpBB

Code Changes

File: includes/acp/acp_bbcodes.php

  Unmodified   Added   Modified   Removed
Line 33Line 33
		// Set up general vars
$action = $request->variable('action', '');
$bbcode_id = $request->variable('bbcode', 0);

		// Set up general vars
$action = $request->variable('action', '');
$bbcode_id = $request->variable('bbcode', 0);

		$submit = $request->is_set_post('submit');

 

$this->tpl_name = 'acp_bbcodes';
$this->page_title = 'ACP_BBCODES';
$form_key = 'acp_bbcodes';

add_form_key($form_key);


$this->tpl_name = 'acp_bbcodes';
$this->page_title = 'ACP_BBCODES';
$form_key = 'acp_bbcodes';

add_form_key($form_key);


if ($submit && !check_form_key($form_key))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}

 

// Set up mode-specific vars
switch ($action)


// Set up mode-specific vars
switch ($action)

Line 179Line 173
				extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars)));

$warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl);

				extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars)));

$warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl);

 

if (!$warn_text && !check_form_key($form_key))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}


				if (!$warn_text || confirm_box(true))
{
$data = $this->build_regexp($bbcode_match, $bbcode_tpl);

				if (!$warn_text || confirm_box(true))
{
$data = $this->build_regexp($bbcode_match, $bbcode_tpl);

Line 209Line 209
					else
{
$test = $data['bbcode_tag'];

					else
{
$test = $data['bbcode_tag'];

					}

if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match))
{
trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING);

 
					}

if (strlen($data['bbcode_tag']) > 16)

					}

if (strlen($data['bbcode_tag']) > 16)

Line 253Line 248

if ($row)
{


if ($row)
{

							$bbcode_id = $row['max_bbcode_id'] + 1;

							$bbcode_id = (int) $row['max_bbcode_id'] + 1;


// Make sure it is greater than the core bbcode ids...
if ($bbcode_id <= NUM_CORE_BBCODES)


// Make sure it is greater than the core bbcode ids...
if ($bbcode_id <= NUM_CORE_BBCODES)

Line 294Line 289
					}

$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag']));

					}

$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag']));

 

/**
* Event after a BBCode has been added or updated
*
* @event core.acp_bbcodes_modify_create_after
* @var string action Type of the action: modify|create
* @var int bbcode_id The id of the added or updated bbcode
* @var array sql_ary Array with bbcode data (read only)
* @since 3.2.4-RC1
*/
$vars = array(
'action',
'bbcode_id',
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create_after', compact($vars)));


trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
}


trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
}

Line 325Line 336
				{
if (confirm_box(true))
{

				{
if (confirm_box(true))
{

 
						$bbcode_tag = $row['bbcode_tag'];


						$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
$cache->destroy('sql', BBCODES_TABLE);
$phpbb_container->get('text_formatter.cache')->invalidate();

						$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
$cache->destroy('sql', BBCODES_TABLE);
$phpbb_container->get('text_formatter.cache')->invalidate();

						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($row['bbcode_tag']));

















						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($bbcode_tag));

/**
* Event after a BBCode has been deleted
*
* @event core.acp_bbcodes_delete_after
* @var string action Type of the action: delete
* @var int bbcode_id The id of the deleted bbcode
* @var string bbcode_tag The tag of the deleted bbcode
* @since 3.2.4-RC1
*/
$vars = array(
'action',
'bbcode_id',
'bbcode_tag',
);
extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_delete_after', compact($vars)));


if ($request->is_ajax())
{


if ($request->is_ajax())
{

Line 494Line 523
				// Pad backreference numbers from tokens
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
{

				// Pad backreference numbers from tokens
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
{

					$repad = $pad + sizeof(array_unique($repad[0]));

					$repad = $pad + count(array_unique($repad[0]));

					$replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) {
return '${' . ($match[1] + $pad) . '}';
}, $replace);

					$replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) {
return '${' . ($match[1] + $pad) . '}';
}, $replace);

Line 553Line 582
		}

// Lowercase tags

		}

// Lowercase tags

		$bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+=?).*/i', '$1', $bbcode_match);
$bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+)=?.*/i', '$1', $bbcode_match);

		$bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match);
$bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match);





		if (!preg_match('/^[a-zA-Z0-9_-]+=?$/', $bbcode_tag))

		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $bbcode_tag))

		{
global $user;
trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);

		{
global $user;
trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);