$fid = $_POST['fid']; } else { $fid = 1; } if (isset($_POST['name']) && strlen(trim($_POST['name'])) > 0) { $name = trim($_POST['name']); if (mb_strlen($name) > 32) { $error_msg_array[] = sprintf(gettext("Folder name too long. Maximum length is %s characters"), 32); $valid = false; } } else { $error_msg_array[] = gettext("You must specify a name!"); $valid = false; } if ($valid) { if (links_add_folder($fid, $name, $_SESSION['UID'], true)) { header_redirect("links.php?webtag={$webtag}&fid={$fid}&folder_added={$name}"); exit; } else { $error_msg_array[] = gettext("Failed to add folder"); $valid = false; } } } else { if (isset($_GET['fid']) && is_numeric($_GET['fid'])) { $fid = $_GET['fid']; if ($_GET['mode'] == 'link' && !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!"));
$fid = $_POST['fid']; } else { $fid = 1; } if (isset($_POST['name']) && strlen(trim($_POST['name'])) > 0) { $name = trim($_POST['name']); if (mb_strlen($name) > 32) { $error_msg_array[] = sprintf(gettext("Folder name too long. Maximum length is %s characters"), 32); $valid = false; } } else { $error_msg_array[] = gettext("You must specify a name!"); $valid = false; } if ($valid) { if (links_add_folder($fid, $name, $uid, true)) { header_redirect("links.php?webtag={$webtag}&fid={$fid}&folder_added={$name}"); exit; } else { $error_msg_array[] = gettext("Failed to add folder"); $valid = false; } } } else { if (isset($_GET['fid']) && is_numeric($_GET['fid'])) { $fid = $_GET['fid']; if ($_GET['mode'] == 'link' && !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!"));