From 1f9024763d9224c4cd9a181bac27e6b9f12ad672 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Wed, 18 Sep 2024 14:14:53 -0400 Subject: refactor --- src/web/_model/_comments.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/web/_model/_comments.php') diff --git a/src/web/_model/_comments.php b/src/web/_model/_comments.php index 73c1fc7..f36c642 100644 --- a/src/web/_model/_comments.php +++ b/src/web/_model/_comments.php @@ -1,12 +1,9 @@ load_profanity(); return preg_match($profanity, $text); } - public function get_comments($page) { - $ip = $this->main->info['ip']; - $query = $this->db + public function get_comments($page) + { + $ip = CONTEXT['ip']; + $query = $this->db() ->select('*') ->from('admin.comment c') ->where('c.page') @@ -46,17 +45,19 @@ class _comments_model extends Model { return $result; } - public function ban_user() { - $ip = $this->main->info['ip']; - $this->db + public function ban_user() + { + $ip = CONTEXT['ip']; + $this->db() ->insert_into('admin.banned', 'ip', 'reason') ->values($ip, 'vulgar language') ->execute(); } - public function post_comment($author, $content, $page, $vulgar) { - $ip = $this->main->info['ip']; - return $this->db + public function post_comment($author, $content, $page, $vulgar) + { + $ip = CONTEXT['ip']; + return $this->db() ->insert_into('admin.comment', 'author', 'content', 'page', 'ip', 'vulgar') ->values($author, $content, $page, $ip, $vulgar) -- cgit v1.2.3-freya