Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
113499254b | |||
3b6d7f3a2c | |||
09f96c369a | |||
afb9624971 | |||
8d3dee2ac2 | |||
355e509e68 | |||
c3f46cf6c3 | |||
4a521afa88 | |||
0fa83b0ae6 | |||
5c7a320c2a | |||
551f6654f6 | |||
80048ad1dd | |||
80b8226218 | |||
cc9e57888f | |||
ec317e6426 | |||
910c9646b8 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -61,5 +61,5 @@ logs/*
|
|||||||
.vscode/
|
.vscode/
|
||||||
mail.log
|
mail.log
|
||||||
vendor/canary/logs/*
|
vendor/canary/logs/*
|
||||||
docker/.env
|
|
||||||
.env
|
.env
|
||||||
|
components/*
|
||||||
|
@ -113,6 +113,10 @@ TheTempusProject is an open source project and welcomes community contributions.
|
|||||||
|
|
||||||
See the [LICENSE](LICENSE) file for licensing information as it pertains to files in this repository.
|
See the [LICENSE](LICENSE) file for licensing information as it pertains to files in this repository.
|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
|
||||||
|
- [ ] The blog plugin should add a welcome post during the installResources step of the installer. It doesn't work right now.
|
||||||
|
|
||||||
## Currently being developed
|
## Currently being developed
|
||||||
|
|
||||||
- [ ] Adding documentation
|
- [ ] Adding documentation
|
||||||
@ -123,3 +127,5 @@ See the [LICENSE](LICENSE) file for licensing information as it pertains to file
|
|||||||
- [ ] Expansion of PDO to allow different database types
|
- [ ] Expansion of PDO to allow different database types
|
||||||
- [ ] Update installer to account for database deltas, allowing easy updating.
|
- [ ] Update installer to account for database deltas, allowing easy updating.
|
||||||
- [ ] Implement uniformity in terms of error reporting, exceptions, logging.
|
- [ ] Implement uniformity in terms of error reporting, exceptions, logging.
|
||||||
|
- [ ] I want to make an api that allows you to download and install new plugins from a centralized repository
|
||||||
|
- [ ] i want plugin instalation to be compatible with composer for easier management of added plugins.
|
||||||
|
@ -16,11 +16,19 @@ namespace TheTempusProject\Classes;
|
|||||||
|
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
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 {
|
class Forms extends Check {
|
||||||
private static $formHandlers = [];
|
private static $formHandlers = [];
|
||||||
|
private static $initialized = false;
|
||||||
|
|
||||||
public static function check( $formName ) {
|
public static function check( $formName ) {
|
||||||
|
if ( self::$initialized !== true ) {
|
||||||
|
self::initHandlers();
|
||||||
|
}
|
||||||
if ( empty( self::$formHandlers[ $formName ] ) ) {
|
if ( empty( self::$formHandlers[ $formName ] ) ) {
|
||||||
Debug::error( "Form not found: $formName" );
|
Debug::error( "Form not found: $formName" );
|
||||||
return false;
|
return false;
|
||||||
@ -74,4 +82,530 @@ class Forms extends Check {
|
|||||||
}
|
}
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ class Installer {
|
|||||||
|
|
||||||
// exclude any flags we don't have a matric map for
|
// exclude any flags we don't have a matric map for
|
||||||
if ( empty( $module_data->class_object->$matrix ) ) {
|
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;
|
$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
|
// exclude any flags we don't have a matric map for
|
||||||
if ( empty( $module_data->class_object->$matrix ) ) {
|
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;
|
$module_data->$flag_type = INSTALL_STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@ if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
|
|||||||
// Cookies
|
// Cookies
|
||||||
define( 'DEFAULT_COOKIE_PREFIX', 'TP_');
|
define( 'DEFAULT_COOKIE_PREFIX', 'TP_');
|
||||||
// Debug
|
// Debug
|
||||||
|
|
||||||
|
define( 'CANARY_DEBUG_DIRECTORY', APP_ROOT_DIRECTORY . 'logs' . DIRECTORY_SEPARATOR );
|
||||||
define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
|
define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
|
||||||
define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
|
define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
|
||||||
define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
|
define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
|
||||||
|
@ -39,7 +39,7 @@ class Admin extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
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 ) {
|
public function view( $id = null ) {
|
||||||
|
@ -59,6 +59,6 @@ class Composer extends AdminController {
|
|||||||
$out[] = (object) $versionsInstalled[ $name ];
|
$out[] = (object) $versionsInstalled[ $name ];
|
||||||
}
|
}
|
||||||
|
|
||||||
Views::view( 'admin.dependencies', $out );
|
Views::view( 'admin.modules.composer.dependencies', $out );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class Errors extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
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 ) {
|
public function view( $id = null ) {
|
||||||
|
@ -95,7 +95,7 @@ class Groups extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index( $data = null ) {
|
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 ) {
|
public function listmembers( $data = null ) {
|
||||||
|
@ -39,7 +39,7 @@ class Logins extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
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 ) {
|
public function view( $id = null ) {
|
||||||
|
@ -26,8 +26,8 @@ class Logs extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index( $data = null ) {
|
public function index( $data = null ) {
|
||||||
Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
|
Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
|
||||||
Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
|
Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
|
||||||
Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
|
Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class Plugins extends AdminController {
|
|||||||
if ( !Input::exists( 'installHash' ) ) {
|
if ( !Input::exists( 'installHash' ) ) {
|
||||||
return Views::view( 'admin.modules.plugins.enable' );
|
return Views::view( 'admin.modules.plugins.enable' );
|
||||||
}
|
}
|
||||||
if ( !Plugin::enable( $name ) ) {
|
if ( ! Plugin::enable( $name ) ) {
|
||||||
Session::flash( 'error', 'There was an error enabling the plugin.' );
|
Session::flash( 'error', 'There was an error enabling the plugin.' );
|
||||||
} else {
|
} else {
|
||||||
Session::flash( 'success', 'Plugin has been enabled.' );
|
Session::flash( 'success', 'Plugin has been enabled.' );
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
namespace TheTempusProject\Controllers\Admin;
|
namespace TheTempusProject\Controllers\Admin;
|
||||||
|
|
||||||
use TheTempusProject\TTPForms;
|
use TheTempusProject\Classes\Forms as TTPForms;
|
||||||
use TheTempusProject\Houdini\Classes\Views;
|
use TheTempusProject\Houdini\Classes\Views;
|
||||||
use TheTempusProject\Houdini\Classes\Issues;
|
use TheTempusProject\Houdini\Classes\Issues;
|
||||||
use TheTempusProject\Houdini\Classes\Navigation;
|
use TheTempusProject\Houdini\Classes\Navigation;
|
||||||
@ -88,7 +88,7 @@ class Routes extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
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 ) {
|
public function view( $id = null ) {
|
||||||
|
@ -140,7 +140,7 @@ class Users extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
Views::view( 'admin.users.list', self::$user->userList() );
|
Views::view( 'admin.users.list', self::$user->listPaginated() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view( $id = null ) {
|
public function view( $id = null ) {
|
||||||
|
@ -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;
|
|
@ -257,7 +257,7 @@ class Group extends DatabaseModel {
|
|||||||
if ( $group === false ) {
|
if ( $group === false ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$members = self::$db->get( 'users', [ 'userGroup', '=', $id ] );
|
$members = self::$db->getPaginated( 'users', [ 'userGroup', '=', $id ] );
|
||||||
if ( !$members->count() ) {
|
if ( !$members->count() ) {
|
||||||
Debug::info( "list members: Could not find anyone in group: $id" );
|
Debug::info( "list members: Could not find anyone in group: $id" );
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,7 +13,7 @@ namespace TheTempusProject\Models;
|
|||||||
|
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
use TheTempusProject\Bedrock\Classes\Config;
|
use TheTempusProject\Bedrock\Classes\Config;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
use TheTempusProject\Classes\DatabaseModel;
|
||||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
@ -21,7 +21,7 @@ use TheTempusProject\Bedrock\Functions\Hash;
|
|||||||
use TheTempusProject\Bedrock\Functions\Session;
|
use TheTempusProject\Bedrock\Functions\Session;
|
||||||
use TheTempusProject\Bedrock\Functions\Code;
|
use TheTempusProject\Bedrock\Functions\Code;
|
||||||
use TheTempusProject\Bedrock\Classes\Config;
|
use TheTempusProject\Bedrock\Classes\Config;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
use TheTempusProject\Classes\Email;
|
use TheTempusProject\Classes\Email;
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
use TheTempusProject\Classes\DatabaseModel;
|
||||||
use TheTempusProject\Classes\Preferences;
|
use TheTempusProject\Classes\Preferences;
|
||||||
|
@ -17,11 +17,14 @@ use TheTempusProject\Bedrock\Functions\Check;
|
|||||||
use TheTempusProject\Bedrock\Functions\Sanitize;
|
use TheTempusProject\Bedrock\Functions\Sanitize;
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
use TheTempusProject\Classes\DatabaseModel;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
use TheTempusProject\Houdini\Classes\Filters;
|
use TheTempusProject\Houdini\Classes\Filters;
|
||||||
|
use TheTempusProject\Plugins\Comments as CommentPlugin;
|
||||||
|
use TheTempusProject\Models\Comments;
|
||||||
|
|
||||||
class Posts extends DatabaseModel {
|
class Posts extends DatabaseModel {
|
||||||
public $tableName = 'posts';
|
public $tableName = 'posts';
|
||||||
|
public static $comments = false;
|
||||||
|
|
||||||
public $databaseMatrix = [
|
public $databaseMatrix = [
|
||||||
[ 'author', 'int', '11' ],
|
[ 'author', 'int', '11' ],
|
||||||
@ -32,19 +35,14 @@ class Posts extends DatabaseModel {
|
|||||||
[ 'content', 'text', '' ],
|
[ '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() {
|
public function __construct() {
|
||||||
parent::__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 ) {
|
public function newPost( $title, $post, $draft ) {
|
||||||
@ -161,6 +159,9 @@ class Posts extends DatabaseModel {
|
|||||||
if ( isset( $params['stripHtml'] ) && $params['stripHtml'] === true ) {
|
if ( isset( $params['stripHtml'] ) && $params['stripHtml'] === true ) {
|
||||||
$instance->contentSummary = strip_tags( $instance->content );
|
$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( 'mentions.0', $instance->content, true );
|
||||||
$instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
|
$instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
|
||||||
$out[] = $instance;
|
$out[] = $instance;
|
||||||
|
@ -38,6 +38,18 @@ class Blog extends Plugin {
|
|||||||
'url' => '{ROOT_URL}blog/index',
|
'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 $posts;
|
||||||
|
|
||||||
public function __construct( $load = false ) {
|
public function __construct( $load = false ) {
|
||||||
|
@ -15,7 +15,7 @@ namespace TheTempusProject\Models;
|
|||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
use TheTempusProject\Bedrock\Classes\Config;
|
use TheTempusProject\Bedrock\Classes\Config;
|
||||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
use TheTempusProject\Classes\DatabaseModel;
|
||||||
use TheTempusProject\Plugins\Bugreport as Plugin;
|
use TheTempusProject\Plugins\Bugreport as Plugin;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @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\Input;
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
|
@ -18,7 +18,7 @@ use TheTempusProject\Canary\Bin\Canary as Debug;
|
|||||||
use TheTempusProject\Houdini\Classes\Views;
|
use TheTempusProject\Houdini\Classes\Views;
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
use TheTempusProject\Classes\DatabaseModel;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
use TheTempusProject\Houdini\Classes\Filters;
|
use TheTempusProject\Houdini\Classes\Filters;
|
||||||
|
|
||||||
class Comments extends DatabaseModel {
|
class Comments extends DatabaseModel {
|
||||||
|
@ -54,7 +54,7 @@ class Comments extends Plugin {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
public $resourceMatrix = [
|
public $resourceMatrix = [
|
||||||
'group' => [
|
'groups' => [
|
||||||
[
|
[
|
||||||
'name' => 'Moderator',
|
'name' => 'Moderator',
|
||||||
'permissions' => '{"adminAccess":false}',
|
'permissions' => '{"adminAccess":false}',
|
||||||
|
@ -53,6 +53,6 @@ class Feedback extends AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function index( $data = null ) {
|
public function index( $data = null ) {
|
||||||
Views::view( 'feedback.admin.list', self::$feedback->list() );
|
Views::view( 'feedback.admin.list', self::$feedback->listPaginated() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ use TheTempusProject\Canary\Bin\Canary as Debug;
|
|||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
use TheTempusProject\Bedrock\Functions\Sanitize;
|
use TheTempusProject\Bedrock\Functions\Sanitize;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
|
|
||||||
class Message extends DatabaseModel {
|
class Message extends DatabaseModel {
|
||||||
public $tableName = 'messages';
|
public $tableName = 'messages';
|
||||||
@ -61,7 +61,7 @@ class Message extends DatabaseModel {
|
|||||||
Debug::info( 'Invalid user ID' );
|
Debug::info( 'Invalid user ID' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $parent ] );
|
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $parent ] );
|
||||||
if ( $messageData->count() == 0 ) {
|
if ( $messageData->count() == 0 ) {
|
||||||
Debug::info( 'Message not found.' );
|
Debug::info( 'Message not found.' );
|
||||||
return false;
|
return false;
|
||||||
@ -71,7 +71,7 @@ class Message extends DatabaseModel {
|
|||||||
if ( $type !== null ) {
|
if ( $type !== null ) {
|
||||||
$params = array_merge( $params, [ 'AND', $type, '=', $user ] );
|
$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->count() != 0 ) {
|
||||||
if ( $messageData->first()->recieverDeleted == 0 ) {
|
if ( $messageData->first()->recieverDeleted == 0 ) {
|
||||||
$message = $messageData->first();
|
$message = $messageData->first();
|
||||||
@ -93,7 +93,7 @@ class Message extends DatabaseModel {
|
|||||||
Debug::info( 'Invalid ID' );
|
Debug::info( 'Invalid ID' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] );
|
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $id ] );
|
||||||
if ( $messageData->count() == 0 ) {
|
if ( $messageData->count() == 0 ) {
|
||||||
Debug::info( 'Message not found.' );
|
Debug::info( 'Message not found.' );
|
||||||
return false;
|
return false;
|
||||||
@ -122,7 +122,7 @@ class Message extends DatabaseModel {
|
|||||||
} else {
|
} else {
|
||||||
$find = $message->ID;
|
$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 );
|
Components::set( 'PID', $find );
|
||||||
|
|
||||||
if ( $markRead == true ) {
|
if ( $markRead == true ) {
|
||||||
@ -138,7 +138,7 @@ class Message extends DatabaseModel {
|
|||||||
$limit = 10;
|
$limit = 10;
|
||||||
}
|
}
|
||||||
$limit = [ 0, $limit ];
|
$limit = [ 0, $limit ];
|
||||||
$messageData = self::$db->get(
|
$messageData = self::$db->getPaginated(
|
||||||
$this->tableName,
|
$this->tableName,
|
||||||
[
|
[
|
||||||
'parent', '=', 0,
|
'parent', '=', 0,
|
||||||
@ -175,7 +175,7 @@ class Message extends DatabaseModel {
|
|||||||
$limit = 10;
|
$limit = 10;
|
||||||
}
|
}
|
||||||
$limit = [ 0, $limit ];
|
$limit = [ 0, $limit ];
|
||||||
$messageData = self::$db->get(
|
$messageData = self::$db->getPaginated(
|
||||||
$this->tableName,
|
$this->tableName,
|
||||||
[
|
[
|
||||||
'parent', '=', 0,
|
'parent', '=', 0,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @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\Input;
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* app/plugins/feedback/models/feedback.php
|
* app/plugins/notification/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 Notifications
|
||||||
*
|
|
||||||
* @package TP Feedback
|
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
@ -18,10 +16,9 @@ use TheTempusProject\Bedrock\Classes\Config;
|
|||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
use TheTempusProject\Classes\DatabaseModel;
|
||||||
use TheTempusProject\Plugins\Feedback as Plugin;
|
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
use TheTempusProject\Houdini\Classes\Views;
|
use TheTempusProject\Houdini\Classes\Views;
|
||||||
use TheTempusProject\Bedrock\Classes\CustomException;
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
|
|
||||||
class Notification extends DatabaseModel {
|
class Notification extends DatabaseModel {
|
||||||
public $tableName = 'notifications';
|
public $tableName = 'notifications';
|
||||||
@ -34,15 +31,6 @@ class Notification extends DatabaseModel {
|
|||||||
[ 'deletedAt', 'int', '11' ],
|
[ 'deletedAt', 'int', '11' ],
|
||||||
[ 'seenAt', 'int', '11' ],
|
[ 'seenAt', 'int', '11' ],
|
||||||
];
|
];
|
||||||
public $plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The model constructor.
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
$this->plugin = new Plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUnreadCount( $userID ) {
|
public function getUnreadCount( $userID ) {
|
||||||
$result = self::$db->get(
|
$result = self::$db->get(
|
||||||
@ -86,9 +74,9 @@ class Notification extends DatabaseModel {
|
|||||||
'expiresAt', '<', time(),
|
'expiresAt', '<', time(),
|
||||||
];
|
];
|
||||||
if ( empty( $limit ) ) {
|
if ( empty( $limit ) ) {
|
||||||
$notifications = self::$db->get( $this->tableName, $whereClause );
|
$notifications = self::$db->getPaginated( $this->tableName, $whereClause );
|
||||||
} else {
|
} 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() ) {
|
if ( !$notifications->count() ) {
|
||||||
Debug::info( 'No Notifications found.' );
|
Debug::info( 'No Notifications found.' );
|
||||||
|
@ -27,5 +27,4 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{PAGINATION}
|
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* app/plugins/feedback/plugin.php
|
* app/plugins/redirects/plugin.php
|
||||||
*
|
*
|
||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Feedback
|
* @package TP Redirects
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
|
@ -16,6 +16,8 @@ use ReflectionClass;
|
|||||||
use TheTempusProject\Classes\Installer;
|
use TheTempusProject\Classes\Installer;
|
||||||
use TheTempusProject\Houdini\Classes\Navigation;
|
use TheTempusProject\Houdini\Classes\Navigation;
|
||||||
use TheTempusProject\Classes\Plugin;
|
use TheTempusProject\Classes\Plugin;
|
||||||
|
use TheTempusProject\Houdini\Classes\Components;
|
||||||
|
use TheTempusProject\Houdini\Classes\Views;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
|
|
||||||
class Subscribe extends Plugin {
|
class Subscribe extends Plugin {
|
||||||
@ -31,4 +33,9 @@ class Subscribe extends Plugin {
|
|||||||
'url' => '{ROOT_URL}admin/subscriptions',
|
'url' => '{ROOT_URL}admin/subscriptions',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function __construct( $load = false ) {
|
||||||
|
parent::__construct( $load );
|
||||||
|
Components::set( 'FOOTER_RIGHT', Views::simpleView( 'subscribe.footer.right') );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
15
app/plugins/subscribe/views/footer/right.html
Normal file
15
app/plugins/subscribe/views/footer/right.html
Normal 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>
|
@ -28,12 +28,23 @@ class DefaultLoader extends Loader {
|
|||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
Components::set( 'TEMPLATE_URL', Template::parse( '{ROOT_URL}app/templates/default/' ) );
|
Components::set( 'TEMPLATE_URL', Template::parse( '{ROOT_URL}app/templates/default/' ) );
|
||||||
Components::set( 'BOOTSTRAP_CDN', self::BOOTSTRAP_CDN );
|
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->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>' );
|
$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::setIfNull( 'LOGO', Config::getValue( 'main/logo' ) );
|
||||||
Components::set( 'FOOT', Navigation::getMenuView( 'foot', 'FOOTER_LINKS', App::FOOTER_MENU_NAME, false ) );
|
Components::setIfNull( 'FOOTER_LEFT', Navigation::getMenuView( 'footer.left', 'FOOTER_LINKS', App::FOOTER_MENU_NAME, false ) );
|
||||||
Components::set( 'COPY', Views::simpleView( 'copy') );
|
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
|
* Top-Nav
|
||||||
*/
|
*/
|
||||||
@ -47,8 +58,6 @@ class DefaultLoader extends Loader {
|
|||||||
Components::set( 'topNavRight', Template::parse( App::$topNavRight . '{STATUS}' ) );
|
Components::set( 'topNavRight', Template::parse( App::$topNavRight . '{STATUS}' ) );
|
||||||
Components::set( 'topNavLeft', Navigation::getMenuView( 'nav.main', 'MENU_LINKS', App::MAIN_MENU_NAME ) );
|
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( 'colorSelect', Views::simpleView( 'forms.colorSelect' ) );
|
||||||
Components::set( 'iconSelect', Views::simpleView( 'forms.iconSelect' ) );
|
Components::set( 'iconSelect', Views::simpleView( 'forms.iconSelect' ) );
|
||||||
Navigation::setCrumbComponent( 'BREADCRUMB', Input::get( 'url' ) );
|
Navigation::setCrumbComponent( 'BREADCRUMB', Input::get( 'url' ) );
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<legend><h2>Installed Dependencies</h2></legend>
|
<legend><h2>Installed Dependencies</h2></legend>
|
||||||
{PAGINATION}
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<legend><h2>Installed Models</h2></legend>
|
<legend><h2>Installed Models</h2></legend>
|
||||||
{PAGINATION}
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<legend><h2>Installed Plugins</h2></legend>
|
<legend><h2>Installed Plugins</h2></legend>
|
||||||
{PAGINATION}
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -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>
|
|
9
app/views/footer/center.html
Normal file
9
app/views/footer/center.html
Normal 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>
|
17
app/views/footer/container.html
Normal file
17
app/views/footer/container.html
Normal 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>
|
7
app/views/footer/left.html
Normal file
7
app/views/footer/left.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
<div class="col-lg-3 text-center">
|
||||||
|
<h3> Contact </h3>
|
||||||
|
<ul>
|
||||||
|
{FOOTER_LINKS}
|
||||||
|
</ul>
|
||||||
|
</div>
|
15
app/views/footer/right.html
Normal file
15
app/views/footer/right.html
Normal 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>
|
@ -151,14 +151,14 @@ function sideLoad() {
|
|||||||
// Canary Autoloader (Debugging)
|
// Canary Autoloader (Debugging)
|
||||||
if ( ! defined( 'CANARY_AUTOLOADED' ) ) {
|
if ( ! defined( 'CANARY_AUTOLOADED' ) ) {
|
||||||
if ( defined( 'CANARY_ROOT_DIRECTORY' ) ) {
|
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)
|
// Bedrock Autoloader (Core Functionality)
|
||||||
if ( ! defined( 'BEDROCK_AUTOLOADED' ) ) {
|
if ( ! defined( 'BEDROCK_AUTOLOADED' ) ) {
|
||||||
if ( defined( 'BEDROCK_ROOT_DIRECTORY' ) ) {
|
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 );
|
define( 'VENDOR_AUTOLOADED', false );
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once 'bin/tempus_project.php';
|
require_once 'tempus_project.php';
|
||||||
|
@ -19,6 +19,7 @@ use TheTempusProject\Bedrock\Functions\Input;
|
|||||||
use TheTempusProject\Bedrock\Functions\Session;
|
use TheTempusProject\Bedrock\Functions\Session;
|
||||||
use TheTempusProject\Bedrock\Functions\Cookie;
|
use TheTempusProject\Bedrock\Functions\Cookie;
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
|
use TheTempusProject\Bedrock\Functions\Date;
|
||||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
|
||||||
use TheTempusProject\Hermes\Functions\Redirect;
|
use TheTempusProject\Hermes\Functions\Redirect;
|
||||||
@ -241,13 +242,85 @@ class TheTempusProject extends Bedrock {
|
|||||||
'example' => '(?)',
|
'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
|
* The constructor takes care of everything that we will need before
|
||||||
* finally calling appload to instantiate the appropriate controller/method.
|
* finally calling appload to instantiate the appropriate controller/method.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
// Initialize the parent app
|
// Initialize the parent app
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
Debug::info( 'Requested URL: ' . $this->getCurrentUrl() );
|
Debug::info( 'Requested URL: ' . $this->getCurrentUrl() );
|
||||||
@ -289,9 +362,6 @@ class TheTempusProject extends Bedrock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo '<pre>'.var_export( $plugins, true ).'</pre>';
|
|
||||||
// exit();
|
|
||||||
|
|
||||||
Debug::gend();
|
Debug::gend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,6 +399,13 @@ class TheTempusProject extends Bedrock {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dateTimeCallback( $data ) {
|
||||||
|
if ( empty( $data[2] ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return Date::formatTimestamp( $data[1], $data[2] );
|
||||||
|
}
|
||||||
|
|
||||||
public function loadFilters() {
|
public function loadFilters() {
|
||||||
// These Filter have to be loaded here because they have calculated values
|
// These Filter have to be loaded here because they have calculated values
|
||||||
$this->filters[] = [
|
$this->filters[] = [
|
||||||
@ -359,9 +436,17 @@ class TheTempusProject extends Bedrock {
|
|||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'example' => '{LOGGEDIN}Only visible to users who are logged-in{LOGGEDIN}',
|
'example' => '{LOGGEDIN}Only visible to users who are logged-in{LOGGEDIN}',
|
||||||
];
|
];
|
||||||
if ( !empty( $this->filters ) ) {
|
$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 ) {
|
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 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,16 @@
|
|||||||
"require":
|
"require":
|
||||||
{
|
{
|
||||||
"fortawesome/font-awesome": "4.7",
|
"fortawesome/font-awesome": "4.7",
|
||||||
"thetempusproject/bedrock": "1.0.8",
|
"thetempusproject/bedrock": "1.0.10",
|
||||||
"thetempusproject/canary": "1.0.4",
|
"thetempusproject/canary": "1.0.5",
|
||||||
"thetempusproject/houdini": "1.0.7",
|
"thetempusproject/houdini": "1.0.8",
|
||||||
|
"components/jquery": "1.9.*",
|
||||||
"twbs/bootstrap": "3.3.7"
|
"twbs/bootstrap": "3.3.7"
|
||||||
},
|
},
|
||||||
"autoload":
|
"autoload":
|
||||||
{
|
{
|
||||||
"files":
|
"files":
|
||||||
[
|
[
|
||||||
"app/functions/forms.php",
|
|
||||||
"app/functions/common.php"
|
"app/functions/common.php"
|
||||||
],
|
],
|
||||||
"classmap":
|
"classmap":
|
||||||
@ -56,8 +56,11 @@
|
|||||||
{
|
{
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
"sort-packages": true
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"robloach/component-installer": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
}
|
}
|
||||||
|
269
composer.lock
generated
269
composer.lock
generated
@ -4,8 +4,60 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "d2223741ba10267e9b8f31f8bbe24b63",
|
"content-hash": "4d87b4a533236913cbbc0e75664016de",
|
||||||
"packages": [
|
"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",
|
"name": "fortawesome/font-awesome",
|
||||||
"version": "v4.7.0",
|
"version": "v4.7.0",
|
||||||
@ -58,13 +110,204 @@
|
|||||||
},
|
},
|
||||||
"time": "2016-10-24T15:52:54+00:00"
|
"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",
|
"name": "thetempusproject/bedrock",
|
||||||
"version": "1.0.8",
|
"version": "1.0.10",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.thetempusproject.com/the-tempus-project/bedrock",
|
"url": "https://git.thetempusproject.com/the-tempus-project/bedrock",
|
||||||
"reference": "ef4818356ce4cb5c4ceaf09e013f5acd606b7e0a"
|
"reference": "42ade08306525488f2449a2f4e3e05569eee9822"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0",
|
"php": ">=8.1.0",
|
||||||
@ -101,15 +344,15 @@
|
|||||||
"framework",
|
"framework",
|
||||||
"mvc"
|
"mvc"
|
||||||
],
|
],
|
||||||
"time": "2024-08-13T06:35:11+00:00"
|
"time": "2024-08-21T10:12:54+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "thetempusproject/canary",
|
"name": "thetempusproject/canary",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.thetempusproject.com/the-tempus-project/canary",
|
"url": "https://git.thetempusproject.com/the-tempus-project/canary",
|
||||||
"reference": "7ce988fbd95c0d9b975e7647f2e4d7ee3d5e3aad"
|
"reference": "35415fbf3c5888ccdb8a8695989176a120026c7f"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0"
|
"php": ">=8.1.0"
|
||||||
@ -144,15 +387,15 @@
|
|||||||
"thetempusproject",
|
"thetempusproject",
|
||||||
"tools"
|
"tools"
|
||||||
],
|
],
|
||||||
"time": "2024-08-10T18:58:57+00:00"
|
"time": "2024-08-20T10:26:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "thetempusproject/hermes",
|
"name": "thetempusproject/hermes",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.thetempusproject.com/the-tempus-project/hermes",
|
"url": "https://git.thetempusproject.com/the-tempus-project/hermes",
|
||||||
"reference": "171183c0abdbbdf12b3b577821636dd1c51ec752"
|
"reference": "31c51c1a5bad2871df800c89f27ace0a49848583"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0"
|
"php": ">=8.1.0"
|
||||||
@ -187,15 +430,15 @@
|
|||||||
"thetempusproject",
|
"thetempusproject",
|
||||||
"tools"
|
"tools"
|
||||||
],
|
],
|
||||||
"time": "2024-08-13T02:56:27+00:00"
|
"time": "2024-08-20T10:26:47+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "thetempusproject/houdini",
|
"name": "thetempusproject/houdini",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.thetempusproject.com/the-tempus-project/houdini",
|
"url": "https://git.thetempusproject.com/the-tempus-project/houdini",
|
||||||
"reference": "4d2ccfb1c5f18dba9886405e7e6e2264e04e1f89"
|
"reference": "d9e61d3f8f5d10f3fa7ba31907a4b3c1edc76614"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0",
|
"php": ">=8.1.0",
|
||||||
@ -231,7 +474,7 @@
|
|||||||
"thetempusproject",
|
"thetempusproject",
|
||||||
"tools"
|
"tools"
|
||||||
],
|
],
|
||||||
"time": "2024-08-13T03:43:46+00:00"
|
"time": "2024-08-20T10:30:48+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twbs/bootstrap",
|
"name": "twbs/bootstrap",
|
||||||
|
56
install.php
56
install.php
@ -188,6 +188,7 @@ class Install extends Controller {
|
|||||||
Views::view( 'install.check' );
|
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
|
* 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.
|
* 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();
|
$logo = 'Uploads/Images/System/' . Upload::last();
|
||||||
}
|
}
|
||||||
TheTempusProject::$activeConfig->load( BEDROCK_CONFIG_JSON );
|
TheTempusProject::$activeConfig->load( BEDROCK_CONFIG_JSON );
|
||||||
$configMatrix = [
|
$baseConfig = TheTempusProject::$configMatrix;
|
||||||
'main' => [
|
$baseConfig['main']['logo']['value'] = $logo;
|
||||||
'logo' => [
|
$baseConfig['main']['name']['value'] = Input::postNull( 'siteName' );
|
||||||
'value' => $logo,
|
$baseConfig['main']['template']['value'] = $baseConfig['main']['template']['default'];
|
||||||
],
|
$baseConfig['main']['tokenEnabled']['value'] = $baseConfig['main']['tokenEnabled']['default'];
|
||||||
'name' => [
|
$baseConfig['main']['loginLimit']['value'] = $baseConfig['main']['loginLimit']['default'];
|
||||||
'value' => Input::postNull( 'siteName' ),
|
$baseConfig['database']['dbEnabled']['value'] = $baseConfig['database']['dbEnabled']['default'];
|
||||||
],
|
$baseConfig['database']['dbHost']['value'] = Input::postNull( 'dbHost' );
|
||||||
'loginLimit' => [
|
$baseConfig['database']['dbMaxQuery']['value'] = $baseConfig['database']['dbMaxQuery']['default'];
|
||||||
'type' => 'text',
|
$baseConfig['database']['dbName']['value'] = Input::postNull( 'dbName' );
|
||||||
'pretty' => 'Maximum Login Attempts per hour',
|
$baseConfig['database']['dbPassword']['value'] = Input::postNull( 'dbPassword' );
|
||||||
'default' => 5,
|
$baseConfig['database']['dbPrefix']['value'] = Input::postNull( 'dbPrefix' );
|
||||||
'value' => 5,
|
$baseConfig['database']['dbUsername']['value'] = Input::postNull( 'dbUsername' );
|
||||||
],
|
if ( ! TheTempusProject::$activeConfig->generate( CONFIG_JSON, $baseConfig ) ) {
|
||||||
],
|
|
||||||
'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 ) ) {
|
|
||||||
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.' );
|
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.' );
|
Session::flash( 'success', 'Config saved successfully.' );
|
||||||
@ -366,7 +341,6 @@ class Install extends Controller {
|
|||||||
} else {
|
} else {
|
||||||
$installResult = $this->installer->installModel( (object) $module, [ 'installResources' => true ], false );
|
$installResult = $this->installer->installModel( (object) $module, [ 'installResources' => true ], false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$installResult ) {
|
if ( !$installResult ) {
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user