function printForm($data = array()) { // The first field that's empty $focus = ''; foreach (array('name', 'email', 'subject', 'text') as $key) { if (!isset($data[$key])) { $data[$key] = ''; $focus == '' ? $focus = $key : ''; } } $bb = new BorderBox('Send email'); $form = new HTML_Form(htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES) . '?handle=' . htmlspecialchars($_GET['handle'], ENT_QUOTES), 'post', 'contact'); $form->addText('name', 'Your name:', $data['name'], 30); $form->addText('email', 'EMail address:', $data['email'], 30); $form->addText('subject', 'Subject:', $data['subject'], 30); $form->addTextarea('text', 'Text:', $data['text'], 35, 10); $form->addSubmit('submit', 'Submit'); $form->display(); $bb->end(); echo "<script language=\"JavaScript\">\n"; echo "<!--\n"; echo "document.forms.contact." . $focus . ".focus();\n"; echo "-->\n"; echo "</script>"; }
$maintainers = maintainer::get($id); foreach ($maintainers as $handle => $role) { $info = user::info($handle, "name"); // XXX: This sucks printf('<option value="%s||%s">%s (%s, %s)</option>', $handle, $role['role'], $info['name'], $handle, $role['role']); } echo ' </select>'; echo ' </td>'; echo '</tr>'; echo '<tr>'; echo ' <td colspan="3"><input type="submit" /></td>'; echo '</tr>'; echo '</table>'; echo '</form>'; echo '<script language="JavaScript" type="text/javascript">'; echo 'document.form.remove.disabled = true;'; echo 'document.form.add.disabled = true;'; echo 'document.form.role.disabled = true;'; echo '</script>'; $bb->end(); } } function isAllowed($package) { global $auth_user; auth_require(); $lead = in_array($auth_user->handle, array_keys(maintainer::get($package, true))); $admin = user::isAdmin($auth_user->handle); return $lead || $admin; } response_footer();
function display_user_notes($user, $width = '50%') { global $dbh; $bb = new BorderBox("Notes for user {$user}", $width); $notes = $dbh->getAssoc("SELECT id,nby,ntime,note FROM notes " . "WHERE uid = ? ORDER BY ntime", true, array($user)); if (!empty($notes)) { print "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\">\n"; foreach ($notes as $nid => $data) { print " <tr>\n"; print " <td>\n"; print " <b>{$data['nby']} {$data['ntime']}:</b>"; print "<br />\n"; print " " . htmlspecialchars($data['note']) . "\n"; print " </td>\n"; print " </tr>\n"; print " <tr><td> </td></tr>\n"; } print "</table>\n"; } else { print "No notes."; } $bb->end(); return sizeof($notes); }