Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
a1f786876e | |||
46390c2447 | |||
c40b29e812 | |||
4dd66c6f56 | |||
2ac64e5c49 | |||
5590592ebe | |||
b65dda1328 | |||
f928e87141 | |||
a6b241c7f0 | |||
a38d132e61 | |||
d7e8b586d7 | |||
ea120e09bc | |||
2aed4ec2ed | |||
bd939cc078 | |||
1fb4d2eb57 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -65,3 +65,4 @@ vendor/canary/logs/*
|
|||||||
components/*
|
components/*
|
||||||
mailhog.log
|
mailhog.log
|
||||||
uploads/*
|
uploads/*
|
||||||
|
images/qr-codes/
|
||||||
|
@ -35,7 +35,7 @@ New classes must be prefaced with a doc-block following this style:
|
|||||||
*
|
*
|
||||||
* This is the admin controller.
|
* This is the admin controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the base admin controller. Every other admin controller should
|
* This is the base admin controller. Every other admin controller should
|
||||||
* extend this class.
|
* extend this class.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the base api controller. Every other api controller should
|
* This is the base api controller. Every other api controller should
|
||||||
* extend this class.
|
* extend this class.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class handles all the hard-coded configurations.
|
* This class handles all the hard-coded configurations.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -69,14 +69,21 @@ class Config extends BedrockConfig {
|
|||||||
$html .= '<div class="col-lg-6">';
|
$html .= '<div class="col-lg-6">';
|
||||||
$html .= $fieldHtml;
|
$html .= $fieldHtml;
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
$html .= '</div>';
|
||||||
if ( 'file' === $node['type'] ) {
|
if ( 'file' === $node['type'] ) {
|
||||||
$html .= '<div class="mb-3 row">';
|
$html .= '<div class="mb-3 row">';
|
||||||
$html .= '<h4 class="col-lg-3 col-form-label text-end">Current Image</h4>';
|
$html .= '<h4 class="col-lg-3 col-form-label text-end">Current Value</h4>';
|
||||||
$html .= '<div class="col-lg-6">';
|
$html .= '<div class="col-lg-6">';
|
||||||
$html .= '<img alt="User Avatar" src="{ROOT_URL}' . $node['value'] . '" class="img-circle img-fluid p-2 avatar-125">';
|
$html .= '<input type="text" class="form-control" name="'.$fieldname.'Text" value="'.$node['value'] . '">';
|
||||||
|
$html .= '</div>';
|
||||||
|
$html .= '</div>';
|
||||||
|
$html .= '<div class="mb-3 row">';
|
||||||
|
$html .= '<h4 class="col-lg-3 col-form-label text-end">Current Image</h4>';
|
||||||
|
$html .= '<div class="col-lg-6 d-flex justify-content-center">';
|
||||||
|
$html .= '<img alt="configured image" src="{ROOT_URL}' . $node['value'] . '" class="img-circle img-fluid p-2 avatar-125">';
|
||||||
|
$html .= '</div>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
return Template::parse( $html );
|
return Template::parse( $html );
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the main controller class.
|
* This is the main controller class.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the main TempusProject database model.
|
* This is the main TempusProject database model.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -121,7 +121,6 @@ class DatabaseModel extends BedrockDatabaseModel {
|
|||||||
$errors = [];
|
$errors = [];
|
||||||
foreach ( self::$installFlags as $flag_name ) {
|
foreach ( self::$installFlags as $flag_name ) {
|
||||||
if ( empty( $options[$flag_name] ) ) {
|
if ( empty( $options[$flag_name] ) ) {
|
||||||
$module_data[ $flag_name ] = INSTALL_STATUS_SKIPPED;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is our class for constructing and sending various kinds of emails.
|
* This is our class for constructing and sending various kinds of emails.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -164,7 +164,7 @@ class Email {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data->MAIL_FOOT = Views::simpleView( 'email.foot' );
|
$data->MAIL_FOOT = Views::simpleView( 'email.foot' );
|
||||||
$data->MAIL_TITLE = self::$title;
|
$data->MAIL_TITLE = Template::parse( self::$title );
|
||||||
$data->MAIL_BODY = Template::parse( self::$message, $data );
|
$data->MAIL_BODY = Template::parse( self::$message, $data );
|
||||||
$subject = Template::parse( self::$subject, $data );
|
$subject = Template::parse( self::$subject, $data );
|
||||||
$body = Views::simpleView( 'email.template', $data );
|
$body = Views::simpleView( 'email.template', $data );
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* error reporting to easily define exactly what feedback you
|
* error reporting to easily define exactly what feedback you
|
||||||
* would like to give.
|
* would like to give.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -115,6 +115,8 @@ class Forms extends Check {
|
|||||||
self::addHandler( 'adminCreateToken', __CLASS__, 'adminCreateToken' );
|
self::addHandler( 'adminCreateToken', __CLASS__, 'adminCreateToken' );
|
||||||
self::addHandler( 'apiLogin', __CLASS__, 'apiLogin' );
|
self::addHandler( 'apiLogin', __CLASS__, 'apiLogin' );
|
||||||
self::addHandler( 'updatePreference', __CLASS__, 'updatePreference' );
|
self::addHandler( 'updatePreference', __CLASS__, 'updatePreference' );
|
||||||
|
self::addHandler( 'renameIImage', __CLASS__, 'renameIImage' );
|
||||||
|
self::addHandler( 'addImage', __CLASS__, 'addImage' );
|
||||||
self::addHandler( 'installStart', __CLASS__, 'install', [ 'start' ] );
|
self::addHandler( 'installStart', __CLASS__, 'install', [ 'start' ] );
|
||||||
self::addHandler( 'installAgreement', __CLASS__, 'install', [ 'agreement' ] );
|
self::addHandler( 'installAgreement', __CLASS__, 'install', [ 'agreement' ] );
|
||||||
self::addHandler( 'installCheck', __CLASS__, 'install', [ 'check' ] );
|
self::addHandler( 'installCheck', __CLASS__, 'install', [ 'check' ] );
|
||||||
@ -356,6 +358,10 @@ class Forms extends Check {
|
|||||||
self::addUserError( 'Invalid Email.' );
|
self::addUserError( 'Invalid Email.' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ( $user->usernameExists( Input::post( 'username' ) ) ) {
|
||||||
|
self::addUserError( 'A user with that username is already registered.' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ( !$user->noEmailExists( Input::post( 'email' ) ) ) {
|
if ( !$user->noEmailExists( Input::post( 'email' ) ) ) {
|
||||||
self::addUserError( 'A user with that email is already registered.' );
|
self::addUserError( 'A user with that email is already registered.' );
|
||||||
return false;
|
return false;
|
||||||
@ -663,4 +669,28 @@ class Forms extends Check {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function renameIImage() {
|
||||||
|
if ( !Input::exists( 'filelocation' ) ) {
|
||||||
|
self::addUserError( 'You must specify a location' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !Input::exists( 'newname' ) ) {
|
||||||
|
self::addUserError( 'You must specify a new name' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addImage() {
|
||||||
|
if ( !Input::exists( 'folderSelect' ) ) {
|
||||||
|
self::addUserError( 'You must specify a location' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !Input::exists( 'uploadImage' ) ) {
|
||||||
|
self::addUserError( 'You must include a file.' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* the application. It handles installing the application, installing and updating
|
* the application. It handles installing the application, installing and updating
|
||||||
* models as well as the database, and generating and checking the htaccess file.
|
* models as well as the database, and generating and checking the htaccess file.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -158,6 +158,10 @@ class Installer {
|
|||||||
} else {
|
} else {
|
||||||
self::$installJson['modules'][$name]['enabled_txt'] = '<span class="text-danger">No</span>';
|
self::$installJson['modules'][$name]['enabled_txt'] = '<span class="text-danger">No</span>';
|
||||||
}
|
}
|
||||||
|
// in this case only, we save an array to remove the objects later, so an array stored is a success.
|
||||||
|
if ( ! empty( self::$installJson['modules'][$name]['resources_installed'] ) && is_array( self::$installJson['modules'][$name]['resources_installed'] ) ) {
|
||||||
|
self::$installJson['modules'][$name]['resources_installed'] = INSTALL_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return self::$installJson['modules'][$name];
|
return self::$installJson['modules'][$name];
|
||||||
}
|
}
|
||||||
@ -530,7 +534,7 @@ class Installer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $flags as $flag_type ) {
|
foreach ( $flags as $flag_type ) {
|
||||||
if ( ! in_array( $modelInfo[ $flag_type ], [ INSTALL_STATUS_SUCCESS, INSTALL_STATUS_NOT_REQUIRED ] ) ) {
|
if ( empty( $modelInfo[ $flag_type ] ) || ! in_array( $modelInfo[ $flag_type ], [ INSTALL_STATUS_SUCCESS, INSTALL_STATUS_NOT_REQUIRED ] ) ) {
|
||||||
$modelInfo['installStatus'] = INSTALL_STATUS_PARTIALLY_INSTALLED;
|
$modelInfo['installStatus'] = INSTALL_STATUS_PARTIALLY_INSTALLED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class handles all the hard-coded permissions.
|
* This class handles all the hard-coded permissions.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -245,7 +245,7 @@ class Permissions {
|
|||||||
|
|
||||||
public static function getFieldEditHtml( $name, $default, $pretty ) {
|
public static function getFieldEditHtml( $name, $default, $pretty ) {
|
||||||
$fieldname = str_ireplace( '/', '-', $name );
|
$fieldname = str_ireplace( '/', '-', $name );
|
||||||
$fieldHtml = Forms::getSwitchHtml( $fieldname, [ 'true', 'false' ], $default );
|
$fieldHtml = Forms::getSwitchHtml( $fieldname, $default );
|
||||||
$html = '';
|
$html = '';
|
||||||
$html .= '<div class="mb-3 row">';
|
$html .= '<div class="mb-3 row">';
|
||||||
$html .= '<label for="' . $fieldname . '" class="col-lg-6 col-form-label text-end">' . $pretty . '</label>';
|
$html .= '<label for="' . $fieldname . '" class="col-lg-6 col-form-label text-end">' . $pretty . '</label>';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class is used as a foundation for all plugins to build from.
|
* This class is used as a foundation for all plugins to build from.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -89,7 +89,7 @@ class Plugin {
|
|||||||
|
|
||||||
foreach ( self::PLUGIN_FLAG_MAP as $flag_name => $function_name ) {
|
foreach ( self::PLUGIN_FLAG_MAP as $flag_name => $function_name ) {
|
||||||
if ( empty( $options[$flag_name] ) ) {
|
if ( empty( $options[$flag_name] ) ) {
|
||||||
$module_data[ $flag_name ] = INSTALL_STATUS_SKIPPED;
|
// $module_data[ $flag_name ] = INSTALL_STATUS_SKIPPED;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ class Plugin {
|
|||||||
public function installResources( $options = '' ) {
|
public function installResources( $options = '' ) {
|
||||||
if ( empty( $this->resourceMatrix ) ) {
|
if ( empty( $this->resourceMatrix ) ) {
|
||||||
Debug::log( 'resourceMatrix is empty' );
|
Debug::log( 'resourceMatrix is empty' );
|
||||||
return true;
|
return INSTALL_STATUS_NOT_REQUIRED;
|
||||||
}
|
}
|
||||||
$ids = [];
|
$ids = [];
|
||||||
foreach( $this->resourceMatrix as $tableName => $entries ) {
|
foreach( $this->resourceMatrix as $tableName => $entries ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class handles all the hard-coded preferences.
|
* This class handles all the hard-coded preferences.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -276,7 +276,7 @@ class Preferences {
|
|||||||
$html .= '<div class="mb-3 row">';
|
$html .= '<div class="mb-3 row">';
|
||||||
$html .= '<h4 class="col-lg-6 col-form-label text-start text-lg-end">Current Image</h4>';
|
$html .= '<h4 class="col-lg-6 col-form-label text-start text-lg-end">Current Image</h4>';
|
||||||
$html .= '<div class="col-lg-6">';
|
$html .= '<div class="col-lg-6">';
|
||||||
$html .= '<img alt="User Avatar" src="{ROOT_URL}' . $defaultValue . '" class="img-circle img-fluid p-2 avatar-125">';
|
$html .= '<img alt="preferred image" src="{ROOT_URL}' . $defaultValue . '" class="img-circle img-fluid p-2">';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
@ -39,7 +39,7 @@ if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
|
|||||||
define( 'CANARY_SECURE_HASH', 'd73ed7591a30f0ca7d686a0e780f0d05' );
|
define( 'CANARY_SECURE_HASH', 'd73ed7591a30f0ca7d686a0e780f0d05' );
|
||||||
# Tempus Project Core
|
# Tempus Project Core
|
||||||
define( 'APP_NAME', 'The Tempus Project');
|
define( 'APP_NAME', 'The Tempus Project');
|
||||||
define( 'TP_DEFAULT_LOGO', 'images/logo.png');
|
define( 'TP_DEFAULT_LOGO', 'images/logoWhite.png');
|
||||||
// Check
|
// Check
|
||||||
define( 'MINIMUM_PHP_VERSION', 8.1);
|
define( 'MINIMUM_PHP_VERSION', 8.1);
|
||||||
// Cookies
|
// Cookies
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the admin log controller.
|
* This is the admin log controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the composer controller. Its only very effective when using composer for autoloading.
|
* This is the composer controller. Its only very effective when using composer for autoloading.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the error logs controller.
|
* This is the error logs controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the groups admin controller.
|
* This is the groups admin controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the admin dashboard controller.
|
* This is the admin dashboard controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the admin app/user tokens controller.
|
* This is the admin app/user tokens controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -23,8 +23,118 @@ use TheTempusProject\Bedrock\Functions\Input;
|
|||||||
use TheTempusProject\Bedrock\Functions\Check;
|
use TheTempusProject\Bedrock\Functions\Check;
|
||||||
use TheTempusProject\Hermes\Functions\Redirect;
|
use TheTempusProject\Hermes\Functions\Redirect;
|
||||||
use TheTempusProject\Bedrock\Functions\Session;
|
use TheTempusProject\Bedrock\Functions\Session;
|
||||||
|
use TheTempusProject\Hermes\Functions\Route as Routes;
|
||||||
|
use TheTempusProject\Bedrock\Functions\Upload;
|
||||||
|
use RecursiveIteratorIterator;
|
||||||
|
use RecursiveDirectoryIterator;
|
||||||
|
use FilesystemIterator;
|
||||||
|
|
||||||
class Images extends AdminController {
|
class Images extends AdminController {
|
||||||
|
private $directories = [
|
||||||
|
APP_ROOT_DIRECTORY . 'images',
|
||||||
|
APP_ROOT_DIRECTORY . 'app/images',
|
||||||
|
APP_ROOT_DIRECTORY . 'app/plugins'
|
||||||
|
];
|
||||||
|
|
||||||
|
private $spacer = [];
|
||||||
|
|
||||||
|
private $excludedDirectories = [
|
||||||
|
'.',
|
||||||
|
'..',
|
||||||
|
'vendor',
|
||||||
|
'docker',
|
||||||
|
'logs',
|
||||||
|
'gitlab',
|
||||||
|
'uploads',
|
||||||
|
'config',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function upload() {
|
||||||
|
if ( Input::exists( 'submit' ) ) {
|
||||||
|
$route = '';
|
||||||
|
$destination = '';
|
||||||
|
if ( !TTPForms::check( 'addImage' ) ) {
|
||||||
|
Issues::add( 'error', [ 'There was an error with your image upload.' => Check::userErrors() ] );
|
||||||
|
} else {
|
||||||
|
$folder = Input::post( 'folderSelect' ) . DIRECTORY_SEPARATOR;
|
||||||
|
// dv( $folder );
|
||||||
|
$upload = Upload::image( 'uploadImage', $folder );
|
||||||
|
if ( $upload ) {
|
||||||
|
$route = str_replace( APP_ROOT_DIRECTORY, '', $folder );
|
||||||
|
$destination = $route . Upload::last();
|
||||||
|
Issues::add( 'success', 'Image uploaded.' );
|
||||||
|
} else {
|
||||||
|
Issues::add( 'error', [ 'There was an error with your image upload.' => Check::userErrors() ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$folders = $this->getDirectoriesRecursive( APP_ROOT_DIRECTORY );
|
||||||
|
$folderHtml = $this->generateFolderHtml( $folders );
|
||||||
|
Components::set( 'FOLDER_SELECT_ROOT', APP_ROOT_DIRECTORY );
|
||||||
|
Components::set( 'FOLDER_SELECT', Views::simpleView( 'forms.folderSelect', $folderHtml ) );
|
||||||
|
Views::view( 'admin.images.upload' );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFolderObject( $folder, $subdirs = '' ) {
|
||||||
|
$names = explode( DIRECTORY_SEPARATOR, $folder );
|
||||||
|
$folderName = array_pop( $names );
|
||||||
|
$out = [
|
||||||
|
'spacer' => implode( '', $this->spacer ),
|
||||||
|
'folderName' => $folderName,
|
||||||
|
'location' => $folder,
|
||||||
|
'subdirs' => $subdirs,
|
||||||
|
];
|
||||||
|
if ( ! empty( $subdirs ) ) {
|
||||||
|
$out['folderexpand'] = '<i class="fa fa-caret-down"></i>';
|
||||||
|
} else {
|
||||||
|
$out['folderexpand'] = '';
|
||||||
|
}
|
||||||
|
return (object) $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateFolderHtml( $folders ) {
|
||||||
|
$rows = [];
|
||||||
|
foreach ( $folders as $top => $sub ) {
|
||||||
|
$object = $this->getFolderObject( $top );
|
||||||
|
if ( $top == $sub ) {
|
||||||
|
$html = '';
|
||||||
|
} else {
|
||||||
|
$this->spacer[] = '-> ';
|
||||||
|
$children = $this->generateFolderHtml( $sub );
|
||||||
|
array_pop( $this->spacer );
|
||||||
|
Components::set( 'parentfolderName', $object->folderName );
|
||||||
|
$html = Views::simpleView( 'forms.folderSelectParent', $children );
|
||||||
|
Components::set( 'parentfolderName', '' );
|
||||||
|
}
|
||||||
|
$rows[] = $this->getFolderObject( $top, $html );
|
||||||
|
}
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDirectoriesRecursive( $directory ) {
|
||||||
|
$dirs = [];
|
||||||
|
|
||||||
|
$directory = rtrim( $directory, DIRECTORY_SEPARATOR );
|
||||||
|
$directory = $directory. DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
$files = scandir( $directory );
|
||||||
|
$filteredFiles = array_values( array_diff( $files, $this->excludedDirectories ) );
|
||||||
|
|
||||||
|
foreach ( $filteredFiles as $key => $filename ) {
|
||||||
|
$long_name = $directory . $filename;
|
||||||
|
$is_dir = ( ( strpos( $filename, '.' ) === false ) && ( is_dir( $long_name ) === true ) );
|
||||||
|
if ( $is_dir ) {
|
||||||
|
$recursive_dirs = $this->getDirectoriesRecursive( $long_name );
|
||||||
|
if ( empty( $recursive_dirs ) ) {
|
||||||
|
$recursive_dirs = $long_name;
|
||||||
|
}
|
||||||
|
$dirs[$long_name] = $recursive_dirs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dirs;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -53,62 +163,175 @@ class Images extends AdminController {
|
|||||||
Debug::error( 'There was an error with your upload.');
|
Debug::error( 'There was an error with your upload.');
|
||||||
Issues::add( 'error', [ 'There was an error with your upload.' => Check::userErrors() ] );
|
Issues::add( 'error', [ 'There was an error with your upload.' => Check::userErrors() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if ( self::$token->create(
|
|
||||||
// Input::post( 'name' ),
|
|
||||||
// Input::post( 'notes' ),
|
|
||||||
// Input::post( 'token_type' )
|
|
||||||
// ) ) {
|
|
||||||
// Session::flash( 'success', 'Token Created' );
|
|
||||||
// Redirect::to( 'admin/images' );
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Views::view( 'admin.images.create' );
|
Views::view( 'admin.images.create' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete( $id = null ) {
|
public function delete() {
|
||||||
if ( self::$token->delete( [ $id ] ) ) {
|
if ( ! Input::exists( 'fileLocation' ) ) {
|
||||||
Session::flash( 'success', 'Token deleted.' );
|
Session::flash( 'warning', 'Unknown image.' );
|
||||||
}
|
|
||||||
Redirect::to( 'admin/images' );
|
Redirect::to( 'admin/images' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit( $id = null ) {
|
$fileLocation = Input::get('fileLocation');
|
||||||
$token = self::$token->findById( $id );
|
|
||||||
if ( Input::exists( 'submit' ) ) {
|
// Ensure the file exists
|
||||||
if ( !TTPForms::check( 'adminEditToken' ) ) {
|
if ( ! file_exists( $fileLocation ) ) {
|
||||||
Issues::add( 'error', [ 'There was an error with your token.' => Check::userErrors() ] );
|
Session::flash('error', 'File does not exist.');
|
||||||
} else {
|
|
||||||
if ( self::$token->update(
|
|
||||||
$id,
|
|
||||||
Input::post( 'name' ),
|
|
||||||
Input::post( 'notes' ),
|
|
||||||
Input::post( 'token_type' )
|
|
||||||
) ) {
|
|
||||||
Session::flash( 'success', 'Token Updated' );
|
|
||||||
Redirect::to('admin/images');
|
Redirect::to('admin/images');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the file is an image
|
||||||
|
$validMimeTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||||
|
$fileMimeType = mime_content_type( $fileLocation );
|
||||||
|
|
||||||
|
if ( ! in_array( $fileMimeType, $validMimeTypes ) ) {
|
||||||
|
Session::flash('error', 'Invalid file type. Only images can be deleted.');
|
||||||
|
Redirect::to('admin/images');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to delete the file
|
||||||
|
if (@unlink($fileLocation)) {
|
||||||
|
Session::flash('success', 'Image deleted.');
|
||||||
|
} else {
|
||||||
|
Session::flash('error', 'Failed to delete the image.');
|
||||||
|
}
|
||||||
|
|
||||||
|
Redirect::to('admin/images');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rename() {
|
||||||
|
if ( ! Input::exists( 'fileLocation' ) ) {
|
||||||
|
Session::flash( 'warning', 'Unknown image.' );
|
||||||
|
Redirect::to( 'admin/images' );
|
||||||
|
}
|
||||||
|
|
||||||
|
Components::set( 'filelocation', Input::get( 'fileLocation' ) );
|
||||||
|
|
||||||
|
if ( Input::exists( 'submit' ) ) {
|
||||||
|
if ( !TTPForms::check( 'renameIImage' ) ) {
|
||||||
|
Issues::add( 'error', [ 'There was an error renaming the image.' => Check::userErrors() ] );
|
||||||
|
} else {
|
||||||
|
$result = $this->renameFile( Input::post( 'filelocation' ), Input::post( 'newname' ) );
|
||||||
|
if ( ! empty( $result ) ) {
|
||||||
|
Session::flash( 'success', 'Image has been renamed.' );
|
||||||
|
Redirect::to( 'admin/images' );
|
||||||
|
} else {
|
||||||
|
Issues::add( 'error', [ 'There was an error with the install.' => $this->installer->getErrors() ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Forms::selectOption( $token->token_type );
|
}
|
||||||
return Views::view( 'admin.images.edit', $token );
|
|
||||||
|
return Views::view( 'admin.images.rename' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
return Views::view( 'admin.images.list', self::$token->listPaginated() );
|
return Views::view( 'admin.images.list.combined', $this->getAllImageDetails() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view( $id = null ) {
|
public function view() {
|
||||||
return Views::view( 'admin.images.view', self::$token->findById( $id ) );
|
if ( Input::exists( 'fileLocation' ) ) {
|
||||||
|
return Views::view( 'admin.images.view', $this->getImageByLocation( Input::get( 'fileLocation' ) ) );
|
||||||
|
}
|
||||||
|
return $this->index();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getAllImages() {
|
||||||
|
$files = [];
|
||||||
|
foreach ($this->directories as $dir) {
|
||||||
|
if ($dir === 'app/plugins') {
|
||||||
|
$pluginDirs = glob($dir . '/*', GLOB_ONLYDIR);
|
||||||
|
foreach ($pluginDirs as $pluginDir) {
|
||||||
|
$imageDir = $pluginDir . '/images';
|
||||||
|
if (is_dir($imageDir)) {
|
||||||
|
$files = array_merge($files, $this->scanDirectoryRecursively($imageDir));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$files = array_merge($files, $this->scanDirectory($dir));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function scanDirectory($path) {
|
||||||
|
return glob($path . '/*.{jpg,jpeg,png,gif,webp}', GLOB_BRACE) ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function scanDirectoryRecursively($path) {
|
||||||
|
$files = [];
|
||||||
|
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS));
|
||||||
|
|
||||||
|
foreach ($iterator as $file) {
|
||||||
|
if (preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $file->getFilename())) {
|
||||||
|
$files[] = $file->getPathname();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getAllImageDetails() {
|
||||||
|
$images = [];
|
||||||
|
$files = $this->getAllImages();
|
||||||
|
foreach ( $files as $file ) {
|
||||||
|
$images[] = $this->getImageByLocation( $file );
|
||||||
|
}
|
||||||
|
return $images;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getImageByLocation( $location ) {
|
||||||
|
$realPath = realpath( $location );
|
||||||
|
|
||||||
|
return (object) [
|
||||||
|
'filename' => basename( $location ),
|
||||||
|
'extension' => pathinfo( $location , PATHINFO_EXTENSION),
|
||||||
|
'fileSize' => $this->formatFileSize(filesize( $location )),
|
||||||
|
'location' => $realPath,
|
||||||
|
'locationSafe' => urlencode( $realPath ),
|
||||||
|
'url' => Routes::getAddress() . str_replace( APP_ROOT_DIRECTORY, '', $realPath ),
|
||||||
|
'folder' => dirname( $location )
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function formatFileSize($size) {
|
||||||
|
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||||
|
$i = 0;
|
||||||
|
while ($size >= 1024 && $i < count($units) - 1) {
|
||||||
|
$size /= 1024;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return round($size, 2) . ' ' . $units[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function renameFile( $currentLocation, $newFilename ) {
|
||||||
|
// Ensure the file exists
|
||||||
|
if (!file_exists($currentLocation)) {
|
||||||
|
throw new \Exception("File does not exist: $currentLocation");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract directory and current extension
|
||||||
|
$directory = dirname($currentLocation);
|
||||||
|
$currentExtension = pathinfo($currentLocation, PATHINFO_EXTENSION);
|
||||||
|
$newExtension = pathinfo($newFilename, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
// Ensure the file extension has not changed
|
||||||
|
if (strcasecmp($currentExtension, $newExtension) !== 0) {
|
||||||
|
throw new \Exception("File extension cannot be changed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct the new file path
|
||||||
|
$newLocation = $directory . DIRECTORY_SEPARATOR . $newFilename;
|
||||||
|
|
||||||
|
// Ensure the new file name does not already exist
|
||||||
|
if (file_exists($newLocation)) {
|
||||||
|
throw new \Exception("A file with the new name already exists: $newFilename");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to rename the file
|
||||||
|
if (!rename($currentLocation, $newLocation)) {
|
||||||
|
throw new \Exception("Failed to rename file.");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the login logs controller.
|
* This is the login logs controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the generic logs controller.
|
* This is the generic logs controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the installed plugins controller.
|
* This is the installed plugins controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the admin routes/redirects controller.
|
* This is the admin routes/redirects controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the admin email controller. The only real use is to send out emails to the various lists.
|
* This is the admin email controller. The only real use is to send out emails to the various lists.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the configuration and settings controller.
|
* This is the configuration and settings controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the admin app/user tokens controller.
|
* This is the admin app/user tokens controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the users admin controller.
|
* This is the users admin controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the api authentication controller.
|
* This is the api authentication controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the api authentication controller.
|
* This is the api authentication controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the users' api controller.
|
* This is the users' api controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the error controller.
|
* This is the error controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the home or 'index' controller.
|
* This is the home or 'index' controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the user registration controller.
|
* This is the user registration controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -25,6 +25,7 @@ use TheTempusProject\TheTempusProject as App;
|
|||||||
use TheTempusProject\Classes\Controller;
|
use TheTempusProject\Classes\Controller;
|
||||||
use TheTempusProject\Classes\Forms;
|
use TheTempusProject\Classes\Forms;
|
||||||
use TheTempusProject\Bedrock\Classes\Config;
|
use TheTempusProject\Bedrock\Classes\Config;
|
||||||
|
use TheTempusProject\Plugins\Turnstile;
|
||||||
|
|
||||||
class Register extends Controller {
|
class Register extends Controller {
|
||||||
public function confirm( $code = null ) {
|
public function confirm( $code = null ) {
|
||||||
@ -47,11 +48,19 @@ class Register extends Controller {
|
|||||||
public function index() {
|
public function index() {
|
||||||
self::$title = '{SITENAME} Sign Up';
|
self::$title = '{SITENAME} Sign Up';
|
||||||
self::$pageDescription = 'Many features of {SITENAME} are disabled or hidden from unregistered users. On this page you can sign up for an account to access all the app has to offer.';
|
self::$pageDescription = 'Many features of {SITENAME} are disabled or hidden from unregistered users. On this page you can sign up for an account to access all the app has to offer.';
|
||||||
|
|
||||||
if ( ! Config::getValue( 'main/registrationEnabled' ) ) {
|
if ( ! Config::getValue( 'main/registrationEnabled' ) ) {
|
||||||
return Issues::add( 'notice', 'The site administrator has disable the ability to register a new account.' );
|
return Issues::add( 'notice', 'The site administrator has disable the ability to register a new account.' );
|
||||||
}
|
}
|
||||||
|
$turnstile = '';
|
||||||
|
if ( class_exists( 'TheTempusProject\Plugins\Turnstile' ) ) {
|
||||||
|
$turnstile = new Turnstile;
|
||||||
|
if ( ! $turnstile->checkEnabled() ) {
|
||||||
|
Components::set( 'TURNSTILE_WIDGET', '' );
|
||||||
|
$turnstile = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Components::set( 'TURNSTILE_WIDGET', '' );
|
||||||
|
}
|
||||||
Components::set( 'TERMS', Views::simpleView( 'auth.terms' ) );
|
Components::set( 'TERMS', Views::simpleView( 'auth.terms' ) );
|
||||||
if ( App::$isLoggedIn ) {
|
if ( App::$isLoggedIn ) {
|
||||||
return Issues::add( 'notice', 'You are currently logged in.' );
|
return Issues::add( 'notice', 'You are currently logged in.' );
|
||||||
@ -59,10 +68,20 @@ class Register extends Controller {
|
|||||||
if ( ! Input::exists() ) {
|
if ( ! Input::exists() ) {
|
||||||
return Views::view( 'auth.register' );
|
return Views::view( 'auth.register' );
|
||||||
}
|
}
|
||||||
|
if ( Input::exists( 'userEmail' ) ) {
|
||||||
|
// for the really bad AI / headless bots
|
||||||
|
Session::flash( 'success', 'Thank you for registering! Please check your email to confirm your account.' );
|
||||||
|
Redirect::to( 'home/index' );
|
||||||
|
}
|
||||||
if ( ! Forms::check( 'register' ) ) {
|
if ( ! Forms::check( 'register' ) ) {
|
||||||
Issues::add( 'error', [ 'There was an error with your registration.' => Check::userErrors() ] );
|
Issues::add( 'error', [ 'There was an error with your registration.' => Check::userErrors() ] );
|
||||||
return Views::view( 'auth.register' );
|
return Views::view( 'auth.register' );
|
||||||
}
|
}
|
||||||
|
if ( ! empty( $turnstile ) ) {
|
||||||
|
if ( empty( $turnstile->verify() ) ) {
|
||||||
|
return Views::view( 'auth.register' );
|
||||||
|
}
|
||||||
|
}
|
||||||
self::$user->create( [
|
self::$user->create( [
|
||||||
'username' => Input::post( 'username' ),
|
'username' => Input::post( 'username' ),
|
||||||
'password' => Hash::make( Input::post( 'password' ) ),
|
'password' => Hash::make( Input::post( 'password' ) ),
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the user control panel controller.
|
* This is the user control panel controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* This is css used in the debuging console.
|
* This is css used in the debuging console.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -3,15 +3,27 @@
|
|||||||
*
|
*
|
||||||
* This file provides dark mode styles to override existing Bootstrap 5 base styles.
|
* This file provides dark mode styles to override existing Bootstrap 5 base styles.
|
||||||
*
|
*
|
||||||
* @version 3.0-dark
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.context-popover {
|
||||||
|
background-color: #383838;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.context-popover .popover-header {
|
||||||
|
background-color: #2c2c2c;
|
||||||
|
}
|
||||||
|
|
||||||
.context-main-border {
|
.context-main-border {
|
||||||
border-color: #f5f5f5!important;
|
border-color: #f5f5f5!important;
|
||||||
}
|
}
|
||||||
|
.context-main-border-other {
|
||||||
|
border-color: #1e1e1e!important;
|
||||||
|
}
|
||||||
|
|
||||||
.context-main-bg {
|
.context-main-bg {
|
||||||
background-color: #2c2c2c;
|
background-color: #2c2c2c;
|
||||||
|
@ -3,15 +3,52 @@
|
|||||||
*
|
*
|
||||||
* This file is for any css that should be applied site wide.
|
* This file is for any css that should be applied site wide.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
*/
|
*/
|
||||||
|
.facebook {
|
||||||
|
border-color: #1877F2 !important; /* Facebook Blue */
|
||||||
|
color: #1877F2 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.x-black {
|
||||||
|
border-color: #000000 !important; /* X (formerly Twitter) Black */
|
||||||
|
color: #000000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reddit {
|
||||||
|
border-color: #FF4500 !important; /* Reddit Orange */
|
||||||
|
color: #FF4500 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.opera {
|
||||||
|
border-color: #FF1B2D !important; /* Opera Red */
|
||||||
|
color: #FF1B2D !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.firefox {
|
||||||
|
border-color: #FF7139 !important; /* Firefox Orange */
|
||||||
|
color: #FF7139 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edge {
|
||||||
|
border-color: #0078D7 !important; /* Microsoft Edge Blue */
|
||||||
|
color: #0078D7 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.safari {
|
||||||
|
border-color: #0B78E3 !important; /* Safari Blue */
|
||||||
|
color: #0B78E3 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.context-main-border {
|
.context-main-border {
|
||||||
border-color: #1e1e1e!important;
|
border-color: #1e1e1e!important;
|
||||||
}
|
}
|
||||||
|
.context-main-border-other {
|
||||||
|
border-color: #f5f5f5!important;
|
||||||
|
}
|
||||||
|
|
||||||
.context-main-bg {
|
.context-main-bg {
|
||||||
background-color: #f7f7f7;
|
background-color: #f7f7f7;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* app/functions/common.php
|
* app/functions/common.php
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 56 KiB |
BIN
app/images/ttp-gitlab.png
Normal file
BIN
app/images/ttp-gitlab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 47 KiB |
152
app/js/main.js
152
app/js/main.js
@ -3,11 +3,101 @@
|
|||||||
*
|
*
|
||||||
* This file is for 'access anywhere' javascript.
|
* This file is for 'access anywhere' javascript.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Progressive Web-App
|
||||||
|
**/
|
||||||
|
let deferredPrompt;
|
||||||
|
const installPrompt = document.getElementById("install-prompt");
|
||||||
|
const chromeMessage = document.getElementById("chrome-install-message");
|
||||||
|
const iosMessage = document.getElementById("ios-install-message");
|
||||||
|
const installButton = document.getElementById("install-button");
|
||||||
|
const dismissButton = document.querySelector("#install-prompt .btn-close");
|
||||||
|
|
||||||
|
// Check if the user previously dismissed the prompt
|
||||||
|
if ( ! localStorage.getItem("pwaInstallDismissed") ) {
|
||||||
|
window.addEventListener("beforeinstallprompt", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
deferredPrompt = event;
|
||||||
|
installPrompt.classList.remove("d-none");
|
||||||
|
installPrompt.classList.add("d-block"); // Show the alert
|
||||||
|
if ( chromeMessage ) {
|
||||||
|
chromeMessage.classList.remove("d-none");
|
||||||
|
chromeMessage.classList.add("d-block"); // Show the prompt
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if ( isIos() && ! isInStandaloneMode() ) {
|
||||||
|
installPrompt.classList.remove("d-none");
|
||||||
|
installPrompt.classList.add("d-block"); // Show the alert
|
||||||
|
|
||||||
|
if ( iosMessage ) {
|
||||||
|
iosMessage.classList.remove("d-none");
|
||||||
|
iosMessage.classList.add("d-block"); // Show the prompt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ios REQUIRES a service worker
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
navigator.serviceWorker.register('/app/js/sw.js')
|
||||||
|
.then(() => console.log('Service Worker Registered'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Install Button Click
|
||||||
|
if ( installButton ) {
|
||||||
|
installButton.addEventListener("click", async () => {
|
||||||
|
if ( deferredPrompt ) {
|
||||||
|
deferredPrompt.prompt();
|
||||||
|
const { outcome } = await deferredPrompt.userChoice;
|
||||||
|
|
||||||
|
if (outcome === "dismissed") {
|
||||||
|
setInstallDismissed(); // Store that the user dismissed the prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
deferredPrompt = null; // Reset prompt
|
||||||
|
installPrompt.classList.remove("d-block");
|
||||||
|
installPrompt.classList.add("d-none");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Close Button Click
|
||||||
|
if ( dismissButton ) {
|
||||||
|
dismissButton.addEventListener("click", () => {
|
||||||
|
setInstallDismissed(); // Store that the user dismissed the prompt
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to remember user choice for 7 days
|
||||||
|
function setInstallDismissed() {
|
||||||
|
localStorage.setItem("pwaInstallDismissed", Date.now() + 7 * 24 * 60 * 60 * 1000);
|
||||||
|
installPrompt.classList.remove("d-block"); // Hide the prompt
|
||||||
|
installPrompt.classList.add("d-none");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the 7-day period has passed
|
||||||
|
if (localStorage.getItem("pwaInstallDismissed")) {
|
||||||
|
const dismissUntil = parseInt(localStorage.getItem("pwaInstallDismissed"), 10);
|
||||||
|
if (Date.now() < dismissUntil) {
|
||||||
|
//
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem("pwaInstallDismissed"); // Reset after 7 days
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isIos() {
|
||||||
|
return /iphone|ipad|ipod/i.test(navigator.userAgent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isInStandaloneMode() {
|
||||||
|
return window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically selects/de-selects all check boxes associated with that field
|
* Automatically selects/de-selects all check boxes associated with that field
|
||||||
**/
|
**/
|
||||||
@ -80,14 +170,14 @@ function copyElementText( id ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
$('select').each(function() {
|
document.querySelectorAll("select").forEach(function (select) {
|
||||||
var selectedValue = $(this).attr('value');
|
var selectedValue = select.getAttribute("value");
|
||||||
if (selectedValue) {
|
if (selectedValue) {
|
||||||
$(this).removeAttr('value');
|
select.removeAttribute("value");
|
||||||
$(this).find('option').each(function() {
|
select.querySelectorAll("option").forEach(function (option) {
|
||||||
if ($(this).attr('value') === selectedValue) {
|
if (option.getAttribute("value") === selectedValue) {
|
||||||
$(this).prop('selected', true);
|
option.selected = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -179,11 +269,45 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggleDarkModePref(value) {
|
function toggleDarkModePref(value) {
|
||||||
var fields = {};
|
var fields = new URLSearchParams();
|
||||||
fields.prefName = 'darkMode';
|
fields.append("prefName", "darkMode");
|
||||||
fields.prefValue = value;
|
fields.append("prefValue", value);
|
||||||
$.post( '/usercp/updatePref', fields ).done(function(response) {
|
|
||||||
// alert('Timer updated successfully!');
|
fetch("/usercp/updatePref", {
|
||||||
});
|
method: "POST",
|
||||||
|
body: fields,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// .then(response => response.text()) // Handle response if needed
|
||||||
|
.catch(error => console.error("Error:", error));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// this reverses the carets for the folderSelect
|
||||||
|
document.querySelectorAll('[data-bs-toggle="collapse"]').forEach(button => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const icon = button.querySelector('i');
|
||||||
|
|
||||||
|
// Only proceed if the icon already has one of the relevant classes
|
||||||
|
if (icon && (icon.classList.contains('fa-caret-down') || icon.classList.contains('fa-caret-up'))) {
|
||||||
|
icon.classList.toggle('fa-caret-down', button.classList.contains('collapsed'));
|
||||||
|
icon.classList.toggle('fa-caret-up', !button.classList.contains('collapsed'));
|
||||||
|
}
|
||||||
|
}, 150);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// this should load all popovers
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
||||||
|
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||||
|
return new bootstrap.Popover(popoverTriggerEl, {
|
||||||
|
customClass: 'context-popover',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
1
app/js/sw.js
Normal file
1
app/js/sw.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
self.addEventListener('fetch', () => {});
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class is used for the manipulation of the groups database table.
|
* This class is used for the manipulation of the groups database table.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -46,6 +46,14 @@ class Group extends DatabaseModel {
|
|||||||
'pretty' => 'Access Administrator Areas',
|
'pretty' => 'Access Administrator Areas',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
],
|
],
|
||||||
|
'uploadImages' => [
|
||||||
|
'pretty' => 'Upload images (such as avatars)',
|
||||||
|
'default' => false,
|
||||||
|
],
|
||||||
|
'maintenanceAccess' => [
|
||||||
|
'pretty' => 'Upload images (such as avatars)',
|
||||||
|
'default' => false,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
public $resourceMatrix = [
|
public $resourceMatrix = [
|
||||||
[
|
[
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Model for handling all logging.
|
* Model for handling all logging.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class is used for the manipulation of the routes database table.
|
* This class is used for the manipulation of the routes database table.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Notes: After refactor, the sessions will use ID's for short term, and Cookies
|
* Notes: After refactor, the sessions will use ID's for short term, and Cookies
|
||||||
* will use the token for long term storage
|
* will use the token for long term storage
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -59,7 +59,7 @@ class Sessions extends DatabaseModel {
|
|||||||
public function checkSession( $sessionID ) {
|
public function checkSession( $sessionID ) {
|
||||||
$user = new User;
|
$user = new User;
|
||||||
// @todo lets put this on some sort of realistic checking regime other than check everything every time
|
// @todo lets put this on some sort of realistic checking regime other than check everything every time
|
||||||
if ( $sessionID == false ) {
|
if ( empty( $sessionID ) ) {
|
||||||
Debug::log( 'sessionID false' );
|
Debug::log( 'sessionID false' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This class is used for the manipulation of the tokens database table.
|
* This class is used for the manipulation of the tokens database table.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @todo finish fixing the check functions that were migrated here
|
* @todo finish fixing the check functions that were migrated here
|
||||||
* These could go in the Forms class?
|
* These could go in the Forms class?
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -47,12 +47,6 @@ class User extends DatabaseModel {
|
|||||||
public $searchFields = [
|
public $searchFields = [
|
||||||
'username',
|
'username',
|
||||||
];
|
];
|
||||||
public $permissionMatrix = [
|
|
||||||
'uploadImages' => [
|
|
||||||
'pretty' => 'Upload images (such as avatars)',
|
|
||||||
'default' => false,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
public $preferenceMatrix = [
|
public $preferenceMatrix = [
|
||||||
'gender' => [
|
'gender' => [
|
||||||
'pretty' => 'Gender',
|
'pretty' => 'Gender',
|
||||||
@ -647,7 +641,7 @@ class User extends DatabaseModel {
|
|||||||
Debug::error( 'User not created.' );
|
Debug::error( 'User not created.' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return self::$db->lastId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the Blog admin controller.
|
* This is the Blog admin controller.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the blog controller.
|
* This is the blog controller.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the form checking functions for this plugin.
|
* This houses all of the form checking functions for this plugin.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This class is used for the manipulation of the blog database table.
|
* This class is used for the manipulation of the blog database table.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the loader for the blog template.
|
* This is the loader for the blog template.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* app/plugins/blog/templates/blog.tpl
|
* app/plugins/blog/templates/blog.tpl
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -45,19 +45,19 @@
|
|||||||
<!-- Navbar Toggler (Left) -->
|
<!-- Navbar Toggler (Left) -->
|
||||||
|
|
||||||
<!-- Centered Logo (Now inside normal document flow) -->
|
<!-- Centered Logo (Now inside normal document flow) -->
|
||||||
<a href="/" class="d-flex align-items-center text-white text-decoration-none d-md-none mx-auto">
|
<a href="/" class="align-items-center text-white text-decoration-none d-flex d-md-none">
|
||||||
<img src="{ROOT_URL}{LOGO}" width="40" height="32" alt="{SITENAME} Logo" class="bi">
|
<img src="{ROOT_URL}{LOGO}" width="40" height="32" alt="{SITENAME} Logo" class="bi">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Logo (Normal Position for Large Screens) -->
|
<!-- Logo (Normal Position for Large Screens) -->
|
||||||
<a href="/" class="d-flex align-items-center text-white text-decoration-none d-none d-md-flex">
|
<a href="/" class="align-items-center text-white text-decoration-none d-none d-md-flex">
|
||||||
<img src="{ROOT_URL}{LOGO}" width="40" height="32" alt="{SITENAME} Logo" class="bi">
|
<img src="{ROOT_URL}{LOGO}" width="40" height="32" alt="{SITENAME} Logo" class="bi">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="navbar-expand-md flex-grow-1">
|
<div class="navbar-expand-md flex-grow-1">
|
||||||
<div class="collapse navbar-collapse d-md-flex" id="mainMenu">
|
<div class="collapse navbar-collapse d-md-flex" id="mainMenu">
|
||||||
<!-- Centered Navigation -->
|
<!-- Centered Navigation -->
|
||||||
<div class="d-none d-md-block d-flex justify-content-center w-100 position-absolute start-50 translate-middle-x">
|
<div class="d-none d-md-block d-flex justify-content-center position-absolute start-50 translate-middle-x">
|
||||||
{topNavLeft}
|
{topNavLeft}
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-center flex-grow-1 d-md-none">
|
<div class="d-flex justify-content-center flex-grow-1 d-md-none">
|
||||||
@ -77,6 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="d-flex flex-column min-vh-100">
|
<div class="d-flex flex-column min-vh-100">
|
||||||
<div class="flex-container flex-grow-1">
|
<div class="flex-container flex-grow-1">
|
||||||
{ISSUES}
|
{ISSUES}
|
||||||
@ -129,7 +130,6 @@
|
|||||||
{FOOT}
|
{FOOT}
|
||||||
</div>
|
</div>
|
||||||
<!-- Bootstrap core JavaScript and jquery -->
|
<!-- Bootstrap core JavaScript and jquery -->
|
||||||
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{JQUERY_CDN}jquery.min.js"></script>
|
|
||||||
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
||||||
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{BOOTSTRAP_CDN}js/bootstrap.min.js"></script>
|
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{BOOTSTRAP_CDN}js/bootstrap.min.js"></script>
|
||||||
<!-- Custom javascript for this template -->
|
<!-- Custom javascript for this template -->
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the loader for the rss template.
|
* This is the loader for the rss template.
|
||||||
*
|
*
|
||||||
* @package TP Blog
|
* @package TP Blog
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the bug report admin controller.
|
* This is the bug report admin controller.
|
||||||
*
|
*
|
||||||
* @package TP BugReports
|
* @package TP BugReports
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the bug reports controller.
|
* This is the bug reports controller.
|
||||||
*
|
*
|
||||||
* @package TP BugReports
|
* @package TP BugReports
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the form checking functions for this plugin.
|
* This houses all of the form checking functions for this plugin.
|
||||||
*
|
*
|
||||||
* @package TP BugReports
|
* @package TP BugReports
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This class is used for the manipulation of the bugreports database table.
|
* This class is used for the manipulation of the bugreports database table.
|
||||||
*
|
*
|
||||||
* @package TP BugReports
|
* @package TP BugReports
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP BugReports
|
* @package TP BugReports
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -44,7 +44,7 @@ class Bugreport extends Plugin {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
public $permissionMatrix = [
|
public $permissionMatrix = [
|
||||||
'bugReport' => [
|
'canSendBugReports' => [
|
||||||
'pretty' => 'Can Submit Bug Reports',
|
'pretty' => 'Can Submit Bug Reports',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
],
|
],
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the comments admin controller.
|
* This is the comments admin controller.
|
||||||
*
|
*
|
||||||
* @package TP Comments
|
* @package TP Comments
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the Moderator controller.
|
* This is the Moderator controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the form checking functions for this plugin.
|
* This houses all of the form checking functions for this plugin.
|
||||||
*
|
*
|
||||||
* @package TP Comments
|
* @package TP Comments
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* of the comments table.
|
* of the comments table.
|
||||||
*
|
*
|
||||||
* @package TP Comments
|
* @package TP Comments
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Comments
|
* @package TP Comments
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the contact admin controller.
|
* This is the contact admin controller.
|
||||||
*
|
*
|
||||||
* @package TP Contact
|
* @package TP Contact
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the home controller for the contact plugin.
|
* This is the home controller for the contact plugin.
|
||||||
*
|
*
|
||||||
* @package TP Contact
|
* @package TP Contact
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -21,6 +21,7 @@ use TheTempusProject\Bedrock\Functions\Input;
|
|||||||
use TheTempusProject\Bedrock\Functions\Session;
|
use TheTempusProject\Bedrock\Functions\Session;
|
||||||
use TheTempusProject\Hermes\Functions\Redirect;
|
use TheTempusProject\Hermes\Functions\Redirect;
|
||||||
use TheTempusProject\Models\Contact as ContactModel;
|
use TheTempusProject\Models\Contact as ContactModel;
|
||||||
|
use TheTempusProject\Plugins\Turnstile;
|
||||||
|
|
||||||
class Contact extends Controller {
|
class Contact extends Controller {
|
||||||
protected static $contact;
|
protected static $contact;
|
||||||
@ -29,6 +30,16 @@ class Contact extends Controller {
|
|||||||
self::$contact = new ContactModel;
|
self::$contact = new ContactModel;
|
||||||
self::$title = 'Contact - {SITENAME}';
|
self::$title = 'Contact - {SITENAME}';
|
||||||
self::$pageDescription = 'At {SITENAME}, we value our users\' input. You can provide any contact or suggestions using this form.';
|
self::$pageDescription = 'At {SITENAME}, we value our users\' input. You can provide any contact or suggestions using this form.';
|
||||||
|
$turnstile = '';
|
||||||
|
if ( class_exists( 'TheTempusProject\Plugins\Turnstile' ) ) {
|
||||||
|
$turnstile = new Turnstile;
|
||||||
|
if ( ! $turnstile->checkEnabled() ) {
|
||||||
|
Components::set( 'TURNSTILE_WIDGET', '' );
|
||||||
|
$turnstile = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Components::set( 'TURNSTILE_WIDGET', '' );
|
||||||
|
}
|
||||||
if ( ! Input::exists() ) {
|
if ( ! Input::exists() ) {
|
||||||
return Views::view( 'contact.create' );
|
return Views::view( 'contact.create' );
|
||||||
}
|
}
|
||||||
@ -36,6 +47,11 @@ class Contact extends Controller {
|
|||||||
Issues::add( 'error', [ 'There was an error with your form, please check your submission and try again.' => Check::userErrors() ] );
|
Issues::add( 'error', [ 'There was an error with your form, please check your submission and try again.' => Check::userErrors() ] );
|
||||||
return Views::view( 'contact.create' );
|
return Views::view( 'contact.create' );
|
||||||
}
|
}
|
||||||
|
if ( ! empty( $turnstile ) ) {
|
||||||
|
if ( empty( $turnstile->verify() ) ) {
|
||||||
|
return Views::view( 'contact.create' );
|
||||||
|
}
|
||||||
|
}
|
||||||
$result = self::$contact->create( Input::post( 'name' ), Input::post( 'contactEmail' ), Input::post( 'entry' ) );
|
$result = self::$contact->create( Input::post( 'name' ), Input::post( 'contactEmail' ), Input::post( 'entry' ) );
|
||||||
if ( $result ) {
|
if ( $result ) {
|
||||||
Session::flash( 'success', 'Thank you! Your contact has been received.' );
|
Session::flash( 'success', 'Thank you! Your contact has been received.' );
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the form checking functions for this plugin.
|
* This houses all of the form checking functions for this plugin.
|
||||||
*
|
*
|
||||||
* @package TP Contact
|
* @package TP Contact
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @todo make this send a confirmation email
|
* @todo make this send a confirmation email
|
||||||
*
|
*
|
||||||
* @package TP Contact
|
* @package TP Contact
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Contact
|
* @package TP Contact
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -40,7 +40,7 @@ class Contact extends Plugin {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
public $permissionMatrix = [
|
public $permissionMatrix = [
|
||||||
'contact' => [
|
'canUseContactForm' => [
|
||||||
'pretty' => 'Can Submit Contact',
|
'pretty' => 'Can Submit Contact',
|
||||||
'default' => true,
|
'default' => true,
|
||||||
],
|
],
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
<!-- Submit Button -->
|
<!-- Submit Button -->
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
|
{TURNSTILE_WIDGET}
|
||||||
<button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg">Submit</button>
|
<button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the user messages controller.
|
* This is the user messages controller.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Houses all of the functions for the core messaging system.
|
* Houses all of the functions for the core messaging system.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Messages
|
* @package TP Messages
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the notifications admin controller.
|
* This is the notifications admin controller.
|
||||||
*
|
*
|
||||||
* @package TP Notifications
|
* @package TP Notifications
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -35,8 +35,6 @@ class Notifications extends AdminController {
|
|||||||
self::$notifications = new NotificationsModel;
|
self::$notifications = new NotificationsModel;
|
||||||
self::$user = new User;
|
self::$user = new User;
|
||||||
self::$group = new Group;
|
self::$group = new Group;
|
||||||
$view = Navigation::activePageSelect( 'nav.admin', '/admin/Notifications' );
|
|
||||||
Components::set( 'ADMINNAV', $view );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index( $data = null ) {
|
public function index( $data = null ) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the home controller for the notifications plugin.
|
* This is the home controller for the notifications plugin.
|
||||||
*
|
*
|
||||||
* @package TP Notifications
|
* @package TP Notifications
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the form checking functions for this plugin.
|
* This houses all of the form checking functions for this plugin.
|
||||||
*
|
*
|
||||||
* @package TP Notifications
|
* @package TP Notifications
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This class is used for the manipulation of the notifications database table.
|
* This class is used for the manipulation of the notifications database table.
|
||||||
*
|
*
|
||||||
* @package TP Notifications
|
* @package TP Notifications
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -121,21 +121,21 @@ class Notification extends DatabaseModel {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter( $messageArray, $filters = [] ) {
|
public function filter( $entities, $filters = [] ) {
|
||||||
$out = [];
|
$out = [];
|
||||||
foreach ( $messageArray as $message ) {
|
foreach ( $entities as $entity ) {
|
||||||
if ( !is_object( $message ) ) {
|
if ( !is_object( $entity ) ) {
|
||||||
$message = $messageArray;
|
$entity = $entities;
|
||||||
$end = true;
|
$end = true;
|
||||||
}
|
}
|
||||||
if ( $message->seenAt == 0 ) {
|
if ( $entity->seenAt == 0 ) {
|
||||||
$message->unseenBadge = Views::simpleView( 'notifications.unseenBadge' );
|
$entity->unseenBadge = Views::simpleView( 'notifications.unseenBadge' );
|
||||||
$message->markReadLink = '<a href="{ROOT_URL}notifications/markRead/'.$message->ID.'" class="btn btn-sm btn-primary"><i class="fa-solid fa-fw fa-envelope-open"></i></a>';
|
$entity->markReadLink = '<a href="{ROOT_URL}notifications/markRead/'.$entity->ID.'" class="btn btn-sm btn-primary"><i class="fa-solid fa-fw fa-envelope-open"></i></a>';
|
||||||
} else {
|
} else {
|
||||||
$message->unseenBadge = '';
|
$entity->unseenBadge = '';
|
||||||
$message->markReadLink = '';
|
$entity->markReadLink = '';
|
||||||
}
|
}
|
||||||
$out[] = (object) $message;
|
$out[] = (object) $entity;
|
||||||
if ( !empty( $end ) ) {
|
if ( !empty( $end ) ) {
|
||||||
$out = $out[0];
|
$out = $out[0];
|
||||||
break;
|
break;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Notifications
|
* @package TP Notifications
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the subscriptions admin controller.
|
* This is the subscriptions admin controller.
|
||||||
*
|
*
|
||||||
* @package TP Subscribe
|
* @package TP Subscribe
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This is the home controller for the subscribe plugin.
|
* This is the home controller for the subscribe plugin.
|
||||||
*
|
*
|
||||||
* @package TP Subscribe
|
* @package TP Subscribe
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the form checking functions for this plugin.
|
* This houses all of the form checking functions for this plugin.
|
||||||
*
|
*
|
||||||
* @package TP Subscribe
|
* @package TP Subscribe
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This class is used for the manipulation of the subscribers database table.
|
* This class is used for the manipulation of the subscribers database table.
|
||||||
*
|
*
|
||||||
* @package TP Subscribe
|
* @package TP Subscribe
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP Subscribe
|
* @package TP Subscribe
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
85
app/plugins/turnstile/plugin.php
Normal file
85
app/plugins/turnstile/plugin.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* app/plugins/turnstile/plugin.php
|
||||||
|
*
|
||||||
|
* This houses all of the main plugin info and functionality.
|
||||||
|
*
|
||||||
|
* @package TP Turnstile
|
||||||
|
* @version 5.0.1
|
||||||
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
|
* @link https://TheTempusProject.com
|
||||||
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
*/
|
||||||
|
namespace TheTempusProject\Plugins;
|
||||||
|
|
||||||
|
use TheTempusProject\TheTempusProject as App;
|
||||||
|
use TheTempusProject\Classes\Plugin;
|
||||||
|
use TheTempusProject\Models\Notification;
|
||||||
|
use TheTempusProject\Houdini\Classes\Components;
|
||||||
|
use TheTempusProject\Houdini\Classes\Views;
|
||||||
|
use TheTempusProject\Bedrock\Classes\Config;
|
||||||
|
use TheTempusProject\Bedrock\Functions\Input;
|
||||||
|
use TheTempusProject\Houdini\Classes\Issues;
|
||||||
|
|
||||||
|
class Turnstile extends Plugin {
|
||||||
|
private static $loaded = false;
|
||||||
|
public $pluginName = 'TP Turnstile';
|
||||||
|
public $pluginAuthor = 'JoeyK';
|
||||||
|
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||||
|
public $modelVersion = '1.0';
|
||||||
|
public $pluginVersion = '3.0';
|
||||||
|
public $pluginDescription = 'A simple plugin which adds a site wide cloudflare turnstile integration.';
|
||||||
|
public $configName = 'turnstile';
|
||||||
|
public $configMatrix = [
|
||||||
|
'secretKey' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'pretty' => 'Turnstile Secret Key',
|
||||||
|
'default' => 'xxxxxxxxxxxxx',
|
||||||
|
],
|
||||||
|
'apiKey' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'pretty' => 'Turnstile API Key',
|
||||||
|
'default' => 'xxxxxxxxxxxxxx',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
public function __construct( $load = false ) {
|
||||||
|
parent::__construct( $load );
|
||||||
|
if ( ! self::$loaded ) {
|
||||||
|
if ( $this->checkEnabled() ) {
|
||||||
|
Components::set( 'TURNSTILE_API_KEY', Config::getValue( 'turnstile/apiKey' ) );
|
||||||
|
Components::set( 'TURNSTILE_WIDGET', Views::simpleView( 'turnstile.widget') );
|
||||||
|
Components::append( 'TEMPLATE_JS_INCLUDES', '<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>' );
|
||||||
|
}
|
||||||
|
self::$loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify() {
|
||||||
|
if ( ! Input::exists('cf-turnstile-response') ) {
|
||||||
|
Issues::add( 'notice', 'Turnstile verification failed. Please try again.' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$verify_url = "https://challenges.cloudflare.com/turnstile/v0/siteverify";
|
||||||
|
$data = [
|
||||||
|
"secret" => Config::getValue( 'turnstile/secretKey' ),
|
||||||
|
"response" => Input::post('cf-turnstile-response'),
|
||||||
|
"remoteip" => $_SERVER["REMOTE_ADDR"] // Optional, helps detect abuse
|
||||||
|
];
|
||||||
|
$options = [
|
||||||
|
"http" => [
|
||||||
|
"header" => "Content-Type: application/x-www-form-urlencoded",
|
||||||
|
"method" => "POST",
|
||||||
|
"content" => http_build_query($data)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$context = stream_context_create($options);
|
||||||
|
$response = file_get_contents($verify_url, false, $context);
|
||||||
|
$result = json_decode($response, true);
|
||||||
|
if ( ! $result["success"]) {
|
||||||
|
Issues::add( 'notice', 'Turnstile verification failed. Please try again. If the issue persists, please contact the site administrator.' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
1
app/plugins/turnstile/views/widget.html
Normal file
1
app/plugins/turnstile/views/widget.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div class="cf-turnstile" data-sitekey="{TURNSTILE_API_KEY}"></div>
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is an example controller layout.
|
* This is an example controller layout.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is an example model.
|
* This is an example model.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This houses all of the main plugin info and functionality.
|
* This houses all of the main plugin info and functionality.
|
||||||
*
|
*
|
||||||
* @package TP XXXXXXXXXX
|
* @package TP XXXXXXXXXX
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* app/resources/templates/example.tpl
|
* app/resources/templates/example.tpl
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is an example loader for the example template.
|
* This is an example loader for the example template.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the loader for the admin template.
|
* This is the loader for the admin template.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* app/templates/admin/admin.tpl
|
* app/templates/admin/admin.tpl
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -28,27 +28,35 @@
|
|||||||
<!-- Main Content Area -->
|
<!-- Main Content Area -->
|
||||||
<div class="d-flex flex-grow-1">
|
<div class="d-flex flex-grow-1">
|
||||||
<!-- Side Navigation -->
|
<!-- Side Navigation -->
|
||||||
<div class="d-flex flex-column flex-shrink-0 p-3 text-bg-dark" style="width: 280px;">
|
<div class="d-flex flex-column p-md-3 text-bg-dark">
|
||||||
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-white text-decoration-none">
|
<div class="collapse d-md-block" id="mainMenu">
|
||||||
|
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-white text-decoration-none justify-content-center">
|
||||||
<img src="{ROOT_URL}{LOGO}" class="bi me-2" width="40" height="32" role="img" aria-label="{SITENAME} Logo">
|
<img src="{ROOT_URL}{LOGO}" class="bi me-2" width="40" height="32" role="img" aria-label="{SITENAME} Logo">
|
||||||
<span class="fs-4">{SITENAME}</span>
|
|
||||||
</a>
|
</a>
|
||||||
<hr>
|
<div class="border-top border-bottom border-white mt-4 mb-2 pt-3 pb-5">
|
||||||
{ADMIN}
|
{ADMIN}
|
||||||
{ADMIN_LINKS}
|
{ADMIN_LINKS}
|
||||||
{/ADMIN}
|
{/ADMIN}
|
||||||
<hr>
|
</div>
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center p-2">
|
||||||
{topNavRight}
|
{topNavRight}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Center Element -->
|
<!-- Center Element -->
|
||||||
<div class="flex-grow-1 d-flex flex-column">
|
<div class="flex-grow-1 d-flex flex-column">
|
||||||
<!-- Top Navigation Bar -->
|
<!-- Top Navigation Bar -->
|
||||||
<div class="p-2 text-bg-dark">
|
<div class="p-2 text-bg-dark">
|
||||||
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
|
<div class="d-flex justify-content-between justify-content-md-center">
|
||||||
|
<div class="d-flex flex-wrap align-items-center justify-content-lg-start">
|
||||||
{topNavLeft}
|
{topNavLeft}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mx-3 d-md-none">
|
||||||
|
<button class="my-3 btn btn-lg btn-outline-light" type="button" data-bs-toggle="collapse" data-bs-target="#mainMenu" aria-controls="mainMenu" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="fa fa-bars"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
@ -66,26 +74,62 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer class="border-top context-main-bg">
|
<div class="container mt-auto border-top context-main-border">
|
||||||
<div class="container pb-4 pt-3 align-items-center">
|
<footer class="pt-0">
|
||||||
<div class="d-flex justify-content-between align-items-center context-main-bg">
|
<div class="d-md-block collapse" id="footerMenu">
|
||||||
{COPY}
|
<div class="d-flex justify-content-between align-items-center py-2 my-2">
|
||||||
<div class="col-6 col-md-2">
|
<a href="/" class="text-decoration-none lh-1 d-flex align-items-center px-md-5 mx-md-5">
|
||||||
<div class="material-switch">
|
<img src="{ROOT_URL}{LOGO}" class="bi me-2" width="40" height="32" alt="Joey Kimsey Logo">
|
||||||
|
</a>
|
||||||
|
<div class="material-switch d-flex align-items-center">
|
||||||
<input name="dark-mode-toggle" type="checkbox" id="dark-mode-toggle" class="form-check-input">
|
<input name="dark-mode-toggle" type="checkbox" id="dark-mode-toggle" class="form-check-input">
|
||||||
<label for="dark-mode-toggle" class="label-default"></label>
|
<label for="dark-mode-toggle" class="label-default"></label>
|
||||||
</div>
|
</div>
|
||||||
|
<ul class="list-unstyled d-flex align-items-center mb-0">
|
||||||
|
<li class="ms-3">
|
||||||
|
<a class="context-main" href="{ROOT_URL}fb">
|
||||||
|
<span class="fa-brands fa-fw fa-facebook"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="ms-3">
|
||||||
|
<a class="context-main" href="{ROOT_URL}twitter">
|
||||||
|
<span class="fa-brands fa-fw fa-twitter"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="ms-3">
|
||||||
|
<a class="context-main" href="{ROOT_URL}in">
|
||||||
|
<span class="fa-brands fa-fw fa-linkedin"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="ms-3">
|
||||||
|
<a class="context-main" href="{ROOT_URL}youtube">
|
||||||
|
<span class="fa-brands fa-fw fa-youtube"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="ms-3">
|
||||||
|
<a class="context-main" href="{ROOT_URL}git">
|
||||||
|
<span class="fa-brands fa-fw fa-github"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{SOCIAL}
|
<div class="d-flex justify-content-center justify-content-md-center text-center text-md-center my-2">
|
||||||
|
<span>© 2025 {SITENAME}, Powered by <a href="https://thetempusproject.com" class="text-decoration-none">The Tempus Project</a></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<button class="d-md-none my-3 btn btn-lg context-main context-main-border" type="button" data-bs-toggle="collapse" data-bs-target="#footerMenu" aria-controls="footerMenu" aria-expanded="false" aria-label="Toggle footer navigation">
|
||||||
|
<i class="fa fa-bars"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Bootstrap core JavaScript and jquery -->
|
<!-- Bootstrap core JavaScript and jquery -->
|
||||||
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{JQUERY_CDN}jquery.min.js"></script>
|
|
||||||
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
||||||
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{BOOTSTRAP_CDN}js/bootstrap.min.js"></script>
|
<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{BOOTSTRAP_CDN}js/bootstrap.min.js"></script>
|
||||||
<!-- Custom javascript for this template -->
|
<!-- Custom javascript for this template -->
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the loader for the admin template.
|
* This is the loader for the admin template.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This is the loader for the default template.
|
* This is the loader for the default template.
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -19,11 +19,19 @@ use TheTempusProject\Houdini\Classes\Components;
|
|||||||
use TheTempusProject\Bedrock\Classes\Config;
|
use TheTempusProject\Bedrock\Classes\Config;
|
||||||
use TheTempusProject\Bedrock\Functions\Input;
|
use TheTempusProject\Bedrock\Functions\Input;
|
||||||
use TheTempusProject\TheTempusProject as App;
|
use TheTempusProject\TheTempusProject as App;
|
||||||
|
use Endroid\QrCode\Builder\Builder;
|
||||||
|
use Endroid\QrCode\Encoding\Encoding;
|
||||||
|
use Endroid\QrCode\ErrorCorrectionLevel;
|
||||||
|
use Endroid\QrCode\Label\LabelAlignment;
|
||||||
|
use Endroid\QrCode\Label\Font\OpenSans;
|
||||||
|
use Endroid\QrCode\RoundBlockSizeMode;
|
||||||
|
use Endroid\QrCode\Writer\PngWriter;
|
||||||
|
use TheTempusProject\Hermes\Functions\Route as Routes;
|
||||||
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
|
||||||
class DefaultLoader extends Loader {
|
class DefaultLoader extends Loader {
|
||||||
private static $loaded = false;
|
private static $loaded = false;
|
||||||
const TEMPLATE_NAME = 'Default Tempus Project Template';
|
const TEMPLATE_NAME = 'Default Tempus Project Template';
|
||||||
const JQUERY_CDN = 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/';
|
|
||||||
const BOOTSTRAP_CDN = 'https://cdn.jsdelivr.net/npm/bootstrap@3.3.6/dist/';
|
const BOOTSTRAP_CDN = 'https://cdn.jsdelivr.net/npm/bootstrap@3.3.6/dist/';
|
||||||
const FONT_AWESOME_URL = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/';
|
const FONT_AWESOME_URL = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/';
|
||||||
|
|
||||||
@ -36,20 +44,68 @@ class DefaultLoader extends Loader {
|
|||||||
if ( VENDOR_AUTOLOADED === true ) {
|
if ( VENDOR_AUTOLOADED === true ) {
|
||||||
Components::set( 'FONT_AWESOME_URL', '/vendor/fortawesome/font-awesome/css/' );
|
Components::set( 'FONT_AWESOME_URL', '/vendor/fortawesome/font-awesome/css/' );
|
||||||
Components::set( 'BOOTSTRAP_CDN', '/vendor/twbs/bootstrap/dist/' );
|
Components::set( 'BOOTSTRAP_CDN', '/vendor/twbs/bootstrap/dist/' );
|
||||||
Components::set( 'JQUERY_CDN', '/vendor/components/jquery/' );
|
|
||||||
} else {
|
} else {
|
||||||
Components::set( 'BOOTSTRAP_CDN', self::BOOTSTRAP_CDN );
|
Components::set( 'BOOTSTRAP_CDN', self::BOOTSTRAP_CDN );
|
||||||
Components::set( 'JQUERY_CDN', self::JQUERY_CDN );
|
|
||||||
Components::set( 'FONT_AWESOME_URL', self::FONT_AWESOME_URL );
|
Components::set( 'FONT_AWESOME_URL', self::FONT_AWESOME_URL );
|
||||||
}
|
}
|
||||||
$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>' );
|
||||||
|
$this->addJs( '<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{ROOT_URL}app/js/sw.js"></script>' );
|
||||||
Components::setIfNull( 'LOGO', Config::getValue( 'main/logo' ) ?? TP_DEFAULT_LOGO );
|
Components::setIfNull( 'LOGO', Config::getValue( 'main/logo' ) ?? TP_DEFAULT_LOGO );
|
||||||
|
|
||||||
|
if ( ! empty( Config::getValue( 'share/enabled' ) ) ) {
|
||||||
|
$currentUrl = Routes::getAddress() . Input::get( 'url' );
|
||||||
|
$folder = IMAGE_DIRECTORY . 'qr-codes' . DIRECTORY_SEPARATOR ;
|
||||||
|
$filename = md5( $currentUrl ) . '.png';
|
||||||
|
|
||||||
|
if ( ! file_exists( $folder ) ) {
|
||||||
|
Debug::Info( 'Creating Directory because it does not exist' );
|
||||||
|
mkdir( $folder, 0777, true );
|
||||||
|
}
|
||||||
|
if ( ! empty( Config::getValue( 'share/qr' ) ) ) {
|
||||||
|
if ( ! file_exists( $folder . $filename ) ) {
|
||||||
|
Debug::Info( 'Creating qr-image because it does not exist' );
|
||||||
|
$builder = new Builder(
|
||||||
|
writer: new PngWriter(),
|
||||||
|
writerOptions: [],
|
||||||
|
validateResult: false,
|
||||||
|
data: Routes::getAddress() . Input::get( 'url' ),
|
||||||
|
encoding: new Encoding('UTF-8'),
|
||||||
|
errorCorrectionLevel: ErrorCorrectionLevel::High,
|
||||||
|
size: 200,
|
||||||
|
margin: 10,
|
||||||
|
roundBlockSizeMode: RoundBlockSizeMode::Margin,
|
||||||
|
logoPath: APP_ROOT_DIRECTORY . DIRECTORY_SEPARATOR . Config::getValue( 'main/logo' ),
|
||||||
|
logoResizeToWidth: 30,
|
||||||
|
logoPunchoutBackground: true,
|
||||||
|
labelText: Config::getValue( 'main/name' ),
|
||||||
|
labelFont: new OpenSans(14),
|
||||||
|
labelAlignment: LabelAlignment::Center
|
||||||
|
);
|
||||||
|
$result = $builder->build();
|
||||||
|
$result->saveToFile( $folder . $filename );
|
||||||
|
}
|
||||||
|
Components::set( 'QR_CODE','<img src="{ROOT_URL}images/qr-codes/' . $filename . '" alt="QR Code" class="img-fluid mb-2">' );
|
||||||
|
} else {
|
||||||
|
Components::setIfNull( 'QR_CODE', '' );
|
||||||
|
}
|
||||||
|
Components::setIfNull( 'SHARE_IMAGE', Views::simpleView( 'footer.share' ) );
|
||||||
|
} else {
|
||||||
|
Components::setIfNull( 'SHARE_IMAGE', '' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( Config::getValue( 'main/pwa' ) ) ) {
|
||||||
|
Components::setIfNull( 'PWA', Views::simpleView( 'pwa') );
|
||||||
|
} else {
|
||||||
|
Components::setIfNull( 'PWA', '' );
|
||||||
|
}
|
||||||
|
|
||||||
Components::setIfNull( 'COPY', Views::simpleView( 'footer.copy') );
|
Components::setIfNull( 'COPY', Views::simpleView( 'footer.copy') );
|
||||||
Components::setIfNull( 'SOCIAL', Views::simpleView( 'footer.social') );
|
Components::setIfNull( 'SOCIAL', Views::simpleView( 'footer.social') );
|
||||||
Components::prepend( 'FOOTER_LEFT', Views::simpleView( 'footer.left', Navigation::getMenuLinks( App::CONTACT_FOOTER_MENU_NAME ) ) );
|
Components::prepend( 'FOOTER_LEFT', Views::simpleView( 'footer.left', Navigation::getMenuLinks( App::CONTACT_FOOTER_MENU_NAME ) ) );
|
||||||
Components::prepend( 'FOOTER_CENTER', Views::simpleView( 'footer.center', Navigation::getMenuLinks( App::INFO_FOOTER_MENU_NAME ) ) );
|
Components::prepend( 'FOOTER_CENTER', Views::simpleView( 'footer.center', Navigation::getMenuLinks( App::INFO_FOOTER_MENU_NAME ) ) );
|
||||||
Components::prepend( 'FOOTER_RIGHT', Views::simpleView( 'footer.right') );
|
Components::prepend( 'FOOTER_RIGHT', Views::simpleView( 'footer.right') );
|
||||||
Components::setIfNull( 'FOOT', Views::simpleView( 'footer.container') );
|
Components::setIfNull( 'FOOT', Views::simpleView( 'footer.container') );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top-Nav
|
* Top-Nav
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* app/templates/default/default.tpl
|
* app/templates/default/default.tpl
|
||||||
*
|
*
|
||||||
* @version 3.0
|
* @version 5.0.1
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||||
* @link https://TheTempusProject.com
|
* @link https://TheTempusProject.com
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||||
@ -28,7 +28,12 @@
|
|||||||
{AUTHOR}
|
{AUTHOR}
|
||||||
{ROBOT}
|
{ROBOT}
|
||||||
<link rel="icon" href="{ROOT_URL}images/favicon.ico" sizes="32x32">
|
<link rel="icon" href="{ROOT_URL}images/favicon.ico" sizes="32x32">
|
||||||
|
<!-- Apple PWA -->
|
||||||
<link rel="apple-touch-icon" href="{ROOT_URL}images/apple-touch-icon.png"><!-- 180×180 -->
|
<link rel="apple-touch-icon" href="{ROOT_URL}images/apple-touch-icon.png"><!-- 180×180 -->
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
<meta name="apple-mobile-web-app-title" content="{SITENAME}">
|
||||||
|
<!-- PWA -->
|
||||||
<link rel="manifest" href="{ROOT_URL}manifest.webmanifest">
|
<link rel="manifest" href="{ROOT_URL}manifest.webmanifest">
|
||||||
<!-- Required CSS -->
|
<!-- Required CSS -->
|
||||||
<!-- <link rel="stylesheet" href="{FONT_AWESOME_URL}fontawesome.min.css" crossorigin="anonymous"> -->
|
<!-- <link rel="stylesheet" href="{FONT_AWESOME_URL}fontawesome.min.css" crossorigin="anonymous"> -->
|
||||||
@ -91,6 +96,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/ISSUES}
|
{/ISSUES}
|
||||||
|
{PWA}
|
||||||
<!-- Main Page Content -->
|
<!-- Main Page Content -->
|
||||||
{CONTENT}
|
{CONTENT}
|
||||||
</div>
|
</div>
|
||||||
@ -100,7 +106,6 @@
|
|||||||
<!-- User Pref to control Dark mode across frontend and backend -->
|
<!-- User Pref to control Dark mode across frontend and backend -->
|
||||||
<input type="hidden" name="dark-mode-pref" id="dark-mode-pref" value="{DARK_MODE_SETTING}">
|
<input type="hidden" name="dark-mode-pref" id="dark-mode-pref" value="{DARK_MODE_SETTING}">
|
||||||
<!-- Bootstrap core JavaScript and jquery -->
|
<!-- Bootstrap core JavaScript and jquery -->
|
||||||
<script crossorigin="anonymous" src="{JQUERY_CDN}jquery.min.js"></script>
|
|
||||||
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
||||||
<script crossorigin="anonymous" src="{BOOTSTRAP_CDN}js/bootstrap.min.js"></script>
|
<script crossorigin="anonymous" src="{BOOTSTRAP_CDN}js/bootstrap.min.js"></script>
|
||||||
<!-- Custom javascript for this template -->
|
<!-- Custom javascript for this template -->
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user