function DMA_forum_DeleteBoards($delboardsarray, $movetoboardid = 'delete', $uploaddir = "./")
{
    global $serendipity;
    if ($movetoboardid == 'delete') {
        foreach ($delboardsarray as $delid) {
            $sql = "SELECT threadid FROM {$serendipity['dbPrefix']}dma_forum_threads WHERE boardid = '" . $delid . "'";
            $threads = serendipity_db_query($sql);
            if (is_array($threads) && count($threads) >= 1) {
                foreach ($threads as $threadid) {
                    $q = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_posts WHERE threadid = '" . $threadid . "'";
                    $posts = serendipity_db_query($q);
                    if (is_array($posts) && count($posts) >= 1) {
                        foreach ($posts as $post) {
                            $q = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_uploads WHERE postid = '" . intval($post['postid']) . "'";
                            $uploads = serendipity_db_query($q);
                            if (is_array($uploads) && count($uploads) >= 1) {
                                foreach ($uploads as $upload) {
                                    @unlink($uploaddir . "/" . $upload['sysfilename']);
                                }
                                $q = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_uploads WHERE postid = '" . intval($post['postid']) . "'";
                                $sql = serendipity_db_query($q);
                            }
                        }
                        $sql = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_posts WHERE threadid = '" . $threadid . "'";
                        serendipity_db_query($sql);
                    }
                    $sql = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_threads WHERE threadid = '" . $threadid . "'";
                    serendipity_db_query($sql);
                }
            }
            $sql = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE boardid = '" . $delid . "'";
            serendipity_db_query($sql);
        }
    } else {
        $postcount = 0;
        $threadcount = 0;
        foreach ($delboardsarray as $delid) {
            $sql = "UPDATE {$serendipity['dbPrefix']}dma_forum_threads\n                          SET boardid = '" . intval($movetoboardid) . "'\n                        WHERE boardid = '" . $delid . "'";
            serendipity_db_query($sql);
        }
        $sql = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE boardid = '" . $delid . "'";
        serendipity_db_query($sql);
        DMA_forum_CheckLastProperties(intval($movetoboardid));
    }
    $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards ORDER BY sortorder";
    $boards = serendipity_db_query($sql);
    if (is_array($boards) && count($boards) >= 1) {
        for ($idx = 0; $idx < count($boards); $idx++) {
            $boards[$idx]['sortorder'] = $idx;
        }
        foreach ($boards as $board) {
            $key = intval($board['boardid']);
            serendipity_db_query("UPDATE {$serendipity['dbPrefix']}dma_forum_boards SET sortorder = {$board['sortorder']} WHERE boardid='{$key}'");
        }
    }
}
 function forumAdmin()
 {
     global $serendipity;
     if (!headers_sent()) {
         header('HTTP/1.0 200');
         header('Status: 200 OK');
     }
     $adminurl = $serendipity['baseURL'] . "serendipity_admin.php?serendipity[adminModule]=event_display&serendipity[adminAction]=" . $this->get_config('pageurl');
     $up = "<img src=\"" . $serendipity['baseURL'] . "templates/default/admin/img/uparrow.png\" width=\"16\" height=\"16\" border=\"0\" />";
     $down = "<img src=\"" . $serendipity['baseURL'] . "templates/default/admin/img/downarrow.png\" width=\"16\" height=\"16\" border=\"0\" />";
     $ERRORMSG = "";
     $OUTPUT = "";
     $OUTPUT .= "<h2>" . PLUGIN_FORUM_TITLE . "</h2>\n";
     $OUTPUT .= PLUGIN_FORUM_DESC . "<br /><br />\n";
     // POST part
     if (isset($serendipity['POST']['action']) && (trim($serendipity['POST']['action']) == "delete" && (is_array($serendipity['POST']['delboard']) || trim($serendipity['POST']['s_delboard']) != ""))) {
         // Delete boards
         if (!isset($serendipity['POST']['s_delboard']) || trim($serendipity['POST']['s_delboard']) == "") {
             $delboards = $serendipity['POST']['delboard'];
             $OUTPUT .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n                    <form action=\"?\" name=\"boardsdeleteform\" method=\"POST\">\n                        <div>\n                            <input type=\"hidden\" name=\"serendipity[adminModule]\" value=\"event_display\" />\n                            <input type=\"hidden\" name=\"serendipity[adminAction]\" value=\"" . $this->get_config('pageurl') . "\" />\n                            <input type=\"hidden\" name=\"serendipity[action]\" value=\"delete\" />\n                            <input type=\"hidden\" name=\"serendipity[s_delboard]\" value=\"" . addslashes(str_replace("\"", "M", trim(serialize($delboards)))) . "\" />\n                        </div>\n                    <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                        <td align=\"center\"><b>" . str_replace("{num}", count($delboards), PLUGIN_FORUM_REALLY_DELETE_BOARDS) . "</b></td>\n                    </tr>\n                    <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                        <td align=\"center\">" . PLUGIN_FORUM_DELETE_OR_MOVE . "<br />" . PLUGIN_FORUM_WHERE_TO_MOVE . "<br />\n                            <select name=\"serendipity[moveto]\">\n                                <option value=\"delete\" selected> ---------- " . DELETE . " ---------- </option>\n";
             $WHERE = "";
             foreach ($delboards as $id) {
                 if ($WHERE != "") {
                     $WHERE .= " AND ";
                 }
                 $WHERE .= "boardid != '" . $id . "'";
             }
             $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE " . $WHERE . " ORDER BY sortorder";
             $boards = serendipity_db_query($sql);
             if (is_array($boards) && count($boards) >= 1) {
                 foreach ($boards as $board) {
                     $OUTPUT .= "<option value=\"" . intval($board['boardid']) . "\">" . trim(stripslashes($board['name'])) . "</option>\n";
                 }
             }
             $OUTPUT .= "    </select>\n                        </td>\n                    </tr>\n                    <tr height=\"60\" style=\"background-color: " . $this->get_config('bgcolor1') . ";\">\n                        <td align=\"center\">\n                            <input type=\"image\" src=\"" . $this->DMA_forum_getRelPath() . "/img/yes.png\" style=\"width: 60px;\" width=\"60\" name=\"serendipity[yes]\" value=\"" . YES . "\" /> &nbsp;\n                            <input type=\"image\" src=\"" . $this->DMA_forum_getRelPath() . "/img/no.png\" style=\"width: 60px;\" width=\"60\" name=\"serendipity[no]\" value=\"" . NO . "\" />\n                        </td>\n                    </tr>\n                    </form>\n                </table>\n";
         } elseif (trim($serendipity['POST']['s_delboard']) != "" && isset($serendipity['POST']['yes']) && $serendipity['POST']['yes'] != "") {
             $delboards = unserialize(str_replace("M", "\"", trim(stripslashes($serendipity['POST']['s_delboard']))));
             DMA_forum_DeleteBoards($delboards, $serendipity['POST']['moveto'], $this->get_config('uploaddir'));
         }
     } elseif (isset($serendipity['POST']['action']) && trim($serendipity['POST']['action']) == "edit" && intval($serendipity['POST']['boardid']) >= 1) {
         // EDIT boards
         $boardid = intval($serendipity['POST']['boardid']);
         $sql = "UPDATE {$serendipity['dbPrefix']}dma_forum_boards SET\n                            name = '" . serendipity_db_escape_string(trim($serendipity['POST']['name'])) . "',\n                            description = '" . serendipity_db_escape_string(trim($serendipity['POST']['description'])) . "'\n                    WHERE   boardid = '" . $boardid . "'";
         serendipity_db_query($sql);
     } elseif (isset($serendipity['POST']['action']) && trim($serendipity['POST']['action']) == "new") {
         // Add NEW board
         $LIMIT = serendipity_db_limit(0, 1);
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards ORDER BY sortorder DESC LIMIT " . $LIMIT;
         $lastsort = serendipity_db_query($sql);
         if (!is_array($lastsort) || !isset($lastsort[0]['sortorder'])) {
             $newsort = 0;
         } else {
             $newsort = intval($lastsort[0]['sortorder']) + 1;
         }
         $sql = "INSERT INTO {$serendipity['dbPrefix']}dma_forum_boards (\n                            name,\n                            description,\n                            sortorder\n                ) VALUES (\n                            '" . serendipity_db_escape_string(trim($serendipity['POST']['name'])) . "',\n                            '" . serendipity_db_escape_string(trim($serendipity['POST']['description'])) . "',\n                            '" . $newsort . "'\n                )";
         serendipity_db_query($sql);
     } elseif (isset($serendipity['POST']['action']) && trim($serendipity['POST']['action']) == "move") {
         // move thread
         $sql = "UPDATE {$serendipity['dbPrefix']}dma_forum_threads SET\n                            boardid = '" . intval($serendipity['POST']['moveto']) . "'\n                    WHERE   threadid = '" . intval($serendipity['POST']['threadid']) . "'";
         serendipity_db_query($sql);
         DMA_forum_CheckLastProperties(intval($serendipity['POST']['boardid']));
         DMA_forum_CheckLastProperties(intval($serendipity['POST']['moveto']));
     } elseif (isset($serendipity['POST']['action']) && trim($serendipity['POST']['action']) == "delete" && trim($serendipity['POST']['yes']) != "") {
         // delete thread
         $sql = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_threads\n                    WHERE   threadid = '" . intval($serendipity['POST']['threadid']) . "'";
         serendipity_db_query($sql);
         $q = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_posts WHERE threadid = '" . intval($serendipity['POST']['threadid']) . "'";
         $posts = serendipity_db_query($q);
         if (is_array($posts) && count($posts) >= 1) {
             foreach ($posts as $post) {
                 $q = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_uploads WHERE postid = '" . intval($post['postid']) . "'";
                 $uploads = serendipity_db_query($q);
                 if (is_array($uploads) && count($uploads) >= 1) {
                     foreach ($uploads as $upload) {
                         @unlink($this->get_config('uploaddir') . "/" . $upload['sysfilename']);
                     }
                     $q = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_uploads WHERE postid = '" . intval($post['postid']) . "'";
                     $sql = serendipity_db_query($q);
                 }
             }
             $sql = "DELETE FROM {$serendipity['dbPrefix']}dma_forum_posts WHERE threadid = '" . intval($serendipity['POST']['threadid']) . "'";
             serendipity_db_query($sql);
         }
         DMA_forum_CheckLastProperties(intval($serendipity['POST']['boardid']));
     }
     // GET part
     if (isset($_GET['action']) && (trim($_GET['action']) == "down" || trim($_GET['action']) == "up")) {
         //  Reorder the boards
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards ORDER BY sortorder";
         $boards = serendipity_db_query($sql);
         $idx_to_move = -1;
         for ($idx = 0; $idx < count($boards); $idx++) {
             $boards[$idx]['sortorder'] = $idx;
             if ($boards[$idx]['boardid'] == intval($_GET['boardid'])) {
                 $idx_to_move = $idx;
             }
         }
         if ($idx_to_move >= 0 && (trim($_GET['action']) == 'down' && $idx_to_move < count($boards) - 1 || trim($_GET['action']) == 'up' && $idx_to_move > 0)) {
             $tmp = $boards[$idx_to_move]['sortorder'];
             $boards[$idx_to_move]['sortorder'] = (int) $boards[$idx_to_move + (trim($_GET['action']) == 'down' ? 1 : -1)]['sortorder'];
             $boards[$idx_to_move + (trim($_GET['action']) == 'down' ? 1 : -1)]['sortorder'] = (int) $tmp;
             foreach ($boards as $board) {
                 $key = intval($board['boardid']);
                 serendipity_db_query("UPDATE {$serendipity['dbPrefix']}dma_forum_boards SET sortorder = {$board['sortorder']} WHERE boardid='{$key}'");
             }
         }
         $_GET['action'] = "";
     } elseif (isset($_GET['action']) && trim($_GET['action']) == "edit") {
         // Edit board
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE boardid = '" . intval($_GET['boardid']) . "'";
         $board = serendipity_db_query($sql);
         $OUTPUT .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n                <form action=\"?\" name=\"boardseditform\" method=\"POST\">\n                    <div>\n                        <input type=\"hidden\" name=\"serendipity[adminModule]\" value=\"event_display\" />\n                        <input type=\"hidden\" name=\"serendipity[adminAction]\" value=\"" . $this->get_config('pageurl') . "\" />\n                        <input type=\"hidden\" name=\"serendipity[action]\" value=\"edit\" />\n                        <input type=\"hidden\" name=\"serendipity[boardid]\" value=\"" . intval($_GET['boardid']) . "\" />\n                    </div>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td width=\"130\"><b>" . PLUGIN_FORUM_BOARDNAME . "</b></td><td><input class=\"input_textbox\" style=\"width: 100%;\" width=\"100%\" type=\"text\" name=\"serendipity[name]\" value=\"" . stripslashes(trim($board[0]['name'])) . "\" /></td>\n                </tr>\n                <tr style=\"background-color: " . $this->get_config('bgcolor1') . ";\">\n                    <td width=\"130\"><b>" . PLUGIN_FORUM_BOARDDESC . "</b></td><td><textarea style=\"width: 100%;\" rows=\"3\" width=\"100%\" name=\"serendipity[description]\">" . stripslashes(trim($board[0]['description'])) . "</textarea></td>\n                </tr>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td colspan=\"2\" align=\"center\"><input class=\"serendipityPrettyButton input_button\" type=\"submit\" name=\"serendipity[submit]\" value=\"" . PLUGIN_FORUM_SUBMIT . "\" /></td>\n                </tr>\n                </form>\n            </table>\n";
     } elseif (isset($_GET['action']) && trim($_GET['action']) == "new") {
         // Add NEW board
         $OUTPUT .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n                <form action=\"?\" name=\"boardnewform\" method=\"POST\">\n                    <div>\n                        <input type=\"hidden\" name=\"serendipity[adminModule]\" value=\"event_display\" />\n                        <input type=\"hidden\" name=\"serendipity[adminAction]\" value=\"" . $this->get_config('pageurl') . "\" />\n                        <input type=\"hidden\" name=\"serendipity[action]\" value=\"new\" />\n                    </div>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td width=\"130\"><b>" . PLUGIN_FORUM_BOARDNAME . "</b></td><td><input class=\"input_textbox\" style=\"width: 100%;\" width=\"100%\" type=\"text\" name=\"serendipity[name]\" value=\"\" /></td>\n                </tr>\n                <tr style=\"background-color: " . $this->get_config('bgcolor1') . ";\">\n                    <td width=\"130\"><b>" . PLUGIN_FORUM_BOARDDESC . "</b></td><td><textarea style=\"width: 100%;\" rows=\"3\" width=\"100%\" name=\"serendipity[description]\"></textarea></td>\n                </tr>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td colspan=\"2\" align=\"center\"><input class=\"serendipityPrettyButton input_button\" type=\"submit\" name=\"serendipity[submit]\" value=\"" . PLUGIN_FORUM_SUBMIT . "\" /></td>\n                </tr>\n                </form>\n            </table>\n";
     } elseif (isset($_GET['action']) && trim($_GET['action']) == "move") {
         // Move thread
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_threads WHERE threadid = '" . intval($_GET['threadid']) . "'";
         $thisthread = serendipity_db_query($sql);
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE boardid = '" . intval($_GET['boardid']) . "'";
         $thisboard = serendipity_db_query($sql);
         $OUTPUT .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n                <form action=\"?\" name=\"movethreadform\" method=\"POST\">\n                    <div>\n                        <input type=\"hidden\" name=\"serendipity[adminModule]\" value=\"event_display\" />\n                        <input type=\"hidden\" name=\"serendipity[adminAction]\" value=\"" . $this->get_config('pageurl') . "\" />\n                        <input type=\"hidden\" name=\"serendipity[action]\" value=\"move\" />\n                        <input type=\"hidden\" name=\"serendipity[boardid]\" value=\"" . intval($_GET['boardid']) . "\" />\n                        <input type=\"hidden\" name=\"serendipity[threadid]\" value=\"" . intval($_GET['threadid']) . "\" />\n                    </div>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td align=\"center\"><b>" . PLUGIN_FORUM_MOVE_THREAD . "</b><br />&quot;" . stripslashes(trim($thisthread[0]['title'])) . "&quot;<br />\n                    " . PLUGIN_FORUM_FROM_BOARD . " &quot;" . $thisboard[0]['name'] . "&quot; " . PLUGIN_FORUM_TO_BOARD . ":</td>\n                </tr>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td align=\"center\"><select name=\"serendipity[moveto]\">\n";
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE boardid != '" . intval($_GET['boardid']) . "' ORDER BY sortorder";
         $boards = serendipity_db_query($sql);
         if (is_array($boards) && count($boards) >= 1) {
             foreach ($boards as $board) {
                 $OUTPUT .= "<option value=\"" . intval($board['boardid']) . "\">" . trim(stripslashes($board['name'])) . "</option>\n";
             }
         }
         $OUTPUT .= "    </select>\n                    </td>\n                </tr>\n                <tr height=\"60\" style=\"background-color: " . $this->get_config('bgcolor1') . ";\">\n                    <td align=\"center\">\n                        <input class=\"serendipityPrettyButton input_button\" type=\"submit\"  name=\"serendipity[submit]\" value=\"" . PLUGIN_FORUM_MOVE . "\" /> &nbsp;\n                    </td>\n                </tr>\n                </form>\n            </table>\n";
     } elseif (isset($_GET['action']) && trim($_GET['action']) == "delete") {
         // delete thread
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_threads WHERE threadid = '" . intval($_GET['threadid']) . "'";
         $thisthread = serendipity_db_query($sql);
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards WHERE boardid = '" . intval($_GET['boardid']) . "'";
         $thisboard = serendipity_db_query($sql);
         $OUTPUT .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n                <form action=\"?\" name=\"threaddeleteform\" method=\"POST\">\n                    <div>\n                        <input type=\"hidden\" name=\"serendipity[adminModule]\" value=\"event_display\" />\n                        <input type=\"hidden\" name=\"serendipity[adminAction]\" value=\"" . $this->get_config('pageurl') . "\" />\n                        <input type=\"hidden\" name=\"serendipity[action]\" value=\"delete\" />\n                        <input type=\"hidden\" name=\"serendipity[boardid]\" value=\"" . intval($_GET['boardid']) . "\" />\n                        <input type=\"hidden\" name=\"serendipity[threadid]\" value=\"" . intval($_GET['threadid']) . "\" />\n                    </div>\n                <tr style=\"background-color: " . $this->get_config('bgcolor2') . ";\">\n                    <td align=\"center\"><b>" . PLUGIN_FORUM_REALLY_DELETE_THREAD . "</b><br />&quot;" . stripslashes(trim($thisthread[0]['title'])) . "&quot;</td>\n                </tr>\n                <tr height=\"60\" style=\"background-color: " . $this->get_config('bgcolor1') . ";\">\n                    <td align=\"center\">\n                        <input type=\"image\" src=\"" . $this->DMA_forum_getRelPath() . "/img/yes.png\" style=\"width: 60px;\" width=\"60\" name=\"serendipity[yes]\" value=\"1" . YES . "\" /> &nbsp;\n                        <input type=\"image\" src=\"" . $this->DMA_forum_getRelPath() . "/img/no.png\" style=\"width: 60px;\" width=\"60\" name=\"serendipity[no]\" value=\"" . NO . "\" />\n                    </td>\n                </tr>\n                </form>\n            </table>\n";
     }
     /*
     echo "<pre>";
     print_r($serendipity);
     echo "</pre>";
     */
     unset($_GET);
     unset($_POST);
     if (!isset($_GET['action']) || trim($_GET['action']) == "") {
         // Main Admin page (Boardlist)
         unset($boards);
         unset($board);
         $sql = "SELECT * FROM {$serendipity['dbPrefix']}dma_forum_boards ORDER BY sortorder";
         $boards = serendipity_db_query($sql);
         $num = count($boards);
         $OUTPUT .= "<div align=\"right\"><b>[ <a href=\"" . $adminurl . "&amp;action=new\">" . PLUGIN_FORUM_ADD_BOARD . "</a> ]</b></div><br />\n";
         $OUTPUT .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
         if (is_array($boards) && $num >= 1) {
             $OUTPUT .= "<tr style=\"background-color: " . $this->get_config('bgcolor_head') . ";\">\n";
             $OUTPUT .= "<td width=\"18\">&nbsp;</td>\n";
             $OUTPUT .= "<td><b>" . PLUGIN_FORUM_BOARDS . "</b></td>\n";
             $OUTPUT .= "<td width=\"60\" align=\"right\"><b>" . PLUGIN_FORUM_THREADS . "</b></td>\n";
             $OUTPUT .= "<td width=\"60\" align=\"right\"><b>" . PLUGIN_FORUM_POSTS . "</b></td>\n";
             $OUTPUT .= "<td width=\"60\"><b>" . PLUGIN_FORUM_ORDER . "</b></td>\n";
             $OUTPUT .= "</tr>\n";
             $OUTPUT .= "    <form action=\"?\" name=\"boardsdeleteform\" method=\"POST\">\n";
             $OUTPUT .= "        <div>\n";
             $OUTPUT .= "            <input type=\"hidden\" name=\"serendipity[adminModule]\" value=\"event_display\" />\n";
             $OUTPUT .= "            <input type=\"hidden\" name=\"serendipity[adminAction]\" value=\"" . $this->get_config('pageurl') . "\" />\n";
             $OUTPUT .= "            <input type=\"hidden\" name=\"serendipity[action]\" value=\"delete\" />\n";
             $OUTPUT .= "        </div>\n";
             foreach ($boards as $board) {
                 if ($thiscolor == $this->get_config('bgcolor2')) {
                     $thiscolor = $this->get_config('bgcolor1');
                 } else {
                     $thiscolor = $this->get_config('bgcolor2');
                 }
                 $OUTPUT .= "<tr style=\"background-color: " . $thiscolor . ";\">\n";
                 $OUTPUT .= "<td width=\"18\"><input class=\"input_checkbox\" type=\"checkbox\" name=\"serendipity[delboard][]\" value=\"" . intval($board['boardid']) . "\" /></td>\n";
                 $OUTPUT .= "<td><a href=\"" . $adminurl . "&amp;action=edit&amp;boardid=" . intval($board['boardid']) . "\"><b>" . $board['name'] . "</b></a></td>\n";
                 $OUTPUT .= "<td width=\"60\" align=\"right\">" . intval($board['threads']) . "</td>\n";
                 $OUTPUT .= "<td width=\"60\" align=\"right\">" . intval($board['posts']) . "</td>\n";
                 $OUTPUT .= "<td width=\"60\" align=\"center\">\n";
                 if ($num <= 1) {
                     $OUTPUT .= "&nbsp;\n";
                 } elseif ($num >= 2 && intval($board['sortorder']) == 0) {
                     $OUTPUT .= "<a href=\"" . $adminurl . "&amp;action=down&amp;boardid=" . intval($board['boardid']) . "\">" . $down . "</a>\n";
                 } elseif ($num >= 2 && (intval($board['sortorder']) >= 1 && intval($board['sortorder']) <= $num - 2)) {
                     $OUTPUT .= "<a href=\"" . $adminurl . "&amp;action=up&amp;boardid=" . intval($board['boardid']) . "\">" . $up . "</a>&nbsp&nbsp;\n";
                     $OUTPUT .= "<a href=\"" . $adminurl . "&amp;action=down&amp;boardid=" . intval($board['boardid']) . "\">" . $down . "</a>\n";
                 } elseif ($num >= 2 && intval($board['sortorder']) == $num - 1) {
                     $OUTPUT .= "<a href=\"" . $adminurl . "&amp;action=up&amp;boardid=" . intval($board['boardid']) . "\">" . $up . "</a>&nbsp&nbsp;\n";
                 }
                 $OUTPUT .= "</td>\n";
                 $OUTPUT .= "</tr>\n";
             }
             $OUTPUT .= "<tr style=\"background-color: " . $this->get_config('bgcolor_head') . ";\">\n";
             $OUTPUT .= "<td colspan=\"5\"><input class=\"serendipityPrettyButton input_button\" type=\"submit\" name=\"serendipity[submit]\" value=\"" . DELETE . "\" /></td>\n";
             $OUTPUT .= "</tr>\n";
             $OUTPUT .= "</form>\n";
         } else {
             $OUTPUT .= "<tr><td><div align=\"center\"><b>" . PLUGIN_FORUM_NO_BOARDS . "</b></div></td></tr>\n";
         }
         $OUTPUT .= "</table>\n";
     }
     echo $OUTPUT;
 }