diff options
author | MaZderMind | 2015-03-31 21:38:03 +0200 |
---|---|---|
committer | MaZderMind | 2015-03-31 21:38:03 +0200 |
commit | 7a163c226c99eb97fb9ce59ce5774da513bcdfd1 (patch) | |
tree | 19e94eae8e42c0b7cb5efd02d03d3dab95601f04 /model | |
parent | f48084e1d68429235a5655a92b463cc5099be646 (diff) |
Feedback Read-View
Diffstat (limited to 'model')
-rw-r--r-- | model/Feedback.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/model/Feedback.php b/model/Feedback.php index 7ba697d..578650a 100644 --- a/model/Feedback.php +++ b/model/Feedback.php @@ -45,4 +45,40 @@ class Feedback extends ModelBase 'issuetext' => $info['issuetext'], )); } + + public function isLoggedIn() + { + return + isset($_SERVER['PHP_AUTH_USER']) && + $_SERVER['PHP_AUTH_USER'] == $this->get('FEEDBACK.USERNAME') && + $_SERVER['PHP_AUTH_PW'] == $this->get('FEEDBACK.PASSWORD'); + } + + public function requestLogin() + { + header('WWW-Authenticate: Basic realm="Kadse?"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'You are no real Winkekatzenoperator!!!1!'; + exit; + } + + public function read($from, $to) + { + $db = new PDO($this->get('FEEDBACK.DSN')); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + $stm = $db->prepare(' + SELECT * + FROM feedback + WHERE reported BETWEEN :from AND :to + '); + $stm->setFetchMode(PDO::FETCH_ASSOC); + + $stm->execute(array( + 'from' => $from, + 'to' => $to, + )); + + return $stm; + } } |