diff options
author | MaZderMind | 2016-12-10 18:22:34 +0100 |
---|---|---|
committer | MaZderMind | 2016-12-10 18:22:34 +0100 |
commit | f6c0270d40f6730fe1e1820f2866b08792df1db6 (patch) | |
tree | f0da1effc9f55f2f75dc57fe1ba17419d559b45b /model/Feedback.php | |
parent | b227ac0ee80f6de300fed10a34e7393847227cfc (diff) |
rewrite data-model so that every configuration option is accessed through the conference
Diffstat (limited to 'model/Feedback.php')
-rw-r--r-- | model/Feedback.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/model/Feedback.php b/model/Feedback.php index 578650a..9475fe8 100644 --- a/model/Feedback.php +++ b/model/Feedback.php @@ -1,12 +1,16 @@ <?php -class Feedback extends ModelBase +class Feedback { - public function isEnabled() { - return $this->has('FEEDBACK'); + private $conference; + + public function __construct(Conference $conference) + { + $this->conference = $conference; } - public function getUrl() { - return 'feedback/'; + + public function getConference() { + return $this->conference; } public function validate($info) @@ -23,7 +27,7 @@ class Feedback extends ModelBase public function store($info) { - $db = new PDO($this->get('FEEDBACK.DSN')); + $db = new PDO($this->getConference()->get('FEEDBACK.DSN')); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stm = $db->prepare(' @@ -50,8 +54,8 @@ class Feedback extends ModelBase { return isset($_SERVER['PHP_AUTH_USER']) && - $_SERVER['PHP_AUTH_USER'] == $this->get('FEEDBACK.USERNAME') && - $_SERVER['PHP_AUTH_PW'] == $this->get('FEEDBACK.PASSWORD'); + $_SERVER['PHP_AUTH_USER'] == $this->getConference()->get('FEEDBACK.USERNAME') && + $_SERVER['PHP_AUTH_PW'] == $this->getConference()->get('FEEDBACK.PASSWORD'); } public function requestLogin() @@ -64,7 +68,7 @@ class Feedback extends ModelBase public function read($from, $to) { - $db = new PDO($this->get('FEEDBACK.DSN')); + $db = new PDO($this->getConference()->get('FEEDBACK.DSN')); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stm = $db->prepare(' |