function links_folder_dropdown($default_fid, $folders) { $default_value = 0; $labels = array(); foreach (array_keys($folders) as $key) { $labels[$key] = links_get_folder_path_links($key, $folders, false); if ($key == $default_fid) { $default_value = $key; } } return form_dropdown_array("fid", $labels, $default_value, null, "links_dropdown"); }
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}&lid={$lid}&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"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n";
echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">", form_submit("add", gettext("Add")), " ", form_submit("cancel", gettext("Cancel")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; html_draw_bottom(); } else { if ($mode == LINKS_ADD_FOLDER) { html_draw_top(array('title' => gettext("Links - Add a New Folder"), 'class' => 'window_title')); echo "<h1>", gettext("Links"), html_style_image('separator'), gettext("Add a new folder"), "</h1>\n"; echo "<p>", gettext("Adding new folder under"), ": <b>" . links_get_folder_path_links($fid, $folders, false) . "</b></p>\n"; if (isset($error_msg_array) && sizeof($error_msg_array) > 0) { html_display_error_array($error_msg_array, '500', 'left'); } echo "<form accept-charset=\"utf-8\" name=\"folderadd\" action=\"links_add.php\" method=\"post\" target=\"_self\">\n"; echo " ", form_csrf_token_field(), "\n"; echo " ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n"; echo " ", form_input_hidden("fid", htmlentities_array($fid)) . "\n"; echo " ", form_input_hidden("mode", LINKS_ADD_FOLDER) . "\n"; echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n";
$viewmode = LINKS_VIEW_HIERARCHICAL; if (isset($_GET['viewmode']) && is_numeric($_GET['viewmode'])) { if ($_GET['viewmode'] == LINKS_VIEW_LIST) { $viewmode = LINKS_VIEW_LIST; } else { $viewmode = LINKS_VIEW_HIERARCHICAL; } } if (isset($_GET['page']) && is_numeric($_GET['page'])) { $page = $_GET['page'] > 0 ? $_GET['page'] : 1; } else { $page = 1; } $page_title = links_get_folder_page_title($fid, $folders); html_draw_top("title={$page_title}", 'class=window_title'); echo "<h1>", links_get_folder_path_links($fid, $folders), "</h1>\n"; if (isset($_GET['link_added']) && strlen(trim($_GET['link_added'])) > 0) { $link_added = $_GET['link_added']; html_display_success_msg(sprintf(gettext("Successfully added link '%s'"), htmlentities_array($link_added)), '85%', 'center'); } else { if (isset($_GET['folder_added']) && strlen(trim($_GET['folder_added'])) > 0) { $folder_added = $_GET['folder_added']; html_display_success_msg(sprintf(gettext("Successfully added link '%s'"), htmlentities_array($folder_added)), '85%', 'center'); } } // work out where we are in the folder hierarchy and display links to all the higher levels if ($viewmode == LINKS_VIEW_HIERARCHICAL) { echo "<div align=\"right\">", gettext("View Mode"), ": "; echo " <a href=\"links.php?webtag={$webtag}&fid={$fid}&viewmode=0\"><b>", gettext("Hierarchical"), "</b></a> | "; echo " <a href=\"links.php?webtag={$webtag}&fid={$fid}&viewmode=1\">", gettext("List"), "</a>\n"; echo "</div>\n";
if ($valid) { links_update_folder($fid, $_SESSION['UID'], $name); header_redirect("links.php?webtag={$webtag}&fid={$fid}"); } } else { if (isset($_GET['fid']) && is_numeric($_GET['fid'])) { $fid = $_GET['fid']; if (!in_array($fid, array_keys($folders))) { html_draw_error(gettext("You must specify a valid folder!")); } } else { html_draw_error(gettext("You must specify a folder!")); } } html_draw_top(array('title' => gettext("Links - Edit Folder"), 'class' => 'window_title')); echo "<h1>", links_get_folder_path_links($fid, $folders, false), html_style_image('separator'), gettext("Edit Folder"), "</h1>\n"; echo "<br />\n"; if (isset($error_msg_array) && sizeof($error_msg_array) > 0) { html_display_error_array($error_msg_array, '500', 'left'); } echo "<form accept-charset=\"utf-8\" name=\"folderadd\" action=\"links_folder_edit.php\" method=\"post\" target=\"_self\">\n"; echo " ", form_csrf_token_field(), "\n"; echo " ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n"; echo " ", form_input_hidden("fid", htmlentities_array($fid)) . "\n"; echo " ", form_input_hidden("mode", LINKS_ADD_FOLDER) . "\n"; echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n";
if ($valid) { links_update_folder($fid, $uid, $name); header_redirect("links.php?webtag={$webtag}&fid={$fid}"); } } else { if (isset($_GET['fid']) && is_numeric($_GET['fid'])) { $fid = $_GET['fid']; if (!in_array($fid, array_keys($folders))) { html_draw_error(gettext("You must specify a valid folder!")); } } else { html_draw_error(gettext("You must specify a folder!")); } } html_draw_top(sprintf('title=%s', gettext("Links - Edit Folder")), 'class=window_title'); echo "<h1>", links_get_folder_path_links($fid, $folders, false), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Edit Folder"), "</h1>\n"; echo "<br />\n"; if (isset($error_msg_array) && sizeof($error_msg_array) > 0) { html_display_error_array($error_msg_array, '500', 'left'); } echo "<form accept-charset=\"utf-8\" name=\"folderadd\" action=\"links_folder_edit.php\" method=\"post\" target=\"_self\">\n"; echo " ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n"; echo " ", form_input_hidden("fid", htmlentities_array($fid)) . "\n"; echo " ", form_input_hidden("mode", LINKS_ADD_FOLDER) . "\n"; echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n";
function links_folder_dropdown($default_fid, $folders) { $default_value = 0; while (list($key) = each($folders)) { $labels[$key] = links_get_folder_path_links($key, $folders, false); if ($key == $default_fid) { $default_value = $key; } } return form_dropdown_array("fid", $labels, $default_value, false, "links_dropdown"); }