Пример #1
0
function links_folder_delete($fid)
{
    if (!is_numeric($fid)) {
        return false;
    }
    $folders = links_folders_get(!session::check_perm(USER_PERM_LINKS_MODERATE, 0));
    if (!($db = db::get())) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $sql = "SELECT MIN(FID) AS FID FROM `{$table_prefix}LINKS`";
    if (!($result = $db->query($sql))) {
        return false;
    }
    $link_array = $result->fetch_assoc();
    if (isset($link_array['FID']) && $link_array['FID'] == $fid) {
        return false;
    }
    $sql = "UPDATE LOW_PRIORITY `{$table_prefix}LINKS` ";
    $sql .= "SET FID = '{$folders[$fid]['PARENT_FID']}' WHERE FID = '{$fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    $sql = "DELETE QUICK FROM `{$table_prefix}LINKS_FOLDERS` ";
    $sql .= "WHERE FID = '{$fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    return $result;
}
Пример #2
0
        }
    }
}
if (isset($_GET['delete_comment']) && is_numeric($_GET['delete_comment'])) {
    $comment_id = $_GET['delete_comment'];
    $comment_uid = links_get_comment_uid($comment_id);
    if ($user_perm_links_moderate || $comment_uid == $_SESSION['UID']) {
        if (links_delete_comment($comment_id)) {
            $success_msg = gettext("Comment was deleted.");
        } else {
            $error_msg_array[] = gettext("Comment could not be deleted.");
            $valid = false;
        }
    }
}
$folders = links_folders_get(!$user_perm_links_moderate);
$page_title = links_get_folder_page_title($link['FID'], $folders, $link['TITLE']);
html_draw_top(array('title' => $page_title, 'class' => 'window_title'));
echo "<h1>", links_get_folder_path_links($link['FID'], $folders, true, true), html_style_image('separator'), "<a href=\"links.php?webtag={$webtag}&amp;lid={$lid}&amp;action=go\" target=\"_blank\">", word_filter_add_ob_tags($link['TITLE'], true), "</a></h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    html_display_error_array($error_msg_array, '600', 'center');
} else {
    if (isset($success_msg) && strlen($success_msg) > 0) {
        html_display_success_msg($success_msg, '600', 'center');
    }
}
echo "<br />\n";
echo "<div align=\"center\">\n";
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n";
echo "  <tr>\n";
echo "    <td align=\"left\">\n";
Пример #3
0
// Check links section is enabled
if (!forum_get_setting('show_links', 'Y')) {
    html_draw_error(gettext("You may not access this section."));
}
// Array to hold error messages
$error_msg_array = array();
$name = null;
$uri = null;
$description = null;
// User pressed cancel
if (isset($_POST['cancel'])) {
    header_redirect("links.php?webtag={$webtag}&fid={$_POST['fid']}");
    exit;
}
// Get the Links Folders.
$folders = links_folders_get(!session::check_perm(USER_PERM_LINKS_MODERATE, 0));
// Check the mode.
if (isset($_GET['mode'])) {
    if ($_GET['mode'] == LINKS_ADD_LINK) {
        $mode = LINKS_ADD_LINK;
    } else {
        if ($_GET['mode'] == LINKS_ADD_FOLDER) {
            $mode = LINKS_ADD_FOLDER;
        } else {
            $mode = LINKS_ADD_LINK;
        }
    }
} else {
    if (isset($_POST['mode'])) {
        if ($_POST['mode'] == LINKS_ADD_LINK) {
            $mode = LINKS_ADD_LINK;