Change for with count.

This commit is contained in:
Vasily Komrakov 2017-05-07 20:59:35 +03:00
commit 56540c893a
No known key found for this signature in database
GPG key ID: 558236680C20A69A
16 changed files with 73 additions and 73 deletions

View file

@ -103,7 +103,7 @@ function auth_pack($auth_array)
$one_char = $two_char = false;
$auth_cache = '';
for ($i = 0; $i < count($auth_array); $i++) {
for ($i = 0, $iMax = count($auth_array); $i < $iMax; $i++) {
$val = base64_pack((int)$auth_array[$i]);
if (strlen($val) == 1 && !$one_char) {
$auth_cache .= $one_char_encoding;

View file

@ -187,7 +187,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
//bt end
for ($i = 0; $i < count($attach_id_array); $i++) {
for ($i = 0, $iMax = count($attach_id_array); $i < $iMax; $i++) {
$sql = 'SELECT attach_id
FROM ' . BB_ATTACHMENTS . '
WHERE attach_id = ' . (int)$attach_id_array[$i];

View file

@ -50,7 +50,7 @@ function group_select($select_name, $default_group = 0)
$group_name[$num_rows]['group_id'] = 0;
$group_name[$num_rows]['group_name'] = $lang['NOT_ASSIGNED'];
for ($i = 0; $i < count($group_name); $i++) {
for ($i = 0, $iMax = count($group_name); $i < $iMax; $i++) {
if (!$default_group) {
$selected = ($i == 0) ? ' selected="selected"' : '';
} else {
@ -93,7 +93,7 @@ function download_select($select_name, $group_id = 0)
$group_select = '<select name="' . $select_name . '">';
for ($i = 0; $i < count($types_download); $i++) {
for ($i = 0, $iMax = count($types_download); $i < $iMax; $i++) {
if (!$group_id) {
$selected = ($types_download[$i] == INLINE_LINK) ? ' selected="selected"' : '';
} else {
@ -138,14 +138,14 @@ function category_select($select_name, $group_id = 0)
$types = array(NONE_CAT);
$modes = array('none');
for ($i = 0; $i < count($types_category); $i++) {
for ($i = 0, $iMax = count($types_category); $i < $iMax; $i++) {
$types[] = $types_category[$i];
$modes[] = $modes_category[$i];
}
$group_select = '<select name="' . $select_name . '" style="width:100px">';
for ($i = 0; $i < count($types); $i++) {
for ($i = 0, $iMax = count($types); $i < $iMax; $i++) {
if (!$group_id) {
$selected = ($types[$i] == NONE_CAT) ? ' selected="selected"' : '';
} else {
@ -172,7 +172,7 @@ function size_select($select_name, $size_compare)
$select_field = '<select name="' . $select_name . '">';
for ($i = 0; $i < count($size_types_text); $i++) {
for ($i = 0, $iMax = count($size_types_text); $i < $iMax; $i++) {
$selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
$select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
}
@ -204,7 +204,7 @@ function quota_limit_select($select_name, $default_quota = 0)
}
DB()->sql_freeresult($result);
for ($i = 0; $i < count($quota_name); $i++) {
for ($i = 0, $iMax = count($quota_name); $i < $iMax; $i++) {
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
}
@ -235,7 +235,7 @@ function default_quota_limit_select($select_name, $default_quota = 0)
}
DB()->sql_freeresult($result);
for ($i = 0; $i < count($quota_name); $i++) {
for ($i = 0, $iMax = count($quota_name); $i < $iMax; $i++) {
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
}