xref: /web-bugs/templates/addpatch.php (revision 9d47b05f)
1<?php
2response_header('Add Patch :: ' . clean($package_name));
3?>
4<h2>Add a Patch to <a href="bug.php?id=<?php echo $bug_id; ?>">Bug #<?php echo $bug_id; ?></a></h2>
5<ul>
6 <li>One problem per patch, please</li>
7 <li>Patches must be 100k or smaller</li>
8 <li>Only text/plain files accepted</li>
9 <li>choose a meaningful patch name (i.e. add-fronk-support)</li>
10</ul>
11<form name="patchform" method="post" action="patch-add.php" enctype="multipart/form-data">
12<input type="hidden" name="MAX_FILE_SIZE" value="102400">
13<input type="hidden" name="bug" value="<?php echo $bug_id; ?>">
14<?php
15if (!empty($errors)) {
16    foreach ($errors as $err) {
17        echo '<div class="errors">' . htmlspecialchars($err) . '</div>';
18    }
19}
20?>
21<table>
22<?php
23if (!$logged_in) {
24    $_SESSION['answer'] = $captcha->getAnswer();
25?>
26 <tr>
27  <th class="form-label_left">
28   Email Address (MUST BE VALID)
29  </th>
30  <td class="form-input">
31   <input type="text" name="email" value="<?php echo clean($email); ?>">
32  </td>
33 </tr>
34 <tr>
35  <th>Solve the problem:<br><?php echo $captcha->getQuestion(); ?></th>
36  <td class="form-input"><input type="text" name="captcha"></td>
37 </tr>
38<?php } ?>
39 <tr>
40  <th class="form-label_left">
41   Patch Name
42  </th>
43  <td class="form-input">
44   <input type="text" maxlength="80" size="40" name="name" value="<?php echo clean($patch_name); ?>"><br>
45   <small>The patch name must be shorter than 80 characters and it must only contain alpha-numeric characters, dots, underscores or hyphens.</small>
46  </td>
47 </tr>
48 <tr>
49  <th class="form-label_left">
50   Patch File
51  </th>
52  <td class="form-input">
53   <input type="file" name="patch">
54  </td>
55 </tr>
56<?php if (!empty($patches)) { ?>
57 <tr>
58  <th class="form-label_left">
59   Old patches this patch should replace:
60  </th>
61  <td class="form-input">
62   <select name="obsoleted[]" multiple="true" size="5">
63    <option value="0">(none)</option>
64    <?php foreach ($patches as $patch): ?>
65        <option value="<?= htmlspecialchars($patch['patch'].'#'.$patch['revision'], ENT_QUOTES); ?>">
66            <?= htmlspecialchars($patch['patch'], ENT_QUOTES); ?>,
67            Revision <?= format_date($patch['revision']); ?>
68            <?= $patch['developer'] ? '('.spam_protect(htmlspecialchars($patch['developer'], ENT_QUOTES)).')' : ''; ?>
69        </option>
70    <?php endforeach; ?>
71   </select>
72  </td>
73 </tr>
74<?php } ?>
75</table>
76<br>
77<input type="submit" name="addpatch" value="Save">
78</form>
79<?php if (!empty($patches)) { ?>
80<h2>Existing patches:</h2>
81<?php
82}
83
84$canpatch = false;
85require "{$ROOT_DIR}/templates/listpatches.php";
86response_footer();
87