Some fixes in admin_attach_cp.php (#1009)

This commit is contained in:
Roman Kelesidis 2023-10-29 10:30:35 +07:00 committed by GitHub
commit 3ca2777f7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 14 deletions

View file

@ -85,7 +85,7 @@ if ($view === 'username') {
} }
} elseif ($view === 'attachments') { } elseif ($view === 'attachments') {
switch ($mode) { switch ($mode) {
case 'filename': case 'real_filename':
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page']; $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'comment': case 'comment':
@ -114,18 +114,19 @@ if ($view === 'username') {
// Set select fields // Set select fields
$view_types_text = [$lang['VIEW_STATISTIC'], $lang['VIEW_SEARCH']]; $view_types_text = [$lang['VIEW_STATISTIC'], $lang['VIEW_SEARCH']];
$view_types = ['stats', 'search']; $view_types = ['stats', 'search'];
$select_view = '';
if (in_array($view, $view_types)) {
$select_view = '<select name="view">'; $select_view = '<select name="view">';
for ($i = 0, $iMax = count($view_types_text); $i < $iMax; $i++) { for ($i = 0, $iMax = count($view_types_text); $i < $iMax; $i++) {
$selected = ($view === $view_types[$i]) ? ' selected' : ''; $selected = ($view === $view_types[$i]) ? ' selected' : '';
$select_view .= '<option value="' . $view_types[$i] . '"' . $selected . '>' . $view_types_text[$i] . '</option>'; $select_view .= '<option value="' . $view_types[$i] . '"' . $selected . '>' . $view_types_text[$i] . '</option>';
} }
$select_view .= '</select>'; $select_view .= '</select>';
}
if (count($mode_types_text) > 0) { if (count($mode_types_text) > 0 && !empty($mode_types)) {
$select_sort_mode = '<select name="mode">'; $select_sort_mode = '<select name="mode">';
for ($i = 0, $iMax = count($mode_types_text); $i < $iMax; $i++) { for ($i = 0, $iMax = count($mode_types_text); $i < $iMax; $i++) {
$selected = ($mode === $mode_types[$i]) ? ' selected' : ''; $selected = ($mode === $mode_types[$i]) ? ' selected' : '';
$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>'; $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
@ -172,7 +173,7 @@ if ($confirm && count($delete_id_list) > 0) {
// Assign Default Template Vars // Assign Default Template Vars
$template->assign_vars([ $template->assign_vars([
'S_VIEW_SELECT' => $select_view, 'S_VIEW_SELECT' => $select_view,
'S_MODE_ACTION' => 'admin_attach_cp.php', 'S_MODE_ACTION' => 'admin_attach_cp.php?view=' . $view . '&amp;mode=' . $mode . '&amp;order=' . $sort_order . '&amp;uid=' . $uid
]); ]);
if ($submit_change && $view === 'attachments') { if ($submit_change && $view === 'attachments') {

View file

@ -9,7 +9,7 @@
<form method="post" action="{S_MODE_ACTION}"> <form method="post" action="{S_MODE_ACTION}">
<table width="100%"> <table width="100%">
<tr> <tr>
<td align="right" nowrap="nowrap">{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp; <td align="right" nowrap="nowrap"><!-- IF S_VIEW_SELECT -->{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;<!-- ENDIF -->
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" /> <input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
</td> </td>
</tr> </tr>
@ -60,7 +60,7 @@
<form method="post" action="{S_MODE_ACTION}"> <form method="post" action="{S_MODE_ACTION}">
<table width="100%"> <table width="100%">
<tr> <tr>
<td align="right" nowrap="nowrap"><span class="med">{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp; <td align="right" nowrap="nowrap"><span class="med"><!-- IF S_VIEW_SELECT -->{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;<!-- ENDIF -->
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" /> <input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
</span></td> </span></td>
</tr> </tr>
@ -133,7 +133,7 @@
<table width="100%"> <table width="100%">
<tr> <tr>
<td align="right" nowrap="nowrap"> <td align="right" nowrap="nowrap">
<span class="med">{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;{L_SORT_BY}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp; <span class="med"><!-- IF S_VIEW_SELECT -->{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;<!-- ENDIF -->{L_SORT_BY}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp;
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" /> <input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
</span> </span>
</td> </td>
@ -191,7 +191,7 @@
<table width="100%"> <table width="100%">
<tr> <tr>
<td align="right" nowrap="nowrap"> <td align="right" nowrap="nowrap">
<span class="med">{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;{L_SORT_BY}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp; <span class="med"><!-- IF S_VIEW_SELECT -->{L_VIEW}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;<!-- ENDIF -->{L_SORT_BY}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp;
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" /> <input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
</span> </span>
</td> </td>