Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fix mybb#4711

* Warning [2] Undefined variable $written

* Revert fix for questionable warning

Revert fix for:
Warning [2] Undefined array key "fragment" - Line: 1494 - File: inc/class_parser.php PHP 8.2.6 (Linux)

* Revert unnecessary changes

* Revert unnecessary changes

* Fix spacing

* Revert unnecessary changes

* Revert unnecessary changes

---------

Co-authored-by: dvz <devilshakerz@gmail.com>
  • Loading branch information
Sama34 and dvz committed Apr 15, 2024
1 parent aef16e2 commit 0d9440c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
8 changes: 4 additions & 4 deletions admin/modules/user/users.php
Expand Up @@ -2986,7 +2986,7 @@ function toggleBox(action)
$page->output_footer();
break;
case 'multiusergroup':
if($mybb->input['processed'] == 1)
if($mybb->get_input('processed', \MyBB::INPUT_INT) === 1)
{
// Determine additional usergroups
if(is_array($mybb->input['additionalgroups']))
Expand Down Expand Up @@ -3086,12 +3086,12 @@ function toggleBox(action)
$display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
}

if(!is_array($mybb->input['additionalgroups']))
if(!$mybb->get_input('additionalgroups', \MyBB::INPUT_ARRAY))
{
$mybb->input['additionalgroups'] = explode(',', $mybb->input['additionalgroups']);
$mybb->input['additionalgroups'] = explode(',', $mybb->get_input('additionalgroups'));
}

$form_container->output_row($lang->primary_user_group, "", $form->generate_select_box('usergroup', $options, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
$form_container->output_row($lang->primary_user_group, "", $form->generate_select_box('usergroup', $options, $mybb->get_input('usergroup'), array('id' => 'usergroup')), 'usergroup');
$form_container->output_row($lang->additional_user_groups, $lang->additional_user_groups_desc, $form->generate_select_box('additionalgroups[]', $options, $mybb->input['additionalgroups'], array('id' => 'additionalgroups', 'multiple' => true, 'size' => 5)), 'additionalgroups');
$form_container->output_row($lang->display_user_group, "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');

Expand Down
9 changes: 8 additions & 1 deletion inc/class_error.php
Expand Up @@ -178,7 +178,14 @@ function error($type, $message, $file=null, $line=0, $allow_output=true)
return true;
}

$file = str_replace(MYBB_ROOT, "", $file);
if(isset($file))
{
$file = str_replace(MYBB_ROOT, "", $file);
}
else
{
$file = "";
}

if($type == MYBB_SQL || strpos(strtolower($this->error_types[$type]), 'warning') === false)
{
Expand Down
6 changes: 3 additions & 3 deletions inc/class_templates.php
Expand Up @@ -95,16 +95,16 @@ function get($title, $eslashes=1, $htmlcomments=1)
$this->uncached_templates[$title] = $title;
}

if(!$gettemplate)
if(empty($gettemplate))
{
$gettemplate['template'] = "";
$gettemplate = array('template' => '');
}

$this->cache[$title] = $gettemplate['template'];
}
$template = $this->cache[$title];

if($htmlcomments)
if($htmlcomments && $template !== false)
{
if($mybb->settings['tplhtmlcomments'] == 1)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/datahandlers/post.php
Expand Up @@ -1803,7 +1803,7 @@ function insert_thread()
}

// Assign any uploaded attachments with the specific posthash to the newly created post.
if($thread['posthash'])
if(!empty($thread['posthash']))
{
$thread['posthash'] = $db->escape_string($thread['posthash']);
$attachmentassign = array(
Expand Down
20 changes: 17 additions & 3 deletions inc/functions.php
Expand Up @@ -1694,7 +1694,14 @@ function fetch_forum_permissions($fid, $gid, $groupperms)
{
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;

$groups = explode(",", $gid);
if(isset($gid))
{
$groups = explode(",", $gid);
}
else
{
$groups = array();
}

$current_permissions = array();
$only_view_own_threads = 1;
Expand Down Expand Up @@ -5742,7 +5749,14 @@ function my_number_format($number)
}
else
{
$parts = explode('.', $number);
if(isset($number))
{
$parts = explode('.', $number);
}
else
{
$parts = array();
}

if(isset($parts[1]))
{
Expand Down Expand Up @@ -6129,7 +6143,7 @@ function my_strlen($string)

$string = preg_replace("#&\#([0-9]+);#", "-", $string);

if(strtolower($lang->settings['charset']) == "utf-8")
if(isset($lang->settings['charset']) && strtolower($lang->settings['charset']) == "utf-8")
{
// Get rid of any excess RTL and LTR override for they are the workings of the devil
$string = str_replace(dec_to_utf8(8238), "", $string);
Expand Down
14 changes: 14 additions & 0 deletions inc/mailhandlers/php.php
Expand Up @@ -26,6 +26,20 @@ class PhpMail extends MailHandler
*/
public $additional_parameters = '';

/**
* Path where the sendmail program can be found.
*
* @var string
*/
public $sendmail = '';

/**
* Which "From:" mail address should be used in mail sent directly via SMTP.
*
* @var string
*/
public $sendmail_from = '';

/**
* Sends the email.
*
Expand Down

0 comments on commit 0d9440c

Please sign in to comment.