$lid = $_GET['lid']; } else { html_draw_error(gettext("Invalid link id or link not found"), 'admin_link_approve.php', 'post', array('cancel' => gettext("Cancel")), array('ret' => $ret), '_self', 'center'); } } } if (isset($lid) && is_numeric($lid)) { if (!session::check_perm(USER_PERM_LINKS_MODERATE, 0)) { html_draw_error(gettext("Cannot edit links"), 'admin_link_approve.php', 'post', array('cancel' => gettext("Cancel")), array('ret' => $ret), '_self', 'center'); } if ($link = links_get_single($lid, false)) { if (isset($link['APPROVED']) && $link['APPROVED'] > 0) { html_draw_error(gettext("Link does not require approval"), 'admin_link_approve.php', 'post', array('cancel' => gettext("Cancel")), array('ret' => $ret), '_self', 'center'); } if (isset($_POST['approve'])) { if (links_approve($lid)) { admin_add_log_entry(APPROVED_LINK, array($lid)); if (preg_match("/^links_detail.php/u", $ret) > 0) { header_redirect("links_detail.php?webtag={$webtag}&lid={$lid}&link_approve_success={$lid}"); exit; } else { html_draw_top(sprintf('title=%s', gettext("Approve Link")), 'class=window_title'); html_display_msg(gettext("Approve Link"), sprintf(gettext("Successfully approved link"), $lid), "admin_link_approve.php", 'get', array('back' => gettext("Back")), array('ret' => $ret), '_self', 'center'); html_draw_bottom(); exit; } } else { $error_msg_array[] = gettext("Link approval failed"); } } else { if (isset($_POST['delete'])) {
} if (sizeof($process_links) > 0) { if (isset($_POST['approve_confirm']) && $_POST['approve_confirm'] == 'Y') { $valid = true; foreach ($process_links as $approve_lid) { $process_valid = true; if ($process_valid && !session::check_perm(USER_PERM_LINKS_MODERATE, 0)) { $process_valid = false; } if ($process_valid && !($link = links_get_single($approve_lid, false))) { $process_valid = false; } if ($process_valid && isset($link['APPROVED']) && $link['APPROVED'] > 0) { $process_valid = false; } if ($process_valid && links_approve($approve_lid)) { admin_add_log_entry(APPROVED_LINK, array($approve_lid)); } else { $valid = false; } } if ($valid) { header_redirect("admin_link_approve.php?webtag={$webtag}&page={$page}&approve_success=true"); exit; } else { $error_msg_array[] = gettext("Failed to approve some links"); } } else { html_draw_top(array('title' => gettext('Approve Links'), 'class' => 'window_title')); html_display_msg(gettext("Approve"), gettext("Are you sure you want to approve all of the selected links?"), "admin_link_approve.php", 'post', array('approve_links' => gettext("Yes"), 'back' => gettext("No")), array('page' => $page, 'process' => $process_links, 'approve_confirm' => 'Y'), '_self', 'center'); html_draw_bottom();