This commit is contained in:
Joey Kimsey
2025-01-28 17:33:12 -05:00
parent 2004837a8f
commit 9fe4829b47
34 changed files with 605 additions and 199 deletions

View File

@ -62,12 +62,17 @@ class Blog extends Controller {
return $this->index();
}
$plugin = new Comments;
if ( ! $plugin->checkEnabled() ) {
Issues::add( 'error', 'Comments are disabled.' );
if ( class_exists( 'TheTempusProject\Plugins\Comments' ) ) {
$plugin = new Comments;
if ( ! $plugin->checkEnabled() ) {
Issues::add( 'error', 'Comments are disabled.' );
return $this->index();
}
$comments = new CommentsModel;
} else {
Debug::info( 'error', 'Comments plugin missing.' );
return $this->index();
}
$comments = new CommentsModel;
switch ( $sub ) {
case 'post':
@ -111,21 +116,22 @@ class Blog extends Controller {
Components::set( 'CONTENT_ID', $id );
Components::set( 'COMMENT_TYPE', self::$posts->tableName );
Components::set( 'NEWCOMMENT', '' );
Components::set( 'count', '0' );
Components::set( 'COMMENTS', '' );
$plugin = new Comments;
if ( ! $plugin->checkEnabled() ) {
Components::set( 'NEWCOMMENT', '' );
Components::set( 'count', '0' );
Components::set( 'COMMENTS', '' );
} else {
$comments = new CommentsModel;
if ( App::$isLoggedIn ) {
Components::set( 'NEWCOMMENT', Views::simpleView( 'comments.create' ) );
} else {
Components::set( 'NEWCOMMENT', '' );
if ( class_exists( 'TheTempusProject\Plugins\Comments' ) ) {
$plugin = new Comments;
if ( $plugin->checkEnabled() ) {
$comments = new CommentsModel;
if ( App::$isLoggedIn ) {
Components::set( 'NEWCOMMENT', Views::simpleView( 'comments.create' ) );
} else {
Components::set( 'NEWCOMMENT', '' );
}
Components::set( 'count', $comments->count( self::$posts->tableName, $post->ID ) );
Components::set( 'COMMENTS', Views::simpleView( 'comments.list', $comments->display( 10, self::$posts->tableName, $post->ID ) ) );
}
Components::set( 'count', $comments->count( self::$posts->tableName, $post->ID ) );
Components::set( 'COMMENTS', Views::simpleView( 'comments.list', $comments->display( 10, self::$posts->tableName, $post->ID ) ) );
}
$post = self::$posts->findById( $id );

View File

@ -49,13 +49,13 @@ class Comments extends AdminController {
$this->index();
}
public function viewComments( $contentIID = null ) {
if ( empty( $contentIID ) ) {
public function viewComments( $contentID = null ) {
if ( empty( $contentID ) ) {
Issues::add( 'error', 'Content ID not found.' );
return $this->index();
}
$contentData = self::$comments->findById( $data );
if ( empty( $contentIID ) ) {
if ( empty( $contentID ) ) {
return Views::view( 'comments.list', $commentData );
}
Issues::add( 'error', 'Comment not found.' );

View File

@ -19,6 +19,9 @@ use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Houdini\Classes\Issues;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Bedrock\Functions\Session;
class Messages extends Controller {
private static $message;
@ -27,6 +30,10 @@ class Messages extends Controller {
parent::__construct();
self::$title = 'Messages';
self::$message = new Message;
if ( ! App::$isLoggedIn ) {
Session::flash( 'error', 'You do not have permission to access this page.' );
return Redirect::home();
}
}
public function create() {
@ -71,8 +78,9 @@ class Messages extends Controller {
}
public function index() {
Views::view( 'messages.inbox', self::$message->getInbox() );
Views::view( 'messages.outbox', self::$message->getOutbox() );
Components::set( 'message_inbox', Views::simpleView( 'messages.inbox', self::$message->getInbox() ) );
Components::set( 'message_outbox', Views::simpleView( 'messages.outbox', self::$message->getOutbox() ) );
Views::view( 'messages.index' );
}
public function read( $id = '' ) {

View File

@ -1 +1 @@
<span class="label label-danger">{MESSAGE_COUNT}</span>
<span class="badge bg-danger rounded-pill">{MESSAGE_COUNT}</span>

View File

@ -1,7 +1,6 @@
<h2>Inbox</h2>
{PAGINATION}
<form action="{ROOT_URL}messages/delete" method="post">
<table class="table table-hover">
<table class="table table-striped">
<thead>
<tr>
<th style="width: 20%">From</th>

View File

@ -0,0 +1,8 @@
<div class="context-main context-main-bg col-10 offset-1 my-3 p-3">
<div class="my-3 p-3">
{message_inbox}
</div>
<div class="my-3 p-3">
{message_outbox}
</div>
</div>

View File

@ -1,43 +1,37 @@
<div class="container">
<div class="row">
<div class="context-main context-main-bg col-8 offset-2 my-3 p-3">
<div class="col-sm-12 col-md-6 col-lg-6 col-sm-offset-0 col-md-offset-3 col-lg-offset-3 top-pad" >
<div class="card panel-primary">
{LOOP}
{SINGLE}
<div class="card-header">
<h3 class="card-title">{subject}</h3>
</div>
{/SINGLE}
<div class="card-body">
<div class="row">
<div class="col-md-3 col-lg-3 " align="center">
<a href="{ROOT_URL}home/profile/{userFrom}">{userFrom}</a><br>
<img alt="User Pic" src="{ROOT_URL}{fromAvatar}" class="img-circle img-responsive">
{SINGLE}
<div class="card-header context-main-bg">
<h5 class="card-title context-main">{subject}</h5>
</div>
<div class=" col-md-9 col-lg-9 ">
<table class="table table-user-information">
<tbody>
<td>{message}</td>
</tbody>
</table>
{/SINGLE}
<div class="card-body context-second-bg">
<div class="row">
<div class="col-md-3 col-lg-3 text-center">
<a href="{ROOT_URL}home/profile/{userFrom}">{userFrom}</a><br>
<img alt="User Pic" src="{ROOT_URL}{fromAvatar}" class="img-circle img-fluid">
</div>
<div class=" col-md-9 col-lg-9 context-main">
{message}
</div>
</div>
</div>
</div>
<div class="card-footer">
{ADMIN}
{ID}
<span class="float-right">
{DTC}{sent}{/DTC}
</span>
{/ADMIN}
</div>
<div class="card-footer context-main-bg">
{ADMIN}
{ID}
<span class="float-right">
{DTC}{sent}{/DTC}
</span>
{/ADMIN}
</div>
{/LOOP}
</div>
<form action="{ROOT_URL}messages/reply" method="post">
<input type="hidden" name="token" value="{TOKEN}">
<input type="hidden" name="messageID" value="{PID}">
<button name="submit" value="reply" type="submit" class="btn btn-sm btn-primary">Reply</button>
<button name="submit" value="reply" type="submit" class="btn btn-md btn-primary my-4">Reply</button>
</form>
</div>
</div>
</div>

View File

@ -1,49 +1,46 @@
<div class="dropdown nav-item mx-2">
<a
href="#"
class="d-block dropdown-toggle nav-link"
class="d-flex align-items-center text-white text-decoration-none dropdown-toggle"
id="messagesDropdown"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<i class="fa fa-fw fa-envelope"></i><span class="ml-3">{MBADGE}</span>
<i class="fa fa-fw fa-envelope"></i><span class="">{MBADGE}</span>
</a>
<ul class="dropdown-menu text-small" aria-labelledby="messagesDropdown">
<li class="message-header">
<div class="media">
<div class="media-body text-center" style="padding-bottom: 10px; padding-top: 10px">
{MESSAGE_COUNT} unread message(s) total
</div>
</div>
</li>
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="messagesDropdown">
{LOOP}
<li class="message-preview">
<a href="{ROOT_URL}messages/view/{ID}">
<div class="media">
<span class="float-left">
<img class="media-object avatar-round-40" src="{ROOT_URL}{fromAvatar}" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong>{userFrom}</strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> {DTC}{lastReply}{/DTC}</p>
{summary}
<!-- Message Item -->
<li>
<a href="{ROOT_URL}messages/view/{ID}" class="dropdown-item">
<div class="d-flex">
<h5 class="media-heading text-start">
<img class="" style="width: 40px;" src="{ROOT_URL}{fromAvatar}" alt="">
<strong>{userFrom}</strong>
</h5>
<div class="text-end">
<div class="media-body">
<p class="small text-muted mb-1"><i class="fa fa-clock-o me-1"></i> {DTC}{lastReply}{/DTC}</p>
<span>{summary}</span>
</div>
</div>
</div>
</a>
</li>
{/LOOP}
{ALT}
<li class="message-preview">
<div class="media">
<div class="media-body text-center" style="padding-bottom: 10px; padding-top: 10px">
<h5 class="media-heading"><strong>No Messages</strong></h5>
</div>
</div>
<li class="px-3 text-center">
<strong>No Messages</strong>
</li>
{/ALT}
<li class="message-footer text-center">
<a href="{ROOT_URL}messages" class="dropdown-item">Read All New Messages</a>
<!-- Footer -->
<li>
<hr class="dropdown-divider">
</li>
<li>
<a href="/messages" class="dropdown-item text-center">
Read All New Messages
</a>
</li>
</ul>
</div>

View File

@ -1,7 +1,6 @@
<h2>Outbox</h2>
{PAGINATION}
<form action="{ROOT_URL}messages/delete" method="post">
<table class="table table-hover">
<table class="table table-striped">
<thead>
<tr>
<th style="width: 20%">To</th>

View File

@ -1,14 +1,18 @@
<form action="" method="post" class="form-horizontal">
<legend>Reply</legend>
<fieldset>
<div class="form-group">
<label for="message" class="col-lg-3 control-label">Message:</label>
<div class="col-lg-6">
<textarea class="form-control" name="message" maxlength="2000" rows="10" cols="50" id="message"></textarea>
<div class="context-main context-main-bg col-8 offset-2 my-3 p-3">
<form action="" method="post" class="form-horizontal">
<legend class="text-center">Reply</legend>
<fieldset>
<div class="form-group">
<div class="col-6 offset-3">
<label for="message" class="control-label">Message:</label>
<textarea class="form-control" name="message" maxlength="2000" rows="10" cols="50" id="message"></textarea>
</div>
</div>
</fieldset>
<input type="hidden" name="messageID" value="{messageID}">
<input type="hidden" name="token" value="{TOKEN}">
<div class="text-center">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block my-3">Send</button>
</div>
</fieldset>
<input type="hidden" name="messageID" value="{messageID}">
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Send</button><br>
</form>
</form>
</div>

View File

@ -17,6 +17,8 @@ use TheTempusProject\Houdini\Classes\Issues;
use TheTempusProject\Classes\Controller;
use TheTempusProject\Models\Notification as NotificationsModel;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Bedrock\Functions\Session;
class Notifications extends Controller {
protected static $notifications;
@ -26,6 +28,10 @@ class Notifications extends Controller {
self::$notifications = new NotificationsModel;
self::$title = 'Notifications - {SITENAME}';
self::$pageDescription = 'Your recent notifications';
if ( ! App::$isLoggedIn ) {
Session::flash( 'error', 'You do not have permission to access this page.' );
return Redirect::home();
}
}
public function index() {

View File

@ -3,13 +3,13 @@
<a
href="#"
class="d-flex align-items-center text-white text-decoration-none dropdown-toggle"
id="notiificationsDropdown"
id="notificationsDropdown"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<i class="fa fa-fw fa-bell"></i><span class="ms-2">{NBADGE}</span>
<i class="fa fa-fw fa-bell"></i><span class="">{NBADGE}</span>
</a>
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="notiificationsDropdown">
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="notificationsDropdown">
{LOOP}
<!-- Notification Item -->
<li>

View File

@ -38,7 +38,9 @@ class Subscribe extends Plugin {
public function __construct( $load = false ) {
parent::__construct( $load );
if ( ! self::$loaded ) {
Components::append( 'FOOTER_RIGHT', Views::simpleView( 'subscribe.footer.right') );
if ( $this->checkEnabled() ) {
Components::append( 'FOOTER_RIGHT', Views::simpleView( 'subscribe.footer.right') );
}
self::$loaded = true;
}
}