Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Don't allow anonymous comments if disabled in admin
givanzea469ca127d8
diff --git a/app/controller/content/comment-trait.php b/app/controller/content/comment-trait.phpold mode 100644new mode 100755index 8e107f3..102072e--- a/app/controller/content/comment-trait.php+++ b/app/controller/content/comment-trait.php@@ -33,6 +33,13 @@ trait CommentTrait {$result = false;$post = &$this->request->post;+ $commentsOpen = $this->global['site']['default_comment_status'] ?? false;+ $anonymousComments = $this->global['site']['anonymous_comments'] ?? false;++ if (! $commentsOpen || (! $anonymousComments && ! $this->global['user'])) {+ return [];+ }+if (isset($post['content'])) {//robots will also fill hidden inputs$notSpam =@@ -54,6 +61,7 @@ trait CommentTrait {'notSpam' => $notSpam,'commentType' => $commentType,'commentName' => $commentName,+ 'user_id' => $user['user_id'],]);list($comment) = Event :: trigger(__CLASS__, __FUNCTION__ , $comment);diff --git a/app/controller/content/post.php b/app/controller/content/post.phpindex cc3a92f..382ed78 100755--- a/app/controller/content/post.php+++ b/app/controller/content/post.php@@ -58,7 +58,6 @@ class Post extends Base {$content = $contentSql->getContent($options) ?? [];$class = __NAMESPACE__ . '\\' . ucfirst($this->type); //__CLASS__ is always Post- $error = __('Post not found!');list($content, $language, $slug) = Event :: trigger($class,__FUNCTION__, $content, $language, $slug);if ($content) {@@ -112,9 +111,15 @@ class Post extends Base {$this->view->tplFile("content/{$this->type}.tpl");}} else {+ $error = sprintf(__('%s not found!'), ucfirst(__($this->type)));return $this->notFound(true, ['message' => $error, 'title' => $error]);}+ $languageContent['title'] = $languageContent['name'];+ if (isset($this->global['site']['description']['title'])) {+ $languageContent['title'] = $languageContent['title'] . ' - ' . $this->global['site']['description']['title'];+ }+list($content, $languageContent, $language, $slug) = Event :: trigger($class, __FUNCTION__ . ':after', $content, $languageContent, $language, $slug);} else {//check for custom post or product@@ -137,6 +142,7 @@ class Post extends Base {die();} else {+ $error = sprintf(__('%s not found!'), ucfirst(__($this->type)));return $this->notFound(true, ['message' => $error, 'title' => $error]);}}@@ -144,5 +150,8 @@ class Post extends Base {$this->view->post = $languageContent;$this->view->content = $content;}++ $this->view->default_comment_status = $this->global['site']['default_comment_status'] ?? false;+ $this->view->anonymous_comments = $this->global['site']['anonymous_comments'] ?? false;}}