1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Merge pull request #3370 from SimSync/fix_3245

fixes #3245 eHelper::title2sef() now strips any html or bbcode
This commit is contained in:
Cameron
2018-08-10 14:19:56 -07:00
committed by GitHub
3 changed files with 26 additions and 2 deletions

View File

@@ -4690,6 +4690,9 @@ class eHelper
$tp = e107::getParser(); $tp = e107::getParser();
// issue #3245: strip all html and bbcode before processing
$title = $tp->toText($title);
$title = $tp->toASCII($title); $title = $tp->toASCII($title);
$title = str_replace(array('/',' ',","),' ',$title); $title = str_replace(array('/',' ',","),' ',$title);

View File

@@ -137,7 +137,7 @@ if(!deftrue('OLD_FORUMADMIN'))
protected $fields = array ( protected $fields = array (
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
'forum_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'forum_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_name' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'inline'=>true, 'data' => 'str', 'width' => '40%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'forum_name' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'inline'=>true, 'data' => 'str', 'width' => '40%', 'help' => FORLAN_223, 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_sef' => array ( 'title' => LAN_SEFURL, 'type' => 'text', 'batch'=>true, 'inline'=>true, 'noedit'=>false, 'data' => 'str', 'width' => 'auto', 'help' => 'Leave blank to auto-generate it from the title above.', 'readParms' => '', 'writeParms' => 'sef=forum_name&size=xxlarge', 'class' => 'left', 'thclass' => 'left', ), 'forum_sef' => array ( 'title' => LAN_SEFURL, 'type' => 'text', 'batch'=>true, 'inline'=>true, 'noedit'=>false, 'data' => 'str', 'width' => 'auto', 'help' => 'Leave blank to auto-generate it from the title above.', 'readParms' => '', 'writeParms' => 'sef=forum_name&size=xxlarge', 'class' => 'left', 'thclass' => 'left', ),
'forum_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'forum_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'forum_parent' => array ( 'title' => FORLAN_75, 'type' => 'dropdown', 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'forum_parent' => array ( 'title' => FORLAN_75, 'type' => 'dropdown', 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
@@ -354,10 +354,21 @@ if(!deftrue('OLD_FORUMADMIN'))
$new_data['forum_order'] = $parentOrder + 50; $new_data['forum_order'] = $parentOrder + 50;
if (!empty($new_data['forum_name']))
{
// make sure the forum_name contains only plain text, no bbcode or html
$new_data['forum_name'] = trim(e107::getParser()->toText($new_data['forum_name']));
}
if(empty($new_data['forum_sef'])) if(empty($new_data['forum_sef']))
{ {
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']); $new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']);
} }
else
{
// issue #3245 correct any possible errors/misformatting in the forum_sef
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_sef']);
}
return $new_data; return $new_data;
} }
@@ -378,10 +389,20 @@ if(!deftrue('OLD_FORUMADMIN'))
public function beforeUpdate($new_data, $old_data, $id) public function beforeUpdate($new_data, $old_data, $id)
{ {
if (!empty($new_data['forum_name']))
{
// make sure the forum_name contains only plain text, no bbcode or html
$new_data['forum_name'] = trim(e107::getParser()->toText($new_data['forum_name']));
}
if(empty($new_data['forum_sef']) && !empty($new_data['forum_name'])) if(empty($new_data['forum_sef']) && !empty($new_data['forum_name']))
{ {
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']); $new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']);
} }
elseif(!empty($new_data['forum_sef']))
{
// issue #3245 correct any possible errors/misformatting in the forum_sef
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_sef']);
}
return $new_data; return $new_data;
} }

View File

@@ -237,5 +237,5 @@ define("FORLAN_219", "Rich Text Editor");
define("FORLAN_220", "Post editor"); define("FORLAN_220", "Post editor");
define("FORLAN_221", "Which editor should be used to create/edit posts?"); define("FORLAN_221", "Which editor should be used to create/edit posts?");
define("FORLAN_222", "Quick reply editor"); define("FORLAN_222", "Quick reply editor");
define("FORLAN_223", "Use only plain text (no bbcode or html allowed!)")
?> ?>