function printForm($data = array()) { foreach (array('name', 'email', 'copy_me', 'subject', 'text') as $value) { if (!isset($data[$value])) { $data[$value] = ''; } } $form = new HTML_QuickForm2('contect', 'post', array('action' => '/account-mail.php?handle=' . htmlspecialchars($_GET['handle']))); $form->removeAttribute('name'); // Set defaults for the form elements $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('name' => htmlspecialchars($data['name']), 'email' => htmlspecialchars($data['email']), 'copy_me' => htmlspecialchars($data['copy_me']), 'subject' => htmlspecialchars($data['subject']), 'text' => htmlspecialchars($data['text'])))); $form->addElement('text', 'name', array('required' => 'required'))->setLabel('Y<span class="accesskey">o</span>ur Name:', 'size="40" accesskey="o"'); $form->addElement('email', 'email', array('required' => 'required'))->setLabel('Email Address:'); $form->addElement('checkbox', 'copy_me')->setLabel('CC me?:'); $form->addElement('text', 'subject', array('required' => 'required', 'size' => '80'))->setLabel('Subject:'); $form->addElement('textarea', 'text', array('cols' => 80, 'rows' => 10, 'required' => 'required'))->setLabel('Text:'); if (!auth_check('pear.dev')) { $numeralCaptcha = new Text_CAPTCHA_Numeral(); $form->addElement('number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?'); $_SESSION['answer'] = $numeralCaptcha->getAnswer(); } $form->addElement('submit', 'submit')->setLabel('Send Email'); print $form; }
Operating system: </th> <td class="form-input"> <input type="text" size="20" maxlength="32" name="in[php_os]" id="in[php_os]" value="<?php echo clean($_POST['in']['php_os']); ?> " /> </td> </tr> <?php if (!isset($auth_user)) { ?> <tr> <th>Solve the problem : <?php print $numeralCaptcha->getOperation(); ?> = ?</th> <td class="form-input"><input type="text" name="captcha" id="captcha" /></td> </tr> <?php $_SESSION['answer'] = $numeralCaptcha->getAnswer(); ?> <?php } // if (!isset($auth_user)): ?> <tr> <th class="form-label_left"> Summary: </th>
Skip if irrelevant. This could be a <a href="bugs-generating-backtrace.php">backtrace</a> for example. Try to keep it as short as possible without leaving anything relevant out. </p> </th> <td class="form-input"> <textarea cols="80" rows="15" name="in[actres]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['actres'], ENT_COMPAT, 'UTF-8'); ?> </textarea> </td> </tr> <?php if (!$logged_in) { $captcha = $numeralCaptcha->getOperation(); $_SESSION['answer'] = $numeralCaptcha->getAnswer(); if (!empty($_POST['captcha']) && empty($ok_to_submit_report)) { $captcha_label = '<strong>Solve this <em>new</em> problem:</strong>'; } else { $captcha_label = 'Solve the problem:'; } ?> <tr> <th><?php echo $captcha_label; ?> <br><?php echo htmlspecialchars($captcha); ?> = ?</th>
<p> Note that this account can also be used to report a bug or comment on an existing bug. </p> <p> Please use the "latin counterparts" of non-latin characters (for instance th instead of þ). </p> MSG; echo '<a name="requestform" id="requestform"></a>'; report_error($errors); $form = new HTML_QuickForm2('account-request-vote', 'post', array('action' => 'account-request-vote.php#requestform')); $form->removeAttribute('name'); $renderer = new HTML_QuickForm2_Renderer_PEAR(); $hsc = array_map('htmlspecialchars', $stripped); // Set defaults for the form elements $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('handle' => @$hsc['handle'], 'firstname' => @$hsc['firstname'], 'lastname' => @$hsc['lastname'], 'email' => @$hsc['email'], 'showemail' => @$hsc['showemail'], 'read_everything' => @$hsc['read_everything']))); $form->addElement('text', 'handle', array('placeholder' => 'psmith', 'maxlength' => "20", 'accesskey' => "r", 'required' => 'required'))->setLabel('Use<span class="accesskey">r</span>name:'); $form->addElement('text', 'firstname', array('placeholder' => 'Peter', 'required' => 'required'))->setLabel('First Name:'); $form->addElement('text', 'lastname', array('placeholder' => 'Smith', 'required' => 'required'))->setLabel('Last Name:'); $form->addElement('password', 'password', array('size' => 10, 'required' => 'required'))->setLabel('Password:'******'password', 'password2', array('size' => 10, 'required' => 'required'))->setLabel('Repeat Password:'******'number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?'); $_SESSION['answer'] = $numeralCaptcha->getAnswer(); $form->addElement('email', 'email', array('placeholder' => '*****@*****.**', 'required' => 'required'))->setLabel('Email Address:'); $form->addElement('checkbox', 'showemail')->setLabel('Show email address?'); $form->addGroup('read_everything')->addElement('checkbox', 'comments_read', array('required' => 'required'))->setLabel('I have read EVERYTHING on this page'); $form->addElement('submit', 'submit')->setLabel('Submit Request'); print $form->render($renderer); } response_footer();