From bc33b4cac4f69eaf3e396cf503f70779b416527b Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Tue, 28 Jan 2025 17:04:05 -0500 Subject: [PATCH 1/3] cleanup and added admin images control --- app/controllers/admin/groups.php | 2 - app/controllers/admin/images.php | 114 ++++++++++++++++++ app/controllers/admin/plugins.php | 2 - app/controllers/admin/routes.php | 2 - app/controllers/admin/tokens.php | 2 - app/controllers/admin/users.php | 2 - app/js/main.js | 30 ++--- app/plugins/blog/controllers/admin/blog.php | 2 - .../contact/controllers/admin/contact.php | 2 - bin/tempus_project.php | 4 + 10 files changed, 133 insertions(+), 29 deletions(-) create mode 100644 app/controllers/admin/images.php diff --git a/app/controllers/admin/groups.php b/app/controllers/admin/groups.php index 44e8ccc..b6ed9d9 100644 --- a/app/controllers/admin/groups.php +++ b/app/controllers/admin/groups.php @@ -32,8 +32,6 @@ class Groups extends AdminController { self::$title = 'Admin - Groups'; self::$group = new Group; self::$permissions = new Permissions; - $view = Navigation::activePageSelect( 'nav.admin', '/admin/groups' ); - Components::set( 'ADMINNAV', $view ); } public function create( $data = null ) { diff --git a/app/controllers/admin/images.php b/app/controllers/admin/images.php new file mode 100644 index 0000000..0499c41 --- /dev/null +++ b/app/controllers/admin/images.php @@ -0,0 +1,114 @@ + + * @link https://TheTempusProject.com + * @license https://opensource.org/licenses/MIT [MIT LICENSE] + */ +namespace TheTempusProject\Controllers\Admin; + +use TheTempusProject\Classes\Forms as TTPForms; +use TheTempusProject\Houdini\Classes\Views; +use TheTempusProject\Houdini\Classes\Issues; +use TheTempusProject\Houdini\Classes\Navigation; +use TheTempusProject\Houdini\Classes\Components; +use TheTempusProject\Houdini\Classes\Forms; +use TheTempusProject\Classes\AdminController; +use TheTempusProject\Models\Token; +use TheTempusProject\Bedrock\Functions\Input; +use TheTempusProject\Bedrock\Functions\Check; +use TheTempusProject\Hermes\Functions\Redirect; +use TheTempusProject\Bedrock\Functions\Session; + +class Images extends AdminController { + + public function __construct() { + parent::__construct(); + self::$title = 'Admin - Images'; + } + + public function create() { + if ( Input::exists( 'submit' ) ) { + if ( !TTPForms::check( 'addImage' ) ) { + Issues::add( 'error', [ 'There was an error with your image.' => Check::userErrors() ] ); + } + + if ( Input::exists( 'folder' ) ) { + $folder = Input::post('folder'); + } else { + // IMAGE_DIRECTORY + $folder = UPLOAD_DIRECTORY . App::$activeUser->username . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR; + } + + $upload = Upload::image( 'upload', $folder ); + + if ( $upload ) { + $route = str_replace( APP_ROOT_DIRECTORY, '', $folder ); + $out = $route . Upload::last(); + } else { + Debug::error( 'There was an error with your upload.'); + Issues::add( 'error', [ 'There was an error with your upload.' => Check::userErrors() ] ); + } + + + + + + + + + + // if ( self::$token->create( + // Input::post( 'name' ), + // Input::post( 'notes' ), + // Input::post( 'token_type' ) + // ) ) { + // Session::flash( 'success', 'Token Created' ); + // Redirect::to( 'admin/images' ); + // } + + + } + Views::view( 'admin.images.create' ); + } + + public function delete( $id = null ) { + if ( self::$token->delete( [ $id ] ) ) { + Session::flash( 'success', 'Token deleted.' ); + } + Redirect::to( 'admin/images' ); + } + + public function edit( $id = null ) { + $token = self::$token->findById( $id ); + if ( Input::exists( 'submit' ) ) { + if ( !TTPForms::check( 'adminEditToken' ) ) { + Issues::add( 'error', [ 'There was an error with your token.' => Check::userErrors() ] ); + } else { + if ( self::$token->update( + $id, + Input::post( 'name' ), + Input::post( 'notes' ), + Input::post( 'token_type' ) + ) ) { + Session::flash( 'success', 'Token Updated' ); + Redirect::to( 'admin/images' ); + } + } + } + Forms::selectOption( $token->token_type ); + return Views::view( 'admin.images.edit', $token ); + } + + public function index() { + return Views::view( 'admin.images.list', self::$token->listPaginated() ); + } + + public function view( $id = null ) { + return Views::view( 'admin.images.view', self::$token->findById( $id ) ); + } +} diff --git a/app/controllers/admin/plugins.php b/app/controllers/admin/plugins.php index ea152e8..34ae918 100644 --- a/app/controllers/admin/plugins.php +++ b/app/controllers/admin/plugins.php @@ -30,8 +30,6 @@ class Plugins extends AdminController { self::$title = 'Admin - Installed Plugins'; $this->installer = new Installer; $this->plugins = $this->installer->getAvailablePlugins(); - $view = Navigation::activePageSelect( 'nav.admin', '/admin/plugins' ); - Components::set( 'ADMINNAV', $view ); } public function index() { diff --git a/app/controllers/admin/routes.php b/app/controllers/admin/routes.php index 1f8b84c..116394b 100644 --- a/app/controllers/admin/routes.php +++ b/app/controllers/admin/routes.php @@ -31,8 +31,6 @@ class Routes extends AdminController { parent::__construct(); self::$title = 'Admin - Redirects'; self::$routes = new RoutesClass; - $view = Navigation::activePageSelect( 'nav.admin', '/admin/routes' ); - Components::set( 'ADMINNAV', $view ); } public function create() { diff --git a/app/controllers/admin/tokens.php b/app/controllers/admin/tokens.php index 5655b22..a60aa75 100644 --- a/app/controllers/admin/tokens.php +++ b/app/controllers/admin/tokens.php @@ -31,8 +31,6 @@ class Tokens extends AdminController { parent::__construct(); self::$title = 'Admin - Tokens'; self::$token = new Token; - $view = Navigation::activePageSelect( 'nav.admin', '/admin/tokens' ); - Components::set( 'ADMINNAV', $view ); } public function create() { diff --git a/app/controllers/admin/users.php b/app/controllers/admin/users.php index 0cff516..d97aa97 100644 --- a/app/controllers/admin/users.php +++ b/app/controllers/admin/users.php @@ -37,8 +37,6 @@ class Users extends AdminController { self::$title = 'Admin - Users'; self::$user = new User; self::$group = new Group; - $view = Navigation::activePageSelect( 'nav.admin', '/admin/users' ); - Components::set( 'ADMINNAV', $view ); } public function create() { diff --git a/app/js/main.js b/app/js/main.js index 805f466..461b5fe 100644 --- a/app/js/main.js +++ b/app/js/main.js @@ -125,7 +125,7 @@ document.addEventListener('DOMContentLoaded', function () { if ( toggleButton ) { toggleButton.checked = true; } - + if ( enableButton ) { enableButton.innerText = 'Disable Now'; } @@ -158,21 +158,21 @@ document.addEventListener('DOMContentLoaded', function () { toggleButton.addEventListener('click', function () { if (darkModeStylesheet.disabled) { toggleDarkModePref( true ); - darkModeStylesheet.disabled = false; - localStorage.setItem('darkMode', 'enabled'); - } else { - toggleDarkModePref( false ); - 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'); + darkModeStylesheet.disabled = false; + localStorage.setItem('darkMode', 'enabled'); } else { - table.classList.add('table-light'); - table.classList.remove('table-dark'); + toggleDarkModePref( false ); + 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 36b9097..b97e319 100644 --- a/app/plugins/blog/controllers/admin/blog.php +++ b/app/plugins/blog/controllers/admin/blog.php @@ -29,8 +29,6 @@ class Blog extends AdminController { parent::__construct(); self::$posts = new Posts; self::$title = 'Admin - Blog'; - $view = Navigation::activePageSelect( 'nav.admin', '/admin/blog' ); - Components::set( 'ADMINNAV', $view ); } public function index( $data = null ) { diff --git a/app/plugins/contact/controllers/admin/contact.php b/app/plugins/contact/controllers/admin/contact.php index 1a1aa4a..be6fd11 100644 --- a/app/plugins/contact/controllers/admin/contact.php +++ b/app/plugins/contact/controllers/admin/contact.php @@ -27,8 +27,6 @@ class Contact extends AdminController { parent::__construct(); self::$title = 'Admin - Contact'; self::$contact = new ContactModel; - $view = Navigation::activePageSelect( 'nav.admin', '/admin/contact' ); - Components::set( 'ADMINNAV', $view ); } public function view( $id = null ) { diff --git a/bin/tempus_project.php b/bin/tempus_project.php index ef2a22f..697ee5d 100644 --- a/bin/tempus_project.php +++ b/bin/tempus_project.php @@ -100,6 +100,10 @@ class TheTempusProject extends Bedrock { 'text' => ' Tokens', 'url' => '{ROOT_URL}admin/tokens', ], + [ + 'text' => ' Images', + 'url' => '{ROOT_URL}admin/images', + ], [ 'text' => ' Modules', 'url' => [ From b5996dc7db179da3246d9e97bbd8098ce9cc560d Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Thu, 30 Jan 2025 12:56:14 -0500 Subject: [PATCH 2/3] remove unused code --- app/controllers/alpha.php | 35 ----- app/controllers/plugins.php | 3 - app/css/main.css | 11 +- app/css/wysiwyg.css | 218 --------------------------- app/js/wysiwyg.js | 233 ----------------------------- app/views/alpha/certification.html | 0 app/views/alpha/crashcourse.html | 0 app/views/alpha/index.html | 30 ---- app/views/debug.html | 16 -- app/views/dump.html | 9 -- app/views/hashtags.html | 1 - app/views/switches.html | 52 ------- app/views/test.html | 1 - app/views/wysiwyg.html | 104 ------------- bin/tempus_project.php | 1 + 15 files changed, 2 insertions(+), 712 deletions(-) delete mode 100644 app/controllers/alpha.php delete mode 100644 app/controllers/plugins.php delete mode 100644 app/css/wysiwyg.css delete mode 100644 app/js/wysiwyg.js delete mode 100644 app/views/alpha/certification.html delete mode 100644 app/views/alpha/crashcourse.html delete mode 100644 app/views/alpha/index.html delete mode 100644 app/views/debug.html delete mode 100644 app/views/dump.html delete mode 100644 app/views/hashtags.html delete mode 100644 app/views/switches.html delete mode 100644 app/views/test.html delete mode 100644 app/views/wysiwyg.html diff --git a/app/controllers/alpha.php b/app/controllers/alpha.php deleted file mode 100644 index 1f6c806..0000000 --- a/app/controllers/alpha.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @link https://TheTempusProject.com - * @license https://opensource.org/licenses/MIT [MIT LICENSE] - */ -namespace TheTempusProject\Controllers; - -use TheTempusProject\Classes\Controller; -use TheTempusProject\Houdini\Classes\Views; - -class Alpha extends Controller { - public function index() { - self::$title = 'Friends and Family Alpha'; - self::$pageDescription = 'The Tempus Project friends and family alpha has begun. Please join me and take part in bringing a dream to reality.'; - Views::view( 'alpha.index' ); - } - - public function crashcourse() { - self::$title = 'Friends and Family Crash-Course'; - self::$pageDescription = 'The Tempus Project runs not only this site, but it can be used and deployed for any number of sites. This crash course is intended to give you all the knowledge you will need to start building your own applications powered by The Tempus Project.'; - Views::view( 'alpha.crashcourse' ); - } - - public function certification() { - self::$title = 'Friends and Family Certification'; - self::$pageDescription = 'The Tempus Project runs not only this site, but it can be used and deployed for any number of sites. This certification course is intended to give experienced users all the information they will need to start building your own applications powered by The Tempus Project.'; - Views::view( 'alpha.certification' ); - } -} diff --git a/app/controllers/plugins.php b/app/controllers/plugins.php deleted file mode 100644 index c2970ff..0000000 --- a/app/controllers/plugins.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/app/css/main.css b/app/css/main.css index 4153e56..e984dd3 100644 --- a/app/css/main.css +++ b/app/css/main.css @@ -8,8 +8,7 @@ * @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ - - .context-other-bg { +.context-other-bg { background-color: #eaeaea; } @@ -77,14 +76,6 @@ hr { transform: translateX(25px); /* Adjust based on switch width */ } - - - - - - - - .context-main { color: #000; } diff --git a/app/css/wysiwyg.css b/app/css/wysiwyg.css deleted file mode 100644 index eeb25b2..0000000 --- a/app/css/wysiwyg.css +++ /dev/null @@ -1,218 +0,0 @@ -/** - * app/css/wysiwyg.css - * - * This file is for the wysiwyg editor's css. - * - * @version 3.0 - * @author Joey Kimsey - * @link https://TheTempusProject.com - * @license https://opensource.org/licenses/MIT [MIT LICENSE] - */ -body { - margin: 0; - height: 100vh; - display: flex; - justify-content: center; - align-items: center; - font-family: 'Helvetica Neue', 'Helvetica', arial, sans-serif; -} - -/* WYSIWYG Editor */ -.wp-webdeasy-comment-editor { - width: 40rem; - min-height: 18rem; - box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.3); - border-top: 6px solid #4a4a4a; - border-radius: 3px; - margin: 2rem 0; - - .toolbar { - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); - - .line { - display: flex; - border-bottom: 1px solid #e2e2e2; - - &:last-child { - border-bottom: none; - } - - .box { - display: flex; - border-left: 1px solid #e2e2e2; - - .editor-btn { - display: block; - display: flex; - align-items: center; - justify-content: center; - position: relative; - transition: .2s ease all; - - &:hover, &.active { - background-color: #e1e1e1; - cursor: pointer; - } - - &.icon img { - width: 15px; - padding: 9px; - box-sizing: content-box; - } - - &.icon.smaller img { - width: 16px; - } - - &.has-submenu { - width: 20px; - padding: 0 10px; - - &::after { - content: ''; - width: 6px; - height: 6px; - position: absolute; - background-image: url(https://img.icons8.com/ios-glyphs/30/000000/chevron-down.png); - background-repeat: no-repeat; - background-size: cover; - background-position: center; - right: 4px; - } - - .submenu { - display: none; - position: absolute; - top: 34px; - left: -1px; - z-index: 10; - background-color: #FFF; - border: 1px solid #b5b5b5; - border-top: none; - - .btn { - width: 39px; - } - - &:hover { - display: block; - } - } - - &:hover .submenu { - display: block; - } - } - } - } - } - } - - .content-area { - padding: 15px 12px; - line-height: 1.5; - - .visuell-view { - outline: none; - min-height: 12rem; - - p { - margin: 12px 0; - } - } - - .html-view { - outline: none; - display: none; - width: 100%; - height: 200px; - border: none; - resize: none; - } - } -} - - -/* Modal */ -.modal { - z-index: 40; - display: none; - - .modal-wrapper { - background-color: #FFF; - padding: 1rem; - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - width: 20rem; - min-height: 10rem; - z-index: 41; - - .close { - position: absolute; - top: 1rem; - right: 1rem; - cursor: pointer; - } - - .modal-content { - flex-direction: column; - - h3 { - margin-top: 0; - } - - input { - margin: 1rem 0; - padding: .5rem; - } - - input[type="text"] { - width: calc(100% - 1rem); - } - - .row { - - label { - margin-left: .5rem; - } - } - - button { - background-color: #D2434F; - border: 0; - color: #FFF; - padding: .5rem 1.2rem; - cursor: pointer; - } - } - } - - .modal-bg { - position: fixed; - background-color: rgba(0, 0, 0, .3); - width: 100vw; - height: 100vh; - top: 0; - left: 0; - } -} - -/* Codepen Footer */ -footer { - position: fixed; - bottom: 0; - display: flex; - - p { - margin: 0.5rem 1rem; - font-size: 12px; - } - - a { - text-decoration: none; - font-weight: bold; - color: #000; - } -} \ No newline at end of file diff --git a/app/js/wysiwyg.js b/app/js/wysiwyg.js deleted file mode 100644 index 2d29989..0000000 --- a/app/js/wysiwyg.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * app/js/wysiwyg.js - * - * This is css used in the debuging console. - * - * @version 3.0 - * @author Joey Kimsey - * @link https://TheTempusProject.com - * @license https://opensource.org/licenses/MIT [MIT LICENSE] - */ -// define vars -const editor = document.getElementsByClassName('wp-webdeasy-comment-editor')[0]; -const toolbar = editor.getElementsByClassName('toolbar')[0]; -const buttons = toolbar.querySelectorAll('.editor-btn:not(.has-submenu)'); -const contentArea = editor.getElementsByClassName('content-area')[0]; -const visuellView = contentArea.getElementsByClassName('visuell-view')[0]; -const htmlView = contentArea.getElementsByClassName('html-view')[0]; -const modal = document.getElementsByClassName('modal')[0]; - -// add active tag event -document.addEventListener('selectionchange', selectionChange); - -// add paste event -visuellView.addEventListener('paste', pasteEvent); - -// add paragraph tag on new line -contentArea.addEventListener('keypress', addParagraphTag); - -// add toolbar button actions -for(let i = 0; i < buttons.length; i++) { - let button = buttons[i]; - - button.addEventListener('click', function(e) { - let action = this.dataset.action; - - switch(action) { - case 'toggle-view': - execCodeAction(this, editor); - break; - case 'createLink': - execLinkAction(); - break; - default: - execDefaultAction(action); - } - - }); -} - -/** - * This function toggles between visual and html view - */ -function execCodeAction(button, editor) { - - if(button.classList.contains('active')) { // show visuell view - visuellView.innerHTML = htmlView.value; - htmlView.style.display = 'none'; - visuellView.style.display = 'block'; - - button.classList.remove('active'); - } else { // show html view - htmlView.innerText = visuellView.innerHTML; - visuellView.style.display = 'none'; - htmlView.style.display = 'block'; - - button.classList.add('active'); - } -} - -/** - * This function adds a link to the current selection - */ -function execLinkAction() { - modal.style.display = 'block'; - let selection = saveSelection(); - - let submit = modal.querySelectorAll('button.done')[0]; - let close = modal.querySelectorAll('.close')[0]; - - // done button active => add link - submit.addEventListener('click', function(e) { - e.preventDefault(); - let newTabCheckbox = modal.querySelectorAll('#new-tab')[0]; - let linkInput = modal.querySelectorAll('#linkValue')[0]; - let linkValue = linkInput.value; - let newTab = newTabCheckbox.checked; - - restoreSelection(selection); - - if(window.getSelection().toString()) { - let a = document.createElement('a'); - a.href = linkValue; - if(newTab) a.target = '_blank'; - window.getSelection().getRangeAt(0).surroundContents(a); - } - - modal.style.display = 'none'; - linkInput.value = ''; - - // deregister modal events - submit.removeEventListener('click', arguments.callee); - close.removeEventListener('click', arguments.callee); - }); - - // close modal on X click - close.addEventListener('click', function(e) { - e.preventDefault(); - let linkInput = modal.querySelectorAll('#linkValue')[0]; - - modal.style.display = 'none'; - linkInput.value = ''; - - // deregister modal events - submit.removeEventListener('click', arguments.callee); - close.removeEventListener('click', arguments.callee); - }); -} - -/** - * This function executes all 'normal' actions - */ -function execDefaultAction(action) { - document.execCommand(action, false); -} - -/** - * Saves the current selection - */ -function saveSelection() { - if(window.getSelection) { - sel = window.getSelection(); - if(sel.getRangeAt && sel.rangeCount) { - let ranges = []; - for(var i = 0, len = sel.rangeCount; i < len; ++i) { - ranges.push(sel.getRangeAt(i)); - } - return ranges; - } - } else if (document.selection && document.selection.createRange) { - return document.selection.createRange(); - } - return null; -} - -/** - * Loads a saved selection - */ -function restoreSelection(savedSel) { - if(savedSel) { - if(window.getSelection) { - sel = window.getSelection(); - sel.removeAllRanges(); - for(var i = 0, len = savedSel.length; i < len; ++i) { - sel.addRange(savedSel[i]); - } - } else if(document.selection && savedSel.select) { - savedSel.select(); - } - } -} - -/** - * Sets the current selected format buttons active/inactive - */ -function selectionChange(e) { - - for(let i = 0; i < buttons.length; i++) { - let button = buttons[i]; - - // don't remove active class on code toggle button - if(button.dataset.action === 'toggle-view') continue; - - button.classList.remove('active'); - } - - if(!childOf(window.getSelection().anchorNode.parentNode, editor)) return false; - - parentTagActive(window.getSelection().anchorNode.parentNode); -} - -/** - * Checks if the passed child has the passed parent - */ -function childOf(child, parent) { - return parent.contains(child); -} - -/** - * Sets the tag active that is responsible for the current element - */ -function parentTagActive(elem) { - if(!elem ||!elem.classList || elem.classList.contains('visuell-view')) return false; - - let toolbarButton; - - // active by tag names - let tagName = elem.tagName.toLowerCase(); - toolbarButton = document.querySelectorAll(`.toolbar .editor-btn[data-tag-name="${tagName}"]`)[0]; - if(toolbarButton) { - toolbarButton.classList.add('active'); - } - - // active by text-align - let textAlign = elem.style.textAlign; - toolbarButton = document.querySelectorAll(`.toolbar .editor-btn[data-style="textAlign:${textAlign}"]`)[0]; - if(toolbarButton) { - toolbarButton.classList.add('active'); - } - - return parentTagActive(elem.parentNode); -} - -/** - * Handles the paste event and removes all HTML tags - */ -function pasteEvent(e) { - e.preventDefault(); - - let text = (e.originalEvent || e).clipboardData.getData('text/plain'); - document.execCommand('insertHTML', false, text); -} - -/** - * This functions adds a paragraph tag when the enter key is pressed - */ -function addParagraphTag(evt) { - if (evt.keyCode == '13') { - - // don't add a p tag on list item - if(window.getSelection().anchorNode.parentNode.tagName === 'LI') return; - document.execCommand('formatBlock', false, 'p'); - } -} \ No newline at end of file diff --git a/app/views/alpha/certification.html b/app/views/alpha/certification.html deleted file mode 100644 index e69de29..0000000 diff --git a/app/views/alpha/crashcourse.html b/app/views/alpha/crashcourse.html deleted file mode 100644 index e69de29..0000000 diff --git a/app/views/alpha/index.html b/app/views/alpha/index.html deleted file mode 100644 index a56d78b..0000000 --- a/app/views/alpha/index.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-
-
-
-

Welcome to The Tempus-Project Friends and Family Alpha.

-
-

This project is now entering its third official version and nearly its tenth year of development. What a long journey it has been to get here.

-

With that being said, I won't waste your time with a journey down memory road. If you have been sent this page, clearly I trust you, or one of our mutual friends is an asshole. Both equally possible... The main purpose of inviting you was to ask for your help.

-

What I need

-

With any application, there are bugs. The best developers I have had the pleasure of working with make mundane every day mistakes just like everyone else. This obviously includes myself. With any project you spend years working on, you will develop blind spots, or places where even if something was broken, you would skip right past it and never notice.

-

I would like your help in identifying these such blind spots.

-

What you can do to help.

-

Currently there is a bug-report form at the bottom, usable by anyone with a registered account. I have also built an administrator system that allows me to track progress of these bugs and ensure they get fixed. In addition to tracking bugs, there is a public suggestions system and a publicly viewable to-do list.

-

I will need some users to help test very specific things like permissions for various groups. I will need some trusted users to act as administrators and test features. I will also just need some people to use and interact with the site to ensure they aren't encountering any bugs.

-

There are a ton of things you can do to help!

-
    -
  • Report any bugs!!! ( there is a bug-report link at the bottom of every page )
  • -
  • Register an account
  • -
  • Subscribe to the mailing list
  • -
  • Browse blog posts
  • -
  • Make suggestions for improvements or new features
  • -
  • Leave comments on the blog and other features.
  • -
  • Keep an eye out for email or messages requesting specific help.
  • -
-
-
-
-
-
diff --git a/app/views/debug.html b/app/views/debug.html deleted file mode 100644 index 0e3739c..0000000 --- a/app/views/debug.html +++ /dev/null @@ -1,16 +0,0 @@ - -
-
-

Debug Log:

- -
-
- {DEBUGGING_LOG} -
-
- \ No newline at end of file diff --git a/app/views/dump.html b/app/views/dump.html deleted file mode 100644 index ca16e83..0000000 --- a/app/views/dump.html +++ /dev/null @@ -1,9 +0,0 @@ - -
- -
-
{DUMP}
-
-
\ No newline at end of file diff --git a/app/views/hashtags.html b/app/views/hashtags.html deleted file mode 100644 index 412bab0..0000000 --- a/app/views/hashtags.html +++ /dev/null @@ -1 +0,0 @@ -

Hey there, it looks like you found our hastags! Unfortunately I haven't finished building them out just yet. Check back soon!

\ No newline at end of file diff --git a/app/views/switches.html b/app/views/switches.html deleted file mode 100644 index 8d314d1..0000000 --- a/app/views/switches.html +++ /dev/null @@ -1,52 +0,0 @@ -
-
- -
Material Design Switch Demos
- - -
    -
  • - Bootstrap Switch Default -
    - - -
    -
  • -
  • - Bootstrap Switch Primary -
    - - -
    -
  • -
  • - Bootstrap Switch Success -
    - - -
    -
  • -
  • - Bootstrap Switch Info -
    - - -
    -
  • -
  • - Bootstrap Switch Warning -
    - - -
    -
  • -
  • - Bootstrap Switch Danger -
    - - -
    -
  • -
-
-
\ No newline at end of file diff --git a/app/views/test.html b/app/views/test.html deleted file mode 100644 index 884c524..0000000 --- a/app/views/test.html +++ /dev/null @@ -1 +0,0 @@ -lul, testing \ No newline at end of file diff --git a/app/views/wysiwyg.html b/app/views/wysiwyg.html deleted file mode 100644 index a9cc13c..0000000 --- a/app/views/wysiwyg.html +++ /dev/null @@ -1,104 +0,0 @@ -
-
-
-
- - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - -
-
- - - -
-
-
-
- - - - - - -
-
- - - - - - -
-
- - - -
-
-
-
-
-

Welcome to my WYSIWYG Editor (What you see is what you get)!

-

It's only made of HTML5, CSS3 and pure JavaScript, no framework!

-
-

See for yourself! 😃

-

Tutorial available here! 😋

-
- -
-
- \ No newline at end of file diff --git a/bin/tempus_project.php b/bin/tempus_project.php index 697ee5d..6c22022 100644 --- a/bin/tempus_project.php +++ b/bin/tempus_project.php @@ -147,6 +147,7 @@ class TheTempusProject extends Bedrock { [ 'text' => 'Home', 'url' => '{ROOT_URL}home/index', + 'filter' => 'notloggedin', ], [ 'text' => 'Admin', From 5e621883ffc99b99239ec1c1530da8870f894cb0 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Thu, 30 Jan 2025 13:11:02 -0500 Subject: [PATCH 3/3] Various changes mobile-friendly ui updates admin user-edit bugfix file cleanup added searchFields add blog search remove unused code add maintenance mode config --- app/classes/preferences.php | 4 +- app/controllers/admin/home.php | 1 + app/controllers/admin/users.php | 23 +- app/controllers/home.php | 13 +- app/controllers/register.php | 24 +- app/controllers/usercp.php | 6 +- app/css/main-dark.css | 32 +- app/css/main.css | 34 +- app/models/group.php | 3 + app/models/log.php | 3 + app/models/routes.php | 3 + app/models/sessions.php | 3 + app/models/token.php | 4 + app/models/user.php | 8 +- app/plugins/blog/controllers/blog.php | 12 + app/plugins/blog/models/posts.php | 5 + app/plugins/blog/plugin.php | 1 + app/plugins/blog/templates/blog.inc.php | 7 +- app/plugins/blog/templates/blog.tpl | 75 ++- app/plugins/blog/views/about.html | 6 - app/plugins/blog/views/admin/create.html | 2 +- app/plugins/blog/views/admin/edit.html | 2 +- app/plugins/blog/views/admin/preview.html | 2 +- app/plugins/blog/views/list.html | 8 +- app/plugins/blog/views/post.html | 4 +- app/plugins/blog/views/recentWidget.html | 15 - app/plugins/blog/views/searchResults.html | 3 + app/plugins/blog/views/sidebar.html | 18 - app/plugins/blog/views/sidebar2.html | 15 - app/plugins/blog/views/widgets/about.html | 11 + app/plugins/blog/views/widgets/archive.html | 17 + app/plugins/blog/views/widgets/recent.html | 20 + app/plugins/blog/views/widgets/search.html | 18 + app/plugins/bugreport/plugin.php | 2 +- app/plugins/bugreport/views/create.html | 27 +- app/plugins/comments/views/admin/edit.html | 2 +- app/plugins/comments/views/create.html | 2 +- app/plugins/comments/views/list.html | 8 +- app/plugins/contact/views/create.html | 90 +-- app/plugins/messages/models/message.php | 2 + app/plugins/messages/views/create.html | 120 ++-- app/plugins/messages/views/inbox.html | 25 +- app/plugins/messages/views/index.html | 14 +- app/plugins/messages/views/mesage.html | 43 -- app/plugins/messages/views/message.html | 78 +-- .../views/nav/recentMessagesDropdown.html | 2 +- app/plugins/messages/views/outbox.html | 10 +- app/plugins/messages/views/reply.html | 2 +- .../notifications/views/admin/send.html | 3 +- app/plugins/notifications/views/list.html | 7 +- .../nav/recentNotificationsDropdown.html | 2 +- app/plugins/subscribe/views/admin/add.html | 2 +- app/plugins/subscribe/views/footer/right.html | 6 +- app/plugins/subscribe/views/subscribe.html | 2 +- app/plugins/subscribe/views/unsubscribe.html | 2 +- app/templates/admin/admin.inc.php | 5 + app/templates/admin/admin.tpl | 2 +- app/templates/default/default.inc.php | 2 + app/templates/default/default.tpl | 53 +- app/views/about.html | 39 +- app/views/admin/contact.html | 2 +- app/views/admin/settings.html | 2 +- app/views/admin/tokens/create.html | 2 +- app/views/admin/tokens/edit.html | 2 +- app/views/admin/users/edit.html | 4 +- app/views/admin/users/list.html | 2 +- app/views/admin/users/view.html | 6 +- app/views/{ => auth}/confirmation.html | 4 +- app/views/{ => auth}/confirmation_resend.html | 2 +- app/views/{ => auth}/forgot.html | 2 +- app/views/{ => auth}/login.html | 0 app/views/{ => auth}/password_reset.html | 2 +- app/views/{ => auth}/password_reset_code.html | 2 +- app/views/auth/register.html | 76 +++ app/views/{ => auth}/terms.html | 0 app/views/contact.html | 0 app/views/copy.html | 5 - app/views/footer/center.html | 2 +- app/views/footer/container.html | 24 +- app/views/footer/copy.html | 4 +- app/views/footer/left.html | 2 +- app/views/footer/right.html | 2 +- app/views/footer/social.html | 4 +- app/views/install/configure.html | 2 +- app/views/install/install.html | 38 -- app/views/install/models.html | 2 +- app/views/install/plugins.html | 2 +- app/views/install/resources.html | 2 +- app/views/install/routing.html | 2 +- app/views/install/user.html | 2 +- app/views/install/verify.html | 2 +- app/views/install/welcome.html | 2 +- app/views/nav/adminTop.html | 13 + app/views/nav/main.html | 6 +- app/views/nav/statusLoggedIn.html | 15 +- app/views/nav/statusLoggedOut.html | 8 +- app/views/nav/usercp.html | 4 +- app/views/privacy.html | 522 +++++++++++------- app/views/profilePage.html | 77 +++ app/views/register.html | 65 --- app/views/termsPage.html | 13 +- app/views/user_cp/email_change.html | 4 +- app/views/user_cp/password_change.html | 4 +- app/views/{ => user_cp}/profile.html | 12 +- app/views/user_cp/settings.html | 4 +- bin/tempus_project.php | 35 +- 106 files changed, 1154 insertions(+), 787 deletions(-) delete mode 100644 app/plugins/blog/views/about.html delete mode 100644 app/plugins/blog/views/recentWidget.html create mode 100644 app/plugins/blog/views/searchResults.html delete mode 100644 app/plugins/blog/views/sidebar.html delete mode 100644 app/plugins/blog/views/sidebar2.html create mode 100644 app/plugins/blog/views/widgets/about.html create mode 100644 app/plugins/blog/views/widgets/archive.html create mode 100644 app/plugins/blog/views/widgets/recent.html create mode 100644 app/plugins/blog/views/widgets/search.html delete mode 100644 app/plugins/messages/views/mesage.html rename app/views/{ => auth}/confirmation.html (92%) rename app/views/{ => auth}/confirmation_resend.html (92%) rename app/views/{ => auth}/forgot.html (95%) rename app/views/{ => auth}/login.html (100%) rename app/views/{ => auth}/password_reset.html (95%) rename app/views/{ => auth}/password_reset_code.html (94%) create mode 100644 app/views/auth/register.html rename app/views/{ => auth}/terms.html (100%) delete mode 100644 app/views/contact.html delete mode 100644 app/views/copy.html delete mode 100644 app/views/install/install.html create mode 100644 app/views/nav/adminTop.html create mode 100644 app/views/profilePage.html delete mode 100644 app/views/register.html rename app/views/{ => user_cp}/profile.html (90%) diff --git a/app/classes/preferences.php b/app/classes/preferences.php index 3f05c9e..c32d08c 100644 --- a/app/classes/preferences.php +++ b/app/classes/preferences.php @@ -268,13 +268,13 @@ class Preferences { } $html .= '
'; - $html .= ''; + $html .= ''; $html .= '
'; $html .= $fieldHtml; $html .= '
'; if ( 'file' === $type ) { $html .= '
'; - $html .= '

Current Image

'; + $html .= '

Current Image

'; $html .= '
'; $html .= 'User Avatar'; $html .= '
'; diff --git a/app/controllers/admin/home.php b/app/controllers/admin/home.php index 6d5fbdd..f3b6ea0 100644 --- a/app/controllers/admin/home.php +++ b/app/controllers/admin/home.php @@ -22,6 +22,7 @@ use TheTempusProject\Plugins\Comments as CommentPlugin; use TheTempusProject\Plugins\Blog as BlogPlugin; use TheTempusProject\Plugins\Contact as ContactPlugin; use TheTempusProject\Canary\Bin\Canary as Debug; +use TheTempusProject\Bedrock\Functions\Input; class Home extends AdminController { public static $user; diff --git a/app/controllers/admin/users.php b/app/controllers/admin/users.php index d97aa97..fbc83a5 100644 --- a/app/controllers/admin/users.php +++ b/app/controllers/admin/users.php @@ -27,6 +27,7 @@ use TheTempusProject\Models\User; use TheTempusProject\Models\Group; use TheTempusProject\TheTempusProject as App; use TheTempusProject\Houdini\Classes\Template; +use TheTempusProject\Bedrock\Functions\Upload; class Users extends AdminController { public static $user; @@ -104,7 +105,7 @@ class Users extends AdminController { } if ( Input::exists( 'submit' ) ) { - if ( !FormChecker::check( 'editUser' ) ) { + if ( ! FormChecker::check( 'editUser' ) ) { Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] ); } else { $fields = [ @@ -112,6 +113,25 @@ class Users extends AdminController { 'email' => Input::post( 'email' ), 'userGroup' => Input::post( 'groupSelect' ), ]; + + if ( Input::exists( 'avatar' ) ) { + $folder = UPLOAD_DIRECTORY . $userData->username . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR; + $upload = Upload::image( 'avatar', $folder ); + if ( $upload ) { + $route = str_replace( APP_ROOT_DIRECTORY, '', $folder ); + $prefs = []; + $prefs['avatar'] = $route . Upload::last(); + + self::$user->updatePrefs( $prefs, $userData->ID ); + } else { + Issues::add( 'error', [ 'There was an error with your avatar.' => Check::userErrors() ] ); + } + } + + if ( Input::exists( 'password' ) ) { + $fields['password'] = Hash::make( Input::post( 'password' ) ); + } + if ( Input::exists( 'confirmed' ) ) { $fields['confirmed'] = 1; } else { @@ -119,6 +139,7 @@ class Users extends AdminController { $fields['confirmationCode'] = Code::genConfirmation(); } } + if ( self::$user->update( $userData->ID, $fields ) ) { Issues::add( 'success', 'User Updated.' ); return $this->index(); diff --git a/app/controllers/home.php b/app/controllers/home.php index 16659f1..ddc3a8a 100644 --- a/app/controllers/home.php +++ b/app/controllers/home.php @@ -38,15 +38,15 @@ class Home extends Controller { return Issues::add( 'notice', 'You are already logged in. Please click here to log out.' ); } if ( !Input::exists() ) { - return Views::view( 'login' ); + return Views::view( 'auth.login' ); } if ( !Forms::check( 'login' ) ) { Issues::add( 'error', [ 'There was an error with your login.' => Check::userErrors() ] ); - return Views::view( 'login' ); + return Views::view( 'auth.login' ); } if ( !self::$user->logIn( Input::post( 'username' ), Input::post( 'password' ), Input::post( 'remember' ) ) ) { Issues::add( 'error', 'Username or password was incorrect.' ); - return Views::view( 'login' ); + return Views::view( 'auth.login' ); } Session::flash( 'success', 'You have been logged in.' ); if ( Input::exists( 'rurl' ) ) { @@ -79,13 +79,13 @@ class Home extends Controller { } self::$title = $user->username . '\'s Profile - {SITENAME}'; self::$pageDescription = 'User Profile for ' . $user->username . ' - {SITENAME}'; - Views::view( 'profile', $user ); + Views::view( 'profilePage', $user ); } public function terms() { self::$title = 'Terms and Conditions - {SITENAME}'; self::$pageDescription = '{SITENAME} Terms and Conditions of use. Please use {SITENAME} safely.'; - Components::set( 'TERMS', Views::simpleView( 'terms' ) ); + Components::set( 'TERMS', Views::simpleView( 'auth.terms' ) ); Views::view( 'termsPage' ); } @@ -98,8 +98,7 @@ class Home extends Controller { public function privacy() { self::$title = 'Privacy Policy - {SITENAME}'; self::$pageDescription = 'At {SITENAME} you privacy is very important to us. On this page you can find a detailed outline of all the information we collect and how its used.'; - Components::set( 'PRIVACY', Views::simpleView( 'privacy' ) ); - Views::raw( '
{PRIVACY}
' ); + Views::view( 'privacy' ); } public function faq() { diff --git a/app/controllers/register.php b/app/controllers/register.php index da84cc5..3e5d10d 100644 --- a/app/controllers/register.php +++ b/app/controllers/register.php @@ -31,14 +31,14 @@ class Register extends Controller { Template::noIndex(); self::$title = 'Confirm Email'; if ( !isset( $code ) && !Input::exists( 'confirmationCode' ) ) { - return Views::view( 'confirmation' ); + return Views::view( 'auth.confirmation' ); } if ( Forms::check( 'emailConfirmation' ) ) { $code = Input::post( 'confirmationCode' ); } if ( !self::$user->confirm( $code ) ) { Issues::add( 'error', 'There was an error confirming your account, please try again.' ); - return Views::view( 'confirmation' ); + return Views::view( 'auth.confirmation' ); } Session::flash( 'success', 'You have successfully confirmed your email address.' ); Redirect::to( 'home/index' ); @@ -52,16 +52,16 @@ class Register extends Controller { return Issues::add( 'notice', 'The site administrator has disable the ability to register a new account.' ); } - Components::set( 'TERMS', Views::simpleView( 'terms' ) ); + Components::set( 'TERMS', Views::simpleView( 'auth.terms' ) ); if ( App::$isLoggedIn ) { return Issues::add( 'notice', 'You are currently logged in.' ); } if ( !Input::exists() ) { - return Views::view( 'register' ); + return Views::view( 'auth.register' ); } if ( !Forms::check( 'register' ) ) { Issues::add( 'error', [ 'There was an error with your registration.' => Check::userErrors() ] ); - return Views::view( 'register' ); + return Views::view( 'auth.register' ); } self::$user->create( [ 'username' => Input::post( 'username' ), @@ -80,7 +80,7 @@ class Register extends Controller { self::$title = 'Recover Account - {SITENAME}'; Template::noIndex(); if ( !Input::exists() ) { - return Views::view( 'forgot' ); + return Views::view( 'auth.forgot' ); } if ( Check::email( Input::post( 'entry' ) ) && self::$user->findByEmail( Input::post( 'entry' ) ) ) { $userData = self::$user->data(); @@ -96,7 +96,7 @@ class Register extends Controller { Redirect::to( 'home/login' ); } Issues::add( 'error', 'User not found.' ); - Views::view( 'forgot' ); + Views::view( 'auth.forgot' ); } public function resend() { @@ -109,7 +109,7 @@ class Register extends Controller { return Issues::add( 'notice', 'Your account has already been confirmed.' ); } if ( !Forms::check( 'confirmationResend' ) ) { - return Views::view( 'confirmation_resend' ); + return Views::view( 'auth.confirmation_resend' ); } Email::send( App::$activeUser->email, 'confirmation', App::$activeUser->confirmationCode, [ 'template' => true ] ); Session::flash( 'success', 'Your confirmation email has been sent to the email for your account.' ); @@ -121,7 +121,7 @@ class Register extends Controller { Template::noIndex(); if ( !isset( $code ) && !Input::exists( 'resetCode' ) ) { Issues::add( 'info', 'Please provide a reset code.' ); - return Views::view( 'password_reset_code' ); + return Views::view( 'auth.password_reset_code' ); } if ( Input::exists( 'resetCode' ) ) { if ( Forms::check( 'passwordResetCode' ) ) { @@ -130,15 +130,15 @@ class Register extends Controller { } if ( ! self::$user->checkCode( $code ) ) { Issues::add( 'error', 'There was an error with your reset code. Please try again.' ); - return Views::view( 'password_reset_code' ); + return Views::view( 'auth.password_reset_code' ); } Components::set( 'resetCode', $code ); if ( ! Input::exists('password') ) { - return Views::view( 'password_reset' ); + return Views::view( 'auth.password_reset' ); } if ( ! Forms::check( 'passwordReset' ) ) { Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] ); - return Views::view( 'password_reset' ); + return Views::view( 'auth.password_reset' ); } self::$user->changePassword( $code, Input::post( 'password' ) ); Email::send( self::$user->data()->email, 'passwordChange', null, [ 'template' => true ] ); diff --git a/app/controllers/usercp.php b/app/controllers/usercp.php index c35ad0d..5d1c6c1 100644 --- a/app/controllers/usercp.php +++ b/app/controllers/usercp.php @@ -70,7 +70,7 @@ class Usercp extends Controller { self::$title = 'User Control Panel'; $menu = Views::simpleView( 'nav.usercp', App::$userCPlinks ); Navigation::activePageSelect( $menu, null, true, true ); - Views::view( 'profile', App::$activeUser ); + Views::view( 'user_cp.profile', App::$activeUser ); } public function password() { @@ -104,6 +104,10 @@ class Usercp extends Controller { $userPrefs = App::$activePrefs; if ( Input::exists( 'submit' ) ) { $fields = $prefs->convertFormToArray( true, false ); + // @TODO now i may need to rework the form checker to work with this.... + // if (!Forms::check('userPrefs')) { + // Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] ); + // } self::$user->updatePrefs( $fields, App::$activeUser->ID ); Issues::add( 'success', 'Your preferences have been updated.' ); // if the image upload fails, need to fall back on original diff --git a/app/css/main-dark.css b/app/css/main-dark.css index ce8a267..f13b9f0 100644 --- a/app/css/main-dark.css +++ b/app/css/main-dark.css @@ -9,36 +9,42 @@ * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ -.context-main { - color: #fff; -} -.context-second { - color: #1e1e1e; +.context-main-border { + border-color: #f5f5f5!important; } + .context-main-bg { background-color: #2c2c2c; } .context-second-bg { - background-color: #1e1e1e; + background-color: #383838; } .context-third-bg { background-color: #3a3a3a; } +.context-other-bg { + background-color: #1e1e1e; +} + +.context-main { + color: #fff; +} + + + .bg-default { background-color: #2c2c2c; } - hr { color: #f5f5f5; } + + .bg-none,.bg-warning { color: #000 !important; } -.context-other { - color: #000; -} .accordion-button:not(.collapsed) { color: #f5f5f5; background-color: var(--bs-accordion-dark-active-bg); @@ -68,12 +74,6 @@ body { .install-terms strong { color: #ffffff; } -.context-main { - color: #ffffff; -} -.context-other { - color: #ffffff; -} /** * Terms Page diff --git a/app/css/main.css b/app/css/main.css index e984dd3..67330d8 100644 --- a/app/css/main.css +++ b/app/css/main.css @@ -8,10 +8,29 @@ * @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ -.context-other-bg { - background-color: #eaeaea; + +.context-main-border { + border-color: #1e1e1e!important; } +.context-main-bg { + background-color: #f7f7f7; + /* background-color: #b1b; */ +} +.context-second-bg { + background-color: #eaeaea; + /* background-color: #b1b; */ +} +.context-third-bg { + background-color: #ccc; + /* background-color: #b1b; */ +} + +.context-main { + color: #000; +} + + .nav-link.active { font-weight: bold; /* Make the text bold */ } @@ -20,10 +39,6 @@ hr { color: #000; } -.context-main-bg { - background-color: #f7f7f7; -} - /* Base styles for the switch container */ .material-switch { position: relative; @@ -76,12 +91,6 @@ hr { transform: translateX(25px); /* Adjust based on switch width */ } -.context-main { - color: #000; -} -.context-other { - color: #fff; -} html { font-family: 'Open Sans', sans-serif; position: relative; @@ -310,3 +319,4 @@ body { /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ background: linear-gradient(to right, #2c2c2c, #1e1e1e, #1e1e1e); } + diff --git a/app/models/group.php b/app/models/group.php index 759dae7..f5331a3 100644 --- a/app/models/group.php +++ b/app/models/group.php @@ -38,6 +38,9 @@ class Group extends DatabaseModel { [ 'name', 'varchar', '32' ], [ 'permissions', 'text', '' ], ]; + public $searchFields = [ + 'name', + ]; public $permissionMatrix = [ 'adminAccess' => [ 'pretty' => 'Access Administrator Areas', diff --git a/app/models/log.php b/app/models/log.php index efd7b4a..135758b 100644 --- a/app/models/log.php +++ b/app/models/log.php @@ -46,6 +46,9 @@ class Log extends DatabaseModel { [ 'source', 'varchar', '64' ], [ 'action', 'text', '' ], ]; + public $searchFields = [ + 'source', + ]; /** * The model constructor. diff --git a/app/models/routes.php b/app/models/routes.php index 8333692..a48b834 100644 --- a/app/models/routes.php +++ b/app/models/routes.php @@ -24,6 +24,9 @@ class Routes extends DatabaseModel { [ 'original_url', 'varchar', '32' ], [ 'forwarded_url', 'text', '' ], ]; + public $searchFields = [ + 'nickname', + ]; public $resourceMatrix = [ [ 'original_url' => 'fb', diff --git a/app/models/sessions.php b/app/models/sessions.php index 9edde85..427d573 100644 --- a/app/models/sessions.php +++ b/app/models/sessions.php @@ -36,6 +36,9 @@ class Sessions extends DatabaseModel { [ 'username', 'varchar', '20' ], [ 'token', 'varchar', '120' ], ]; + public $searchFields = [ + 'username', + ]; public static $activeSession = false; /** diff --git a/app/models/token.php b/app/models/token.php index fe9198a..59cb422 100644 --- a/app/models/token.php +++ b/app/models/token.php @@ -31,6 +31,10 @@ class Token extends DatabaseModel { [ 'createdBy', 'int', '10' ], [ 'expiresAt', 'int', '10' ], ]; + public $searchFields = [ + 'name', + 'token', + ]; public $permissionMatrix = [ 'addAppToken' => [ 'pretty' => 'Add Application Tokens', diff --git a/app/models/user.php b/app/models/user.php index 62012fa..286663d 100644 --- a/app/models/user.php +++ b/app/models/user.php @@ -44,6 +44,9 @@ class User extends DatabaseModel { [ 'confirmationCode', 'varchar', '80' ], [ 'prefs', 'text', '' ], ]; + public $searchFields = [ + 'username', + ]; public $permissionMatrix = [ 'uploadImages' => [ 'pretty' => 'Upload images (such as avatars)', @@ -428,7 +431,7 @@ class User extends DatabaseModel { if ( ! empty( $filter ) ) { switch ( $filter ) { case 'newsletter': - $data = self::$db->search( $this->tableName, 'prefs', 'newsletter":"true' ); + $data = self::$db->searchColumn( $this->tableName, 'prefs', 'newsletter":"true' ); break; default: $data = self::$db->get( $this->tableName, '*' ); @@ -546,6 +549,7 @@ class User extends DatabaseModel { $instance->prefs = json_decode( $instance->prefs, true ); $instance->gender = $instance->prefs['gender']; $instance->avatar = $instance->prefs['avatar']; + $instance->usernamePretty = \ucfirst( $instance->username ); $out[] = $instance; if ( !empty( $end ) ) { $out = $out[0]; @@ -659,7 +663,7 @@ class User extends DatabaseModel { } if ( !self::$db->update( $this->tableName, $id, $fields ) ) { new CustomException( 'userUpdate' ); - Debug::error( "User: $id not updated: $fields" ); + Debug::error( "User: $id not updated: " . var_export( $fields, true ) ); return false; } return true; diff --git a/app/plugins/blog/controllers/blog.php b/app/plugins/blog/controllers/blog.php index 80cc7c8..678f1ee 100644 --- a/app/plugins/blog/controllers/blog.php +++ b/app/plugins/blog/controllers/blog.php @@ -171,4 +171,16 @@ class Blog extends Controller { self::$pageDescription = '{SITENAME} blog posts easily and conveniently sorted by years.'; Views::view( 'blog.list', self::$posts->byYear( $year ) ); } + + public function search() { + $results = []; + if ( Input::exists( 'submit' ) ) { + $dbResults = self::$posts->search( Input::post('searchTerm') ); + if ( ! empty( $dbResults ) ) { + $results = $dbResults; + } + } + Components::set( 'searchResults', Views::simpleView( 'blog.list', $results ) ); + Views::view( 'blog.searchResults' ); + } } diff --git a/app/plugins/blog/models/posts.php b/app/plugins/blog/models/posts.php index 7a4baac..ed049c5 100644 --- a/app/plugins/blog/models/posts.php +++ b/app/plugins/blog/models/posts.php @@ -24,6 +24,11 @@ use TheTempusProject\Models\Comments; class Posts extends DatabaseModel { public $tableName = 'posts'; + public $searchFields = [ + 'title', + 'slug', + 'content', + ]; public static $comments = false; public $databaseMatrix = [ diff --git a/app/plugins/blog/plugin.php b/app/plugins/blog/plugin.php index 883d6bd..0c5275b 100644 --- a/app/plugins/blog/plugin.php +++ b/app/plugins/blog/plugin.php @@ -37,6 +37,7 @@ class Blog extends Plugin { 'posts' => [ [ 'title' => 'Welcome', + 'slug' => 'welcome', 'content' => '

This is just a simple message to say thank you for installing The Tempus Project. If you have any questions you can find everything through our website here.

', 'author' => 1, 'created' => '{time}', diff --git a/app/plugins/blog/templates/blog.inc.php b/app/plugins/blog/templates/blog.inc.php index 857006f..575c5da 100644 --- a/app/plugins/blog/templates/blog.inc.php +++ b/app/plugins/blog/templates/blog.inc.php @@ -26,9 +26,10 @@ class BlogLoader extends DefaultLoader { */ public function __construct() { $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')); + Components::set('SIDEBAR', Views::simpleView('blog.widgets.recent', $posts->recent(5))); + Components::set('SIDEBAR2', Views::simpleView('blog.widgets.archive', $posts->archive())); + Components::set('SIDEBARABOUT', Views::simpleView('blog.widgets.about')); + Components::set('SIDEBARSEARCH', Views::simpleView('blog.widgets.search')); Components::set('BLOGFEATURES', ''); Navigation::setCrumbComponent( 'BLOG_BREADCRUMBS', Input::get( 'url' ) ); Components::set( 'BLOG_TEMPLATE_URL', Template::parse( '{ROOT_URL}app/plugins/comments/' ) ); diff --git a/app/plugins/blog/templates/blog.tpl b/app/plugins/blog/templates/blog.tpl index 880a176..eb9530f 100644 --- a/app/plugins/blog/templates/blog.tpl +++ b/app/plugins/blog/templates/blog.tpl @@ -39,26 +39,44 @@ -
-
-
- - - {SITENAME} - - {topNavLeft} -
- {topNavRight} -
-
-
-
- - - - - - +
+
+
+ + + + + {SITENAME} Logo + + + + + {SITENAME} Logo + + + + + +
+
+
{ISSUES} @@ -79,24 +97,27 @@
-

+

{SITENAME} Blog

-
+
-
+
{CONTENT}
-
+
-
+
{SIDEBARABOUT}
-
+
+ {SIDEBARSEARCH} +
+
{SIDEBAR}
-
+
{SIDEBAR2}
diff --git a/app/plugins/blog/views/about.html b/app/plugins/blog/views/about.html deleted file mode 100644 index ccd8d95..0000000 --- a/app/plugins/blog/views/about.html +++ /dev/null @@ -1,6 +0,0 @@ -
-

About

-

- The blog is mostly here to serve ass a simple way to link to long-form content on the site. There won't be any breaking news or tell-all stories here. Just good ole fashioned boring crap no one wants to read. -

-
\ No newline at end of file diff --git a/app/plugins/blog/views/admin/create.html b/app/plugins/blog/views/admin/create.html index 00d9d00..7d82eb5 100644 --- a/app/plugins/blog/views/admin/create.html +++ b/app/plugins/blog/views/admin/create.html @@ -2,7 +2,7 @@ Add Blog Post
{ADMIN_BREADCRUMBS} -
+
diff --git a/app/plugins/blog/views/admin/edit.html b/app/plugins/blog/views/admin/edit.html index 957a2e8..2cfd7ef 100644 --- a/app/plugins/blog/views/admin/edit.html +++ b/app/plugins/blog/views/admin/edit.html @@ -2,7 +2,7 @@ Edit Blog Post
{ADMIN_BREADCRUMBS} - +
diff --git a/app/plugins/blog/views/admin/preview.html b/app/plugins/blog/views/admin/preview.html index 41c358d..c0794ea 100644 --- a/app/plugins/blog/views/admin/preview.html +++ b/app/plugins/blog/views/admin/preview.html @@ -7,7 +7,7 @@
- + New Blog Post
diff --git a/app/plugins/blog/views/list.html b/app/plugins/blog/views/list.html index 5fd3a34..89a6c9e 100644 --- a/app/plugins/blog/views/list.html +++ b/app/plugins/blog/views/list.html @@ -1,5 +1,5 @@ {LOOP} -
+

{title}

@@ -9,7 +9,7 @@
{/LOOP} {ALT} -
- -
+
+

No Posts Found

+
{/ALT} diff --git a/app/plugins/blog/views/post.html b/app/plugins/blog/views/post.html index bcd8f84..e470cff 100644 --- a/app/plugins/blog/views/post.html +++ b/app/plugins/blog/views/post.html @@ -1,6 +1,6 @@
-
-
+
+

{title}


diff --git a/app/plugins/blog/views/recentWidget.html b/app/plugins/blog/views/recentWidget.html deleted file mode 100644 index e256079..0000000 --- a/app/plugins/blog/views/recentWidget.html +++ /dev/null @@ -1,15 +0,0 @@ -
-
-

Recent Posts

-
-
    - {LOOP} -
  • - {title} -
  • - {/LOOP} - {ALT} -
  • No Posts to show
  • - {/ALT} -
-
\ No newline at end of file diff --git a/app/plugins/blog/views/searchResults.html b/app/plugins/blog/views/searchResults.html new file mode 100644 index 0000000..64adfe6 --- /dev/null +++ b/app/plugins/blog/views/searchResults.html @@ -0,0 +1,3 @@ +Search Results +
+{searchResults} \ No newline at end of file diff --git a/app/plugins/blog/views/sidebar.html b/app/plugins/blog/views/sidebar.html deleted file mode 100644 index 85eb67e..0000000 --- a/app/plugins/blog/views/sidebar.html +++ /dev/null @@ -1,18 +0,0 @@ -
-
-

Recent Posts

-
-
-
    - {LOOP} -
  1. {title}
  2. - {/LOOP} - {ALT} -
  3. No Posts to show
  4. - {/ALT} -
-
- -
\ No newline at end of file diff --git a/app/plugins/blog/views/sidebar2.html b/app/plugins/blog/views/sidebar2.html deleted file mode 100644 index cef0110..0000000 --- a/app/plugins/blog/views/sidebar2.html +++ /dev/null @@ -1,15 +0,0 @@ -
-
-

Archives

-
-
-
    - {LOOP} -
  1. ({count}) {monthText} {year}
  2. - {/LOOP} - {ALT} -
  3. None To Show
  4. - {/ALT} -
-
-
\ No newline at end of file diff --git a/app/plugins/blog/views/widgets/about.html b/app/plugins/blog/views/widgets/about.html new file mode 100644 index 0000000..b6c67f7 --- /dev/null +++ b/app/plugins/blog/views/widgets/about.html @@ -0,0 +1,11 @@ +
+
+
+

About

+

+ The blog is mostly here to serve ass a simple way to link to long-form content on the site. + There won't be any breaking news or tell-all stories here. Just good ole fashioned boring crap no one wants to read. +

+
+
+
\ No newline at end of file diff --git a/app/plugins/blog/views/widgets/archive.html b/app/plugins/blog/views/widgets/archive.html new file mode 100644 index 0000000..63fb52d --- /dev/null +++ b/app/plugins/blog/views/widgets/archive.html @@ -0,0 +1,17 @@ +
+
+
+

Archives

+
+
+
    + {LOOP} +
  1. ({count}) {monthText} {year}
  2. + {/LOOP} + {ALT} +
  3. None To Show
  4. + {/ALT} +
+
+
+
\ No newline at end of file diff --git a/app/plugins/blog/views/widgets/recent.html b/app/plugins/blog/views/widgets/recent.html new file mode 100644 index 0000000..5822bfe --- /dev/null +++ b/app/plugins/blog/views/widgets/recent.html @@ -0,0 +1,20 @@ +
+
+
+

Recent Posts

+
+
+
    + {LOOP} +
  1. {title}
  2. + {/LOOP} + {ALT} +
  3. No Posts to show
  4. + {/ALT} +
+
+ +
+
\ No newline at end of file diff --git a/app/plugins/blog/views/widgets/search.html b/app/plugins/blog/views/widgets/search.html new file mode 100644 index 0000000..aa84fe9 --- /dev/null +++ b/app/plugins/blog/views/widgets/search.html @@ -0,0 +1,18 @@ +
+
+
+ +
+ + + + +
+ + +
+
+ +
+
+
\ No newline at end of file diff --git a/app/plugins/bugreport/plugin.php b/app/plugins/bugreport/plugin.php index c509440..d54e69d 100644 --- a/app/plugins/bugreport/plugin.php +++ b/app/plugins/bugreport/plugin.php @@ -51,7 +51,7 @@ class Bugreport extends Plugin { ]; public $contact_footer_links = [ [ - 'text' => 'Bug Report', + 'text' => 'Report a Bug', 'url' => '{ROOT_URL}bugreport', 'filter' => 'loggedin', ], diff --git a/app/plugins/bugreport/views/create.html b/app/plugins/bugreport/views/create.html index 8230842..3f6ca83 100644 --- a/app/plugins/bugreport/views/create.html +++ b/app/plugins/bugreport/views/create.html @@ -1,15 +1,20 @@ -
-

Bug Report

+
+
+

Report a Bug


-

Thank you for visiting our bug reporting page. We value our users' input highly and in an effort to better serve your needs, please fill out the form below to help us address this issue.

-

We read each and every bug report submitted, and by submitting this form you allow us to send you a follow-up email.

-
+

+ Thank you for visiting our bug reporting page. We value our users' input highly and in an effort to better serve your needs, please fill out the form below to help us address this issue. +

+

+ We read each and every bug report submitted, and by submitting this form you allow us to send you a follow-up email. +

+
- What is the URL of the page you actually received the error on? (The URL is the website address. Example: {ROOT_URL}home) + This is the URL of the page you actually received the error.
@@ -18,7 +23,7 @@ - What is the URL of the page you were on before you received the error? (The URL is the website address. Example: {ROOT_URL}home/newhome) + This is the URL of the page you were on before you received the error.
@@ -37,8 +42,11 @@
- - + + + + (max: 2000 characters) +
@@ -49,4 +57,5 @@
+
\ No newline at end of file diff --git a/app/plugins/comments/views/admin/edit.html b/app/plugins/comments/views/admin/edit.html index 47553e3..fad7bdb 100644 --- a/app/plugins/comments/views/admin/edit.html +++ b/app/plugins/comments/views/admin/edit.html @@ -3,7 +3,7 @@ Edit Comment
{ADMIN_BREADCRUMBS} -
+
diff --git a/app/plugins/comments/views/create.html b/app/plugins/comments/views/create.html index af241f5..6adaf54 100644 --- a/app/plugins/comments/views/create.html +++ b/app/plugins/comments/views/create.html @@ -1,4 +1,4 @@ - +
+ Max: 2000 characters +
+
+ + + + + +
+ +
+
-
- -
- -
- -
-
- - -
- -
- -
-
- - -
- -
- - Max: 2000 characters -
-
- - - - - -
- -
-
-
+
\ No newline at end of file diff --git a/app/plugins/messages/models/message.php b/app/plugins/messages/models/message.php index 6236fd2..a9277a2 100644 --- a/app/plugins/messages/models/message.php +++ b/app/plugins/messages/models/message.php @@ -259,7 +259,9 @@ class Message extends DatabaseModel { } $messageOut['fromAvatar'] = self::$user->getAvatar( $message->userFrom ); $messageOut['userTo'] = self::$user->getUsername( $message->userTo ); + $messageOut['userToPretty'] = \ucfirst( $messageOut['userTo'] ); $messageOut['userFrom'] = self::$user->getUsername( $message->userFrom ); + $messageOut['userFromPretty'] = \ucfirst( $messageOut['userFrom'] ); $out[] = (object) $messageOut; if ( !empty( $end ) ) { $out = $out[0]; diff --git a/app/plugins/messages/views/create.html b/app/plugins/messages/views/create.html index d1cd308..f680f0f 100644 --- a/app/plugins/messages/views/create.html +++ b/app/plugins/messages/views/create.html @@ -1,57 +1,73 @@ -
-
-
-
- New Message -
- -
- -
- +
+
+ +
+
+ + New Message +
+ +
+ +
+ +
-
- - -
- -
- + + +
+ +
+ +
+ + +
+ + +
+
+ +
+
- - -
- - -
- - - -
+ +
-
+
\ No newline at end of file diff --git a/app/plugins/messages/views/inbox.html b/app/plugins/messages/views/inbox.html index 71b1c34..2194b7b 100644 --- a/app/plugins/messages/views/inbox.html +++ b/app/plugins/messages/views/inbox.html @@ -1,14 +1,14 @@

Inbox

- +
- - - - + + + - + @@ -16,11 +16,11 @@ {LOOP} - - - - - + + + + + @@ -35,5 +35,6 @@ {/ALT}
FromSubjectLast ReplyFromSubjectLast Reply +
{userFrom}{subject}{DTC}{lastReply}{/DTC}Mark as readDelete{userFromPretty}{subject}{DTC date}{lastReply}{/DTC}
- New message + + New message
diff --git a/app/plugins/messages/views/index.html b/app/plugins/messages/views/index.html index f35bcad..7d4b30a 100644 --- a/app/plugins/messages/views/index.html +++ b/app/plugins/messages/views/index.html @@ -1,8 +1,10 @@ -
-
- {message_inbox} -
-
- {message_outbox} +
+
+
+ {message_inbox} +
+
+ {message_outbox} +
\ No newline at end of file diff --git a/app/plugins/messages/views/mesage.html b/app/plugins/messages/views/mesage.html deleted file mode 100644 index e076f5b..0000000 --- a/app/plugins/messages/views/mesage.html +++ /dev/null @@ -1,43 +0,0 @@ -
-
-
-
- {LOOP} - {SINGLE} -
-

{subject}

-
- {/SINGLE} -
-
-
- {userFrom}
- User Pic -
-
- - - - -
{message}
-
-
-
- - {/LOOP} -
-
- - - -
-
-
-
\ No newline at end of file diff --git a/app/plugins/messages/views/message.html b/app/plugins/messages/views/message.html index 919a748..628e76b 100644 --- a/app/plugins/messages/views/message.html +++ b/app/plugins/messages/views/message.html @@ -1,37 +1,53 @@ -
-
-
- {LOOP} - {SINGLE} -
-
{subject}
+
+
+ +
+ {LOOP} + {SINGLE} +
+

{subject}

+
+ {/SINGLE} +
+
+ - {/SINGLE} -
-
-
- {userFrom}
- User Pic -
-
- {message} -
+
+ {message}
- + +
+ {/ADMIN} +
+ {/LOOP}
+
+ + + +
+
\ No newline at end of file diff --git a/app/plugins/messages/views/nav/recentMessagesDropdown.html b/app/plugins/messages/views/nav/recentMessagesDropdown.html index c89a2e8..f7ea71e 100644 --- a/app/plugins/messages/views/nav/recentMessagesDropdown.html +++ b/app/plugins/messages/views/nav/recentMessagesDropdown.html @@ -1,4 +1,4 @@ -