}
    if (isset($_POST['categoryFile']) && file_exists(DIR_FS_PHOTO_TMP . $_POST['categoryFile'])) {
        //Move Category Log to the forum Log Directory
        list($width, $height, $type, $attr) = getimagesize(DIR_FS_PHOTO_TMP . $_POST['categoryFile']);
        $ratio = floatval($width / $_POST['width']);
        BuckysForumCategory::saveForumImage($categoryID, $_POST['categoryFile'], $_POST['x1'] * $ratio, $_POST['y1'] * $ratio, ($_POST['x2'] - $_POST['x1']) * $ratio);
    }
    //Save Forum Links
    BuckysForumCategory::removeAllLinks($categoryID);
    if (isset($_POST['link_title'])) {
        foreach ($_POST['link_title'] as $i => $link_title) {
            $link_url = $_POST['link_url'][$i];
            if (!$link_url || !$link_title) {
                continue;
            }
            BuckysForumCategory::saveCategoryLink($categoryID, $link_title, $link_url);
        }
    }
    buckys_redirect("/forum/category.php?id=" . $categoryID, MSG_FORUM_SAVED, MSG_TYPE_SUCCESS);
}
$categoryID = isset($_GET['id']) ? $_GET['id'] : null;
if ($categoryID != null) {
    $category = BuckysForumCategory::getCategory($categoryID);
    //Check Permission
    if (!$category || !buckys_is_admin() && !buckys_is_moderator() && !buckys_is_forum_admin($category['categoryID']) && !buckys_is_forum_moderator($category['categoryID'])) {
        buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
    }
}
buckys_enqueue_stylesheet('sceditor/themes/default.css');
buckys_enqueue_stylesheet('forum.css');
buckys_enqueue_stylesheet('posting.css');