Prefill category upon upload error and fix bug in last patch

When a package upload fails the category value will be prefilled, fixes a bug
in the previous patch where the pkgbuild would not extract properly and splits
the html from php in the form so there are no more prints to output it

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
This commit is contained in:
Callan Barrett 2008-01-15 13:25:29 +09:00 committed by Dan McGee
parent 11f7c682db
commit 2f56688b56

View file

@ -48,8 +48,8 @@ if ($_COOKIE["AURSID"]) {
array(UPLOAD_DIR . $tempdir)); array(UPLOAD_DIR . $tempdir));
} else { } else {
# try using general tar. it should take .gz, .bz2, and plain .tar # try using general tar. it should take .gz, .bz2, and plain .tar
exec("/bin/sh -c 'tar xf ".$upload_file."'", $trash, $retval); exec("/bin/sh -c 'tar xf ".$_FILES['pfile']['tmp_name']."'", $trash, $retval);
if (!$retval) { if ($retval) {
$error = __("Unknown file format for uploaded file."); $error = __("Unknown file format for uploaded file.");
} }
} }
@ -520,52 +520,43 @@ if ($_COOKIE["AURSID"]) {
$pkg_categories = pkgCategories(); $pkg_categories = pkgCategories();
$pkg_locations = pkgLocations(); $pkg_locations = pkgLocations();
?>
print "<form action='/pkgsubmit.php' method='post'"; <form action='/pkgsubmit.php' method='post' enctype='multipart/form-data'>
print " enctype='multipart/form-data'>\n"; <input type='hidden' name='pkgsubmit' value='1' />
print "<input type='hidden' name='pkgsubmit' value='1' />\n"; <table border='0' cellspacing='5'>
print "<input type='hidden' name='MAX_FILE_SIZE' value='"; <tr>
print initeger(ini_get("upload_max_filesize"))."' />\n"; <td span='f4' align='right'><?php print __("Package Category"); ?>:</td>
print "<table border='0' cellspacing='5'>\n"; <td span='f4' align='left'>
print "<tr>\n"; <select name='category'>
print " <td span='f4' align='right'>"; <option value='1'><?php print __("Select Category"); ?></option>
print __("Package Category").":</td>\n"; <?php
print " <td span='f4' align='left'>";
print "<select name='category'>";
print "<option value='1'> " . __("Select Category") . "</option>";
while (list($k, $v) = each($pkg_categories)) { while (list($k, $v) = each($pkg_categories)) {
print "<option value='".$k."'> " . $v . "</option>"; print "<option value='".$k."'";
if (isset($_POST['category']) && $_POST['category'] == $k) {
print " selected='selected'";
} }
print "</select></td>\n"; print "> " . $v . "</option>";
print "</tr>\n"; }
# print "<tr>\n"; ?>
# print " <td span='f4' align='right'>"; </select>
# print __("Package Location").":</td>\n"; </td>
# print " <td span='f4' align='left'>"; </tr>
# print "<select name='location'>"; <tr>
# print "<option value='0'> " . __("Select Location") . "</option>"; <td span='f4' align='right'><?php print __("Upload package file"); ?>:</td>
# while (list($k, $v) = each($pkg_locations)) { <td span='f4' align='left'>
# print "<option value='".$k."'> " . $v . "</option>"; <input type='file' name='pfile' size='30' />
# } </td>
# print "</select></td>\n"; </tr>
# print "</tr>\n"; <tr>
print "<tr>\n"; <td align='left'>
print " <td span='f4' align='right'>"; <input class='button' type='submit' value='<?php print __("Upload"); ?>' />
print __("Upload package file").":</td>\n"; </td>
print " <td span='f4' align='left'>"; </tr>
print "<input type='file' name='pfile' size='30' />\n"; </table>
print " </td>\n"; </form>
print "</tr>\n";
print "<tr>\n"; <?php
print " <td>&nbsp;</td>\n";
print " <td align='left'>";
print "<input class='button' type='submit' value='".__("Upload")."' />\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "</form>\n";
} else { } else {
print __("Sorry, uploads are not permitted by this server."); print __("Sorry, uploads are not permitted by this server.");
print "<br />\n"; print "<br />\n";