Minor improvements (#882)

* Minor improvements

* Updated

* Updated

* Updated

* Update privmsg.php

* Updated

* Update admin_attach_cp.php
This commit is contained in:
Roman Kelesidis 2023-09-04 01:01:01 +07:00 committed by GitHub
commit 4b453de64a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 699 additions and 735 deletions

View file

@ -55,7 +55,7 @@ function base64_unpack($string)
for ($i = 1; $i <= $length; $i++) {
$pos = $length - $i;
$operand = strpos($chars, (string) $string[$pos]);
$operand = strpos($chars, (string)$string[$pos]);
$exponent = $base ** ($i - 1);
$decValue = $operand * $exponent;
$number += $decValue;
@ -454,7 +454,7 @@ function _set_var(&$result, $var, $type, $multibyte = false)
$result = $var;
if ($type == 'string') {
$result = trim(str_replace(array("\r\n", "\r", '\xFF'), array("\n", "\n", ' '), $result));
$result = trim(str_replace(["\r\n", "\r", '\xFF'], ["\n", "\n", ' '], $result));
// 2.0.x is doing addslashes on all variables
$result = stripslashes($result);
if ($multibyte) {

View file

@ -23,7 +23,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
if ($post_id_array === 0 && $attach_id_array !== 0) {
$post_id_array = array();
$post_id_array = [];
if (!is_array($attach_id_array)) {
if (false !== strpos($attach_id_array, ', ')) {
@ -32,7 +32,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
$attach_id_array = explode(',', $attach_id_array);
} else {
$attach_id = (int)$attach_id_array;
$attach_id_array = array();
$attach_id_array = [];
$attach_id_array[] = $attach_id;
}
}
@ -74,7 +74,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
} else {
$post_id = (int)$post_id_array;
$post_id_array = array();
$post_id_array = [];
$post_id_array[] = $post_id;
}
}
@ -85,7 +85,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
// First of all, determine the post id and attach_id
if ($attach_id_array === 0) {
$attach_id_array = array();
$attach_id_array = [];
// Get the attach_ids to fill the array
$whereclause = 'WHERE post_id IN (' . implode(', ', $post_id_array) . ')';
@ -119,7 +119,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
} else {
$attach_id = (int)$attach_id_array;
$attach_id_array = array();
$attach_id_array = [];
$attach_id_array[] = $attach_id;
}
}
@ -147,7 +147,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
}
$torrents_sql = array();
$torrents_sql = [];
while ($row = DB()->sql_fetchrow($result)) {
$torrents_sql[] = $row['topic_id'];

View file

@ -109,11 +109,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
6
);
];
}
$error = false;
@ -147,11 +147,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
1
);
];
}
$error = false;
@ -199,11 +199,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
2
);
];
}
$error = false;
@ -245,11 +245,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
7
);
];
}
fclose($fp);

View file

@ -98,10 +98,10 @@ function attachment_quota_settings($admin_mode, $mode, $submit = false)
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
$template->assign_vars([
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota),
));
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota)
]);
}
if ($admin_mode == 'user' && $submit && @$_POST['delete_user']) {
@ -148,10 +148,10 @@ function attachment_quota_settings($admin_mode, $mode, $submit = false)
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
$template->assign_vars([
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
));
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota)
]);
}
if ($admin_mode == 'group' && $submit && isset($_POST['group_delete'])) {

View file

@ -120,8 +120,8 @@ function category_select($select_name, $group_id = 0)
}
}
$types = array(NONE_CAT);
$modes = array('none');
$types = [NONE_CAT];
$modes = ['none'];
for ($i = 0, $iMax = count($types_category); $i < $iMax; $i++) {
$types[] = $types_category[$i];
@ -152,8 +152,8 @@ function size_select($select_name, $size_compare)
{
global $lang;
$size_types_text = array($lang['BYTES'], $lang['KB'], $lang['MB']);
$size_types = array('b', 'kb', 'mb');
$size_types_text = [$lang['BYTES'], $lang['KB'], $lang['MB']];
$size_types = ['b', 'kb', 'mb'];
$select_field = '<select name="' . $select_name . '">';

View file

@ -22,16 +22,16 @@ function get_img_size_format($width, $height)
$max_width = 400;
if ($width > $height) {
return array(
return [
round($width * ($max_width / $width)),
round($height * ($max_width / $width))
);
];
}
return array(
return [
round($width * ($max_width / $height)),
round($height * ($max_width / $height))
);
];
}
/**
@ -78,14 +78,14 @@ function get_supported_image_types($type)
break;
}
return array(
return [
'gd' => (bool)$new_type,
'format' => $new_type,
'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1
);
];
}
return array('gd' => false);
return ['gd' => false];
}
/**