';
+
+ return Template::parse( $html );
+ }
}
diff --git a/app/css/main-dark.css b/app/css/main-dark.css
index c76d335..64e5a25 100644
--- a/app/css/main-dark.css
+++ b/app/css/main-dark.css
@@ -15,6 +15,9 @@
.context-main-bg {
background-color: #2c2c2c;
}
+.context-second-bg {
+ background-color: #1e1e1e;
+}
.bg-default {
background-color: #2c2c2c;
}
@@ -109,8 +112,6 @@ body {
*/
.b-example-divider {
background-color: rgba(255, 255, 255, .1);
- border: solid rgba(255, 255, 255, .15);
- box-shadow: inset 0 .5em 1.5em rgba(255, 255, 255, .1), inset 0 .125em .5em rgba(255, 255, 255, .15);
}
/**
@@ -124,4 +125,4 @@ body {
}
.text-shadow-3 {
text-shadow: 0 .5rem 1.5rem rgba(255, 255, 255, .25);
-}
\ No newline at end of file
+}
diff --git a/app/js/main.js b/app/js/main.js
index a41ce06..00641e3 100644
--- a/app/js/main.js
+++ b/app/js/main.js
@@ -27,15 +27,6 @@ function checkAll(ele) {
}
}
-function copyAll( ele ) {
- var eleName = '#' + ele;
- var text = $( eleName ).text();
- text = text.replaceAll( "''", "\n" ).trim();
- text = text.substring( 1, text.length - 1 );
- navigator.clipboard.writeText( text );
- console.log( '#' + ele );
-}
-
function insertTag( box, tag ) {
var Field = document.getElementById( box );
var currentPos = cursorPos( Field );
@@ -69,6 +60,26 @@ function getRandomInt(min, max) {
return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled);
}
+function copyElementText( id ) {
+ const inputElement = document.getElementById( id );
+ const textToCopy = inputElement.value;
+
+ if (navigator.clipboard && navigator.clipboard.writeText) {
+ navigator.clipboard.writeText(textToCopy)
+ .then(() => alert('Copied to clipboard!'))
+ .catch((err) => console.error('Failed to copy: ', err));
+ } else {
+ // Fallback for older browsers
+ inputElement.select();
+ try {
+ document.execCommand('copy');
+ alert('Copied to clipboard!');
+ } catch (err) {
+ console.error('Failed to copy: ', err);
+ }
+ }
+}
+
$(document).ready(function() {
$('select').each(function() {
var selectedValue = $(this).attr('value');
@@ -84,21 +95,29 @@ $(document).ready(function() {
});
// with the dynamic footer, you need to adjust the content padding to make sure the footer doesn't overlap the content
- document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('DOMContentLoaded', function () {
const toggleButton = document.getElementById('dark-mode-toggle');
const enableButton = document.getElementById('dark-mode-toggle-button');
const darkModeStylesheet = document.getElementById('dark-mode-stylesheet');
// Check if dark mode is saved in localStorage
if (localStorage.getItem('darkMode') === 'enabled') {
- darkModeStylesheet.disabled = false;
- toggleButton.checked = true;
+ darkModeStylesheet.disabled = false;
+ toggleButton.checked = true;
if ( enableButton ) {
enableButton.innerText = 'Disable Now';
}
}
-
+
+ document.querySelectorAll('.table-striped').forEach((table) => {
+ if (localStorage.getItem('darkMode') === 'enabled') {
+ table.classList.add('table-dark');
+ } else {
+ table.classList.add('table-light')
+ }
+ });
+
if ( enableButton ) {
enableButton.addEventListener('click', function () {
if (darkModeStylesheet.disabled) {
@@ -121,5 +140,15 @@ $(document).ready(function() {
darkModeStylesheet.disabled = true;
localStorage.setItem('darkMode', 'disabled');
}
+
+ document.querySelectorAll('.table-striped').forEach((table) => {
+ if (localStorage.getItem('darkMode') === 'enabled') {
+ table.classList.add('table-dark');
+ table.classList.remove('table-light');
+ } else {
+ table.classList.add('table-light');
+ table.classList.remove('table-dark');
+ }
});
- });
+ });
+});
diff --git a/app/plugins/blog/controllers/admin/blog.php b/app/plugins/blog/controllers/admin/blog.php
index d786858..adfc451 100644
--- a/app/plugins/blog/controllers/admin/blog.php
+++ b/app/plugins/blog/controllers/admin/blog.php
@@ -20,15 +20,14 @@ use TheTempusProject\Houdini\Classes\Navigation;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Classes\AdminController;
use TheTempusProject\Classes\Forms;
-use TheTempusProject\Plugins\Blog as BlogPlugin;
+use TheTempusProject\Models\Posts;
class Blog extends AdminController {
public static $posts;
public function __construct() {
parent::__construct();
- $blog = new BlogPlugin;
- self::$posts = $blog->posts;
+ self::$posts = new Posts;
self::$title = 'Admin - Blog';
$view = Navigation::activePageSelect( 'nav.admin', '/admin/blog' );
Components::set( 'ADMINNAV', $view );
diff --git a/app/plugins/blog/controllers/blog.php b/app/plugins/blog/controllers/blog.php
index 3249365..b14100b 100644
--- a/app/plugins/blog/controllers/blog.php
+++ b/app/plugins/blog/controllers/blog.php
@@ -27,17 +27,16 @@ use TheTempusProject\Plugins\Blog as BlogPlugin;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Plugins\Comments;
use TheTempusProject\Models\Comments as CommentsModel;
+use TheTempusProject\Models\Posts as PostsModel;
class Blog extends Controller {
protected static $blog;
- protected static $comments;
protected static $posts;
public function __construct() {
parent::__construct();
Template::setTemplate( 'blog' );
- $blog = new BlogPlugin;
- self::$posts = $blog->posts;
+ self::$posts = new PostsModel;
}
public function index() {
@@ -57,39 +56,41 @@ class Blog extends Controller {
public function comments( $sub = null, $data = null ) {
Debug::log( 'Controller initiated: ' . __METHOD__ . '.' );
- if ( empty( self::$comments ) ) {
- self::$comments = new CommentsModel;
- }
- $plugin = new Comments;
+
if ( empty( $sub ) || empty( $data ) ) {
- Session::flash( 'error', 'Whoops, try again.' );
- Redirect::to( 'blog' );
+ Issues::add( 'error', 'There was an issue with your request. Please check the url and try again.' );
+ return $this->index();
}
+
+ $plugin = new Comments;
+ if ( ! $plugin->checkEnabled() ) {
+ Issues::add( 'error', 'Comments are disabled.' );
+ return $this->index();
+ }
+ $comments = new CommentsModel;
+
switch ( $sub ) {
case 'post':
$content = self::$posts->findById( (int) $data );
if ( empty( $content ) ) {
- Session::flash( 'error', 'Unknown Post.' );
- Redirect::to( 'blog' );
+ Issues::add( 'error', 'Unknown Content.' );
+ return $this->index();
}
return $plugin->formPost( self::$posts->tableName, $content, 'blog/post/' );
- return self::$comments->formPost( 'blog', $content, 'blog/post/' );
case 'edit':
- $content = self::$comments->findById( $data );
+ $content = $comments->findById( $data );
if ( empty( $content ) ) {
- Session::flash( 'error', 'Unknown Comment.' );
- Redirect::to( 'blog' );
+ Issues::add( 'error', 'Unknown Comment.' );
+ return $this->index();
}
return $plugin->formEdit( self::$posts->tableName, $content, 'blog/post/' );
- return self::$comments->formEdit( 'blog', $content, 'blog/post/' );
case 'delete':
- $content = self::$comments->findById( $data );
+ $content = $comments->findById( $data );
if ( empty( $content ) ) {
- Session::flash( 'error', 'Unknown Comment.' );
- Redirect::to( 'blog' );
+ Issues::add( 'error', 'Unknown Comment.' );
+ return $this->index();
}
return $plugin->formDelete( self::$posts->tableName, $content, 'blog/post/' );
- return self::$comments->formDelete( 'blog', $content, 'blog/post/' );
}
}
@@ -101,26 +102,34 @@ class Blog extends Controller {
if ( empty( $post ) ) {
return $this->index();
}
- if ( empty( self::$comments ) ) {
- self::$comments = new CommentsModel;
- }
Debug::log( 'Controller initiated: ' . __METHOD__ . '.' );
self::$title = 'Blog Post';
- // I removed this once because i didn't realize.
- // this triggers the comment post controller method when the comment form is submitted on the post viewing page
+
if ( Input::exists( 'contentId' ) ) {
$this->comments( 'post', Input::post( 'contentId' ) );
}
+
Components::set( 'CONTENT_ID', $id );
- Components::set( 'COMMENT_TYPE', 'blog' );
- if ( App::$isLoggedIn ) {
- Components::set( 'NEWCOMMENT', Views::simpleView( 'comments.create' ) );
- } else {
+ Components::set( 'COMMENT_TYPE', self::$posts->tableName );
+
+ $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', '' );
+ }
+ 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 );
- Components::set( 'count', self::$comments->count( self::$posts->tableName, $post->ID ) );
- Components::set( 'COMMENTS', Views::simpleView( 'comments.list', self::$comments->display( 10, self::$posts->tableName, $post->ID ) ) );
+
self::$title .= ' - ' . $post->title;
self::$pageDescription = strip_tags( $post->contentSummaryNoLink );
Views::view( 'blog.post', $post );
diff --git a/app/plugins/blog/plugin.php b/app/plugins/blog/plugin.php
index de83c57..883d6bd 100644
--- a/app/plugins/blog/plugin.php
+++ b/app/plugins/blog/plugin.php
@@ -12,12 +12,7 @@
*/
namespace TheTempusProject\Plugins;
-use ReflectionClass;
-use TheTempusProject\Classes\Installer;
-use TheTempusProject\Houdini\Classes\Navigation;
use TheTempusProject\Classes\Plugin;
-use TheTempusProject\Models\Posts;
-use TheTempusProject\TheTempusProject as App;
class Blog extends Plugin {
public $pluginName = 'TP Blog';
@@ -50,10 +45,4 @@ class Blog extends Plugin {
],
],
];
- public $posts;
-
- public function __construct( $load = false ) {
- $this->posts = new Posts;
- parent::__construct( $load );
- }
}
diff --git a/app/plugins/blog/templates/blog.inc.php b/app/plugins/blog/templates/blog.inc.php
index 714bf5f..857006f 100644
--- a/app/plugins/blog/templates/blog.inc.php
+++ b/app/plugins/blog/templates/blog.inc.php
@@ -12,7 +12,7 @@
*/
namespace TheTempusProject\Templates;
-use TheTempusProject\Plugins\Blog;
+use TheTempusProject\Models\Posts;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Navigation;
use TheTempusProject\Houdini\Classes\Views;
@@ -25,8 +25,7 @@ class BlogLoader extends DefaultLoader {
* needed by this template.
*/
public function __construct() {
- $blog = new Blog;
- $posts = $blog->posts;
+ $posts = new Posts;
Components::set('SIDEBAR', Views::simpleView('blog.sidebar', $posts->recent(5)));
Components::set('SIDEBAR2', Views::simpleView('blog.sidebar2', $posts->archive()));
Components::set('SIDEBARABOUT', Views::simpleView('blog.about'));
diff --git a/app/plugins/blog/views/admin/create.html b/app/plugins/blog/views/admin/create.html
index 0e31c5d..7ae25f5 100644
--- a/app/plugins/blog/views/admin/create.html
+++ b/app/plugins/blog/views/admin/create.html
@@ -1,31 +1,47 @@
-
\ No newline at end of file
diff --git a/app/plugins/comments/controllers/admin/comments.php b/app/plugins/comments/controllers/admin/comments.php
index 75bed79..8967873 100644
--- a/app/plugins/comments/controllers/admin/comments.php
+++ b/app/plugins/comments/controllers/admin/comments.php
@@ -49,9 +49,13 @@ class Comments extends AdminController {
$this->index();
}
- public function viewComment( $data = null ) {
- $commentData = self::$comments->findById( $data );
- if ( $commentData !== false ) {
+ public function viewComments( $contentIID = null ) {
+ if ( empty( $contentIID ) ) {
+ Issues::add( 'error', 'Content ID not found.' );
+ return $this->index();
+ }
+ $contentData = self::$comments->findById( $data );
+ if ( empty( $contentIID ) ) {
return Views::view( 'comments.list', $commentData );
}
Issues::add( 'error', 'Comment not found.' );
diff --git a/app/plugins/comments/plugin.php b/app/plugins/comments/plugin.php
index a7cb138..146da01 100644
--- a/app/plugins/comments/plugin.php
+++ b/app/plugins/comments/plugin.php
@@ -25,9 +25,10 @@ use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Classes\Forms;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Bedrock\Functions\Session;
-use TheTempusProject\Models\Comments as CommentModel;
+use TheTempusProject\Models\Comments as CommentsModel;
class Comments extends Plugin {
+ protected static $comments;
public $pluginName = 'TP Comments';
public $pluginAuthor = 'JoeyK';
public $pluginWebsite = 'https://TheTempusProject.com';
@@ -61,7 +62,6 @@ class Comments extends Plugin {
]
],
];
- public $comments;
public function __construct( $load = false ) {
if ( !empty(App::$activePerms) ) {
@@ -75,11 +75,16 @@ class Comments extends Plugin {
'replace' => ( App::$isMod ? '$1' : '' ),
'enabled' => true,
];
- $this->getModel();
+ self::$comments = new CommentsModel;
parent::__construct( $load );
}
public function formPost( $type, $content, $redirect ) {
+ if ( ! $this->checkEnabled() ) {
+ Debug::info( 'Comments Plugin is disabled in the control panel.' );
+ Issues::add( 'error', 'Comments are disabled.' );
+ return false;
+ }
if ( !App::$isLoggedIn ) {
Session::flash( 'notice', 'You must be logged in to post comments.' );
return Redirect::to( $redirect . $content->ID );
@@ -88,7 +93,7 @@ class Comments extends Plugin {
Session::flash( 'error', [ 'There was a problem with your comment form.' => Check::userErrors() ] );
return Redirect::to( $redirect . $content->ID );
}
- if ( !$this->comments->create( $type, $content->ID, Input::post( 'comment' ) ) ) {
+ if ( !self::$comments->create( $type, $content->ID, Input::post( 'comment' ) ) ) {
Session::flash( 'error', [ 'There was a problem posting your comment.' => Check::userErrors() ] );
} else {
Session::flash( 'success', 'Comment posted' );
@@ -97,6 +102,11 @@ class Comments extends Plugin {
}
public function formEdit( $type, $content, $redirect ) {
+ if ( ! $this->checkEnabled() ) {
+ Debug::info( 'Comments Plugin is disabled in the control panel.' );
+ Issues::add( 'error', 'Comments are disabled.' );
+ return false;
+ }
if ( !App::$isLoggedIn ) {
Session::flash( 'notice', 'You must be logged in to do that.' );
return Redirect::to( $type );
@@ -112,7 +122,7 @@ class Comments extends Plugin {
Issues::add( 'error', [ 'There was a problem editing your comment.' => Check::userErrors() ] );
return Views::view( 'comments.admin.edit', $content );
}
- if ( !$this->comments->update( $content->ID, Input::post( 'comment' ) ) ) {
+ if ( !self::$comments->update( $content->ID, Input::post( 'comment' ) ) ) {
Issues::add( 'error', [ 'There was a problem editing your comment.' => Check::userErrors() ] );
return Views::view( 'comments.admin.edit', $content );
}
@@ -121,6 +131,11 @@ class Comments extends Plugin {
}
public function formDelete( $type, $content, $redirect ) {
+ if ( ! $this->checkEnabled() ) {
+ Debug::info( 'Comments Plugin is disabled in the control panel.' );
+ Issues::add( 'error', 'Comments are disabled.' );
+ return false;
+ }
if ( !App::$isLoggedIn ) {
Session::flash( 'notice', 'You must be logged in to do that.' );
return Redirect::to( $type );
@@ -129,18 +144,11 @@ class Comments extends Plugin {
Session::flash( 'error', 'You do not have permission to edit this comment' );
return Redirect::to( $type );
}
- if ( !$this->comments->delete( (array) $content->ID ) ) {
+ if ( !self::$comments->delete( (array) $content->ID ) ) {
Session::flash( 'error', 'There was an error with your request.' );
} else {
Session::flash( 'success', 'Comment has been deleted' );
}
return Redirect::to( $redirect . $content->contentID );
}
-
- public function getModel() {
- if ( empty($this->comments) ) {
- $this->comments = new CommentModel;
- }
- return $this->comments;
- }
}
diff --git a/app/plugins/comments/views/admin/edit.html b/app/plugins/comments/views/admin/edit.html
index e46f4aa..47553e3 100644
--- a/app/plugins/comments/views/admin/edit.html
+++ b/app/plugins/comments/views/admin/edit.html
@@ -1,9 +1,25 @@
-
-
-
-
-
+
+
+
+
+ {ADMIN_BREADCRUMBS}
+
+
+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/plugins/comments/views/admin/list.html b/app/plugins/comments/views/admin/list.html
index 20c49c4..df9983b 100644
--- a/app/plugins/comments/views/admin/list.html
+++ b/app/plugins/comments/views/admin/list.html
@@ -1,43 +1,45 @@
-
-{PAGINATION}
-
\ No newline at end of file
diff --git a/app/plugins/comments/views/list.html b/app/plugins/comments/views/list.html
index 840d104..3fc478b 100644
--- a/app/plugins/comments/views/list.html
+++ b/app/plugins/comments/views/list.html
@@ -1,14 +1,14 @@
\ No newline at end of file
diff --git a/app/plugins/contact/views/admin/view.html b/app/plugins/contact/views/admin/view.html
index ecd441d..89549cf 100644
--- a/app/plugins/contact/views/admin/view.html
+++ b/app/plugins/contact/views/admin/view.html
@@ -1,56 +1,61 @@
-
-
-
-
-
-
Contact
-
-
-
-
-
-
+
+
+
+ {ADMIN_BREADCRUMBS}
+
+
+
+
Contact Form
+
+
+
+
+
+
+
+
+
+
ID:
+
{ID}
+
-
ID:
-
{ID}
+
Time submitted
+
{DTC}{time}{/DTC}
-
Time submitted:
-
{DTC}{time}{/DTC}
+
Email:
+
{email}
-
IP:
-
{ip}
+
Name:
+
{name}
+
+
IP:
+
{ip}
+
-
Email:
-
{email}
-
-
-
Name
-
{name}
-
-
-
Feedback
+
Feedback:
{feedback}
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/app/plugins/contact/views/feedback.html b/app/plugins/contact/views/feedback.html
deleted file mode 100644
index cfdab0b..0000000
--- a/app/plugins/contact/views/feedback.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
Here at {SITENAME} we highly value your feedback. We constantly strive to provide our users with the highest level of quality in everything we do.
-
If you would like to provide any suggestions or comments on our service, we ask that you please fill out the quick form below and let us know what's on your mind.
-
-
-
-
\ No newline at end of file
diff --git a/app/plugins/notifications/controllers/admin/notifications.php b/app/plugins/notifications/controllers/admin/notifications.php
index 11a56b2..1ff39cd 100644
--- a/app/plugins/notifications/controllers/admin/notifications.php
+++ b/app/plugins/notifications/controllers/admin/notifications.php
@@ -45,7 +45,10 @@ class Notifications extends AdminController {
}
public function create() {
- $select = Forms::getFormFieldHtml( 'groupSelect', 'User Group', 'select', 'All', self::$group->listGroupsSimple( true ) );
+ $select = Forms::getSelectHtml(
+ 'groupSelect',
+ self::$group->listGroupsSimple( true )
+ );
Components::set( 'groupSelect', $select );
if ( ! Input::exists( 'submit' ) ) {
return Views::view( 'notifications.admin.send' );
diff --git a/app/plugins/notifications/views/admin/send.html b/app/plugins/notifications/views/admin/send.html
index 4900695..57fbda4 100644
--- a/app/plugins/notifications/views/admin/send.html
+++ b/app/plugins/notifications/views/admin/send.html
@@ -1,44 +1,62 @@
-
-
-
- {groupSelect}
-
-
-
-
-
+
+
+
+ {ADMIN_BREADCRUMBS}
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/app/plugins/subscribe/views/admin/add.html b/app/plugins/subscribe/views/admin/add.html
index 4d3c2e5..119b070 100644
--- a/app/plugins/subscribe/views/admin/add.html
+++ b/app/plugins/subscribe/views/admin/add.html
@@ -1,5 +1,24 @@
-
-
-
-
-
\ No newline at end of file
+
+
+
+ {ADMIN_BREADCRUMBS}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/plugins/subscribe/views/admin/list.html b/app/plugins/subscribe/views/admin/list.html
index 9791f6b..077db75 100644
--- a/app/plugins/subscribe/views/admin/list.html
+++ b/app/plugins/subscribe/views/admin/list.html
@@ -1,37 +1,40 @@
-
-{PAGINATION}
-
\ No newline at end of file
diff --git a/app/templates/admin/admin.tpl b/app/templates/admin/admin.tpl
index 862e51d..76941ec 100644
--- a/app/templates/admin/admin.tpl
+++ b/app/templates/admin/admin.tpl
@@ -30,8 +30,8 @@
diff --git a/app/views/about.html b/app/views/about.html
index 3bc1bf6..213e9d9 100644
--- a/app/views/about.html
+++ b/app/views/about.html
@@ -7,6 +7,10 @@
Right now this entire system was built and managed by myself. As stated, I have used my own version of this for years but translating it to publicly available is not a 1 to 1 job. There may be bugs or issues encountered while you use the produxct. I can't guarantee a fix for every need in every case immidiately, but I do actively keep track of bugs and work hard to ensure everyone has a great experiience usiing the app.
- If you encounter any bugs, feel free to report it here. Likewise, there are forms for feedback, reviews, suggestions, and a general contact form. Thanks for taking the time to check out the product!
+ If you encounter any bugs, feel free to report them here. Likewise, there are forms for feedback, reviews, suggestions, and a general contact form. Thanks for taking the time to check out the product!
\ No newline at end of file
diff --git a/app/views/admin/contact.html b/app/views/admin/contact.html
index f9615b0..a2f0e50 100644
--- a/app/views/admin/contact.html
+++ b/app/views/admin/contact.html
@@ -1,39 +1,69 @@
-
-
-
Please be very careful with this feature. This form allows you to send an email (formatted within the default site email template) to registered emails from various sources including newsletter subscribers, call to action subscribers, and all registered user accounts.