Compare commits

...

19 Commits

Author SHA1 Message Date
d7d8fc4b5e Carousel fix + fiixes 2024-12-02 21:18:36 -05:00
b1b0da0c08 wip 2024-12-02 18:56:52 -05:00
3eec88c228 Carousel fix 2024-12-02 18:04:44 -05:00
113499254b Merge remote-tracking branch 'origin/update_PHP_deps_20240821121538' 2024-08-21 08:16:05 -04:00
3b6d7f3a2c Update PHP dependencies [20240821121538] 2024-08-21 12:15:43 +00:00
09f96c369a fixes to support composer 2024-08-21 08:15:27 -04:00
afb9624971 Merge remote-tracking branch 'origin/update_PHP_deps_20240821101926' 2024-08-21 06:20:22 -04:00
8d3dee2ac2 Update PHP dependencies [20240821101926] 2024-08-21 10:19:29 +00:00
355e509e68 composer bump 2024-08-21 06:19:13 -04:00
c3f46cf6c3 Merge remote-tracking branch 'origin/update_PHP_deps_20240821101740' 2024-08-21 06:19:00 -04:00
4a521afa88 Update PHP dependencies [20240821101740] 2024-08-21 10:17:43 +00:00
0fa83b0ae6 composer bump 2024-08-21 06:17:29 -04:00
5c7a320c2a bugfixes for pagination and installation 2024-08-21 06:14:54 -04:00
551f6654f6 composer version bumps 2024-08-20 06:42:29 -04:00
80048ad1dd various bugfixes 2024-08-20 06:37:38 -04:00
80b8226218 Readme updates 2024-08-20 06:32:38 -04:00
cc9e57888f more fixes 2024-08-16 22:17:41 -04:00
ec317e6426 cleanup 2024-08-16 22:14:43 -04:00
910c9646b8 Readme updates 2024-08-15 13:50:59 -04:00
68 changed files with 2011 additions and 942 deletions

3
.gitignore vendored
View File

@ -54,12 +54,11 @@ Temporary Items
# TheTempusProject Specific
.htaccess
app/config/*
!app/config/constants.php
uploads/images/*
logs/*
.vscode/
mail.log
vendor/canary/logs/*
docker/.env
.env
components/*

441
README.md
View File

@ -1,125 +1,380 @@
# The Tempus Project
_Rapid Prototyping Framework built on PHP utilizing the MVC pattern with a Bootstrap front-end_
__Developer(s):__
need to make a vs battle for dnd. someone makes a truly broken character, we take the base character and hand it to two people and give them some time to figure out how they would break it
- __Joey Kimsey__ - _Lead Developer_
need to track points once a week
a huge table tracks points day to day then we add and erase the old data, or move it to historical...
## Rapid Prototyping Framework
### Developer(s): Joey Kimsey
The aim of this project is to provide a simple and stable platform from which to easily add functionality. The goal being the ability to quickly build and test new projects with a lightweight ecosystem to help.
**Notice: This code is in _still_ not production ready. This framework is provided as is, use at your own risk.**\
**Notice: This code is in _still_ not production ready. This framework is provided as is, use at your own risk.**
I am working very hard to ensure the system is safe and reliable enough for me to endorse its widespread use. Unfortunately, it still needs a lot of QA and improvements.
## Table of contents
[[_TOC_]]
## Find Us
* [DockerHub](https://hub.docker.com/repositories/thetempusproject)
* [Packagist](https://packagist.org/users/joeyk4816/packages/)
* [GitLab](https://git.thetempusproject.com/the-tempus-project/thetempusproject)
## Summary
The Tempus Project is a PHP application utilizing the MVC pattern to serve up simple pages and APIs with minimal effort. It requires a MySQL database to function and is designed to run equally well with nginx or apache powering the webserver. Most of the core functionality is developed in house and provided through dependencies. At this time, the frontend is driven on bootstrap 3 and FontAwesome for simplicity.
Currently I am in the process of testing all the systems in preparation for the first production ready release. The beta is still on-going. If you would like to participate or stay up to date with the latest, you can find more information at: https://TheTempusProject.com/beta
## Features
- A Plugin system that allows plug-and-play functionality
- A User management system
- groups
- permissions
- preferences
- registration and recovery
(All Controlled dynamically via our plugin interface)
- Compatibility with both Apache and NGINX
- Built with Bootstrap with a focus on mobile compatibility
- Incredibly easy to set-up, deploy, and develop
A User management system with groups, permissions, preferences, registration, and recovery. (All Controlled dynamically via our plugin interface)
A Plugin system that allows plug-and-play functionality for a huge number of features.
Compatibility with both Apache and NGINX.
Built with Bootstrap with a focus on mobile compatibility.
Incredibly easy to set-up, deploy, and develop with.
## Installation
The preferred method for installation is [Composer](#composer) but special attention has been given to installation and usage [without Composer](#composer).
### Composer
The simplest method to start a new project is to use composer to create a new project and automatically clone all the necessary files:
#### via create-project
```
composer create-project thetempusproject/thetempusproject test-app
```
#### via clone & install
1. Clone the directory to wherever you want to install the framework.
`git clone https://git.thetempusproject.com/the-tempus-project/thetempusproject.git <test-app>`
1. Open your terminal to the directory you previously cloned the repository.
`cd <test-app>`
1. Install using composer:
`php composer.phar install`
Preferred method for installation is using composer.
### Manually
### Docker
### Composer
1. Clone the directory to wherever you want to install the framework.
`git clone https://git.thetempusproject.com/the-tempus-project/thetempusproject.git <test-app>`
1. Open your terminal to the directory you previously cloned the repository.
`cd <test-app>/`
1. Clone the dependency directories to the vendor/ folder.
```
cd vendor/
git clone https://git.thetempusproject.com/the-tempus-project/bedrock.git bedrock
git clone https://git.thetempusproject.com/the-tempus-project/canary.git canary
git clone https://git.thetempusproject.com/the-tempus-project/hermes.git hermes
git clone https://git.thetempusproject.com/the-tempus-project/houdini.git houdini
```
2. Open your terminal to the directory you previously cloned the repository.
3. Install using composer:
`php composer.phar install`
4. Open your browser and navigate to install.php (it will be in the root directory of your installation)
5. When prompted, complete the forms and complete the process.
__Note:__ The autoloader should automatically detect and use the dependencies, but they need to be sorted into the folders ans shown above.
#### Apache
#### NGINX
## Docker
#### Docker-Compose
To enable quick deployment and collaboration The Tempus Project is distributed with the files to build your own docker images or stack with apache or nginx The included `docker-compose.yml` will load up an entire stack including apache and nginx, as well as a MySQL server with phpmyadmin.
If you have any trouble with the installation, you can check out our FAQ page on the wiki for answers to common issues.
You will need docker installed on your system then you can either download the latest images from DockerHud:
If you would like a full copy of the project with all of its included dependencies you can find it at https://github.com/TheTempusProject/TempusProjectFull
Please note this repository is only up to the latest _stable_ release. Please continue to use composer update to get the latest development releases.
```
docker pull thetempusproject/ttp-apache
docker pull thetempusproject/ttp-nginx
```
**Do not forget to remove install.php once you have finished installation!**
Or you can build your own images from this repository. More information can be found in the included README files:
* [Apache Image](docker/ttp-apache/README.md)
* [Nginx Image](docker/ttp-nginx/README.md)
### Docker-Compose
The Docker stack included here will build new versions of the nginx and apache webserver and launch them in individual containers. It will also create 2 more containers; one for php, and one for phpmyadmin.
```
docker-compose -f docker-compose.yml up --build -d --no-cache
```
__Note:__ If you cloned the repository from git, you will need to copy the `docker/.env.example` to `.env` in the root directory and update the contents before proceeding with docker-compose.
## Contributing
TheTempusProject is an open source project and welcomes community contributions. Please refer to the [Contributing file](CONTRIBUTING.md) for more details.
## License
See the [LICENSE](LICENSE) file for licensing information as it pertains to files in this repository.
## Currently being developed
#### Currently being developed
- [ ] Adding documentation
- [ ] Unit testing
- [ ] Unit tests
## Future updates
#### Future updates
- [ ] Expansion of PDO to allow different database types
- [ ] Update installer to account for database deltas, allowing easy updating.
- [ ] Update installer to account for updates.
- [ ] Implement uniformity in terms of error reporting, exceptions, logging.
- [ ] The templating system has gotten too large and needs to be split into its own repo
TTP ToDo:
need to integrate new plugins for some moved features
canary
comments
members
messages
Split inbox and outbox apart
split messages from usercp
redirects
need to make sure all 'use ' statements are updated to new repo names
namespace TempusDebugger; => namespace TheTempusProject\Canary;
namespace TheTempusProject\Houdini; => namespace TheTempusProject\houdini;
namespace TheTempusProject/TempusTool; => namespace TheTempusProject\Overwatch;
need a mechanism for handeling config/constants.php in each plugin
migrate all 'secondary' constants (constants not used in the default execution of the application) to plugin folders
Perform final F & R for:
"tpc"
need better handeling around blog filters like month and day
split profile from usercp
need a way to secure the api
need a standard way to do apis
need a way to show parts conditionally like {@if}
need
if
else
elseif
need a way to show something conditionally if a plugin is enabled
like {@enabled:comments}
{comments}
{@enabled}
https://css-tricks.com/drag-and-drop-file-uploading/
https://www.smashingmagazine.com/2018/01/drag-drop-file-uploader-vanilla-js/
need to merge both autoloaders into the same one under bin
need to be able to install multiple database tables for the same plugin
rename default.js and .css to main.js/css
fix where i moved those to the app/css and app/js folders
make a new template repo/dependency
make a new Debug repo/dependency
Fix the plugin
fix the console logger
add the ability to include js files
add the ability to include css files as needed
chat should include a config for the refresh timer
and better error handeling for models and plugins
need to make a singular list function to remove or combine these:
listGroupsSimple
listPosts
i need to move everything moderator relateed to comments
i also need to make sure that moderators can actually moderate
the get form html thing should work perfectly with the database array to create hella simple to generate forms for anything
we are not doing anything with requiredPlugins
comments and blog are being manually added in the admin dashboard, this could be a problem when they are disabled
removed from blog filter
commentCount
need to address the error handler just failing to work
and the exception handler picking up random errors
need to revisit all of the form checking and make sure it is apparent to the user when and how they mess something up.
many pages are missing descriptions, need to add them
https://jsonapi.org/format/
need a way for the template system to:
switch between the meta-header content types for the sharing info
xlarge
large
etc
need better checking around title, meta-image, and descriptions
prevent accidently feeding bad images or text to these fields
need to manages js and css includes better, and incorperate it into templating system
the get timezone getdate gettime format functions all need to be migrated to app, stored as static vars and refactored
in core, am i using htaccess.html or nginx.html anywhere, if not, change them to .example
Routes -> getHost is using a terrible conditional for docker hosts, need to improve
Need to test all the filters for the editor stuff
need the ability for the autoloader to accept specific file name associations
needs a require_all
need to re-namespace all classes and functions
some classes need to be converted to non-static
some functions need to be converted to more static
run from the command line
initiated // is in so many controllers, i def want this removed initialized
tempus_project.php
test running commands from cli
if we move install.php to the bin, it will be unaccessible to the web server??
if its unaccessible except theough the index.php router, we don't need to delete it because its unaccessible again
can i use submodules?
errors should be able to be customized
if its in the app
should add more logging, esp for admin actions
need to add self::$pageDescription to many pages
man, messages is hot garbage, def needs a rework
need a mechanism to add listeners and events
ability to restore backups of perms prefs and configs
if your controller has no index method, you're just SOL
a blank page is called and no method is loaded
Warns should be for failed checks
add a check for having write access to the config folder and the uploads folder
and whatever is going to be needed to the plugin downloading
some configs have been removed and need to be accounted for
Unused:
---------------------------
Config::getValue('bugReports/sendEmail')
Config::getValue('bugReports/emailTemplate')
Config::getValue('feedback/sendEmail')
Config::getValue('feedback/emailTemplate')
Config::getValue('uploads/files')
Config::getValue('uploads/images')
Config::getValue('uploads/maxFileSize')
after all changes are pushed up and available, docker needs to be tested and updated
when using composer, the composer page is populated and correct
the config step of install should be checking the db creds
// need to make notes of other standards as i go to update the contributing document
// need to cross refrence the configs from core and ttp
// ensure the resources folder is current
// document, fix, and remove @TODO's where possible
Search for cuss words, they make you look stupid
fuck
shit
dam
damm
damn
god
ass
cunt
bitch
ffs
wtf
had to remove the tracking pixel that was to be used with the contacts form, this will need to be re- added in a future update
had to remove the rest controller, its currently just unused
// this can be used for the tempus project
composer create-project laravel/laravel example-app
# Release Checklist
=====================
- [] Spell check every file.
- [] All documentation must be reviewed for accuracy.
- [] If a new year has passed, ensure the year has been updated where applicable.
- [] If default permissions, preferences, configs, base classes or models have been updated, update resources accordingly.
- []
namespace TempusDebugger; => namespace TheTempusProject\Canary;
need to make sure a template loader can be called and still use the default template file, IE always add these CSS or JS resources.
discord bot that shares updates on your party from the site
maybe a summary after each session
warning that time is coming up
changes made to anything
D&D news
is it possible to store a campaigns state on the blockchain?
keeping this as a repository for podcasts would get more people to check it out
same for youtube
people love sharing their resources, so make it EASY to find podcasts, and youtube channels, and etsy stores, and give people a place to share it with their groups
try and earn commisions from this and do featured XYZ every x days or weeks or whatever
have different "kinds" of dice to portray on the dice roll page
maybe spinners instead of conventional die
maybe weird health potions for D4's
What is my goal here?
I would like to play Dungeons and Dragons once a week with my friends. In an ideal world, I would DM this game and spend all week building tools for us to use that I then put on a website which sells memberships to other players so they can use the tools too.
i need to be able to name models in camel case, this shit is getting crazy. Find whatever prevents this and fix it

View File

@ -1,8 +1,8 @@
<?php
/**
* app/classes/admin_controller.php
* app/classes/api_controller.php
*
* This is the base admin controller. Every other admin controller should
* This is the base api controller. Every other api controller should
* extend this class.
*
* @version 3.0

View File

@ -1,12 +1,12 @@
<?php
/**
* classes/config.php
* app/classes/config.php
*
* This class handles all the hard-coded configurations.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com/Core
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Classes;

View File

@ -16,11 +16,19 @@ namespace TheTempusProject\Classes;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Models\User;
use TheTempusProject\Classes\Forms;
use TheTempusProject\Bedrock\Classes\Database;
class Forms extends Check {
private static $formHandlers = [];
private static $initialized = false;
public static function check( $formName ) {
if ( self::$initialized !== true ) {
self::initHandlers();
}
if ( empty( self::$formHandlers[ $formName ] ) ) {
Debug::error( "Form not found: $formName" );
return false;
@ -74,4 +82,530 @@ class Forms extends Check {
}
return true;
}
/**
* Adds these functions to the form list.
*/
public function __construct() {
if ( self::$initialized === true ) {
return;
}
self::initHandlers();
}
private static function initHandlers() {
self::addHandler( 'passwordResetCode', __CLASS__, 'passwordResetCode' );
self::addHandler( 'createRoute', __CLASS__, 'createRoute' );
self::addHandler( 'editRoute', __CLASS__, 'editRoute' );
self::addHandler( 'register', __CLASS__, 'register' );
self::addHandler( 'createUser', __CLASS__, 'createUser' );
self::addHandler( 'editUser', __CLASS__, 'editUser' );
self::addHandler( 'login', __CLASS__, 'login' );
self::addHandler( 'changeEmail', __CLASS__, 'changeEmail' );
self::addHandler( 'changePassword', __CLASS__, 'changePassword' );
self::addHandler( 'passwordReset', __CLASS__, 'passwordReset' );
self::addHandler( 'emailConfirmation', __CLASS__, 'emailConfirmation' );
self::addHandler( 'confirmationResend', __CLASS__, 'confirmationResend' );
self::addHandler( 'replyMessage', __CLASS__, 'replyMessage' );
self::addHandler( 'newMessage', __CLASS__, 'newMessage' );
self::addHandler( 'userPrefs', __CLASS__, 'userPrefs' );
self::addHandler( 'newGroup', __CLASS__, 'newGroup' );
self::addHandler( 'editGroup', __CLASS__, 'editGroup' );
self::addHandler( 'install', __CLASS__, 'install' );
self::addHandler( 'installStart', __CLASS__, 'install', [ 'start' ] );
self::addHandler( 'installAgreement', __CLASS__, 'install', [ 'agreement' ] );
self::addHandler( 'installCheck', __CLASS__, 'install', [ 'check' ] );
self::addHandler( 'installConfigure', __CLASS__, 'install', [ 'configure' ] );
self::addHandler( 'installRouting', __CLASS__, 'install', [ 'routing' ] );
self::addHandler( 'installModels', __CLASS__, 'install', [ 'models' ] );
self::addHandler( 'installPlugins', __CLASS__, 'install', [ 'plugins' ] );
self::addHandler( 'installResources', __CLASS__, 'install', [ 'resources' ] );
self::addHandler( 'installAdminUser', __CLASS__, 'install', [ 'adminUser' ] );
self::$initialized = true;
}
/**
* Validates the installer forms.
*
* @return {bool}
*/
public static function install( $page = '' ) {
// if ( !self::token() ) {
// return false;
// }
switch ( $page ) {
case 'configure':
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( !Database::check( Input::post( 'dbHost' ), Input::post( 'dbName' ), Input::post( 'dbUsername' ), Input::post( 'dbPassword' ) ) ) {
self::addUserError( 'DB connection error.' );
return false;
}
return true;
case 'adminUser':
if ( !self::checkUsername( Input::post( 'newUsername' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'userPassword' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'userPassword' ) !== Input::post( 'userPassword2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( Input::post( 'userEmail' ) !== Input::post( 'userEmail2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
return true;
case 'check':
if ( !self::uploads() ) {
self::addUserError( 'Uploads are disabled.' );
return false;
}
if ( !self::php() ) {
self::addUserError( 'PHP version is too old.' );
return false;
}
if ( !self::phpExtensions() ) {
self::addUserError( 'PHP extensions are missing.' );
return false;
}
if ( !self::sessions() ) {
self::addUserError( 'There is an error with Sessions.' );
return false;
}
if ( !self::mail() ) {
self::addUserError( 'PHP mail is not enabled.' );
return false;
}
if ( !self::safe() ) {
self::addUserError( 'Safe mode is enabled.' );
return false;
}
if ( ! Input::exists( 'submit' ) ) {
return false;
}
return true;
case 'start':
case 'agreement':
case 'routing':
case 'models':
case 'plugins':
case 'resources':
if ( ! Input::exists( 'submit' ) ) {
return false;
}
return true;
default:
return false;
}
return false;
}
/**
* Validates the password re-send form.
*
* @return {bool}
*/
public static function passwordResetCode() {
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the route creation form.
*
* @return {bool}
*/
public static function createRoute() {
if ( !Input::exists( 'redirect_type' ) ) {
return false;
}
if ( 'external' == Input::post( 'redirect_type' ) && !self::url( Input::post( 'forwarded_url' ) ) ) {
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the route edit form.
*
* @return {bool}
*/
public static function editRoute() {
if ( !Input::exists( 'redirect_type' ) ) {
return false;
}
if ( 'external' == Input::post( 'redirect_type' ) && !self::url( Input::post( 'forwarded_url' ) ) ) {
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user creation form.
*
* @return {bool}
*/
public static function createUser() {
$user = new User;
if ( !$user->checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( !$user->noEmailExists( Input::post( 'email' ) ) ) {
self::addUserError( 'A user with that email is already registered.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( Input::post( 'email' ) !== Input::post( 'email2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
if ( !Input::post( 'groupSelect' ) ) {
self::addUserError( 'You must select a group for the new user.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user edit form.
*
* @return {bool}
*/
public static function editUser() {
$user = new User;
if ( !$user->checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( Input::exists( 'password' ) ) {
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
}
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( !Input::post( 'groupSelect' ) ) {
self::addUserError( 'You must select a group for the new user.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user registration form.
*
* @return {bool}
*/
public static function register() {
$user = new User;
if ( !self::checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( !$user->noEmailExists( Input::post( 'email' ) ) ) {
self::addUserError( 'A user with that email is already registered.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( Input::post( 'email' ) !== Input::post( 'email2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
if ( Input::post( 'terms' ) != '1' ) {
self::addUserError( 'You must agree to the terms of service.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user login form.
*
* @return {bool}
*/
public static function login() {
if ( !self::checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the email change form.
*
* @return {bool}
*/
public static function changeEmail() {
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( Input::post( 'email' ) !== Input::post( 'email2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the password change form.
*
* @return {bool}
*/
public static function changePassword() {
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the password reset form.
*
* @return {bool}
*/
public static function passwordReset() {
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the email confirmation re-send form.
*
* @return {bool}
*/
public static function emailConfirmation() {
if ( !Input::exists( 'confirmationCode' ) ) {
self::addUserError( 'No confirmation code provided.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the email confirmation re-send form.
*
* @return {bool}
*/
public static function confirmationResend() {
if ( !Input::exists( 'resendConfirmation' ) ) {
self::addUserError( 'Confirmation not provided.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the reply message form.
*
* @return {bool}
*/
public static function replyMessage() {
if ( !Input::exists( 'message' ) ) {
self::addUserError( 'Reply cannot be empty.' );
return false;
}
if ( !Input::exists( 'messageID' ) ) {
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the new message form.
*
* @return {bool}
*/
public static function newMessage() {
if ( !Input::exists( 'toUser' ) ) {
self::addUserError( 'You must specify a user to send the message to.' );
return false;
}
if ( !Input::exists( 'subject' ) ) {
self::addUserError( 'You must have a subject for your message.' );
return false;
}
if ( !Input::exists( 'message' ) ) {
self::addUserError( 'No message entered.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user preferences form.
*
* @return {bool}
*/
public static function userPrefs() {
// @todo make this a real check
if ( !Input::exists( 'timeFormat' ) ) {
self::addUserError( 'You must specify timeFormat' );
return false;
}
if ( !Input::exists( 'pageLimit' ) ) {
self::addUserError( 'You must specify pageLimit' );
return false;
}
if ( !Input::exists( 'gender' ) ) {
self::addUserError( 'You must specify gender' );
return false;
}
if ( !Input::exists( 'dateFormat' ) ) {
self::addUserError( 'You must specify dateFormat' );
return false;
}
if ( !Input::exists( 'timezone' ) ) {
self::addUserError( 'You must specify timezone' );
return false;
}
if ( !Input::exists( 'updates' ) ) {
self::addUserError( 'You must specify updates' );
return false;
}
if ( !Input::exists( 'newsletter' ) ) {
self::addUserError( 'You must specify newsletter' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the group creation form.
*
* @return {bool}
*/
public static function newGroup() {
if ( !Input::exists( 'name' ) ) {
self::addUserError( 'You must specify a name' );
return false;
}
if ( !self::dataTitle( Input::exists( 'name' ) ) ) {
self::addUserError( 'invalid group name' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the group edit form.
*
* @return {bool}
*/
public static function editGroup() {
if ( !Input::exists( 'name' ) ) {
self::addUserError( 'You must specify a name' );
return false;
}
if ( !self::dataTitle( Input::exists( 'name' ) ) ) {
self::addUserError( 'invalid group name' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
}

View File

@ -439,7 +439,7 @@ class Installer {
// exclude any flags we don't have a matric map for
if ( empty( $module_data->class_object->$matrix ) ) {
Debug::warn( "$flag_type does not have a proper matrix map and cannot be uninstalled." );
Debug::warn( "$flag_type does not have a proper matrix map and cannot be installed." );
$module_data->$flag_type = INSTALL_STATUS_NOT_FOUND;
}
}
@ -500,7 +500,7 @@ class Installer {
// exclude any flags we don't have a matric map for
if ( empty( $module_data->class_object->$matrix ) ) {
Debug::warn( "$flag_type does not have a proper matrix map and cannot be installed." );
Debug::warn( "$flag_type does not have a proper matrix map and cannot be uninstalled." );
$module_data->$flag_type = INSTALL_STATUS_NOT_FOUND;
}
}

312
app/config/config.json Normal file
View File

@ -0,0 +1,312 @@
{
"main":
{
"logo":
{
"type": "file",
"pretty": "Site Logo (Used mostly in emails)",
"default": "images/logo.png",
"value": "images/logo.png"
},
"name":
{
"type": "text",
"pretty": "Site Name",
"default": "TTP Example",
"value": "TableTop Elite"
},
"template":
{
"type": "text",
"pretty": "Default Site Template",
"default": "default",
"value": "default"
},
"tokenEnabled":
{
"type": "radio",
"pretty": "Enable CSRF Token for all forms.",
"default": true,
"value": true
},
"loginLimit":
{
"type": "text",
"pretty": "Maximum Login Attempts per hour",
"default": 5,
"value": "5"
}
},
"uploads":
{
"files":
{
"type": "radio",
"pretty": "Enable File Uploads",
"default": true,
"value": true
},
"images":
{
"type": "radio",
"pretty": "Enable Image Uploads",
"default": true,
"value": true
},
"maxFileSize":
{
"type": "text",
"pretty": "Maximum File Size",
"default": 5000000,
"value": "5000000"
},
"maxImageSize":
{
"type": "text",
"pretty": "Maximum Image Size",
"default": 500000,
"value": "500000"
}
},
"database":
{
"dbMaxQuery":
{
"type": "text",
"pretty": "Maximum results per query",
"default": 100,
"protected": true,
"value": 100
},
"dbEnabled":
{
"type": "radio",
"pretty": "Database Enabled",
"default": true,
"protected": true,
"value": true
},
"dbHost":
{
"type": "text",
"pretty": "Database Host (IE: http://localhost:3306)",
"default": "127.0.0.1",
"protected": true,
"value": "194.195.208.99"
},
"dbName":
{
"type": "text",
"pretty": "Database Name",
"default": "ttp-example",
"protected": true,
"value": "tte-com"
},
"dbPassword":
{
"type": "text",
"pretty": "Database Password",
"default": "",
"protected": true,
"value": "lsVb#$D74816"
},
"dbPrefix":
{
"type": "text",
"pretty": "Database table Prefix",
"default": "TTP_",
"protected": true,
"value": "TTP_"
},
"dbUsername":
{
"type": "text",
"pretty": "Database Username",
"default": "root",
"protected": true,
"value": "joeyk"
}
},
"group":
{
"defaultGroup":
{
"type": "customSelect",
"pretty": "The Default Group for new registrations.",
"default": 5,
"value": 5
}
},
"logging":
{
"admin":
{
"type": "radio",
"pretty": "Enable Admin Action Logging.",
"default": true,
"value": true
},
"errors":
{
"type": "radio",
"pretty": "Enable Error Logging",
"default": true,
"value": true
},
"logins":
{
"type": "radio",
"pretty": "Enable Login Logging",
"default": true,
"value": true
}
},
"bugreports":
{
"enabled":
{
"type": "radio",
"pretty": "Enable Bug reporting.",
"default": true,
"value": true
},
"sendEmail":
{
"type": "radio",
"pretty": "Email the user after submitting.",
"default": true,
"value": true
},
"emailTemplate":
{
"type": "text",
"pretty": "Email Template",
"default": "BugReportEmail",
"value": "BugReportEmail"
}
},
"bugtracker":
{
"enabled":
{
"type": "radio",
"pretty": "Enable Bug tracking.",
"default": true,
"value": true
}
},
"calendar":
{
"enabled":
{
"type": "radio",
"pretty": "Enable Calendar.",
"default": true,
"value": true
}
},
"chat":
{
"enabled":
{
"type": "radio",
"pretty": "Enable Chat.",
"default": true,
"value": true
}
},
"dice":
{
"enabled":
{
"type": "radio",
"pretty": "Enable dice usage.",
"default": true,
"value": true
}
},
"dnd":
{
"enabled":
{
"type": "radio",
"pretty": "Enable D&D plugin.",
"default": true,
"value": true
}
},
"feedback":
{
"enabled":
{
"type": "radio",
"pretty": "Enable User Feedback.",
"default": true,
"value": true
},
"sendEmail":
{
"type": "radio",
"pretty": "Email the user after submitting.",
"default": false,
"value": false
},
"emailTemplate":
{
"type": "text",
"pretty": "Email Template",
"default": "feedbackEmail",
"value": "feedbackEmail"
}
},
"initiativeTracker":
{
"enabled":
{
"type": "radio",
"pretty": "Enable tracker usage.",
"default": true,
"value": true
}
},
"npcGeneration":
{
"enabled":
{
"type": "radio",
"pretty": "Enable NPC-Generator usage.",
"default": true,
"value": true
}
},
"rng":
{
"enabled":
{
"type": "radio",
"pretty": "Enable rng usage.",
"default": true,
"value": true
}
},
"tablefinder":
{
"enabled":
{
"type": "radio",
"pretty": "Enable the table finder.",
"default": true,
"value": true
}
},
"timers":
{
"enabled":
{
"type": "radio",
"pretty": "Enable timer usage.",
"default": true,
"value": true
}
}
}

View File

@ -0,0 +1 @@
{"main":{"logo":{"value":"images\/logo.png"},"name":{"value":"Table-Top Elite"},"loginLimit":{"type":"text","pretty":"Maximum Login Attempts per hour","default":5,"value":5}},"database":{"dbMaxQuery":{"value":100},"dbEnabled":{"value":true},"dbHost":{"value":"194.195.208.99"},"dbName":{"value":"tte-com"},"dbPassword":{"value":"lsVb#$D74816"},"dbPrefix":{"value":"TTP_"},"dbUsername":{"value":"joeyk"}}}

View File

@ -43,6 +43,8 @@ if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
// Cookies
define( 'DEFAULT_COOKIE_PREFIX', 'TP_');
// Debug
define( 'CANARY_DEBUG_DIRECTORY', APP_ROOT_DIRECTORY . 'logs' . DIRECTORY_SEPARATOR );
define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
@ -131,5 +133,14 @@ if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
define( 'DEFAULT_SESSION_PREFIX', 'TP_' );
// Token
define( 'DEFAULT_TOKEN_NAME', 'TP_SESSION_TOKEN' );
# Bugsnag
define( 'BUGSNAG_API_KEY', '88045bdc058de51139ac1a47dcd5694b' );
// define( 'BUGSNAG_API_KEY', 'cb94acd2a46160589b37cbaad0c61047' );
# Recaptcha
# Google Analytics
# Tell the app; all constants have been loaded
define( 'TEMPUS_PROJECT_CONSTANTS_LOADED', true );

1
app/config/install.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"bugReport":{"pretty":"Can Submit Bug Reports","default":false},"bugTrack":{"pretty":"Can Track Bugs","default":false},"useCalendar":{"pretty":"Can use the calendar feature","default":false},"createEvents":{"pretty":"Can add events to calendars","default":false},"chat":{"pretty":"Can use chat","default":false},"modAccess":{"pretty":"Access Moderator Areas","default":false},"dice":{"pretty":"Can use dice","default":true},"canCreateCharacters":{"pretty":"Can use the character creator","default":true},"canCreateClasses":{"pretty":"Can add Classes.","default":true},"canCreateItems":{"pretty":"Can add Items","default":true},"canCreateMonsters":{"pretty":"Can add Monsters","default":true},"canCreateRaces":{"pretty":"Can add Races","default":true},"canCreateSkills":{"pretty":"Can add Skills","default":true},"canCreateSourceBooks":{"pretty":"Can add SourceBooks","default":true},"canCreateSpells":{"pretty":"Can add Spells","default":true},"feedback":{"pretty":"Can Submit Feedback","default":false},"uploadFiles":{"pretty":"Can upload files","default":false},"useInitiativeTracker":{"pretty":"Can use the tracker","default":true},"memberAccess":{"pretty":"Access Member Areas","default":false},"controlMemberships":{"pretty":"User can Access and Control user memberships.","default":false},"sendMessages":{"pretty":"Can send Messages","default":false},"sendNotifications":{"pretty":"Can send notifications","default":false},"suggest":{"pretty":"Can create suggestions","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"useTableFinder":{"pretty":"Can use the table finder","default":true},"timers":{"pretty":"Can use timers","default":true}}

View File

@ -0,0 +1 @@
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"bugReport":{"pretty":"Can Submit Bug Reports","default":false},"bugTrack":{"pretty":"Can Track Bugs","default":false},"useCalendar":{"pretty":"Can use the calendar feature","default":false},"createEvents":{"pretty":"Can add events to calendars","default":false},"chat":{"pretty":"Can use chat","default":false},"modAccess":{"pretty":"Access Moderator Areas","default":false},"dice":{"pretty":"Can use dice","default":true},"canCreateCharacters":{"pretty":"Can use the character creator","default":true},"canCreateClasses":{"pretty":"Can add Classes.","default":true},"canCreateItems":{"pretty":"Can add Items","default":true},"canCreateMonsters":{"pretty":"Can add Monsters","default":true},"canCreateRaces":{"pretty":"Can add Races","default":true},"canCreateSkills":{"pretty":"Can add Skills","default":true},"canCreateSourceBooks":{"pretty":"Can add SourceBooks","default":true},"canCreateSpells":{"pretty":"Can add Spells","default":true},"feedback":{"pretty":"Can Submit Feedback","default":false},"uploadFiles":{"pretty":"Can upload files","default":false},"useInitiativeTracker":{"pretty":"Can use the tracker","default":true},"memberAccess":{"pretty":"Access Member Areas","default":false},"controlMemberships":{"pretty":"User can Access and Control user memberships.","default":false},"sendMessages":{"pretty":"Can send Messages","default":false},"sendNotifications":{"pretty":"Can send notifications","default":false},"suggest":{"pretty":"Can create suggestions","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"useTableFinder":{"pretty":"Can use the table finder","default":true},"timers":{"pretty":"Can use timers","default":true}}

View File

@ -0,0 +1 @@
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"calendarPreference":{"pretty":"Default Calendar View","type":"select","default":"byMonth","options":{"Daily":"byDay","Weekly":"byWeek","Monthly":"byMonth","Yearly":"byYear","All Events":"events"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"weekStart":{"pretty":"First day of the week for the Calendar","type":"select","default":"sunday","options":{"Sunday":"6","Monday":"7"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"}}

View File

@ -0,0 +1 @@
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"calendarPreference":{"pretty":"Default Calendar View","type":"select","default":"byMonth","options":{"Daily":"byDay","Weekly":"byWeek","Monthly":"byMonth","Yearly":"byYear","All Events":"events"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"},"weekStart":{"pretty":"First day of the week for the Calendar","type":"select","default":"sunday","options":{"Sunday":"6","Monday":"7"},"avatar":"\/var\/www\/tabletopelite.com\/images\/defaultAvatar.png"}}

View File

@ -39,7 +39,7 @@ class Admin extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
return Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
}
public function view( $id = null ) {

View File

@ -59,6 +59,6 @@ class Composer extends AdminController {
$out[] = (object) $versionsInstalled[ $name ];
}
Views::view( 'admin.dependencies', $out );
Views::view( 'admin.modules.composer.dependencies', $out );
}
}

View File

@ -39,7 +39,7 @@ class Errors extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
return Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
}
public function view( $id = null ) {

View File

@ -95,7 +95,7 @@ class Groups extends AdminController {
}
public function index( $data = null ) {
Views::view( 'admin.groups.list', self::$group->list() );
Views::view( 'admin.groups.list', self::$group->listPaginated() );
}
public function listmembers( $data = null ) {

View File

@ -39,7 +39,7 @@ class Logins extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
return Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
}
public function view( $id = null ) {

View File

@ -26,8 +26,8 @@ class Logs extends AdminController {
}
public function index( $data = null ) {
Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
}
}

View File

@ -11,7 +11,7 @@
*/
namespace TheTempusProject\Controllers\Admin;
use TheTempusProject\TTPForms;
use TheTempusProject\Classes\Forms as TTPForms;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Houdini\Classes\Issues;
use TheTempusProject\Houdini\Classes\Navigation;
@ -88,7 +88,7 @@ class Routes extends AdminController {
}
public function index() {
return Views::view( 'admin.routes.list', self::$routes->list() );
return Views::view( 'admin.routes.list', self::$routes->listPaginated() );
}
public function view( $id = null ) {

View File

@ -140,7 +140,7 @@ class Users extends AdminController {
}
public function index() {
Views::view( 'admin.users.list', self::$user->userList() );
Views::view( 'admin.users.list', self::$user->listPaginated() );
}
public function view( $id = null ) {

View File

@ -30,7 +30,7 @@ class Users extends ApiController {
$response = 'No user found.';
} else {
$responseType = 'data';
$response = $user;
$response = $user->ID;
}
Views::view( 'api.response', ['response' => json_encode( [ $responseType => $response ], true )]);
}

View File

@ -29,6 +29,11 @@ class Home extends Controller {
self::$title = '{SITENAME}';
self::$pageDescription = 'This is the homepage of your new Tempus Project Installation. Thank you for installing. find more info at https://thetempusproject.com';
Views::view( 'index' );
Template::addHeader( 'Access-Control-Allow-Origin: *');
$bugsnag = \Bugsnag\Client::make( BUGSNAG_API_KEY );
\Bugsnag\Handler::register($bugsnag);
$bugsnag->notifyException(new \RuntimeException("Test error"));
}
public function login() {

View File

@ -217,7 +217,7 @@ pre {
color: #000;
background-color: #FFF;
}
#carousel-example-generic {
#carousel-home {
margin-bottom: 30px;
}
.col-centered {

View File

@ -1,542 +0,0 @@
<?php
/**
* app/functions/forms.php
*
* This class is used in conjunction with TheTempusProject\Bedrock\Classes\Check
* to house complete form verification. You can utilize the error reporting
* to easily define exactly what feedback you would like to give.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Models\User;
use TheTempusProject\Classes\Forms;
use TheTempusProject\Bedrock\Classes\Database;
class TTPForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'passwordResetCode', __CLASS__, 'passwordResetCode' );
self::addHandler( 'createRoute', __CLASS__, 'createRoute' );
self::addHandler( 'editRoute', __CLASS__, 'editRoute' );
self::addHandler( 'register', __CLASS__, 'register' );
self::addHandler( 'createUser', __CLASS__, 'createUser' );
self::addHandler( 'editUser', __CLASS__, 'editUser' );
self::addHandler( 'login', __CLASS__, 'login' );
self::addHandler( 'changeEmail', __CLASS__, 'changeEmail' );
self::addHandler( 'changePassword', __CLASS__, 'changePassword' );
self::addHandler( 'passwordReset', __CLASS__, 'passwordReset' );
self::addHandler( 'emailConfirmation', __CLASS__, 'emailConfirmation' );
self::addHandler( 'confirmationResend', __CLASS__, 'confirmationResend' );
self::addHandler( 'replyMessage', __CLASS__, 'replyMessage' );
self::addHandler( 'newMessage', __CLASS__, 'newMessage' );
self::addHandler( 'userPrefs', __CLASS__, 'userPrefs' );
self::addHandler( 'newGroup', __CLASS__, 'newGroup' );
self::addHandler( 'editGroup', __CLASS__, 'editGroup' );
self::addHandler( 'install', __CLASS__, 'install' );
self::addHandler( 'installStart', __CLASS__, 'install', [ 'start' ] );
self::addHandler( 'installAgreement', __CLASS__, 'install', [ 'agreement' ] );
self::addHandler( 'installCheck', __CLASS__, 'install', [ 'check' ] );
self::addHandler( 'installConfigure', __CLASS__, 'install', [ 'configure' ] );
self::addHandler( 'installRouting', __CLASS__, 'install', [ 'routing' ] );
self::addHandler( 'installModels', __CLASS__, 'install', [ 'models' ] );
self::addHandler( 'installPlugins', __CLASS__, 'install', [ 'plugins' ] );
self::addHandler( 'installResources', __CLASS__, 'install', [ 'resources' ] );
self::addHandler( 'installAdminUser', __CLASS__, 'install', [ 'adminUser' ] );
}
/**
* Validates the installer forms.
*
* @return {bool}
*/
public static function install( $page = '' ) {
// if ( !self::token() ) {
// return false;
// }
switch ( $page ) {
case 'configure':
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( !Database::check( Input::post( 'dbHost' ), Input::post( 'dbName' ), Input::post( 'dbUsername' ), Input::post( 'dbPassword' ) ) ) {
self::addUserError( 'DB connection error.' );
return false;
}
return true;
case 'adminUser':
if ( !self::checkUsername( Input::post( 'newUsername' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'userPassword' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'userPassword' ) !== Input::post( 'userPassword2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( Input::post( 'userEmail' ) !== Input::post( 'userEmail2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
return true;
case 'check':
if ( !self::uploads() ) {
self::addUserError( 'Uploads are disabled.' );
return false;
}
if ( !self::php() ) {
self::addUserError( 'PHP version is too old.' );
return false;
}
if ( !self::phpExtensions() ) {
self::addUserError( 'PHP extensions are missing.' );
return false;
}
if ( !self::sessions() ) {
self::addUserError( 'There is an error with Sessions.' );
return false;
}
if ( !self::mail() ) {
self::addUserError( 'PHP mail is not enabled.' );
return false;
}
if ( !self::safe() ) {
self::addUserError( 'Safe mode is enabled.' );
return false;
}
if ( ! Input::exists( 'submit' ) ) {
return false;
}
return true;
case 'start':
case 'agreement':
case 'routing':
case 'models':
case 'plugins':
case 'resources':
if ( ! Input::exists( 'submit' ) ) {
return false;
}
return true;
default:
return false;
}
return false;
}
/**
* Validates the password re-send form.
*
* @return {bool}
*/
public static function passwordResetCode() {
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the route creation form.
*
* @return {bool}
*/
public static function createRoute() {
if ( !Input::exists( 'redirect_type' ) ) {
return false;
}
if ( 'external' == Input::post( 'redirect_type' ) && !self::url( Input::post( 'forwarded_url' ) ) ) {
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the route edit form.
*
* @return {bool}
*/
public static function editRoute() {
if ( !Input::exists( 'redirect_type' ) ) {
return false;
}
if ( 'external' == Input::post( 'redirect_type' ) && !self::url( Input::post( 'forwarded_url' ) ) ) {
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user creation form.
*
* @return {bool}
*/
public static function createUser() {
$user = new User;
if ( !$user->checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( !$user->noEmailExists( Input::post( 'email' ) ) ) {
self::addUserError( 'A user with that email is already registered.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( Input::post( 'email' ) !== Input::post( 'email2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
if ( !Input::post( 'groupSelect' ) ) {
self::addUserError( 'You must select a group for the new user.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user edit form.
*
* @return {bool}
*/
public static function editUser() {
$user = new User;
if ( !$user->checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( Input::exists( 'password' ) ) {
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
}
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( !Input::post( 'groupSelect' ) ) {
self::addUserError( 'You must select a group for the new user.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user registration form.
*
* @return {bool}
*/
public static function register() {
$user = new User;
if ( !self::checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( !$user->noEmailExists( Input::post( 'email' ) ) ) {
self::addUserError( 'A user with that email is already registered.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( Input::post( 'email' ) !== Input::post( 'email2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
if ( Input::post( 'terms' ) != '1' ) {
self::addUserError( 'You must agree to the terms of service.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user login form.
*
* @return {bool}
*/
public static function login() {
if ( !self::checkUsername( Input::post( 'username' ) ) ) {
self::addUserError( 'Invalid username.' );
return false;
}
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the email change form.
*
* @return {bool}
*/
public static function changeEmail() {
if ( !self::email( Input::post( 'email' ) ) ) {
self::addUserError( 'Invalid Email.' );
return false;
}
if ( Input::post( 'email' ) !== Input::post( 'email2' ) ) {
self::addUserError( 'Emails do not match.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the password change form.
*
* @return {bool}
*/
public static function changePassword() {
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the password reset form.
*
* @return {bool}
*/
public static function passwordReset() {
if ( !self::password( Input::post( 'password' ) ) ) {
self::addUserError( 'Invalid password.' );
return false;
}
if ( Input::post( 'password' ) !== Input::post( 'password2' ) ) {
self::addUserError( 'Passwords do not match.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the email confirmation re-send form.
*
* @return {bool}
*/
public static function emailConfirmation() {
if ( !Input::exists( 'confirmationCode' ) ) {
self::addUserError( 'No confirmation code provided.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the email confirmation re-send form.
*
* @return {bool}
*/
public static function confirmationResend() {
if ( !Input::exists( 'resendConfirmation' ) ) {
self::addUserError( 'Confirmation not provided.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the reply message form.
*
* @return {bool}
*/
public static function replyMessage() {
if ( !Input::exists( 'message' ) ) {
self::addUserError( 'Reply cannot be empty.' );
return false;
}
if ( !Input::exists( 'messageID' ) ) {
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the new message form.
*
* @return {bool}
*/
public static function newMessage() {
if ( !Input::exists( 'toUser' ) ) {
self::addUserError( 'You must specify a user to send the message to.' );
return false;
}
if ( !Input::exists( 'subject' ) ) {
self::addUserError( 'You must have a subject for your message.' );
return false;
}
if ( !Input::exists( 'message' ) ) {
self::addUserError( 'No message entered.' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the user preferences form.
*
* @return {bool}
*/
public static function userPrefs() {
// @todo make this a real check
if ( !Input::exists( 'timeFormat' ) ) {
self::addUserError( 'You must specify timeFormat' );
return false;
}
if ( !Input::exists( 'pageLimit' ) ) {
self::addUserError( 'You must specify pageLimit' );
return false;
}
if ( !Input::exists( 'gender' ) ) {
self::addUserError( 'You must specify gender' );
return false;
}
if ( !Input::exists( 'dateFormat' ) ) {
self::addUserError( 'You must specify dateFormat' );
return false;
}
if ( !Input::exists( 'timezone' ) ) {
self::addUserError( 'You must specify timezone' );
return false;
}
if ( !Input::exists( 'updates' ) ) {
self::addUserError( 'You must specify updates' );
return false;
}
if ( !Input::exists( 'newsletter' ) ) {
self::addUserError( 'You must specify newsletter' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the group creation form.
*
* @return {bool}
*/
public static function newGroup() {
if ( !Input::exists( 'name' ) ) {
self::addUserError( 'You must specify a name' );
return false;
}
if ( !self::dataTitle( Input::exists( 'name' ) ) ) {
self::addUserError( 'invalid group name' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the group edit form.
*
* @return {bool}
*/
public static function editGroup() {
if ( !Input::exists( 'name' ) ) {
self::addUserError( 'You must specify a name' );
return false;
}
if ( !self::dataTitle( Input::exists( 'name' ) ) ) {
self::addUserError( 'invalid group name' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
}
new TTPForms;

View File

@ -11,101 +11,8 @@
/**
* Automatically selects/de-selects all check boxes associated with that field
**/
function checkAll(ele) {
var checkboxes = document.getElementsByTagName( 'input' );
if (ele.checked) {
test = true;
} else {
test = false;
}
for ( var i = 0; i < checkboxes.length; i++ ) {
if ( checkboxes[i].type == 'checkbox' ) {
if ( checkboxes[i].name == ele.value ) {
checkboxes[i].checked = test;
}
}
}
}
function copyAll( ele ) {
var eleName = '#' + ele;
var text = $( eleName ).text();
text = text.replaceAll( "''", "\n" ).trim();
text = text.substring( 1, text.length - 1 );
navigator.clipboard.writeText( text );
console.log( '#' + ele );
}
function insertTag( box, tag ) {
var Field = document.getElementById( box );
var currentPos = cursorPos( Field );
var val = Field.value;
var before = val.substring( 0, currentPos );
var after = val.substring( currentPos, val.length );
Field.value = before + '(' + tag + ')' + after;
}
import BugsnagPerformance from '//d2wy8f7a9ursnm.cloudfront.net/v1/bugsnag-performance.min.js'
function cursorPos( el ) {
if ( el.selectionStart ) {
return el.selectionStart;
} else if ( document.selection ) {
el.focus();
var r = document.selection.createRange();
if ( r == null ) {
return 0;
}
var re = el.createTextRange(),
rc = re.duplicate();
re.moveToBookmark( r.getBookmark() );
rc.setEndPoint( 'EndToStart', re );
return rc.text.length;
}
return 0;
}
function getRandomInt(min, max) {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled);
}
$(document).ready(function() {
$('select').each(function() {
var selectedValue = $(this).attr('value');
if (selectedValue) {
$(this).removeAttr('value');
$(this).find('option').each(function() {
if ($(this).attr('value') === selectedValue) {
$(this).prop('selected', true);
}
});
}
});
});
// with the dynamic footer, you need to adjust the content padding to make sure the footer doesn't overlap the content
window.onload = function () {
function updateFooterPadding() {
var footer = document.querySelector('footer');
var container = document.querySelector('.container-fluid.top-pad');
if ( ! container ) {
return;
}
// footer has no height but its children do!
var footerHeight = Array.from(footer.children).reduce((totalHeight, child) => {
return totalHeight + child.offsetHeight;
}, 0);
footerHeight += 20; // Add 20px for padding
// console.error(footerHeight);
container.style.setProperty('--footer-height', footerHeight + 'px');
}
// Update padding on initial load
updateFooterPadding();
// Update padding on window resize
window.addEventListener('resize', updateFooterPadding);
};
BugsnagPerformance.start({ apiKey: '88045bdc058de51139ac1a47dcd5694b' });

View File

@ -257,7 +257,7 @@ class Group extends DatabaseModel {
if ( $group === false ) {
return false;
}
$members = self::$db->get( 'users', [ 'userGroup', '=', $id ] );
$members = self::$db->getPaginated( 'users', [ 'userGroup', '=', $id ] );
if ( !$members->count() ) {
Debug::info( "list members: Could not find anyone in group: $id" );
return false;

View File

@ -13,7 +13,7 @@ namespace TheTempusProject\Models;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\Canary\Bin\Canary as Debug;

View File

@ -21,7 +21,7 @@ use TheTempusProject\Bedrock\Functions\Hash;
use TheTempusProject\Bedrock\Functions\Session;
use TheTempusProject\Bedrock\Functions\Code;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\Classes\Email;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\Classes\Preferences;

View File

@ -17,11 +17,14 @@ use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Sanitize;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\Houdini\Classes\Filters;
use TheTempusProject\Plugins\Comments as CommentPlugin;
use TheTempusProject\Models\Comments;
class Posts extends DatabaseModel {
public $tableName = 'posts';
public static $comments = false;
public $databaseMatrix = [
[ 'author', 'int', '11' ],
@ -32,19 +35,14 @@ class Posts extends DatabaseModel {
[ 'content', 'text', '' ],
];
public $resourceMatrix = [
[
'title' => 'Welcome',
'content' => '<p>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 <a href="https://TheTempusProject.com">here</a>.</p>',
'author' => 1,
'created' => '{time}',
'edited' => '{time}',
'draft' => 0,
],
];
public function __construct() {
parent::__construct();
if ( class_exists( 'TheTempusProject\Plugins\Comments' ) ) {
$comments = new CommentPlugin;
if ( $comments->checkEnabled() ) {
self::$comments = new Comments;
}
}
}
public function newPost( $title, $post, $draft ) {
@ -161,6 +159,9 @@ class Posts extends DatabaseModel {
if ( isset( $params['stripHtml'] ) && $params['stripHtml'] === true ) {
$instance->contentSummary = strip_tags( $instance->content );
}
if ( self::$comments !== false ) {
$instance->commentCount = self::$comments->count( 'blog', $instance->ID );
}
$instance->content = Filters::applyOne( 'mentions.0', $instance->content, true );
$instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
$out[] = $instance;

View File

@ -38,6 +38,18 @@ class Blog extends Plugin {
'url' => '{ROOT_URL}blog/index',
],
];
public $resourceMatrix = [
'posts' => [
[
'title' => 'Welcome',
'content' => '<p>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 <a href="https://TheTempusProject.com">here</a>.</p>',
'author' => 1,
'created' => '{time}',
'edited' => '{time}',
'draft' => 0,
],
],
];
public $posts;
public function __construct( $load = false ) {

View File

@ -15,7 +15,7 @@ namespace TheTempusProject\Models;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\Plugins\Bugreport as Plugin;
use TheTempusProject\TheTempusProject as App;

View File

@ -10,7 +10,7 @@
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Feedback;
namespace TheTempusProject\Plugins\Comments;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;

View File

@ -18,7 +18,7 @@ use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\Houdini\Classes\Filters;
class Comments extends DatabaseModel {

View File

@ -54,7 +54,7 @@ class Comments extends Plugin {
],
];
public $resourceMatrix = [
'group' => [
'groups' => [
[
'name' => 'Moderator',
'permissions' => '{"adminAccess":false}',

View File

@ -53,6 +53,6 @@ class Feedback extends AdminController {
}
public function index( $data = null ) {
Views::view( 'feedback.admin.list', self::$feedback->list() );
Views::view( 'feedback.admin.list', self::$feedback->listPaginated() );
}
}

View File

@ -18,7 +18,7 @@ use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Sanitize;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
class Message extends DatabaseModel {
public $tableName = 'messages';
@ -61,7 +61,7 @@ class Message extends DatabaseModel {
Debug::info( 'Invalid user ID' );
return false;
}
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $parent ] );
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $parent ] );
if ( $messageData->count() == 0 ) {
Debug::info( 'Message not found.' );
return false;
@ -71,7 +71,7 @@ class Message extends DatabaseModel {
if ( $type !== null ) {
$params = array_merge( $params, [ 'AND', $type, '=', $user ] );
}
$messageData = self::$db->get( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
$messageData = self::$db->getPaginated( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
if ( $messageData->count() != 0 ) {
if ( $messageData->first()->recieverDeleted == 0 ) {
$message = $messageData->first();
@ -93,7 +93,7 @@ class Message extends DatabaseModel {
Debug::info( 'Invalid ID' );
return false;
}
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] );
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $id ] );
if ( $messageData->count() == 0 ) {
Debug::info( 'Message not found.' );
return false;
@ -122,7 +122,7 @@ class Message extends DatabaseModel {
} else {
$find = $message->ID;
}
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
Components::set( 'PID', $find );
if ( $markRead == true ) {
@ -138,7 +138,7 @@ class Message extends DatabaseModel {
$limit = 10;
}
$limit = [ 0, $limit ];
$messageData = self::$db->get(
$messageData = self::$db->getPaginated(
$this->tableName,
[
'parent', '=', 0,
@ -175,7 +175,7 @@ class Message extends DatabaseModel {
$limit = 10;
}
$limit = [ 0, $limit ];
$messageData = self::$db->get(
$messageData = self::$db->getPaginated(
$this->tableName,
[
'parent', '=', 0,

View File

@ -10,7 +10,7 @@
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Feedback;
namespace TheTempusProject\Plugins\Notifications;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;

View File

@ -1,12 +1,10 @@
<?php
/**
* app/plugins/feedback/models/feedback.php
* app/plugins/notifications/models/notification.php
*
* This class is used for the manipulation of the feedback database table.
* This class is used for the manipulation of the notifications database table.
*
* @todo make this send a confirmation email
*
* @package TP Feedback
* @package TP Notifications
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
@ -18,10 +16,9 @@ use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\Plugins\Feedback as Plugin;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Canary\Classes\CustomException;
class Notification extends DatabaseModel {
public $tableName = 'notifications';
@ -34,15 +31,6 @@ class Notification extends DatabaseModel {
[ 'deletedAt', 'int', '11' ],
[ 'seenAt', 'int', '11' ],
];
public $plugin;
/**
* The model constructor.
*/
public function __construct() {
parent::__construct();
$this->plugin = new Plugin;
}
public function getUnreadCount( $userID ) {
$result = self::$db->get(
@ -86,9 +74,9 @@ class Notification extends DatabaseModel {
'expiresAt', '<', time(),
];
if ( empty( $limit ) ) {
$notifications = self::$db->get( $this->tableName, $whereClause );
$notifications = self::$db->getPaginated( $this->tableName, $whereClause );
} else {
$notifications = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
$notifications = self::$db->getPaginated( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$notifications->count() ) {
Debug::info( 'No Notifications found.' );

View File

@ -28,4 +28,3 @@
</table>
</form>
</div>
{PAGINATION}

View File

@ -1,10 +1,10 @@
<?php
/**
* app/plugins/feedback/plugin.php
* app/plugins/redirects/plugin.php
*
* This houses all of the main plugin info and functionality.
*
* @package TP Feedback
* @package TP Redirects
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com

View File

@ -16,6 +16,8 @@ use ReflectionClass;
use TheTempusProject\Classes\Installer;
use TheTempusProject\Houdini\Classes\Navigation;
use TheTempusProject\Classes\Plugin;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\TheTempusProject as App;
class Subscribe extends Plugin {
@ -31,4 +33,9 @@ class Subscribe extends Plugin {
'url' => '{ROOT_URL}admin/subscriptions',
],
];
public function __construct( $load = false ) {
parent::__construct( $load );
Components::set( 'FOOTER_RIGHT', Views::simpleView( 'subscribe.footer.right') );
}
}

View File

@ -0,0 +1,15 @@
<div class="col-lg-3 text-center">
<h3>Subscribe</h3>
<ul>
<li>
<div class="input-append newsletter-box">
<form action="{ROOT_URL}subscribe/home" method="post" class="form-horizontal">
<input type="email" class="full form-control" placeholder="Email" id="email" name="email" autocomplete="email" style="margin-bottom: 15px;">
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Subscribe</button>
</form>
</div>
</li>
</ul>
</div>

View File

@ -28,12 +28,23 @@ class DefaultLoader extends Loader {
public function __construct() {
Components::set( 'TEMPLATE_URL', Template::parse( '{ROOT_URL}app/templates/default/' ) );
if ( VENDOR_AUTOLOADED === true ) {
Components::set( 'FONT_AWESOME_URL', '/vendor/fortawesome/font-awesome/css/' );
Components::set( 'BOOTSTRAP_CDN', '/vendor/twbs/bootstrap/dist/' );
Components::set( 'JQUERY_CDN', '/vendor/components/jquery/' );
} else {
Components::set( 'BOOTSTRAP_CDN', self::BOOTSTRAP_CDN );
Components::set( 'JQUERY_CDN', self::JQUERY_CDN );
Components::set( 'FONT_AWESOME_URL', self::FONT_AWESOME_URL );
}
$this->addCss( '<link rel="stylesheet" href="{ROOT_URL}app/css/main.css">' );
$this->addJs( '<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{ROOT_URL}app/js/main.js"></script>' );
Components::set( 'LOGO', Config::getValue( 'main/logo' ) );
Components::set( 'FOOT', Navigation::getMenuView( 'foot', 'FOOTER_LINKS', App::FOOTER_MENU_NAME, false ) );
Components::set( 'COPY', Views::simpleView( 'copy') );
Components::setIfNull( 'LOGO', Config::getValue( 'main/logo' ) );
Components::setIfNull( 'FOOTER_LEFT', Navigation::getMenuView( 'footer.left', 'FOOTER_LINKS', App::FOOTER_MENU_NAME, false ) );
Components::setIfNull( 'FOOTER_CENTER', Views::simpleView( 'footer.center') );
Components::setIfNull( 'FOOTER_RIGHT', Views::simpleView( 'footer.right') );
Components::setIfNull( 'FOOT', Views::simpleView( 'footer.container') );
Components::setIfNull( 'COPY', Views::simpleView( 'copy') );
/**
* Top-Nav
*/
@ -47,8 +58,6 @@ class DefaultLoader extends Loader {
Components::set( 'topNavRight', Template::parse( App::$topNavRight . '{STATUS}' ) );
Components::set( 'topNavLeft', Navigation::getMenuView( 'nav.main', 'MENU_LINKS', App::MAIN_MENU_NAME ) );
Components::set( 'JQUERY_CDN', self::JQUERY_CDN );
Components::set( 'FONT_AWESOME_URL', self::FONT_AWESOME_URL );
Components::set( 'colorSelect', Views::simpleView( 'forms.colorSelect' ) );
Components::set( 'iconSelect', Views::simpleView( 'forms.iconSelect' ) );
Navigation::setCrumbComponent( 'BREADCRUMB', Input::get( 'url' ) );

View File

@ -34,6 +34,17 @@
<link rel="stylesheet" href="{BOOTSTRAP_CDN}css/bootstrap.min.css" crossorigin="anonymous">
<!-- Custom styles for this template -->
{TEMPLATE_CSS_INCLUDES}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ETGVZS7PZW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ETGVZS7PZW');
</script>
<!-- Bugsnag -->
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="https://d2wy8f7a9ursnm.cloudfront.net/v1/bugsnag-performance.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">

View File

@ -1,5 +1,4 @@
<legend><h2>Installed Dependencies</h2></legend>
{PAGINATION}
<table class="table table-striped">
<thead>
<tr>

View File

@ -1,5 +1,4 @@
<legend><h2>Installed Models</h2></legend>
{PAGINATION}
<table class="table table-striped">
<thead>
<tr>

View File

@ -1,5 +1,4 @@
<legend><h2>Installed Plugins</h2></legend>
{PAGINATION}
<table class="table table-striped">
<thead>
<tr>

View File

@ -1,44 +0,0 @@
<div class="footer-head" id="footer-head">
<div class="container">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center hidden-lg hidden-md hidden-sm">
<a href="#footer" class="navbar-toggle collapsed" data-toggle="collapse">
<span class="bars"></span>
<span class="sr-only">Toggle navigation</span>
</a>
</div>
<div id="footer" class="navbar-collapse collapse">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 text-center">
<h3> Contact </h3>
<ul>
{FOOTER_LINKS}
</ul>
</div>
<div class="col-lg-6 col-md-6 col-sm-4 col-xs-4 text-center">
<div class="social">
<i><a href="{ROOT_URL}fb"><span class="fa fa-facebook"></span></a></i>
<i><a href="{ROOT_URL}twitter"><span class="fa fa-twitter"></span></a></i>
<i><a href="{ROOT_URL}in"><span class="fa fa-linkedin"></span></a></i>
<i><a href="{ROOT_URL}youtube"><span class="fa fa-youtube"></span></a></i>
<i><a href="{ROOT_URL}git"><span class="fa fa-github"></span></a></i>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-8 pull-right text-center">
<h3>Subscribe</h3>
<ul>
<li>
<div class="input-append newsletter-box">
hey stupid, this should not be here, this should live in the subscribe plugin
<form action="{ROOT_URL}subscribe/home" method="post" class="form-horizontal">
<input type="email" class="full" placeholder="Email" id="email" name="email" autocomplete="email">
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Subscribe</button>
</form>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
<div class="col-lg-6 text-center">
<div class="social">
<i><a href="{ROOT_URL}fb"><span class="fa fa-facebook"></span></a></i>
<i><a href="{ROOT_URL}twitter"><span class="fa fa-twitter"></span></a></i>
<i><a href="{ROOT_URL}in"><span class="fa fa-linkedin"></span></a></i>
<i><a href="{ROOT_URL}youtube"><span class="fa fa-youtube"></span></a></i>
<i><a href="{ROOT_URL}git"><span class="fa fa-github"></span></a></i>
</div>
</div>

View File

@ -0,0 +1,17 @@
<div class="footer-head" id="footer-head">
<div class="container">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center hidden-lg hidden-md hidden-sm">
<a href="#footer" class="navbar-toggle collapsed" data-toggle="collapse">
<span class="bars"></span>
<span class="sr-only">Toggle navigation</span>
</a>
</div>
<div id="footer" class="navbar-collapse collapse">
<div class="row">
{FOOTER_LEFT}
{FOOTER_CENTER}
{FOOTER_RIGHT}
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,7 @@
<div class="col-lg-3 text-center">
<h3> Contact </h3>
<ul>
{FOOTER_LINKS}
</ul>
</div>

View File

@ -0,0 +1,15 @@
<div class="col-lg-3 text-center">
<h3>Information</h3>
<ul>
<li>
<a href="{ROOT_URL}about">About Us</a>
</li>
<li>
<a href="{ROOT_URL}contact">Contact Us</a>
</li>
<li>
<a href="{ROOT_URL}privacy">Privacy Policy</a>
</li>
</ul>
</div>

View File

@ -1,11 +1,11 @@
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<div id="carousel-home" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-home" data-slide-to="0" class="active"></li>
<li data-target="#carousel-home" data-slide-to="1"></li>
<li data-target="#carousel-home" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="bg-primary slide-text-bg carousel-caption main-text">
@ -36,10 +36,10 @@
</div>
</div>
</div>
<a href="#carousel-example-generic" class="left carousel-control" data-slide="prev">
<a href="#carousel-home" class="left carousel-control" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a href="#carousel-example-generic" class="right carousel-control" data-slide="next">
<a href="#carousel-home" class="right carousel-control" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>

View File

@ -44,18 +44,6 @@
</table>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-12 ">
<ul class="nav nav-tabs">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
here
</div>
</div>
</div>
<div class="panel-footer">
<a href="{ROOT_URL}messages/create?prepopuser={USERNAME}" data-original-title="Broadcast Message" data-toggle="tooltip" type="button" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-envelope"></i></a>

View File

@ -151,14 +151,14 @@ function sideLoad() {
// Canary Autoloader (Debugging)
if ( ! defined( 'CANARY_AUTOLOADED' ) ) {
if ( defined( 'CANARY_ROOT_DIRECTORY' ) ) {
require_once CANARY_ROOT_DIRECTORY . 'bin' . DIRECTORY_SEPARATOR . 'autoload.php';
require_once CANARY_ROOT_DIRECTORY . 'Bin' . DIRECTORY_SEPARATOR . 'autoload.php';
}
}
// Bedrock Autoloader (Core Functionality)
if ( ! defined( 'BEDROCK_AUTOLOADED' ) ) {
if ( defined( 'BEDROCK_ROOT_DIRECTORY' ) ) {
require_once BEDROCK_ROOT_DIRECTORY . 'bin' . DIRECTORY_SEPARATOR . 'autoload.php';
require_once BEDROCK_ROOT_DIRECTORY . 'Bin' . DIRECTORY_SEPARATOR . 'autoload.php';
}
}
@ -172,4 +172,4 @@ function sideLoad() {
define( 'VENDOR_AUTOLOADED', false );
}
require_once 'bin/tempus_project.php';
require_once 'tempus_project.php';

View File

@ -19,6 +19,7 @@ use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Session;
use TheTempusProject\Bedrock\Functions\Cookie;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Date;
use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Hermes\Functions\Redirect;
@ -241,13 +242,85 @@ class TheTempusProject extends Bedrock {
'example' => '(?)',
],
];
public static $configMatrix = [
"main" => [
"logo" => [
"type" => "file",
"pretty" => "Site Logo (Used mostly in emails)",
"default" => "images/logo.png"
],
"name" => [
"type" => "text",
"pretty" => "Site Name",
"default" => "TTP Example"
],
"template" => [
"type" => "text",
"pretty" => "Default Site Template",
"default" => "default"
],
"tokenEnabled" => [
"type" => "radio",
"pretty" => "Enable CSRF Token for all forms.",
"default" => true
],
"loginLimit" => [
"type" => "text",
"pretty" => "Maximum Login Attempts per hour",
"default" => 5
]
],
"database" => [
"dbEnabled" => [
"type" => "radio",
"pretty" => "Database Enabled",
"default" => true,
"protected" => true
],
"dbHost" => [
"type" => "text",
"pretty" => "Database Host (IE: http://localhost:3306)",
"default" => "127.0.0.1",
"protected" => true
],
"dbMaxQuery" => [
"type" => "text",
"pretty" => "Maximum results per query",
"default" => 100,
"protected" => true
],
"dbName" => [
"type" => "text",
"pretty" => "Database Name",
"default" => "ttp-example",
"protected" => true
],
"dbPassword" => [
"type" => "text",
"pretty" => "Database Password",
"default" => "",
"protected" => true
],
"dbPrefix" => [
"type" => "text",
"pretty" => "Database table Prefix",
"default" => "TTP_",
"protected" => true
],
"dbUsername" => [
"type" => "text",
"pretty" => "Database Username",
"default" => "root",
"protected" => true
]
]
];
/**
* The constructor takes care of everything that we will need before
* finally calling appload to instantiate the appropriate controller/method.
*/
public function __construct() {
// Initialize the parent app
parent::__construct();
Debug::info( 'Requested URL: ' . $this->getCurrentUrl() );
@ -289,9 +362,6 @@ class TheTempusProject extends Bedrock {
}
}
// echo '<pre>'.var_export( $plugins, true ).'</pre>';
// exit();
Debug::gend();
}
@ -329,6 +399,13 @@ class TheTempusProject extends Bedrock {
return true;
}
public static function dateTimeCallback( $data ) {
if ( empty( $data[2] ) ) {
return '';
}
return Date::formatTimestamp( $data[1], $data[2] );
}
public function loadFilters() {
// These Filter have to be loaded here because they have calculated values
$this->filters[] = [
@ -359,9 +436,17 @@ class TheTempusProject extends Bedrock {
'enabled' => true,
'example' => '{LOGGEDIN}Only visible to users who are logged-in{LOGGEDIN}',
];
$this->filters[] = [
'name' => 'dtc',
'find' => '#{DTC(.*?)}(.*?){/DTC}#is',
'replace' => [ __CLASS__, 'dateTimeCallback' ],
'enabled' => true,
'callback' => true,
'example' => '{DTC=date}000000000{DTC}',
];
if ( ! empty( $this->filters ) ) {
foreach( $this->filters as $filter ) {
Filters::add( $filter['name'], $filter['find'], $filter['replace'], $filter['enabled'] );
Filters::add( $filter['name'], $filter['find'], $filter['replace'], $filter['enabled'], ( $filter['callback'] ?? false ) );
}
}
}

View File

@ -20,17 +20,18 @@
],
"require":
{
"bugsnag/bugsnag": "^3.0",
"fortawesome/font-awesome": "4.7",
"thetempusproject/bedrock": "1.0.8",
"thetempusproject/canary": "1.0.4",
"thetempusproject/houdini": "1.0.7",
"thetempusproject/bedrock": "1.0.10",
"thetempusproject/canary": "1.0.5",
"thetempusproject/houdini": "1.0.8",
"components/jquery": "1.9.*",
"twbs/bootstrap": "3.3.7"
},
"autoload":
{
"files":
[
"app/functions/forms.php",
"app/functions/common.php"
],
"classmap":
@ -56,7 +57,10 @@
{
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"robloach/component-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true

269
composer.lock generated
View File

@ -4,8 +4,60 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d2223741ba10267e9b8f31f8bbe24b63",
"content-hash": "4d87b4a533236913cbbc0e75664016de",
"packages": [
{
"name": "components/jquery",
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/components/jquery.git",
"reference": "ae5c0c13cf163b3751ce55f9d9e97c1ba7ff796d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/components/jquery/zipball/ae5c0c13cf163b3751ce55f9d9e97c1ba7ff796d",
"reference": "ae5c0c13cf163b3751ce55f9d9e97c1ba7ff796d",
"shasum": ""
},
"require": {
"robloach/component-installer": "*"
},
"type": "component",
"extra": {
"component": {
"scripts": [
"jquery.js"
],
"files": [
"jquery.min.js",
"jquery-migrate.js",
"jquery-migrate.min.js",
"jquery.min.map"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "John Resig",
"email": "jeresig@gmail.com"
}
],
"description": "jQuery JavaScript Library",
"homepage": "http://jquery.com",
"support": {
"forum": "http://forum.jquery.com",
"irc": "irc://irc.freenode.org/jquery",
"issues": "http://bugs.jquery.com",
"source": "https://github.com/jquery/jquery",
"wiki": "http://docs.jquery.com/"
},
"time": "2014-10-11T11:52:45+00:00"
},
{
"name": "fortawesome/font-awesome",
"version": "v4.7.0",
@ -58,13 +110,204 @@
},
"time": "2016-10-24T15:52:54+00:00"
},
{
"name": "kriswallsmith/assetic",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/kriswallsmith/assetic.git",
"reference": "e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1",
"reference": "e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1",
"shasum": ""
},
"require": {
"php": ">=5.3.1",
"symfony/process": "~2.1|~3.0"
},
"conflict": {
"twig/twig": "<1.27"
},
"require-dev": {
"leafo/lessphp": "^0.3.7",
"leafo/scssphp": "~0.1",
"meenie/javascript-packer": "^1.1",
"mrclay/minify": "<2.3",
"natxet/cssmin": "3.0.4",
"patchwork/jsqueeze": "~1.0|~2.0",
"phpunit/phpunit": "~4.8 || ^5.6",
"psr/log": "~1.0",
"ptachoire/cssembed": "~1.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"twig/twig": "~1.23|~2.0",
"yfix/packager": "dev-master"
},
"suggest": {
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
"leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler",
"leafo/scssphp-compass": "Assetic provides the integration with the SCSS compass plugin",
"patchwork/jsqueeze": "Assetic provides the integration with the JSqueeze JavaScript compressor",
"ptachoire/cssembed": "Assetic provides the integration with phpcssembed to embed data uris",
"twig/twig": "Assetic provides the integration with the Twig templating engine"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-0": {
"Assetic": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kris Wallsmith",
"email": "kris.wallsmith@gmail.com",
"homepage": "http://kriswallsmith.net/"
}
],
"description": "Asset Management for PHP",
"homepage": "https://github.com/kriswallsmith/assetic",
"keywords": [
"assets",
"compression",
"minification"
],
"support": {
"issues": "https://github.com/kriswallsmith/assetic/issues",
"source": "https://github.com/kriswallsmith/assetic/tree/master"
},
"time": "2016-11-11T18:43:20+00:00"
},
{
"name": "robloach/component-installer",
"version": "0.0.12",
"source": {
"type": "git",
"url": "https://github.com/RobLoach/component-installer.git",
"reference": "1864f25db21fc173e02a359f646acd596c1b0460"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobLoach/component-installer/zipball/1864f25db21fc173e02a359f646acd596c1b0460",
"reference": "1864f25db21fc173e02a359f646acd596c1b0460",
"shasum": ""
},
"require": {
"kriswallsmith/assetic": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"composer/composer": "1.*"
},
"type": "composer-installer",
"extra": {
"class": "ComponentInstaller\\Installer"
},
"autoload": {
"psr-0": {
"ComponentInstaller": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Loach",
"email": "robloach@gmail.com",
"homepage": "http://robloach.net"
}
],
"description": "Allows installation of Components via Composer.",
"support": {
"issues": "https://github.com/RobLoach/component-installer/issues",
"source": "https://github.com/RobLoach/component-installer/tree/master"
},
"abandoned": "oomphinc/composer-installers-extender",
"time": "2013-08-31T23:46:48+00:00"
},
{
"name": "symfony/process",
"version": "v3.4.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca",
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00"
},
{
"name": "thetempusproject/bedrock",
"version": "1.0.8",
"version": "1.0.10",
"source": {
"type": "git",
"url": "https://git.thetempusproject.com/the-tempus-project/bedrock",
"reference": "ef4818356ce4cb5c4ceaf09e013f5acd606b7e0a"
"reference": "42ade08306525488f2449a2f4e3e05569eee9822"
},
"require": {
"php": ">=8.1.0",
@ -101,15 +344,15 @@
"framework",
"mvc"
],
"time": "2024-08-13T06:35:11+00:00"
"time": "2024-08-21T10:12:54+00:00"
},
{
"name": "thetempusproject/canary",
"version": "1.0.4",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://git.thetempusproject.com/the-tempus-project/canary",
"reference": "7ce988fbd95c0d9b975e7647f2e4d7ee3d5e3aad"
"reference": "35415fbf3c5888ccdb8a8695989176a120026c7f"
},
"require": {
"php": ">=8.1.0"
@ -144,15 +387,15 @@
"thetempusproject",
"tools"
],
"time": "2024-08-10T18:58:57+00:00"
"time": "2024-08-20T10:26:09+00:00"
},
{
"name": "thetempusproject/hermes",
"version": "1.0.1",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://git.thetempusproject.com/the-tempus-project/hermes",
"reference": "171183c0abdbbdf12b3b577821636dd1c51ec752"
"reference": "31c51c1a5bad2871df800c89f27ace0a49848583"
},
"require": {
"php": ">=8.1.0"
@ -187,15 +430,15 @@
"thetempusproject",
"tools"
],
"time": "2024-08-13T02:56:27+00:00"
"time": "2024-08-20T10:26:47+00:00"
},
{
"name": "thetempusproject/houdini",
"version": "1.0.7",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://git.thetempusproject.com/the-tempus-project/houdini",
"reference": "4d2ccfb1c5f18dba9886405e7e6e2264e04e1f89"
"reference": "d9e61d3f8f5d10f3fa7ba31907a4b3c1edc76614"
},
"require": {
"php": ">=8.1.0",
@ -231,7 +474,7 @@
"thetempusproject",
"tools"
],
"time": "2024-08-13T03:43:46+00:00"
"time": "2024-08-20T10:30:48+00:00"
},
{
"name": "twbs/bootstrap",

12
index.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: #32363B;}
h1 {color: #00B050;}
</style>
</head>
<body>
<h1>Coming Soon - TTE</h1>
</body>
</html>

View File

@ -188,6 +188,7 @@ class Install extends Controller {
Views::view( 'install.check' );
}
/**
* 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.
@ -199,46 +200,20 @@ class Install extends Controller {
$logo = 'Uploads/Images/System/' . Upload::last();
}
TheTempusProject::$activeConfig->load( BEDROCK_CONFIG_JSON );
$configMatrix = [
'main' => [
'logo' => [
'value' => $logo,
],
'name' => [
'value' => Input::postNull( 'siteName' ),
],
'loginLimit' => [
'type' => 'text',
'pretty' => 'Maximum Login Attempts per hour',
'default' => 5,
'value' => 5,
],
],
'database' => [
'dbMaxQuery' => [
'value'=> 100,
],
'dbEnabled' => [
'value' => true,
],
'dbHost' => [
'value' => Input::postNull( 'dbHost' ),
],
'dbName' => [
'value' => Input::postNull( 'dbName' ),
],
'dbPassword' => [
'value' => Input::postNull( 'dbPassword' ),
],
'dbPrefix' => [
'value' => Input::postNull( 'dbPrefix' ),
],
'dbUsername' => [
'value' => Input::postNull( 'dbUsername' ),
],
],
];
if ( ! TheTempusProject::$activeConfig->generate( CONFIG_JSON, $configMatrix ) ) {
$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.' );
@ -366,7 +341,6 @@ class Install extends Controller {
} else {
$installResult = $this->installer->installModel( (object) $module, [ 'installResources' => true ], false );
}
if ( !$installResult ) {
$error = true;
}

67
server/README.md Normal file
View File

@ -0,0 +1,67 @@
# fresh install
## Install required apps
```
apt install git composer php8.1-curl -y
```
## Set-Up the SSL folder to keep things together
```
mkdir /etc/nginx/ssl/
```
- Now That you have the directory created, copy the `.key` and `.pem` files into the newly made ssl folder on the server.
- You will then need to modify the filer ownership and permissions
```
chmod -R 655 /etc/nginx/ssl
chown -R www-data:www-data /etc/nginx/ssl
```
## Add configs for the site
- First, copy `ttp.conf` into the `/etc/nginx/snippets/` folder.
- Next, copy the `tabletopelite.com.conf` file into the `/etc/nginx/sites-available/` folder.
- The next block will acomplish a few things: backup the old config, enable the new config, disable the old config, and restart the server.
```
mkdir /etc/nginx/sites-available/old/
sudo mv /etc/nginx/sites-available/* /etc/nginx/sites-available/old/
sudo ln -s /etc/nginx/sites-available/tabletopelite.com.conf /etc/nginx/sites-enabled/tabletopelite.com.conf
sudo rm -rf /etc/nginx/sites-enabled/*
sudo systemctl restart nginx.service
```
## Set-Up the files
```
cd /var/www/
git config --global credential.helper store
git clone https://git.thetempusproject.com/tabletopelite/tabletopelite.com.git tabletopelite.com
git fetch
git checkout production
```
_You will be prompted for git creds, use the creds shared below_
```
git config --global --add safe.directory /var/www/tabletopelite.com
git config --global --add safe.directory /var/www/tabletopelite.com/vendor/tabletopelite/hermes
git config --global user.name "Production Server"
git config --global user.email webmaster@tabletopelite.com
cd tabletopelite.com
composer install
chmod -R 777 .
chown -R www-data:www-data .
```
#### GitLab Credentials:
User: `root`\
Password: `rdFtVPhzlu6u6orxN4NAsbgAE4AyqZPTXPXQTleyA5I=`
#### Logging
```
tail -f /var/log/nginx/*.log
```

View File

@ -0,0 +1,36 @@
# upstream to abstract backend connection(s) for php
upstream php {
server unix:/run/php/php8.1-fpm.sock;
}
server {
listen 80;
listen [::]:80;
server_name tabletopelite.com;
include snippets/well-known;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name tabletopelite.com;
include snippets/ssl-params.conf;
root /var/www/tabletopelite.com;
index index.php;
# max php upload size
client_max_body_size 100M;
# disable direcory indexing
autoindex off;
# custom TTP code
include snippets/ttp.conf;
location ~* \.php$ {
fastcgi_pass php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
}
}

View File

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDjrOt2qp1aP2ai
X+eg+kw4viSrZGj6QdZQG8DEnr5ILF4JgngJOZeVeOSWI9zSQW/rkyv2lR1brNft
3fpCdnJNLjLhGqpDqf8NAoADy9Qa8vXsPAR/8aQ5FmEVP5flGTmzY/9wPyZpPW0u
pffwCdP7v7kxXxEwXDY6q4UzvyUpocdbrQqqX/YvuC+aKrPSk7TDg/WdSgpq2XQh
5tRtbtbeXn8BYzgZeSEtw6wVVN3ZDWzizg0qB+Jn1P9GABqAY8aKFZmds1gNrfre
sOqfe8Tjiak/HHPsJCQ6NLN0n0woZmM359DppnSRl9tX3xkHfBD7JOg44YJb0S3K
cDcfad0DAgMBAAECggEAI3LdBpDyBwcwF8AO9IWEMKGKXBU6MxzlHXv0u6hrwBkI
WzqxLd6Ft4QnMylKTIJbxrYXdkEpXQjAZgzV1ltS2KmEyn+4WuixCXmGLREjaT7D
A5EksjcRdsIBQ6mvIMCYt1Guh++NL32c7lJxFDKzitMDJqjCqGDzIJdsGe58/soi
aanRRZwg1THcMqEW9fVyqWgyt9eTPRsCysIVSElxfyoBBKZXgSHqOPGhpcO8Wn86
KIKourtXQq90J2ATv9oB9fVMQVA/kg7YZfL0YHX8mnEacvnjbbYkB1c6EoqTBFOh
Nh7bGiIXAJK8Hd6VU20aKygoHabj5eDzJGEHn4EBIQKBgQD2vrv4OHtx8Hcdz5n3
atPekd/E5x34alC0V7djQBvAHYcvRf/soiHI12fb8NBaRt3KMOu61zKlYlfmhmzo
6MeP9fmDFnCtxJLAwbJfp1Q7jz7dLYZXzyfGngjhCN58koBMGOjlMxo7GU276jhq
9NJ68xFgk0rCgJvPUijZ/SredQKBgQDsNxPr0sxe4fV4CdsOt+vGkU5ir7EpRFD0
oZ7u3BIdqZJdUDolchZVJ5kQSIJ0KTpBqQhS/btl0G8tP+ugYi2t5h3WvSMh2ScB
y5/aD+D2M4jK9nuObNPHi6Gzd8d+1EB4N/tgsxsZMJgUX9XD/++XoXUXToHwAZ9Q
4401lNVOlwKBgQDJhiJTqx33gyRmbqYbk16Ti6StVu39dCeSA4o+P5/qmrNMgulx
RUI+nN+wnNAuy25dsvL02Mn+lYGhP+03lNdY1tcAn5VL9x682/ZpdWqwcmAvmPz+
Pq0H5Q7vbKT6LVUn0bh1afVki1gXwEZv5KD71gY9UE9g6FVZUIsY71LR+QKBgQDI
gPPy76q0O17ONqdvteR3V23OzM03dxq0m9+5Zqol7YMkm+3PTSjxvTvqm3HIQhqG
E4HSWDfSc3t7UE+kgtG9U6AuX7tLhvTaTEpyoZnVweaySUiVm4CkV7y5BsoauPXE
VdiVu1IcLqhYWwSrazqnXdBzKRuYavgdhBmfyqbJHwKBgQDjFuEBgPZhqYYX4oVN
iWq0srFqFIjg2LILKh/RDs9qx6Nv7HNeDBtYa/kDcCoKDvsI4R0zDcX0OerYLHv+
iGDkMIEJ4gm36iINryWpmHE4MXx5HhLsq9UqypMAEbPPvhbsrO2ZirFxklyhQ8Nw
yclilDs5JOxNYgAysjoWR2YO4w==
-----END PRIVATE KEY-----

View File

@ -0,0 +1,28 @@
-----BEGIN CERTIFICATE-----
MIIErjCCA5agAwIBAgIUAYMRpN+9iKLSF6AfWFDLpb6BRawwDQYJKoZIhvcNAQEL
BQAwgYsxCzAJBgNVBAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTQw
MgYDVQQLEytDbG91ZEZsYXJlIE9yaWdpbiBTU0wgQ2VydGlmaWNhdGUgQXV0aG9y
aXR5MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MB4XDTI0MDgxNjA5MzkwMFoXDTM5MDgxMzA5MzkwMFowYjEZMBcGA1UEChMQQ2xv
dWRGbGFyZSwgSW5jLjEdMBsGA1UECxMUQ2xvdWRGbGFyZSBPcmlnaW4gQ0ExJjAk
BgNVBAMTHUNsb3VkRmxhcmUgT3JpZ2luIENlcnRpZmljYXRlMIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA46zrdqqdWj9mol/noPpMOL4kq2Ro+kHWUBvA
xJ6+SCxeCYJ4CTmXlXjkliPc0kFv65Mr9pUdW6zX7d36QnZyTS4y4RqqQ6n/DQKA
A8vUGvL17DwEf/GkORZhFT+X5Rk5s2P/cD8maT1tLqX38AnT+7+5MV8RMFw2OquF
M78lKaHHW60Kql/2L7gvmiqz0pO0w4P1nUoKatl0IebUbW7W3l5/AWM4GXkhLcOs
FVTd2Q1s4s4NKgfiZ9T/RgAagGPGihWZnbNYDa363rDqn3vE44mpPxxz7CQkOjSz
dJ9MKGZjN+fQ6aZ0kZfbV98ZB3wQ+yToOOGCW9EtynA3H2ndAwIDAQABo4IBMDCC
ASwwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcD
ATAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBTW4vKXg4SbtGpF+7kcJ+UmpElZ5jAf
BgNVHSMEGDAWgBQk6FNXXXw0QIep65TbuuEWePwppDBABggrBgEFBQcBAQQ0MDIw
MAYIKwYBBQUHMAGGJGh0dHA6Ly9vY3NwLmNsb3VkZmxhcmUuY29tL29yaWdpbl9j
YTAxBgNVHREEKjAoghMqLnRhYmxldG9wZWxpdGUuY29tghF0YWJsZXRvcGVsaXRl
LmNvbTA4BgNVHR8EMTAvMC2gK6AphidodHRwOi8vY3JsLmNsb3VkZmxhcmUuY29t
L29yaWdpbl9jYS5jcmwwDQYJKoZIhvcNAQELBQADggEBAIusxUSTtM8xuxUvmj0D
dlRZah0mlAyOZIowHbOMbY+b0KlauXPG5da2dXyo4M6QBTRDZAYvGKnItAOM3jwT
5tezpuDRnMDt/ANqJzVw85AjonSkS9jVm/EXOxWhBEdyDewTCAn+F7meFg34l5L9
bGH11OiNEmRNYtNSrh/mKZ5YDKwzVP7DbzWrd6iEu4FmnSzX0DbMr5fDaiFlF8OJ
J7ZMhsWD5pFAZqeqcAytcpPSLxkrDInv9xqzyB4YJ7MfGOddchsLMdGCRDpvHybg
X3LP1B6SXDsqz4FDw9C49c8ay9cRwATgEwaynpv9fTqyyNV07b/ZQ8YOhlGEqVpt
STQ=
-----END CERTIFICATE-----

74
server/ttp.conf Normal file
View File

@ -0,0 +1,74 @@
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php;
charset utf-8;
error_page 404 /index.php;
ssl_certificate /etc/nginx/ssl/tabletopelite.com.pem;
ssl_certificate_key /etc/nginx/ssl/tabletopelite.com.key;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\.(?!well-known).* {
deny all;
}
location ~ /\.ht {
deny all;
}
location ~ ^/(doc|sql|setup)/ {
deny all;
}
location ~ /\. {
deny all;
}
location ~* \.(?:js|css|png|jpg|gif|ico|woff|ttf|woff2)$ {
access_log off;
log_not_found off;
}
location /js/ {
access_log off;
log_not_found off;
try_files $uri /index.php?error=js404&file=$uri;
}
location /css/ {
access_log off;
log_not_found off;
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 / {
rewrite ^/(.+)$ /index.php?url=$1&$args;
}