$icon_selected = ( isset($forum_icon) ) ? '' : HTML_SELECTED;
$icon_select = "<select name=\"forum_icon\" onChange=\"document.images['forum_icon_img'].src = '". $dir ."' + this.value;\" >";
$icon_select .= '<option value="0">' . $lang['Select_icon'] . '</option>';
for( $i = 0; $i < count($icon_images); $i++ )
{
$icon_edit_img = 'blank.gif';
$icon_select .= '<option value="'. $icon_images[$i] .'">'. $icon_images[$i] .'</option>';
}
$icon_select .= '</select>';
if ( isset($_POST['submit']) && isset($_POST['forum_id']))
{
$forum_ids = implode(",", $_POST['forum_id']);
$forum_icon = addslashes(trim($_POST['forum_icon']));
$sql = "UPDATE ". BB_FORUMS ."
SET forum_icon = '$forum_icon'
WHERE forum_id IN ($forum_ids)";
if (!DB()->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Couldn\'t update forum table.', __LINE__, __FILE__);
}
$message = $lang['FORUMS_UPDATED'] . "<br /><br />";
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], "<a href=\"" . "admin_icon_forums.php" . "\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"" . ("index.php?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
$template->assign_vars(array(
'L_TITLE' => $lang['Forum_icons'],
'ICON_SELECT' => $icon_select,
'ICON_IMG' => $dir . $icon_edit_img,
'L_MARK_ALL' => $lang['MARK_ALL'],
'L_UNMARK_ALL' => $lang['UNMARK_ALL'],
'S_ACTION' => ("admin_icon_forums.php"))
);