summaryrefslogtreecommitdiffstats
path: root/static/contact
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2021-01-17 14:04:25 -0500
committerrsiddharth <s@ricketyspace.net>2021-01-17 14:04:25 -0500
commitefd38435895a9e7ded043330330c752865668338 (patch)
treec6b5a77ddf5500b352b3da5b04bad7a807ded8d6 /static/contact
parent4de351ac6faa87fc1a7066b3cfea6bcb6bb6d803 (diff)
static/contact: update submit/index.php
Create gitlab issue for every message that gets sent to us via the fsfi contact form.
Diffstat (limited to 'static/contact')
-rw-r--r--static/contact/submit/index.php43
1 files changed, 37 insertions, 6 deletions
diff --git a/static/contact/submit/index.php b/static/contact/submit/index.php
index 2ffc2a3..e793158 100644
--- a/static/contact/submit/index.php
+++ b/static/contact/submit/index.php
@@ -19,14 +19,45 @@ function email_valid($e) {
return false;
}
+function conf() {
+ return json_decode(file_get_contents(
+ $_SERVER['DOCUMENT_ROOT'] . '/conf.json'
+ ));
+}
+
+function gl_new_issue($title, $desc) {
+ $conf = conf();
+
+ /**
+ * Unable to install php curl module on the current server. So
+ * commandline curl for now.
+ */
+ $cmd = sprintf("%s -v --request POST"
+ . " --header 'Private-Token: %s'"
+ . " %s/1047/issues"
+ . " -d title='%s'"
+ . " -d description='%s'",
+ $conf->curl,
+ $conf->token,
+ $conf->api,
+ urlencode($title),
+ urlencode($desc));
+ $o = NULL;
+ exec($cmd, $o);
+ return true;
+}
+
function send($n, $e, $m) {
$p = $n . ' <' . $e . '>';
- return mail(to(),
- $p . ' sent a message to FSF India',
- 'Per says:' . PHP_EOL . PHP_EOL . $m
- . PHP_EOL . PHP_EOL . '---' . PHP_EOL
- . 'Message originating from ' . $_SERVER['REMOTE_ADDR']
- );
+ $s = $p . ' sent a message to FSF India';
+ $msg = 'Per says:' . PHP_EOL . PHP_EOL . $m
+ . PHP_EOL . PHP_EOL . '---' . PHP_EOL
+ . 'Message originating from ' . $_SERVER['REMOTE_ADDR'];
+
+ $mo = mail(to(), $s, $msg);
+ $go = gl_new_issue($s, $msg);
+
+ return $mo && $go;
}
function em_fw($t) {