\ No newline at end of file
diff --git a/app/plugins/bugreport/views/create.html b/app/plugins/bugreport/views/create.html
deleted file mode 100644
index 8230842..0000000
--- a/app/plugins/bugreport/views/create.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
Bug Report
-
-
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.
-
-
\ No newline at end of file
diff --git a/app/plugins/comments/controllers/admin/comments.php b/app/plugins/comments/controllers/admin/comments.php
deleted file mode 100644
index 4c9ead6..0000000
--- a/app/plugins/comments/controllers/admin/comments.php
+++ /dev/null
@@ -1,83 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Controllers\Admin;
-
-use TheTempusProject\Houdini\Classes\Navigation;
-use TheTempusProject\Houdini\Classes\Issues;
-use TheTempusProject\Houdini\Classes\Views;
-use TheTempusProject\Houdini\Classes\Components;
-use TheTempusProject\Bedrock\Functions\Input;
-use TheTempusProject\Bedrock\Functions\Check;
-use TheTempusProject\Classes\Forms;
-use TheTempusProject\Classes\AdminController;
-use TheTempusProject\Models\Comments as CommentsModel;
-
-class Comments extends AdminController {
- protected static $comments;
-
- public function __construct() {
- parent::__construct();
- self::$title = 'Admin - Comments';
- self::$comments = new CommentsModel;
- $view = Navigation::activePageSelect( 'nav.admin', '/admin/comments' );
- Components::set( 'ADMINNAV', $view );
- }
-
- public function edit( $data = null ) {
- if ( !Input::exists( 'submit' ) ) {
- return Views::view( 'comments.admin.edit', self::$comments->findById( $data ) );
- }
- if ( !Forms::check( 'editComment' ) ) {
- Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
- return Views::view( 'comments.admin.edit', self::$comments->findById( $data ) );
- }
- if ( self::$comments->update( $data, Input::post( 'comment' ) ) ) {
- Issues::add( 'success', 'Comment updated' );
- } else {
- return Views::view( 'comments.admin.edit', self::$comments->findById( $data ) );
- }
- $this->index();
- }
-
- 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( $contentID ) ) {
- return Views::view( 'comments.list', $commentData );
- }
- Issues::add( 'error', 'Comment not found.' );
- $this->index();
- }
-
- public function delete( $data = null ) {
- if ( $data == null ) {
- if ( !Input::exists( 'C_' ) ) {
- return $this->index();
- }
- $data = Input::post( 'C_' );
- }
- if ( !self::$comments->delete( $data ) ) {
- Issues::add( 'error', 'There was an error with your request.' );
- } else {
- Issues::add( 'success', 'Comment has been deleted' );
- }
- $this->index();
- }
-
- public function index() {
- Views::view( 'comments.admin.list', self::$comments->recent() );
- }
-}
diff --git a/app/plugins/comments/controllers/moderator.php b/app/plugins/comments/controllers/moderator.php
deleted file mode 100644
index 8d8f319..0000000
--- a/app/plugins/comments/controllers/moderator.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Controllers;
-
-use TheTempusProject\Houdini\Classes\Template;
-use TheTempusProject\Houdini\Classes\Views;
-use TheTempusProject\Houdini\Classes\Issues;
-use TheTempusProject\Classes\Controller;
-use TheTempusProject\TheTempusProject as App;
-use TheTempusProject\Hermes\Functions\Redirect;
-use TheTempusProject\Bedrock\Functions\Session;
-
-class Moderator extends Controller {
- public function __construct() {
- parent::__construct();
- Template::noIndex();
- if ( !App::$isMod ) {
- Session::flash( 'error', 'You do not have permission to view this page.' );
- return Redirect::home();
- }
- }
-
- public function index() {
- self::$title = 'Moderator\'s Area';
- Views::view( 'comments.moderator' );
- }
-}
diff --git a/app/plugins/comments/css/comments.css b/app/plugins/comments/css/comments.css
deleted file mode 100644
index ebe2208..0000000
--- a/app/plugins/comments/css/comments.css
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Comments
- */
-.comments {
- margin-top: 120px;
-}
\ No newline at end of file
diff --git a/app/plugins/comments/forms.php b/app/plugins/comments/forms.php
deleted file mode 100644
index f9369b1..0000000
--- a/app/plugins/comments/forms.php
+++ /dev/null
@@ -1,69 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Plugins\Comments;
-
-use TheTempusProject\Bedrock\Functions\Input;
-use TheTempusProject\Bedrock\Functions\Check;
-use TheTempusProject\Classes\Forms;
-
-class CommentsForms extends Forms {
- /**
- * Adds these functions to the form list.
- */
- public function __construct() {
- self::addHandler( 'newComment', __CLASS__, 'newComment' );
- self::addHandler( 'editComment', __CLASS__, 'editComment' );
- }
-
- /**
- * Validates the new comment form.
- *
- * @return {bool}
- */
- public static function newComment() {
- if ( !Input::exists( 'comment' ) ) {
- Check::addUserError( 'You cannot post a blank comment.' );
- return false;
- }
- if ( !Input::exists( 'contentId' ) ) {
- Check::addUserError( 'Content ID was missing.' );
- return false;
- }
- // these are disabled because i need to figure out a solution for pages where images are wrong
- // a missing image loads a new token and messes this up
- // if ( !Check::token() ) {
- // return false;
- // }
- return true;
- }
-
- /**
- * Validates the edit comment form.
- *
- * @return {bool}
- */
- public static function editComment() {
- if ( !Input::exists( 'comment' ) ) {
- Check::addUserError( 'You cannot post a blank comment.' );
- return false;
- }
- // these are disabled because i need to figure out a solution for pages where images are wrong
- // a missing image loads a new token and messes this up
- // if ( !Check::token() ) {
- // return false;
- // }
- return true;
- }
-}
-
-new CommentsForms;
diff --git a/app/plugins/comments/models/comments.php b/app/plugins/comments/models/comments.php
deleted file mode 100644
index 662fc47..0000000
--- a/app/plugins/comments/models/comments.php
+++ /dev/null
@@ -1,184 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Models;
-
-use TheTempusProject\Bedrock\Functions\Check;
-use TheTempusProject\Canary\Bin\Canary as Debug;
-use TheTempusProject\Houdini\Classes\Views;
-use TheTempusProject\Classes\DatabaseModel;
-use TheTempusProject\TheTempusProject as App;
-use TheTempusProject\Canary\Classes\CustomException;
-use TheTempusProject\Houdini\Classes\Filters;
-
-class Comments extends DatabaseModel {
- public $tableName = 'comments';
- public $databaseMatrix = [
- [ 'author', 'int', '11' ],
- [ 'contentID', 'int', '11' ],
- [ 'created', 'int', '10' ],
- [ 'edited', 'int', '10' ],
- [ 'approved', 'int', '1' ],
- [ 'contentType', 'varchar', '32' ],
- [ 'content', 'text', '' ],
- ];
-
- public function count( $contentType, $contentID ) {
- if ( !Check::id( $contentID ) ) {
- Debug::info( 'Comments: illegal ID.' );
-
- return false;
- }
- if ( !Check::dataTitle( $contentType ) ) {
- Debug::info( 'Comments: illegal Type.' );
-
- return false;
- }
- $where = ['contentType', '=', $contentType, 'AND', 'contentID', '=', $contentID];
- $data = self::$db->get( $this->tableName, $where );
- if ( !$data->count() ) {
- Debug::info( 'No comments found.' );
-
- return 0;
- }
- return $data->count();
- }
-
- public function display( $displayCount, $contentType, $contentID ) {
- if ( !Check::id( $contentID ) ) {
- Debug::info( 'Comments: illegal ID.' );
-
- return false;
- }
- if ( !Check::dataTitle( $contentType ) ) {
- Debug::info( 'Comments: illegal Type.' );
-
- return false;
- }
- $where = ['contentType', '=', $contentType, 'AND', 'contentID', '=', $contentID];
- $commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC', [0, $displayCount] );
- if ( !$commentData->count() ) {
- Debug::info( 'No comments found.' );
-
- return false;
- }
- return $this->filter( $commentData->results() );
- }
-
- public function update( $id, $comment ) {
- if ( empty( self::$log ) ) {
- self::$log = new Log;
- }
- if ( !Check::id( $id ) ) {
- Debug::info( 'Comments: illegal ID.' );
-
- return false;
- }
- $fields = [
- 'edited' => time(),
- 'content' => $comment,
- 'approved' => 1,
- ];
- if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
- new CustomException( 'commentUpdate' );
- Debug::error( "Post: $id not updated: $fields" );
-
- return false;
- }
- self::$log->admin( "Updated Comment: $id" );
- return true;
- }
-
- public function create( $contentType, $contentID, $comment ) {
- if ( !Check::id( $contentID ) ) {
- Debug::info( 'Comments: illegal ID.' );
-
- return false;
- }
- if ( !Check::dataTitle( $contentType ) ) {
- Debug::info( 'Comments: illegal Type.' );
-
- return false;
- }
- $fields = [
- 'author' => App::$activeUser->ID,
- 'edited' => time(),
- 'created' => time(),
- 'content' => $comment,
- 'contentType' => $contentType,
- 'contentID' => $contentID,
- 'approved' => 0,
- ];
- if ( !self::$db->insert( $this->tableName, $fields ) ) {
- new CustomException( 'commentCreate' );
- Debug::error( "Comments: $data not created: $fields" );
-
- return false;
- }
- return self::$db->lastId();
- }
-
- public function filter( $data, $params = [] ) {
- foreach ( $data as $instance ) {
- if ( !is_object( $instance ) ) {
- $instance = $data;
- $end = true;
- }
- if ( App::$isAdmin || ( App::$isLoggedIn && $instance->author == App::$activeUser->ID ) ) {
- $instance->commentControl = Views::simpleView( 'comments.control', ['ID' => $instance->ID] );
- } else {
- $instance->commentControl = '';
- }
- $data = self::$db->get( $instance->contentType, ['ID', '=', $instance->contentID] )->results();
- if ( empty( $data ) ) {
- $title = 'Unknown';
- } elseif ( empty( $data[0]->title ) ) {
- $title = 'Unknown';
- } else {
- $title = $data[0]->title;
- }
- $authorName = self::$user->getUsername( $instance->author );
- $authorAvatar = self::$user->getAvatar( $instance->author );
- $instance->avatar = $authorAvatar;
- $instance->authorName = $authorName;
- $instance->contentTitle = $title;
- $instance->content = Filters::applyOne( 'mentions.0', $instance->content, true );
- $instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
- $out[] = $instance;
- if ( !empty( $end ) ) {
- $out = $out[0];
- break;
- }
- }
- return $out;
- }
-
- public function recent( $contentType = 'all', $limit = null ) {
- if ( $contentType === 'all' ) {
- $where = ['ID', '>', '0'];
- } else {
- $where = ['contentType', '=', $contentType];
- }
- if ( empty( $limit ) ) {
- $commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC' );
- } else {
- $commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC', [0, $limit] );
- }
- if ( !$commentData->count() ) {
- Debug::info( 'No comments found.' );
-
- return false;
- }
- return $this->filter( $commentData->results() );
- }
-}
diff --git a/app/plugins/comments/plugin.php b/app/plugins/comments/plugin.php
deleted file mode 100644
index 146da01..0000000
--- a/app/plugins/comments/plugin.php
+++ /dev/null
@@ -1,154 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Plugins;
-
-use ReflectionClass;
-use TheTempusProject\Bedrock\Functions\Check;
-use TheTempusProject\Classes\Installer;
-use TheTempusProject\Houdini\Classes\Navigation;
-use TheTempusProject\Classes\Plugin;
-use TheTempusProject\TheTempusProject as App;
-use TheTempusProject\Bedrock\Functions\Input;
-use TheTempusProject\Houdini\Classes\Components;
-use TheTempusProject\Houdini\Classes\Issues;
-use TheTempusProject\Houdini\Classes\Views;
-use TheTempusProject\Classes\Forms;
-use TheTempusProject\Hermes\Functions\Redirect;
-use TheTempusProject\Bedrock\Functions\Session;
-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';
- public $modelVersion = '1.0';
- public $pluginVersion = '3.0';
- public $pluginDescription = 'A simple plugin to add user comments for other plugins.';
- public $admin_links = [
- [
- 'text' => ' Comments',
- 'url' => '{ROOT_URL}admin/comments',
- ],
- ];
- public $main_links = [
- [
- 'text' => 'Moderator',
- 'url' => '{ROOT_URL}moderator/index',
- 'filter' => 'mod',
- ]
- ];
- public $permissionMatrix = [
- 'modAccess' => [
- 'pretty' => 'Access Moderator Areas',
- 'default' => false,
- ],
- ];
- public $resourceMatrix = [
- 'groups' => [
- [
- 'name' => 'Moderator',
- 'permissions' => '{"adminAccess":false}',
- ]
- ],
- ];
-
- public function __construct( $load = false ) {
- if ( !empty(App::$activePerms) ) {
- App::$isMod = !empty(App::$activePerms['modAccess']);
- } else {
- App::$isMod = false;
- }
- $this->filters[] = [
- 'name' => 'mod',
- 'find' => '#{MOD}(.*?){/MOD}#is',
- 'replace' => ( App::$isMod ? '$1' : '' ),
- 'enabled' => true,
- ];
- 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 );
- }
- if ( !Forms::check( 'newComment' ) ) {
- Session::flash( 'error', [ 'There was a problem with your comment form.' => Check::userErrors() ] );
- return Redirect::to( $redirect . $content->ID );
- }
- 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' );
- }
- return Redirect::to( $redirect . $content->ID );
- }
-
- 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 );
- }
- if ( !App::$isAdmin && $content->author != App::$activeUser->ID ) {
- Session::flash( 'error', 'You do not have permission to edit this comment' );
- return Redirect::to( $type );
- }
- if ( !Input::exists( 'submit' ) ) {
- return Views::view( 'comments.admin.edit', $content );
- }
- if ( !Forms::check( 'editComment' ) ) {
- Issues::add( 'error', [ 'There was a problem editing your comment.' => Check::userErrors() ] );
- return Views::view( 'comments.admin.edit', $content );
- }
- 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 );
- }
- Session::flash( 'success', 'Comment updated' );
- return Redirect::to( $redirect . $content->contentID );
- }
-
- 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 );
- }
- if ( !App::$isAdmin && $content->author != App::$activeUser->ID ) {
- Session::flash( 'error', 'You do not have permission to edit this comment' );
- return Redirect::to( $type );
- }
- 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 );
- }
-}
diff --git a/app/plugins/comments/views/admin/dashboard.html b/app/plugins/comments/views/admin/dashboard.html
deleted file mode 100644
index 5034c50..0000000
--- a/app/plugins/comments/views/admin/dashboard.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {LOOP}
-
-
{authorName}
-
{content}
-
-
-
- {/LOOP}
- {ALT}
-
-
- No results to show.
-
-
- {/ALT}
-
-
\ No newline at end of file
diff --git a/app/plugins/comments/views/admin/edit.html b/app/plugins/comments/views/admin/edit.html
deleted file mode 100644
index 47553e3..0000000
--- a/app/plugins/comments/views/admin/edit.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
- {ADMIN_BREADCRUMBS}
-
-
-
\ No newline at end of file
diff --git a/app/plugins/comments/views/admin/list.html b/app/plugins/comments/views/admin/list.html
deleted file mode 100644
index 33b160e..0000000
--- a/app/plugins/comments/views/admin/list.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- {ADMIN_BREADCRUMBS}
-
-
\ No newline at end of file
diff --git a/app/plugins/comments/views/control.html b/app/plugins/comments/views/control.html
deleted file mode 100644
index 26661f4..0000000
--- a/app/plugins/comments/views/control.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
\ No newline at end of file
diff --git a/app/plugins/comments/views/create.html b/app/plugins/comments/views/create.html
deleted file mode 100644
index af241f5..0000000
--- a/app/plugins/comments/views/create.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/app/plugins/comments/views/list.html b/app/plugins/comments/views/list.html
deleted file mode 100644
index 1cdf0fc..0000000
--- a/app/plugins/comments/views/list.html
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- Comments
-
- {count}
-
-
-
- {LOOP}
-
-
-
-
-
-
-
-
- By: {authorName} on {DTC date}{created}{/DTC}
-
-
-
- {content}
-
- {commentControl}
-
-
-
- {/LOOP}
- {ALT}
-
-
-
Be the first to comment.
-
-
- {/ALT}
-
-
-
\ No newline at end of file
diff --git a/app/plugins/comments/views/moderator.html b/app/plugins/comments/views/moderator.html
deleted file mode 100644
index d98f81a..0000000
--- a/app/plugins/comments/views/moderator.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
Moderator' Area
-
-
Welcome!
-
This is the moderator section. You can give some groups permission to access this area. The menu is hidden for normal users and if they get a link to a moderator's area, the authentication system will stop them from accessing any content protected this way.
-
You can even use this feature in-line with your views, hiding certain components from non-moderators
-
The idea behind this role is for them to help you in policing comments as needed.
-
\ No newline at end of file
diff --git a/app/plugins/messages/controllers/messages.php b/app/plugins/messages/controllers/messages.php
deleted file mode 100644
index c07e8cc..0000000
--- a/app/plugins/messages/controllers/messages.php
+++ /dev/null
@@ -1,121 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Controllers;
-
-use TheTempusProject\Classes\Controller;
-use TheTempusProject\Classes\Forms as FormChecker;
-use TheTempusProject\Models\Message;
-use TheTempusProject\Houdini\Classes\Components;
-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;
-
- public function __construct() {
- 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() {
- self::$title .= ' - New Message';
- if ( Input::get( 'prepopuser' ) ) {
- $data = Input::get( 'prepopuser' );
- }
- if ( !empty( $data ) && self::$user->checkUsername( $data ) ) {
- Components::set( 'prepopuser', $data );
- } else {
- Components::set( 'prepopuser', '' );
- }
- if ( !Input::exists( 'submit' ) ) {
- return Views::view( 'messages.create' );
- }
- if ( !FormChecker::check( 'newMessage' ) ) {
- Issues::add( 'error', [ 'There was an problem sending your messages.' => Check::userErrors() ] );
- return Views::view( 'messages.create' );
- }
- if ( self::$message->newThread( Input::post( 'toUser' ), Input::post( 'subject' ), Input::post( 'message' ) ) ) {
- Issues::add( 'success', 'Message Sent.' );
- } else {
- Issues::add( 'notice', 'There was an problem sending your messages.' );
- }
- return $this->index();
- }
-
- public function delete( $id = '' ) {
- if ( Input::exists( 'T_' ) ) {
- self::$message->delete( Input::post( 'T_' ) );
- }
- if ( Input::exists( 'F_' ) ) {
- self::$message->delete( Input::post( 'F_' ) );
- }
- if ( Input::exists( 'ID' ) ) {
- self::$message->delete( Input::get( 'ID' ) );
- }
- if ( !empty( $id ) ) {
- self::$message->delete( $id );
- }
- return $this->index();
- }
-
- public function index() {
- 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 = '' ) {
- self::$message->markRead( $id );
- return $this->index();
- }
-
- public function reply() {
- if ( Input::exists( 'messageID' ) ) {
- $data = Input::post( 'messageID' );
- }
- if ( !Check::id( $data ) ) {
- Issues::add( 'error', 'There was an error with your request.' );
- return $this->index();
- }
- self::$title .= ' - Reply to: ' . self::$message->messageTitle( $data );
- if ( !Input::exists( 'message' ) ) {
- Components::set( 'messageID', $data );
- return Views::view( 'messages.reply' );
- }
- if ( !FormChecker::check( 'replyMessage' ) ) {
- Issues::add( 'error', [ 'There was an problem sending your messages.' => Check::userErrors() ] );
- Components::set( 'messageID', $data );
- return Views::view( 'messages.reply' );
- }
- if ( !self::$message->newMessageReply( $data, Input::post( 'message' ) ) ) {
- Issues::add( 'error', 'There was an error with your request.' );
- return $this->index();
- }
- Issues::add( 'success', 'Reply Sent.' );
- return $this->index();
- }
-
- public function view( $id = '' ) {
- self::$title = self::$message->messageTitle( $id );
- return Views::view( 'messages.message', self::$message->getThread( $id, true ) );
- }
-}
diff --git a/app/plugins/messages/models/message.php b/app/plugins/messages/models/message.php
deleted file mode 100644
index 6236fd2..0000000
--- a/app/plugins/messages/models/message.php
+++ /dev/null
@@ -1,452 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Models;
-
-use TheTempusProject\Classes\DatabaseModel;
-use TheTempusProject\Houdini\Classes\Components;
-use TheTempusProject\Houdini\Classes\Views;
-use TheTempusProject\Canary\Bin\Canary as Debug;
-use TheTempusProject\Bedrock\Functions\Check;
-use TheTempusProject\Bedrock\Functions\Sanitize;
-use TheTempusProject\TheTempusProject as App;
-use TheTempusProject\Canary\Classes\CustomException;
-
-class Message extends DatabaseModel {
- public $tableName = 'messages';
- public $databaseMatrix = [
- [ 'userTo', 'int', '11' ],
- [ 'userFrom', 'int', '11' ],
- [ 'parent', 'int', '11' ],
- [ 'sent', 'int', '10' ],
- [ 'lastReply', 'int', '10' ],
- [ 'senderDeleted', 'int', '1' ],
- [ 'recieverDeleted', 'int', '1' ],
- [ 'isRead', 'int', '1' ],
- [ 'message', 'text', '' ],
- [ 'subject', 'text', '' ],
- ];
- private $messages;
- private $usernames;
-
- /**
- * The model constructor.
- */
- public function __construct() {
- parent::__construct();
- self::$message = $this;
- }
-
- /**
- * Retrieves the most recent relative message in a thread
- *
- * @param int $parent - the id of the parent message
- * @param string $user - the id of the relative user
- * @return object
- */
- public function getLatestMessage( $parent, $user, $type = null ) {
- if ( !Check::id( $parent ) ) {
- Debug::info( 'Invalid message ID' );
- return false;
- }
- if ( !Check::id( $user ) ) {
- Debug::info( 'Invalid user ID' );
- return false;
- }
- $messageData = self::$db->get( $this->tableName, [ 'ID', '=', $parent ] );
- if ( $messageData->count() == 0 ) {
- Debug::info( 'Message not found.' );
- return false;
- }
- $message = $messageData->first();
- $params = [ 'parent', '=', $parent ];
- if ( $type !== null ) {
- $params = array_merge( $params, [ 'AND', $type, '=', $user ] );
- }
- $messageData = self::$db->get( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
- if ( $messageData->count() != 0 ) {
- if ( $messageData->first()->recieverDeleted == 0 ) {
- $message = $messageData->first();
- } else {
- $message->recieverDeleted = 1;
- }
- }
- return $message;
- }
-
- /**
- * This calls a view of the requested message.
- *
- * @param int $ID - The message ID you are looking for.
- * @return null
- */
- public function getThread( $id, $markRead = false ) {
- if ( !Check::id( $id ) ) {
- Debug::info( 'Invalid ID' );
- return false;
- }
- $messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] );
- if ( $messageData->count() == 0 ) {
- Debug::info( 'Message not found.' );
- return false;
- }
- $message = $messageData->first();
- if ( $message->userTo == App::$activeUser->ID ) {
- $permissionCheck = 1;
- if ( $message->recieverDeleted == 1 ) {
- Debug::info( 'User has already deleted this message.' );
- return false;
- }
- }
- if ( $message->userFrom == App::$activeUser->ID ) {
- $permissionCheck = 1;
- if ( $message->senderDeleted == 1 ) {
- Debug::info( 'User has already deleted this message.' );
- return false;
- }
- }
- if ( empty( $permissionCheck ) ) {
- Debug::info( 'You do not have permission to view this message.' );
- return false;
- }
- if ( $message->parent != 0 ) {
- $find = $message->parent;
- } else {
- $find = $message->ID;
- }
- $messageData = self::$db->get( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
- Components::set( 'PID', $find );
-
- if ( $markRead == true ) {
- foreach ( $messageData as $instance ) {
- $this->markRead( $instance->ID );
- }
- }
- return $this->filter( $messageData );
- }
-
- public function getInbox( $limit = null ) {
- if ( empty( $limit ) ) {
- $limit = 10;
- }
- $limit = [ 0, $limit ];
- $messageData = self::$db->get(
- $this->tableName,
- [
- 'parent', '=', 0,
- 'AND',
- 'userFrom', '=', App::$activeUser->ID,
- 'OR',
- 'parent', '=', 0,
- 'AND',
- 'userTo', '=', App::$activeUser->ID,
- ],
- 'ID',
- 'DESC',
- $limit
- );
- if ( $messageData->count() == 0 ) {
- Debug::info( 'getInbox: No messages found' );
- return false;
- }
- $filters = [
- 'importantUser' => App::$activeUser->ID,
- 'deleted' => false,
- 'type' => 'userTo',
- ];
- return $this->filter( $messageData->results(), $filters );
- }
-
- /**
- * This function calls the view for the message outbox.
- *
- * @return null
- */
- public function getOutbox( $limit = null ) {
- if ( empty( $limit ) ) {
- $limit = 10;
- }
- $limit = [ 0, $limit ];
- $messageData = self::$db->get(
- $this->tableName,
- [
- 'parent', '=', 0,
- 'AND',
- 'userFrom', '=', App::$activeUser->ID,
- ],
- 'ID',
- 'DESC',
- $limit
- );
- if ( $messageData->count() == 0 ) {
- Debug::info( 'getOutbox: No messages found' );
- return false;
- }
- $filters = [
- 'importantUser' => App::$activeUser->ID,
- 'deleted' => false,
- 'type' => 'userFrom',
- ];
- return $this->filter( $messageData->results(), $filters );
- }
-
- /**
- * This function is to prep our messages for display. An array of raw messages
- * sent through this function will automatically have all the user ID's filter
- * into actual usernames.
- *
- * @param $messageArray - This is an array of messages that need to be processed.
- * @return array - It will return the same message array after being processed.
- * @todo add filtering for BB-code.
- */
- public function filter( $messageArray, $filters = [] ) {
- $out = [];
- foreach ( $messageArray as $message ) {
- if ( !is_object( $message ) ) {
- $message = $messageArray;
- $end = true;
- }
- if ( isset( $filters['type'] ) && isset( $filters['importantUser'] ) ) {
- $type = $filters['type'];
- } else {
- $type = null;
- }
- if ( isset( $filters['importantUser'] ) ) {
- $user = $filters['importantUser'];
- } else {
- $user = App::$activeUser->ID;
- }
- if ( $message->parent == 0 ) {
- $last = $this->getLatestMessage( $message->ID, $user, $type );
- } else {
- $last = $message;
- }
- if ( $type != null && $message->$type != $user && $last->$type != $user ) {
- continue;
- }
- if ( isset( $filters['deleted'] ) && $filters['deleted'] == false ) {
- if ( $type == 'userFrom' ) {
- if ( $last->senderDeleted == 1 ) {
- continue;
- }
- }
- if ( $type == 'userTo' ) {
- if ( $last->recieverDeleted == 1 ) {
- continue;
- }
- }
- }
- $messageOut = (array) $message;
- $short = explode( ' ', Sanitize::contentShort( $message->message ) );
- $summary = implode( ' ', array_splice( $short, 0, 25 ) );
- if ( count( $short, 1 ) >= 25 ) {
- $messageOut['summary'] = $summary . '...';
- } else {
- $messageOut['summary'] = $summary;
- }
- if ( $last->isRead == 0 ) {
- $messageOut['unreadBadge'] = Views::simpleView( 'messages.unreadBadge' );
- } else {
- $messageOut['unreadBadge'] = '';
- }
- $messageOut['fromAvatar'] = self::$user->getAvatar( $message->userFrom );
- $messageOut['userTo'] = self::$user->getUsername( $message->userTo );
- $messageOut['userFrom'] = self::$user->getUsername( $message->userFrom );
- $out[] = (object) $messageOut;
- if ( !empty( $end ) ) {
- $out = $out[0];
- break;
- }
- }
- return $out;
- }
-
- /**
- * Function to check input and save messages to the DB.
- *
- * @param string $data - Username of the person receiving the sent message.
- * @return function
- */
- public function newThread( $to, $subject, $message ) {
- if ( !self::$user->usernameExists( $to ) ) {
- Debug::info( 'Message->sendMessage: User not found.' );
- return false;
- }
- $fields = [
- 'userTo' => self::$user->getID( $to ),
- 'userFrom' => App::$activeUser->ID,
- 'parent' => 0,
- 'sent' => time(),
- 'lastReply' => time(),
- 'senderDeleted' => 0,
- 'recieverDeleted' => 0,
- 'isRead' => 0,
- 'subject' => $subject,
- 'message' => $message,
- ];
- if ( !self::$db->insert( $this->tableName, $fields ) ) {
- new CustomException( 'messageSend' );
- return false;
- }
- return true;
- }
-
- public function getUnreadCount( $userId ) {
- $result = self::$db->get(
- $this->tableName,
- [
- 'userTo', '=', $userId,
- 'AND',
- 'isRead', '=', 0,
- 'AND',
- 'parent', '=', 0,
- 'AND',
- 'recieverDeleted', '=', 0,
- ]
- );
- return $result->count();
- }
-
- public function unreadCount() {
- if ( empty( App::$activeUser->ID ) ) {
- return 0;
- }
- return $this->getUnreadCount( App::$activeUser->ID );
- }
-
- public function hasPermission( $id ) {
- if ( !Check::id( $id ) ) {
- Debug::info( 'Invalid ID' );
- return false;
- }
- $messageData = self::$db->get( 'messages', [ 'ID', '=', $id ] );
- if ( $messageData->count() == 0 ) {
- Debug::info( 'Message not found.' );
- return false;
- }
- $message = $messageData->first();
- if ( $message->userTo != App::$activeUser->ID && $message->userFrom != App::$activeUser->ID ) {
- return false;
- }
- return true;
- }
-
- /**
- * Marks a message as read. This is setup to only work
- * if the message was sent to the active user.
- *
- * @param int - The message ID you are marking as read.
- * @return bool
- */
- public function markRead( $id ) {
- if ( !Check::id( $id ) ) {
- Debug::info( 'Invalid ID' );
- return false;
- }
- $result = self::$db->get( $this->tableName, [ 'ID', '=', $id, 'AND', 'userTo', '=', App::$activeUser->ID, 'AND', 'isRead', '=', '0' ] );
- if ( $result->count() == 0 ) {
- Debug::info( 'Failed to mark message as read.' );
- return false;
- }
- if ( !self::$db->update( $this->tableName, $id, [ 'isRead' => 1 ] ) ) {
- Debug::error( 'Failed to mark message as read.' );
- return false;
- }
- return true;
- }
-
- public function newMessageReply( $id, $message ) {
- if ( !$this->hasPermission( $id ) ) {
- Debug::info( 'Permission Denied.' );
- return false;
- }
- $messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] )->first();
- if ( $messageData->userTo == App::$activeUser->ID ) {
- $recipient = $messageData->userFrom;
- } else {
- $recipient = $messageData->userTo;
- }
- if ( $recipient === App::$activeUser->ID ) {
- Debug::info( 'Cannot send messages to yourself' );
- return false;
- }
- if ( !self::$db->update( $this->tableName, $messageData->ID, [ 'lastReply' => time() ] ) ) {
- new CustomException( 'messagesReplyUpdate' );
- return false;
- }
- $fields = [
- 'senderDeleted' => 0,
- 'recieverDeleted' => 0,
- 'isRead' => 0,
- 'userTo' => $recipient,
- 'userFrom' => App::$activeUser->ID,
- 'message' => $message,
- 'subject' => 're: ' . $messageData->subject,
- 'sent' => time(),
- 'parent' => $messageData->ID,
- 'lastReply' => time(),
- ];
- if ( !self::$db->insert( $this->tableName, $fields ) ) {
- new CustomException( 'messagesReplySend' );
- return false;
- }
- return true;
- }
-
- public function messageTitle( $id ) {
- if ( !$this->hasPermission( $id ) ) {
- Debug::info( 'Permission Denied.' );
- return false;
- }
- $message = self::$db->get( $this->tableName, [ 'ID', '=', $id ] )->first();
- return $message->subject;
- }
-
- /**
- * Function to delete messages from the DB.
- *
- * @param int $data - The ID of the message you are trying to delete.
- * @todo - done at 5 am after no sleep. This can be simplified a lot, i just wanted a working solution ASAP
- * @return bool
- */
- public function delete( $data ) {
- if ( !is_array( $data ) ) {
- $data = [ $data ];
- }
- foreach ( $data as $instance ) {
- if ( !Check::id( $instance ) ) {
- $error = true;
- }
- if ( !$this->hasPermission( $instance ) ) {
- Debug::info( 'Permission Denied.' );
- return false;
- }
- $message = self::$db->get( $this->tableName, [ 'ID', '=', $instance ] )->first();
- if ( $message->userTo == App::$activeUser->ID ) {
- $fields = [ 'recieverDeleted' => '1' ];
- } else {
- $fields = [ 'senderDeleted' => '1' ];
- }
- if ( !self::$db->update( $this->tableName, $instance, $fields ) ) {
- $error = true;
- }
- Debug::info( "message Deleted: $instance" );
- if ( !empty( $end ) ) {
- break;
- }
- }
- if ( !empty( $error ) ) {
- Debug::info( 'There was an error deleting one or more messages.' );
- return false;
- }
- return true;
- }
-}
diff --git a/app/plugins/messages/plugin.php b/app/plugins/messages/plugin.php
deleted file mode 100644
index 13624ef..0000000
--- a/app/plugins/messages/plugin.php
+++ /dev/null
@@ -1,57 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Plugins;
-
-use TheTempusProject\TheTempusProject as App;
-use TheTempusProject\Classes\Plugin;
-use TheTempusProject\Models\Message;
-use TheTempusProject\Houdini\Classes\Components;
-use TheTempusProject\Houdini\Classes\Views;
-
-class Messages extends Plugin {
- public $pluginName = 'TP Messages';
- public $pluginAuthor = 'JoeyK';
- public $pluginWebsite = 'https://TheTempusProject.com';
- public $modelVersion = '1.0';
- public $pluginVersion = '3.0';
- public $pluginDescription = 'A simple plugin which adds a site wide messaging system.';
- public $permissionMatrix = [
- 'sendMessages' => [
- 'pretty' => 'Can send Messages',
- 'default' => false,
- ],
- ];
- private static $loaded = false;
-
- public function __construct() {
- if ( ! self::$loaded ) {
- $messages = new Message;
- Components::set( 'MESSAGE_COUNT', $messages->unreadCount() );
- if ( $messages->unreadCount() > 0 ) {
- $messageBadge = Views::simpleView( 'messages.badge' );
- } else {
- $messageBadge = '';
- }
- Components::set( 'MBADGE', $messageBadge );
- if ( App::$isLoggedIn ) {
- Components::set( 'RECENT_MESSAGES', Views::simpleView( 'messages.nav.recentMessagesDropdown', $messages->getInbox( 5 ) ) );
- } else {
- Components::set( 'RECENT_MESSAGES', '' );
- }
- App::$topNavRight .= '{RECENT_MESSAGES}';
- App::$topNavRightDropdown .= '
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.
This is a more complex component that includes another component...
-{simple}
-
...right in the middle!
\ No newline at end of file
diff --git a/app/resources/views/example.html b/app/resources/views/example.html
deleted file mode 100644
index e546b1e..0000000
--- a/app/resources/views/example.html
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
It is comprised entirely of free form HTML
-
If you are feeling extra bold you can use the templating engine to set variables to be replaced at runtime such as {variable} or even {variable2}, or maybe even just look through some data:
-{loop}
-{value1} is the first value.
-{value2} is the second value.
-{value3} is the third value.
-{/loop}
-{ALT}No Loop{/ALT}
-{footer}
-
-
-
-
-
-
-
-
-
This is a default view
-
-
The Tempus-Project template-processor works with the backend to render html for the end user. This process has several steps and components that can get pretty complex. For the moment let's just review a few that can be used to generate web pages.
-
-
Views
-
Views are the most basic interaction between the front-end and back-end. Inside of a controler, you can call a view in two ways:
-
1. Normal - Views::view
-
-
2. Inline - Views::simpleView
-
-
-
-
Components
-
You can think of components as a sort of front-end variable that can be filled in by the back-end before being send to the end-user. You can include components in all template parsing with a simple command:
-
-Adding this to a controler will give access to that component's value in the rendering engine. For example:
-
-
-
In some cases, you may want to hide or show text on a page conditionally. For example, you may have administrator controls on a commonly used page. Obviously you would like to hide those controls from regular users; even if you have safeguards to prevent them from performing any restricted actions.
-
This is where filters come in. They do exactly that, conditionally hide or show part of a page based on back-end logic. The admin example is so common, its already built in. If a user has the isAdmin permission on thier group, they will be able to see anything within the "ADMIN" tag:
One of the pre-existing filters happens to be Issues. In the controller for this file, you should see a block that includes several examples of Issues. These issues are automatically added as individual components and hidden with the issues filter.
-
- Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] );
- Issues::add( 'error', 'This is a single error.' );
- Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] );
- Issues::add( 'success', 'This is a single success.' );
- Issues::add( 'notice', 'This is a single notice.' );
- Issues::add( 'info', 'This is a single info.' );
- Filters::add('issues', '#{ISSUES}(.*?){/ISSUES}#is', (Issues::hasIssues() ? '$1' : ''), true);
- Components::set( 'NOTICE', $test );
- Components::set( 'SUCCESS', $test );
- Components::set( 'ERROR', $test );
- Components::set( 'INFO', $test );
-
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index 9505673..0000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-version: "3.8"
-
-volumes:
- db-data:
-
-services:
- ttp-database:
- container_name: TTP-MySQL
- image: mysql:8.0
- ports:
- - ${DOCKER_DB_PORT}:3306
- environment:
- MYSQL_ROOT_PASSWORD: ${DOCKER_DB_PASSWORD}
- MYSQL_DATABASE: ${DOCKER_DB_DATABASE}
- MYSQL_USER: ${DOCKER_DB_USERNAME}
- MYSQL_PASSWORD: ${DOCKER_DB_PASSWORD}
- volumes:
- - db-data:/var/lib/mysql
- healthcheck:
- test: ["CMD", "mysqladmin" ,"ping"]
- interval: 5s
- timeout: 10s
- retries: 10
-
- ttp-phpmyadmin:
- container_name: TTP-PhpMyAdmin
- image: phpmyadmin:latest
- ports:
- - '7000:80'
- restart: always
- environment:
- PMA_HOST: database
- depends_on:
- ttp-database:
- condition: service_healthy
-
- ttp-nginx:
- container_name: TTP-Nginx
- build:
- context: .
- dockerfile: ./docker/ttp-nginx/Dockerfile
- target: php-fpm
- ports:
- - "8080:80"
- environment:
- - APP_ENV=${APP_ENV}
-
- ttp-apache:
- container_name: TTP-Apache
- build:
- context: .
- dockerfile: ./docker/ttp-apache/Dockerfile
- target: apache
- ports:
- - "8000:80"
- environment:
- - APP_ENV=${APP_ENV}
diff --git a/docker/.env.example b/docker/.env.example
deleted file mode 100644
index a814f07..0000000
--- a/docker/.env.example
+++ /dev/null
@@ -1,5 +0,0 @@
-APP_ENV = "docker"
-DOCKER_DB_PORT = 3306
-DOCKER_DB_USERNAME = dbadmin
-DOCKER_DB_PASSWORD = secret
-DOCKER_DB_DATABASE = ttp
\ No newline at end of file
diff --git a/docker/ttp-apache/Dockerfile b/docker/ttp-apache/Dockerfile
deleted file mode 100644
index 7a79f5c..0000000
--- a/docker/ttp-apache/Dockerfile
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM php:8-apache as apache
-ENV COMPOSER_ALLOW_SUPERUSER=1
-RUN apt-get update -y
-RUN apt-get install git libzip-dev -y
-RUN a2enmod ssl && a2enmod rewrite
-RUN docker-php-ext-install mysqli pdo pdo_mysql zip
-COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
-# RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
-WORKDIR /var/www
-RUN rm -rf html/
-RUN composer create-project thetempusproject/thetempusproject html
-RUN chmod -R 777 html/
-RUN chown -R www-data:www-data html/
\ No newline at end of file
diff --git a/docker/ttp-apache/README.md b/docker/ttp-apache/README.md
deleted file mode 100644
index a104a0c..0000000
--- a/docker/ttp-apache/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# TheTempusProject Apache Docker Image
-
-This image will build an apache webserver off php and use composer to clone the project to create a webserver TTP App.
-
-## Build the image
-```
-docker build -t thetempusproject/ttp-apache:latest .
-docker build --no-cache -t thetempusproject/ttp-apache:latest .
-```
-
-## Set the proper tag for dockerhub (in cases where you need to build your own image)
-```
-docker tag ttp-apache:latest thetempusproject/ttp-apache:latest
-```
-
-## Run the image
-```
-docker run -d -p 80:80 thetempusproject/ttp-apache
-```
\ No newline at end of file
diff --git a/docker/ttp-nginx/Dockerfile b/docker/ttp-nginx/Dockerfile
deleted file mode 100644
index b5b2e9f..0000000
--- a/docker/ttp-nginx/Dockerfile
+++ /dev/null
@@ -1,29 +0,0 @@
-FROM php:8-fpm as php-fpm
-
-# Env
-ENV COMPOSER_ALLOW_SUPERUSER=1
-
-# Install Packages
-RUN apt-get update -y
-RUN apt-get install -y nginx libmariadb-dev git libzip-dev zip unzip supervisor
-RUN docker-php-ext-install mysqli pdo pdo_mysql zip
-
-# Install Composer
-COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
-
-#Install TTP
-WORKDIR /var/www
-RUN rm -rf html/
-RUN composer create-project thetempusproject/thetempusproject html
-RUN chmod -R 777 html/
-RUN chown -R www-data:www-data html/
-
-# Copy Nginx configuration file
-RUN cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old
-COPY ./docker/ttp-nginx/nginx.conf /etc/nginx/nginx.conf
-
-# Copy Supervisor configuration file
-COPY ./docker/ttp-nginx/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
-
-# Start Supervisor, which will start both Nginx and PHP-FPM
-CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
\ No newline at end of file
diff --git a/docker/ttp-nginx/README.md b/docker/ttp-nginx/README.md
deleted file mode 100644
index 57bee84..0000000
--- a/docker/ttp-nginx/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# TheTempusProject Nginx Docker Image
-
-This image will build an nginx webserver off php and use composer to clone the project to create a webserver TTP App.
-
-## Build the image
-```
-docker build -t thetempusproject/ttp-nginx:latest .
-docker build --no-cache -t thetempusproject/ttp-nginx:latest .
-```
-
-## Set the proper tag for dockerhub (in cases where you need to build your own image)
-```
-docker tag thetempusproject/ttp-nginx:latest /ttp-nginx:latest
-```
-
-## Run the image
-```
-docker run -d -p 8000:80 thetempusproject/ttp-nginx
-```
\ No newline at end of file
diff --git a/docker/ttp-nginx/cors.conf b/docker/ttp-nginx/cors.conf
deleted file mode 100644
index 5bb8590..0000000
--- a/docker/ttp-nginx/cors.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-
-location /api/ {
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
- add_header 'Access-Control-Request-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
- add_header 'Access-Control-Max-Age' 1728000;
- add_header 'Content-Type' 'text/plain; charset=utf-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- if ($request_method = 'POST') {
- add_header 'Access-Control-Allow-Origin' '*' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
- add_header 'Access-Control-Request-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
- add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
- }
- if ($request_method = 'GET') {
- add_header 'Access-Control-Allow-Origin' '*' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
- add_header 'Access-Control-Request-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
- add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
- }
-}
\ No newline at end of file
diff --git a/docker/ttp-nginx/nginx.conf b/docker/ttp-nginx/nginx.conf
deleted file mode 100644
index 07aaa2e..0000000
--- a/docker/ttp-nginx/nginx.conf
+++ /dev/null
@@ -1,90 +0,0 @@
-user www-data;
-worker_processes auto;
-pid /run/nginx.pid;
-error_log /var/log/nginx/error.log;
-include /etc/nginx/modules-enabled/*.conf;
-
-events {
- worker_connections 768;
-}
-
-http {
- tcp_nopush on;
- types_hash_max_size 2048;
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
- ssl_prefer_server_ciphers on;
-
- access_log /var/log/nginx/access.log;
-
- gzip on;
- server {
- listen 80 default_server;
- index index.php;
- server_name TheTempusProject;
- root /var/www/html;
- charset utf-8;
- sendfile on;
- client_max_body_size 100m;
-
- location /js/ {
- access_log off;
- log_not_found off;
- try_files $uri /index.php?error=js404&file=$uri;
- }
-
- location /css/ {
- try_files $uri /index.php?error=css404&file=$uri;
- }
-
- location /images/ {
- try_files $uri /index.php?error=image404&url=$uri;
- }
-
- location /uploads/ {
- try_files $uri /index.php?error=upload404&url=$uri;
- }
-
- location /errors/ {
- try_files $uri /index.php?error=$uri;
- }
-
- location = /favicon.ico {
- access_log off;
- log_not_found off;
- rewrite ^(.+)$ /images/favicon.ico break;
- }
-
- location = /robots.txt {
- allow all;
- access_log off;
- log_not_found off;
- rewrite ^(.+)$ /bin/robots.txt break;
- }
-
- location ~* \.(?:js|css|png|jpg|gif|ico)$ {
- access_log off;
- log_not_found off;
- }
-
- location ~ \.php$ {
- fastcgi_pass 127.0.0.1:9000;
- include snippets/fastcgi-php.conf;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_intercept_errors off;
- fastcgi_buffer_size 16k;
- fastcgi_buffers 4 16k;
- fastcgi_connect_timeout 60s;
- fastcgi_read_timeout 60s;
- fastcgi_send_timeout 60s;
- }
-
- location / {
- rewrite ^/(.+)$ /index.php?url=$1&$args last;
- }
- }
-
- include /etc/nginx/conf.d/*.conf;
-}
\ No newline at end of file
diff --git a/docker/ttp-nginx/supervisord.conf b/docker/ttp-nginx/supervisord.conf
deleted file mode 100644
index 46e1d7d..0000000
--- a/docker/ttp-nginx/supervisord.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-[supervisord]
-nodaemon=true
-
-[program:php-fpm]
-command=/usr/local/sbin/php-fpm
-
-[program:nginx]
-command=/usr/sbin/nginx -g 'daemon off;'
\ No newline at end of file
diff --git a/downloads/JoeyKimsey-resume.docx b/downloads/JoeyKimsey-resume.docx
deleted file mode 100644
index 92814f5..0000000
Binary files a/downloads/JoeyKimsey-resume.docx and /dev/null differ
diff --git a/downloads/JoeyKimsey-resume.md b/downloads/JoeyKimsey-resume.md
deleted file mode 100644
index 62ae14d..0000000
--- a/downloads/JoeyKimsey-resume.md
+++ /dev/null
@@ -1,82 +0,0 @@
-Joey Kimsey
-[joeyk4816@gmail.com](mailto:joeyk4816@gmail.com)
-
-Summary
-
-Self-taught application engineer with over 8 years of professional experience building and debugging high traffic web applications and another decade of hands-on experience implementing solutions for smaller private entities. As a member of the team I specialize in understanding complex systems and implementations in order to deliver on intelligent solutions that integrate with existing technology. Able to identify weak points in systems, optimize, or design and implement new solutions. I've worked in application design and development, oversight and QA, even direct customer service. Whether building an app from concept to deployment, or maintaining extensive networks of load-balancers and servers, I'm able to adapt and deliver.
-
-Highlights
-
-* Confidential security clearance with the U.S. Federal Government (Expired/Renewable)
-
-* Extensive knowledge of database interfaces, web server systems, and infrastructure including UNIX, and MacOS
-
-* Experience working with high traffic systems and handling PII
-
-* Extensive operational experience with Heroku, AWS, and dedicated/shared hosting
-
-* Over 20 years of accumulated talent and professional experience in application development
-
-* Proven track record of learning new technologies as well as adapting to new workflows and systems
-
-Professional Experience
-
-**Black Airplane** *March 2021 – July 2024*
-
-*Senior Developer*
-
-* Government Contractor for the CDC under Northrop Grumman/Peraton
-* Security clearance issued at the confidential level
-* Developed custom solutions for content publishing across 18+ .gov sites.
-* Heavily centered around the WordPress platform
-* Planned, developed and delivered several chat-GPT/Laravel based internal tools and applications for Black Airplane that integrated with other services such as Zoom, Git, Harvest, AWS and Mux Video.
-* Developed several stand-alone customer projects to varying specifications utilizing laravel 9-12
-
-
-**eMeals** *Feb 2020 – Jan 2021*
-
-*Senior Developer*
-
-* Developed for several internal tools utilizing nodeJS, PHP, Rails 4, Lambda, and Python
-* Responsible for managing the entire infrastructure on AWS including Lambda, CloudFormation, RDS, EC2 with ELB/ALB, Route53, S3, ElastiCache, and CloudSearch
-* Created integration services for linking internal and external API’s and enabling inter-application communication
-* Implemented better coding standards and error detection with CloudWatch Logging, Alarms, and implementing GitFlow
-* Worked with a small team to ensure quality and appearance are maintained from Responsive web to android and iOS apps
-
-**SpringBot** *Dec 2017 – Feb 2020*
-
-*Operations Engineer*
-
-* Developed and refactored code for high volume web services that integrated with online shopping platforms including Shopify, BigCommerce, WooCommerce, and Magento
-* Investigated and resolved bug reports and improved server latency and response times
-* Developed, oversaw, and deployed multiple applications in several languages
-* Responsible for providing fast and accurate information for any urgent issues or day to day operation of an extensive network of web applications across AWS, Heroku, and others
-* Worked with multiple teams to define requirements and design custom solutions in a continuous Integration cycle
-* Automated processes that saved over 45 hours of engineer time per week
-
-**IgnitionOne** *Oct 2016 – Dec 2017*
-
-*PHP Developer*
-
-* Built and refactored code for high volume web services that integrated with existing client infrastructure including Nissan, Ford, Blizzard EU, and many other major brands
-* Implemented and utilized API services for secure data transfer including PII
-* Responsible for developing, implementing, and testing user interfaces from concept to deployment
-* Peer reviewed revisions and tested code as part of quality assurance standards
-* Wrote documentation for development procedures and audited existing code
-* Worked with teams to refine requirements and implement custom solutions for large enterprise clients
-* Implemented many popular 3rd party services including Facebook Audiences, Adobe analytics, Google Analytics, other industry standard services and remarketing tags
-
-Skills
-
-**Operations**: OpsGenie, SumoLogic, Bugsnag, SendGrid, NewRelic, circleCI, Jenkins
-
-**Frameworks:** Wordpress, Magento, WooCommerce, BootStrap, TailWind, some Symphony
-
-**Languages:** PHP 5+, CSS/LESS/SASS, JavaScript/CoffeeScript, jQuery/AJAX, Python 2+, GO, Rails 4+, some nodeJS 6, 12
-
-**Databases:** REDIS, MSSQL, MySQL, Postgres, Mongo, Metabase
-
-**Version Control:** Git, SVN
-
-**Workflows and Tools:** Agile/SCRUM, Atlassian products (Jira, Confluence, HipChat), Zoho, Slack
-
diff --git a/downloads/JoeyKimsey-resume.pdf b/downloads/JoeyKimsey-resume.pdf
deleted file mode 100644
index dcfa45d..0000000
Binary files a/downloads/JoeyKimsey-resume.pdf and /dev/null differ
diff --git a/downloads/JoeyKimsey-resume.txt b/downloads/JoeyKimsey-resume.txt
deleted file mode 100644
index 5151b84..0000000
--- a/downloads/JoeyKimsey-resume.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-Joey Kimsey
-joeyk4816@gmail.com
-Summary
-Self-taught application engineer with over 8 years of professional experience building and debugging high traffic web applications and another decade of hands-on experience implementing solutions for smaller private entities. As a member of the team I specialize in understanding complex systems and implementations in order to deliver on intelligent solutions that integrate with existing technology. Able to identify weak points in systems, optimize, or design and implement new solutions. I've worked in application design and development, oversight and QA, even direct customer service. Whether building an app from concept to deployment, or maintaining extensive networks of load-balancers and servers, I'm able to adapt and deliver.
-Highlights
-* Confidential security clearance with the U.S. Federal Government (Expired/Renewable)
-* Extensive knowledge of database interfaces, web server systems, and infrastructure including UNIX, and MacOS
-* Experience working with high traffic systems and handling PII
-* Extensive operational experience with Heroku, AWS, and dedicated/shared hosting
-* Over 20 years of accumulated talent and professional experience in application development
-* Proven track record of learning new technologies as well as adapting to new workflows and systems
-Professional Experience
-Black Airplane March 2021 – July 2024
-Senior Developer
-* Government Contractor for the CDC under Northrop Grumman/Peraton
-* Security clearance issued at the confidential level
-* Developed custom solutions for content publishing across 18+ .gov sites.
-* Heavily centered around the WordPress platform
-* Planned, developed and delivered several chat-GPT/Laravel based internal tools and applications for Black Airplane that integrated with other services such as Zoom, Git, Harvest, AWS and Mux Video.
-* Developed several stand-alone customer projects to varying specifications utilizing laravel 9-12
-
-
-eMeals Feb 2020 – Jan 2021
-Senior Developer
-* Developed for several internal tools utilizing nodeJS, PHP, Rails 4, Lambda, and Python
-* Responsible for managing the entire infrastructure on AWS including Lambda, CloudFormation, RDS, EC2 with ELB/ALB, Route53, S3, ElastiCache, and CloudSearch
-* Created integration services for linking internal and external API’s and enabling inter-application communication
-* Implemented better coding standards and error detection with CloudWatch Logging, Alarms, and implementing GitFlow
-* Worked with a small team to ensure quality and appearance are maintained from Responsive web to android and iOS apps
-SpringBot Dec 2017 – Feb 2020
-Operations Engineer
-* Developed and refactored code for high volume web services that integrated with online shopping platforms including Shopify, BigCommerce, WooCommerce, and Magento
-* Investigated and resolved bug reports and improved server latency and response times
-* Developed, oversaw, and deployed multiple applications in several languages
-* Responsible for providing fast and accurate information for any urgent issues or day to day operation of an extensive network of web applications across AWS, Heroku, and others
-* Worked with multiple teams to define requirements and design custom solutions in a continuous Integration cycle
-* Automated processes that saved over 45 hours of engineer time per week
-IgnitionOne Oct 2016 – Dec 2017
-PHP Developer
-* Built and refactored code for high volume web services that integrated with existing client infrastructure including Nissan, Ford, Blizzard EU, and many other major brands
-* Implemented and utilized API services for secure data transfer including PII
-* Responsible for developing, implementing, and testing user interfaces from concept to deployment
-* Peer reviewed revisions and tested code as part of quality assurance standards
-* Wrote documentation for development procedures and audited existing code
-* Worked with teams to refine requirements and implement custom solutions for large enterprise clients
-* Implemented many popular 3rd party services including Facebook Audiences, Adobe analytics, Google Analytics, other industry standard services and remarketing tags
-
-
-Skills
-Operations: OpsGenie, SumoLogic, Bugsnag, SendGrid, NewRelic, circleCI, Jenkins
-Frameworks: Wordpress, Magento, WooCommerce, BootStrap, TailWind, some Symphony
-Languages: PHP 5+, CSS/LESS/SASS, JavaScript/CoffeeScript, jQuery/AJAX, Python 2+, GO, Rails 4+, some nodeJS 6, 12
-Databases: REDIS, MSSQL, MySQL, Postgres, Mongo, Metabase
-Version Control: Git, SVN
-Workflows and Tools: Agile/SCRUM, Atlassian products (Jira, Confluence, HipChat), Zoho, Slack
\ No newline at end of file
diff --git a/gitlab/auto_merge_mr.sh b/gitlab/auto_merge_mr.sh
deleted file mode 100644
index 8131b8d..0000000
--- a/gitlab/auto_merge_mr.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env sh
-
-ACCESS_TOKEN=""
-CURL_FLAGS=""
-GITLAB_API="${CI_API_V4_URL}"
-MERGE_IF_SUCCESSFUL="true"
-MR_BRANCH=""
-MR_TITLE="Auto-Merge-$(date '+%Y%m%d%H%M%S')"
-PROJECT_ID="${CI_PROJECT_ID}"
-SECONDS_BETWEEN_POOLING=10
-TARGET_BRANCH="main"
-eval "${@}"
-
-if [ "${MR_BRANCH}" = '' ]; then
- echo "[ERROR] No MR branch was given."
- exit 1
-fi
-
-if [ "${ACCESS_TOKEN}" = '' ]; then
- echo "[ERROR] No access token was given."
- exit 2
-fi
-
-if [ "${MERGE_IF_SUCCESSFUL}" = "1" ] || [ "${MERGE_IF_SUCCESSFUL}" = "true" ]; then
- MERGE_IF_SUCCESSFUL="true"
-else
- MERGE_IF_SUCCESSFUL="false"
-fi
-
-MR_JSON=$(curl ${CURL_FLAGS} \
- --request POST \
- --header "PRIVATE-TOKEN: ${ACCESS_TOKEN}" \
- --data-urlencode "source_branch=${MR_BRANCH}" \
- --data-urlencode "target_branch=${TARGET_BRANCH}" \
- --data-urlencode "title=${MR_TITLE}" \
- --data-urlencode "remove_source_branch=true" \
- "${GITLAB_API}/projects/${PROJECT_ID}/merge_requests"
-)
-CURL_EXIT_CODE=$?
-
-if [ "${CURL_EXIT_CODE}" != "0" ]; then
- echo "[ERROR] Please check the returned response for details."
- echo "[INFO] CURL_EXIT_CODE=${CURL_EXIT_CODE}"
- echo "[INFO] MR_JSON=${MR_JSON}"
- exit ${CURL_EXIT_CODE}
-fi
-
-echo "[SUCCESS] Merge request created successfully!"
-MR_URL=$(echo "${MR_JSON}" | jq '.web_url')
-echo "[INFO] Merge request URL: ${MR_URL}"
-
-if [ "${MERGE_IF_SUCCESSFUL}" = "true" ]; then
- MR_ID=$(echo "${MR_JSON}" | jq '.iid')
-
- echo "[INFO] Will merge MR ID ${MR_ID} (branch '${MR_BRANCH}' into '${TARGET_BRANCH}'), if and when the pipeline passes."
- echo "[INFO] Waiting for pipeline to finish..."
- while true; do
- PIPELINE_STATUS=$(curl ${CURL_FLAGS} --silent --header "PRIVATE-TOKEN: ${ACCESS_TOKEN}" \
- "${GITLAB_API}/projects/${PROJECT_ID}/merge_requests/${MR_ID}/pipelines" | jq '.[0].status')
-
- if [ "${PIPELINE_STATUS}" = "\"success\"" ]; then
- echo "[INFO] Pipeline succeeded!"
- # Merge the merge request
- curl ${CURL_FLAGS} --request PUT --header "PRIVATE-TOKEN: ${ACCESS_TOKEN}" \
- "${GITLAB_API}/projects/${PROJECT_ID}/merge_requests/${MR_ID}/merge"
- echo "[SUCCESS] Merge request merged successfully!"
- exit 0
- elif [ "${PIPELINE_STATUS}" = "\"failed\"" ]; then
- echo "[ERROR] Pipeline failed!"
- exit 1
- else
- echo "[INFO] Pipeline still running..."
- sleep ${SECONDS_BETWEEN_POOLING}
- fi
- done
-fi
diff --git a/gitlab/update_PHP_deps.yml b/gitlab/update_PHP_deps.yml
deleted file mode 100644
index a5f6f6d..0000000
--- a/gitlab/update_PHP_deps.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-.update_PHP_deps:
- variables:
- TIMEZONE: "Europe/Amsterdam" # For the system in general
- DATE_TIMEZONE: ${TIMEZONE} # For PHP
-
- GIT_DEPTH: 1
- GITLAB_API_URL: ${CI_API_V4_URL}
- TARGET_BRANCH: ${CI_COMMIT_REF_NAME} # This is the branch chosen in the `Pipeline Schedule`
- TARGET_REMOTE: "https://${GITLAB_USERNAME}:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git"
-
- # These could/should be overridden in an extending job:
- UPDATE_BRANCH_PREFIX: "update_PHP_deps_" # Used for the update branch name, it will be followed by the datetime
- GIT_USER: "" # Used for the update commit
- GIT_EMAIL: "" # Used for the update commit
- GITLAB_USERNAME: "" # Used for pushing the new branch and opening the MR
- GITLAB_ACCESS_TOKEN: "" # Used for pushing the new branch and opening the MR
- MERGE_IF_SUCCESSFUL: "false" # Set to true, to merge automatically if the pipeline succeeds
- SECONDS_BETWEEN_POOLING: 10 # Nbr of seconds between checking if the MR pipeline is successful, so then it will merge
- JOB_GIT_FLAGS: ""
- JOB_CURL_FLAGS: ""
- JOB_COMPOSER_FLAGS: ""
- interruptible: true # allows to stop the job if a newer pipeline starts, saving resources and allowing new jobs to start because job concurrency is limited
- stage: "update_PHP_deps"
- rules:
- - if: '$SCHEDULED_PIPELINE == $CI_JOB_NAME'
- script: # `git`, `jq` and `curl` are needed, so if they are not already installed, they should be installed in the `before_script` of the extending job
- - git ${JOB_GIT_FLAGS} fetch origin ${TARGET_BRANCH}
- - git ${JOB_GIT_FLAGS} checkout ${TARGET_BRANCH}
- - export DATE_TIME="$(date '+%Y%m%d%H%M%S')"
- - export MR_BRANCH="${UPDATE_BRANCH_PREFIX}${DATE_TIME}"
- - git ${JOB_GIT_FLAGS} checkout -b "${MR_BRANCH}"
- - composer update ${JOB_COMPOSER_FLAGS}
- - if [ "$(git diff)" == "" ]; then echo "No updates needed!"; exit 0; fi
- - export TITLE="Update PHP dependencies [${DATE_TIME}]"
- - git ${JOB_GIT_FLAGS} commit -a -m "${TITLE}"
- - git ${JOB_GIT_FLAGS} push "${TARGET_REMOTE}" "${MR_BRANCH}"
- - |
- vendor/hgraca/ci-cd-composer-update/src/GitLab/auto_merge_mr.sh \
- MERGE_IF_SUCCESSFUL="${MERGE_IF_SUCCESSFUL}" \
- MR_BRANCH="${MR_BRANCH}" \
- MR_TITLE="\"${TITLE}\"" \
- TARGET_BRANCH="${TARGET_BRANCH}" \
- ACCESS_TOKEN="${GITLAB_ACCESS_TOKEN}" \
- SECONDS_BETWEEN_POOLING="${SECONDS_BETWEEN_POOLING}" \
- GITLAB_API="${GITLAB_API_URL}" \
- CURL_FLAGS="${JOB_CURL_FLAGS}"
diff --git a/index.html b/index.html
deleted file mode 100644
index f5b01d1..0000000
--- a/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
Coming Soon - JK
-
-
\ No newline at end of file
diff --git a/install.php b/install.php
deleted file mode 100644
index 6892434..0000000
--- a/install.php
+++ /dev/null
@@ -1,420 +0,0 @@
-
- * @link https://TheTempusProject.com
- * @license https://opensource.org/licenses/MIT [MIT LICENSE]
- */
-namespace TheTempusProject\Controllers;
-
-require_once 'bin/autoload.php';
-
-use TheTempusProject\TheTempusProject;
-use TheTempusProject\Classes\Controller;
-use TheTempusProject\Classes\Plugin;
-use TheTempusProject\Classes\Installer;
-use TheTempusProject\Classes\Forms;
-use TheTempusProject\Models\User;
-use TheTempusProject\Classes\Email;
-use TheTempusProject\Bedrock\Functions\Code;
-use TheTempusProject\Bedrock\Functions\Check;
-use TheTempusProject\Bedrock\Functions\Cookie;
-use TheTempusProject\Bedrock\Functions\Input;
-use TheTempusProject\Bedrock\Functions\Upload;
-use TheTempusProject\Bedrock\Functions\Hash;
-use TheTempusProject\Bedrock\Functions\Session;
-use TheTempusProject\Houdini\Classes\Issues;
-use TheTempusProject\Houdini\Classes\Views;
-use TheTempusProject\Houdini\Classes\Components;
-use TheTempusProject\Houdini\Classes\Template;
-use TheTempusProject\Hermes\Functions\Redirect;
-use TheTempusProject\Hermes\Functions\Route;
-use TheTempusProject\Canary\Bin\Canary as Debug;
-
-class Install extends Controller {
- private $installer;
- private $location = false;
- private $steps = [
- 'Welcome',
- 'Terms',
- 'Verify',
- 'Configure',
- 'Routing',
- 'Models',
- 'Plugins',
- 'Install',
- 'Resources',
- 'User',
- 'Complete',
- ];
-
- /**
- * This is the main builder for the rest of the controller. It mostly handle template variables used on all pages.
- */
- public function __construct() {
- parent::__construct();
- self::$title = 'TP Installer';
- self::$pageDescription = 'This is the install script for The Tempus Project.';
- $this->installer = new Installer();
- Template::noIndex();
- Template::noFollow();
- foreach ( $this->steps as $step ) {
- Components::set( 'menu-' . $step, 'disabled' );
- }
- if ( $this->checkSession() !== false ) {
- $this->location = $this->getStep();
- Components::set( 'menu-' . ucfirst( $this->location ), 'active' );
- } else {
- Components::set( 'menu-Welcome', 'active' );
- }
- Components::set( 'installer-nav', Views::simpleView( 'install.nav' ) );
- }
-
- /**
- * This method will reset the install hash, set the saved install step, update the session and cookie, and refresh if required.
- *
- * @param string $page
- * @param boolean $redirect
- * @return void
- */
- public function nextStep( $page, $redirect = false ) {
- $newHash = Code::genInstall();
- $this->installer->setNode( 'installHash', $newHash, true );
- $this->installer->setNode( 'installStep', $page, true );
- Session::put( 'installHash', $newHash );
- Cookie::put( 'installHash', $newHash );
- if ( $redirect === true ) {
- Redirect::reload();
- }
- return true;
- }
-
- public function checkSession() {
- if ( empty( $this->installer->getNode('installHash') ) ) {
- Debug::error( 'install hash not found on file.' );
- return false;
- }
- $session = Session::get( 'installHash' );
- $cookie = Cookie::get( 'installHash' );
- $file = $this->installer->getNode('installHash');
-
- if ( ! $session && ! $cookie ) {
- Debug::error( 'install hash not found in session or cookie.' );
- return false;
- }
- if ( $cookie && ! $session ) {
- if ( $cookie !== $file ) {
- Debug::error( 'install cookie did not match install file.' );
- Cookie::delete( 'installHash' );
- return false;
- }
- Debug::error( 'cookie matches file, using as session' );
- Session::put( 'installHash', $cookie );
- return true;
- }
- if ( $session !== $file ) {
- Debug::error( 'session did not match file, deleting session' );
- Session::delete( 'installHash' );
- return false;
- }
- return true;
- }
-
- public function getStep() {
- if ( !empty( $this->installer->getNode('installStep') ) ) {
- return $this->installer->getNode('installStep');
- }
- Debug::error( 'install status not found.' );
- return false;
- }
-
- /**
- * The index method is called on the first request and all requests thereafter and is responsible for routing
- * the current request to the appropriate installer step/method.
- */
- public function index() {
- if ( false === $this->location ) {
- return $this->welcome();
- }
- // this seems dumb, i could probably do this better
- $location = $this->location;
- return $this->$location();
- }
-
- /**
- * The welcome method is is just a page to submit a form and save the install.json for the first time.
- */
- public function welcome() {
- if ( Forms::Check( 'installStart' ) ) {
- return $this->nextStep( 'terms', true );
- }
- if ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with the Installation.' => Check::userErrors()] );
- }
- Views::view( 'install.welcome' );
- }
-
- /**
- * The terms step is pretty straight forward. You simply need to continue to the next step, understanding
- * that you agree to these terms when you continue the installation.
- */
- public function terms() {
- if ( Forms::Check( 'installAgreement' ) ) {
- return $this->nextStep( 'verify', true );
- }
- if ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', [ 'There was an error with the Installation.' => Check::userErrors() ] );
- }
- Components::set( 'TERMS', Views::simpleView( 'terms' ) );
- Views::view( 'install.terms' );
- }
-
- /**
- * There is a small list a of requirements for the application to run properly. These are things like sessions, emails, cookies, etc.
- * This step verifies that all of these features are working as expected.
- */
- public function verify() {
- if ( Forms::Check( 'installCheck' ) ) {
- return $this->nextStep( 'configure', true );
- }
- if ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with the Installation.' => array_merge( Check::userErrors(), Check::systemErrors() )] );
- }
- Views::view( 'install.verify' );
- }
-
- /**
- * One of the most important steps for installation, is the configuration. In this step, we will define some very core settings
- * for the app including the app's name and database credentials.
- */
- public function configure() {
- if ( Forms::Check( 'installConfigure' ) ) {
- $logo = 'images/logo.png';
- if ( Input::exists( 'logo' ) && Upload::image( 'logo', 'System' ) ) {
- $logo = 'Uploads/Images/System/' . Upload::last();
- }
- TheTempusProject::$activeConfig->load( BEDROCK_CONFIG_JSON );
- $baseConfig = TheTempusProject::$configMatrix;
- $baseConfig['main']['logo']['value'] = $logo;
- $baseConfig['main']['name']['value'] = Input::postNull( 'siteName' );
- $baseConfig['main']['template']['value'] = $baseConfig['main']['template']['default'];
- $baseConfig['main']['tokenEnabled']['value'] = $baseConfig['main']['tokenEnabled']['default'];
- $baseConfig['main']['loginLimit']['value'] = $baseConfig['main']['loginLimit']['default'];
- $baseConfig['database']['dbEnabled']['value'] = $baseConfig['database']['dbEnabled']['default'];
- $baseConfig['database']['dbHost']['value'] = Input::postNull( 'dbHost' );
- $baseConfig['database']['dbMaxQuery']['value'] = $baseConfig['database']['dbMaxQuery']['default'];
- $baseConfig['database']['dbName']['value'] = Input::postNull( 'dbName' );
- $baseConfig['database']['dbPassword']['value'] = Input::postNull( 'dbPassword' );
- $baseConfig['database']['dbPrefix']['value'] = Input::postNull( 'dbPrefix' );
- $baseConfig['database']['dbUsername']['value'] = Input::postNull( 'dbUsername' );
- if ( ! TheTempusProject::$activeConfig->generate( CONFIG_JSON, $baseConfig ) ) {
- return Issues::add( 'error', 'Config file already exists so the installer has been halted. If there was an error with installation, please delete app/config/config.json manually and try again. The installer should automatically bring you back to this step.' );
- }
- Session::flash( 'success', 'Config saved successfully.' );
- return $this->nextStep( 'routing', true );
- }
- if ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with your form.' => Check::userErrors()] );
- }
- Views::view( 'install.configure' );
- }
-
- /**
- * For the application to function properly on nginx or apache, the web servers must be configured correctly.
- * Depending on which server you use, this step will help you set up and test the routing required for the
- * application to function as expected.
- */
- public function routing() {
- if ( Input::exists( 'submit' ) && Forms::Check( 'installRouting' ) ) {
- // if its Apache, attempt to generate the htaccess file before testing
- if ( Check::isApache() ) {
- if ( !$this->installer->checkHtaccess() ) {
- if ( !$this->installer->saveHtaccess() ) {
- Issues::add( 'error', 'There was an unexpected error when generating your htaccess file. Please see the error logs for more information.' );
- }
- }
- }
- // Apache should have the htaccess now, and Nginx should have been configured this way out of the box
- if ( Route::testRouting() ) {
- Session::flash( 'success', 'Routing is working as expected.' );
- return $this->nextStep( 'models', true );
- } else {
- Issues::add( 'error', 'Could not verify url routing' );
- }
- // routing is busted, if its Apache, we already have the error from htaccess generation
- // so Nginx is the only one that needs more info
- if ( Check::isNginx() ) {
- Issues::add( 'error', 'There appears to be an issue with your configuration. Certain urls are not being routed as expected.' );
- }
- } elseif ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with your form.' => Check::userErrors()] );
- }
- Views::view( 'install.routing' );
- }
-
- /**
- * Since models are required for the proper function of the app, this step is required and has no selection to make.
- * This step will install all the required models excluding resources.
- */
- public function models() {
- $errors = [];
- $options = [ 'installResources' => false ];
- $models = $this->installer->getModelList( MODEL_DIRECTORY );
- if ( Input::exists( 'submit' ) && Forms::Check( 'installModels' ) ) {
- $error = false;
- foreach ( $models as $model ) {
- $result = $this->installer->installModel( $model, $options );
-
- if ( $result === false ) {
- $error = true;
- continue;
- }
- }
- if ( $error ) {
- Issues::add( 'error', [ 'There was an error with the Installation.' => $this->installer->getErrors() ] );
- } else {
- Session::flash( 'success', [ 'Models Have been installed successfully.' => $this->installer->getErrors() ] );
- return $this->nextStep( 'plugins', true );
- }
- } elseif ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', [ 'There was an error with your form.' => Check::userErrors() ] );
- }
- Views::view( 'install.models', $models );
- }
-
- /**
- * This step will allow the user to install any plugins currently available for installing excluding resources.
- */
- public function plugins() {
- $errors = [];
- $options = [ 'resources_installed' => false ];
- $plugins = $this->installer->getAvailablePlugins();
- $selected_plugins = Input::post( 'P_' );
-
- if ( Input::exists( 'submit' ) && Forms::Check( 'installPlugins' ) ) {
- $error = false;
- foreach ( $plugins as $plugin ) {
- if ( ! in_array( $plugin->name, $selected_plugins ) ) {
- continue;
- }
- $result = $this->installer->installPlugin( $plugin, $options );
-
- if ( !$result ) {
- $error = true;
- continue;
- }
- Plugin::enable( $plugin->name, true );
- }
- if ( $error ) {
- Issues::add( 'error', ['There was an error with the Installation.' => $this->installer->getErrors()] );
- } else {
- Session::flash( 'success', [ 'Plugins Have been installed successfully.' => $this->installer->getErrors() ] );
- return $this->nextStep( 'resources', true );
- }
- } elseif ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with your form.' => Check::userErrors()] );
- }
- Views::view( 'install.plugins', $plugins );
- }
-
- /**
- * The resource step will cycle through the partially installed models and install any missing resources.
- */
- public function resources() {
- $errors = [];
- if ( Input::exists( 'submit' ) && Forms::Check( 'installResources' ) ) {
- $error = false;
- $allModules = $this->installer->getModules(true);
- foreach ( $allModules as $name => $module ) {
- if ( empty( $module ) || 'unknown' === $name || empty( $name ) || empty( $module['installedVersion'] ) ) {
- continue;
- }
-
- if ( 'plugin' == $module['type'] ) {
- $installResult = $this->installer->installPlugin( (object) $module, [ 'resources_installed' => true ], false );
- } else {
- $installResult = $this->installer->installModel( (object) $module, [ 'installResources' => true ], false );
- }
- if ( !$installResult ) {
- $error = true;
- }
- }
- if ( $error ) {
- Issues::add( 'error', ['There was an error with the Installation.' => $this->installer->getErrors()] );
- } else {
- Session::flash( 'success', ['Resources have been installed successfully.' => $this->installer->getErrors()] );
- return $this->nextStep( 'user', true );
- }
- } elseif ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with your form.' => Check::userErrors()] );
- }
- Views::view( 'install.resources' );
- }
-
- /**
- * This is the registration step; allowing the installer to create the super admin account.
- */
- public function user() {
- if ( Input::exists( 'submit' ) && Forms::Check( 'installAdminUser' ) ) {
- $user = new User();
- if ( !$user->create( [
- 'username' => Input::post( 'newUsername' ),
- 'password' => Hash::make( Input::post( 'userPassword' ) ),
- 'email' => Input::post( 'userEmail' ),
- 'lastLogin' => time(),
- 'registered' => time(),
- 'confirmed' => 1,
- 'terms' => 1,
- 'userGroup' => 1,
- ] ) ) {
- Issues::add( 'error', 'There was an error creating the admin user.' );
- return;
- }
- $this->nextStep( 'complete' );
- return $this->complete( true );
- } elseif ( Input::exists( 'submit' ) ) {
- Issues::add( 'error', ['There was an error with your form.' => Check::userErrors()] );
- }
- Views::view( 'install.user' );
- }
-
- /**
- * This is the final step of installation. On first load it will send an email and show the final view.
- * It will then redirect to the index controller and prompt the user to delete this file on any subsequent loads.
- *
- * @param bool $sendEmail
- */
- public function complete( $sendEmail = false ) {
- if ( $sendEmail ) {
- Issues::add( 'success', 'The Tempus Project has been installed successfully.' );
- Email::send( Input::post( 'email' ), 'install', null, [ 'template' => true ] );
- return Views::view( 'install.complete' );
- }
- Session::flash( 'notice', 'Installation has been completed. Updates and installation can be managed in the admin panel. Please delete the install.php file.' );
- Redirect::to( 'home/index' );
- }
-}
-
-$app = new TheTempusProject();
-
-if ( CANARY_ENABLED ) {
- // ini_set( 'display_errors', '1' );
- // ini_set( 'display_startup_errors', '1' );
- // error_reporting( E_ALL );
- // $app->printDebug();
-}
-
-$app->setUrl( 'install/index' );
-$app->load();
-
-if ( CANARY_DEBUG_TO_CONSOLE ) {
- Components::set( 'DEBUGGING_LOG', Debug::dump() );
- register_shutdown_function( [ $app::class, 'handle_shutdown' ] );
-}
-
-exit;
diff --git a/manifest.webmanifest b/manifest.webmanifest
deleted file mode 100644
index ac0991d..0000000
--- a/manifest.webmanifest
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "icons": [
- { "src": "/images/icon-192.png", "type": "image/png", "sizes": "192x192" },
- { "src": "/images/icon-mask.png", "type": "image/png", "sizes": "512x512", "purpose": "maskable" },
- { "src": "/images/icon-512.png", "type": "image/png", "sizes": "512x512" }
- ]
-}
\ No newline at end of file