diff options
author | MaZderMind | 2014-12-22 13:30:42 +0100 |
---|---|---|
committer | MaZderMind | 2014-12-22 13:30:42 +0100 |
commit | 2040e49f949396aa79fb84ed9e025e4de5571ed6 (patch) | |
tree | 2f11c7af5741cff1e410ea25d821986692056b8c | |
parent | 095e23686087b311636a3394fe207e50ca41fc04 (diff) |
standalone feedback page & intrinsic save mechanism
Diffstat (limited to '')
-rw-r--r-- | index.php | 5 | ||||
-rw-r--r-- | lib/schema.sql | 14 | ||||
-rw-r--r-- | pages/feedback.php | 42 | ||||
-rw-r--r-- | template/assemblies/feedback.phtml | 2 | ||||
-rw-r--r-- | template/assemblies/header.phtml | 3 | ||||
-rw-r--r-- | template/feedback.phtml | 8 |
6 files changed, 73 insertions, 1 deletions
@@ -69,6 +69,11 @@ else if(preg_match('@^program.json$@', $route, $m)) include('pages/program-json.php'); } +else if(preg_match('@^feedback$@', $route, $m)) +{ + include('pages/feedback.php'); +} + else { include('pages/404.php'); diff --git a/lib/schema.sql b/lib/schema.sql new file mode 100644 index 0000000..f187326 --- /dev/null +++ b/lib/schema.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS feedback; +CREATE TABLE feedback ( + reported NUMERIC, + datetime NUMERIC, + net TEXT, + os TEXT, + player TEXT, + stream TEXT, + ipproto_v4 NUMERIC, + ipproto_v6 NUMERIC, + provider TEXT, + issues TEXT, + issuetext TEXT +); diff --git a/pages/feedback.php b/pages/feedback.php new file mode 100644 index 0000000..8335c6f --- /dev/null +++ b/pages/feedback.php @@ -0,0 +1,42 @@ +<?php + +if( + !isset($_POST['datetime']) || + !isset($_POST['net']) || + !isset($_POST['os']) || + !isset($_POST['player']) || + !isset($_POST['stream']) || + !isset($_POST['provider']) || + !isset($_POST['issuetext']) +) { + require_once('lib/bootstrap.php'); + + echo $tpl->render(array( + 'page' => 'feedback', + 'title' => 'Give Feedback', + )); +} +else +{ + $db = new PDO('sqlite:/opt/31c3-streaming-feedback/feedback.sqlite3'); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + $stm = $db->prepare(' + INSERT INTO feedback (reported, datetime, net, os, player, stream, ipproto_v4, ipproto_v6, provider, issues, issuetext) + VALUES (:reported, :datetime, :net, :os, :player, :stream, :ipproto_v4, :ipproto_v6, :provider, :issues, :issuetext) + '); + + $stm->execute(array( + 'reported' => time(), + 'datetime' => strtotime($_POST['datetime']), + 'net' => $_POST['net'], + 'os' => $_POST['os'], + 'player' => $_POST['player'], + 'stream' => $_POST['stream'], + 'ipproto_v4' => isset($_POST['ipproto']) && is_array($_POST['ipproto']) && in_array('v4', $_POST['ipproto']), + 'ipproto_v6' => isset($_POST['ipproto']) && is_array($_POST['ipproto']) && in_array('v6', $_POST['ipproto']), + 'provider' => $_POST['provider'], + 'issues' => isset($_POST['issues']) && is_array($_POST['issues']) ? implode(',', $_POST['issues']) : '', + 'issuetext' => $_POST['issuetext'], + )); +} diff --git a/template/assemblies/feedback.phtml b/template/assemblies/feedback.phtml index 25e1d61..0ca00e3 100644 --- a/template/assemblies/feedback.phtml +++ b/template/assemblies/feedback.phtml @@ -1,4 +1,4 @@ -<form action="http://c3voc.de/31c3/feedback/" target="feedback-target" method="post" role="form" class="feedback-form form-horizontal row"> +<form action="feedback/" target="feedback-target" method="post" role="form" class="feedback-form form-horizontal row"> <div class="col-sm-4 col"> <div class="form-group"> <label for="net">Network Connection</label> diff --git a/template/assemblies/header.phtml b/template/assemblies/header.phtml index 3052ea3..2889927 100644 --- a/template/assemblies/header.phtml +++ b/template/assemblies/header.phtml @@ -8,6 +8,9 @@ </div> <div class="nav navbar-form navbar-right button-wrapper"> + <a class="form-control btn btn-default" href="feedback/" title="Feedback"> + <span class="fa fa-bullhorn"></span> + </a> <a class="form-control btn btn-default" href="//media.ccc.de/browse/congress/2014/index.html" title="Recordings"> <span class="fa fa-video-camera"></span> </a> diff --git a/template/feedback.phtml b/template/feedback.phtml new file mode 100644 index 0000000..1cec643 --- /dev/null +++ b/template/feedback.phtml @@ -0,0 +1,8 @@ +<div class="container-fluid rooms"> + <h1>Feedback</h1> + <div class="tab-content"> + <div class="tab-pane active" id="feedback"> + <? include("$assemblies/feedback.phtml") ?> + </div> + </div> +</div> |