curl, $conf->token, $conf->api, urlencode($title), urlencode($desc)); $o = NULL; exec($cmd, $o); return true; } function send($n, $e, $m) { $p = $n . ' <' . $e . '>'; $s = $p . ' wants to volunteer for FSF India'; $msg = 'Per says:' . PHP_EOL . PHP_EOL . $m . PHP_EOL; $mo = mail(to(), $s, $msg); $go = gl_new_issue($s, $msg); return $mo && $go; } function em_fw($t) { return preg_replace('/^(\w+)( .+)/', '$1$2', $t); } function post() { $n = $_POST['name']; $e = $_POST['email']; $m = $_POST['msg']; $c = $_POST['c']; $errors = []; if (empty($n)) { $errors[] = em_fw('Name is required'); } if (!email_valid($e)) { $errors[] = em_fw('Email is invalid'); } if (empty($m)) { $errors[] = em_fw('Message is required'); } if ($c !== '42') { $errors[] = '41 + 1 is not \'' . $c . '\''; } $sok = true; if (empty($errors)) { $sok = send($n, $e, $m); } if (!$sok) { $errors[] = 'Unable to process your submission.'; } return [ 'ok' => empty($errors) && $sok, 'errors' => $errors ]; } $result = post(); include(__DIR__ . '/submit.html');