Various changes
mobile-friendly ui updates admin user-edit bugfix file cleanup added searchFields add blog search remove unused code add maintenance mode config
This commit is contained in:
@ -22,6 +22,7 @@ use TheTempusProject\Plugins\Comments as CommentPlugin;
|
||||
use TheTempusProject\Plugins\Blog as BlogPlugin;
|
||||
use TheTempusProject\Plugins\Contact as ContactPlugin;
|
||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
|
||||
class Home extends AdminController {
|
||||
public static $user;
|
||||
|
@ -27,6 +27,7 @@ use TheTempusProject\Models\User;
|
||||
use TheTempusProject\Models\Group;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Houdini\Classes\Template;
|
||||
use TheTempusProject\Bedrock\Functions\Upload;
|
||||
|
||||
class Users extends AdminController {
|
||||
public static $user;
|
||||
@ -104,7 +105,7 @@ class Users extends AdminController {
|
||||
}
|
||||
|
||||
if ( Input::exists( 'submit' ) ) {
|
||||
if ( !FormChecker::check( 'editUser' ) ) {
|
||||
if ( ! FormChecker::check( 'editUser' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
} else {
|
||||
$fields = [
|
||||
@ -112,6 +113,25 @@ class Users extends AdminController {
|
||||
'email' => Input::post( 'email' ),
|
||||
'userGroup' => Input::post( 'groupSelect' ),
|
||||
];
|
||||
|
||||
if ( Input::exists( 'avatar' ) ) {
|
||||
$folder = UPLOAD_DIRECTORY . $userData->username . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
|
||||
$upload = Upload::image( 'avatar', $folder );
|
||||
if ( $upload ) {
|
||||
$route = str_replace( APP_ROOT_DIRECTORY, '', $folder );
|
||||
$prefs = [];
|
||||
$prefs['avatar'] = $route . Upload::last();
|
||||
|
||||
self::$user->updatePrefs( $prefs, $userData->ID );
|
||||
} else {
|
||||
Issues::add( 'error', [ 'There was an error with your avatar.' => Check::userErrors() ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Input::exists( 'password' ) ) {
|
||||
$fields['password'] = Hash::make( Input::post( 'password' ) );
|
||||
}
|
||||
|
||||
if ( Input::exists( 'confirmed' ) ) {
|
||||
$fields['confirmed'] = 1;
|
||||
} else {
|
||||
@ -119,6 +139,7 @@ class Users extends AdminController {
|
||||
$fields['confirmationCode'] = Code::genConfirmation();
|
||||
}
|
||||
}
|
||||
|
||||
if ( self::$user->update( $userData->ID, $fields ) ) {
|
||||
Issues::add( 'success', 'User Updated.' );
|
||||
return $this->index();
|
||||
|
@ -38,15 +38,15 @@ class Home extends Controller {
|
||||
return Issues::add( 'notice', 'You are already logged in. Please <a href="' . Routes::getAddress() . 'home/logout">click here</a> to log out.' );
|
||||
}
|
||||
if ( !Input::exists() ) {
|
||||
return Views::view( 'login' );
|
||||
return Views::view( 'auth.login' );
|
||||
}
|
||||
if ( !Forms::check( 'login' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your login.' => Check::userErrors() ] );
|
||||
return Views::view( 'login' );
|
||||
return Views::view( 'auth.login' );
|
||||
}
|
||||
if ( !self::$user->logIn( Input::post( 'username' ), Input::post( 'password' ), Input::post( 'remember' ) ) ) {
|
||||
Issues::add( 'error', 'Username or password was incorrect.' );
|
||||
return Views::view( 'login' );
|
||||
return Views::view( 'auth.login' );
|
||||
}
|
||||
Session::flash( 'success', 'You have been logged in.' );
|
||||
if ( Input::exists( 'rurl' ) ) {
|
||||
@ -79,13 +79,13 @@ class Home extends Controller {
|
||||
}
|
||||
self::$title = $user->username . '\'s Profile - {SITENAME}';
|
||||
self::$pageDescription = 'User Profile for ' . $user->username . ' - {SITENAME}';
|
||||
Views::view( 'profile', $user );
|
||||
Views::view( 'profilePage', $user );
|
||||
}
|
||||
|
||||
public function terms() {
|
||||
self::$title = 'Terms and Conditions - {SITENAME}';
|
||||
self::$pageDescription = '{SITENAME} Terms and Conditions of use. Please use {SITENAME} safely.';
|
||||
Components::set( 'TERMS', Views::simpleView( 'terms' ) );
|
||||
Components::set( 'TERMS', Views::simpleView( 'auth.terms' ) );
|
||||
Views::view( 'termsPage' );
|
||||
}
|
||||
|
||||
@ -98,8 +98,7 @@ class Home extends Controller {
|
||||
public function privacy() {
|
||||
self::$title = 'Privacy Policy - {SITENAME}';
|
||||
self::$pageDescription = 'At {SITENAME} you privacy is very important to us. On this page you can find a detailed outline of all the information we collect and how its used.';
|
||||
Components::set( 'PRIVACY', Views::simpleView( 'privacy' ) );
|
||||
Views::raw( '<div class="col-lg-8 mx-auto">{PRIVACY}</div>' );
|
||||
Views::view( 'privacy' );
|
||||
}
|
||||
|
||||
public function faq() {
|
||||
|
@ -31,14 +31,14 @@ class Register extends Controller {
|
||||
Template::noIndex();
|
||||
self::$title = 'Confirm Email';
|
||||
if ( !isset( $code ) && !Input::exists( 'confirmationCode' ) ) {
|
||||
return Views::view( 'confirmation' );
|
||||
return Views::view( 'auth.confirmation' );
|
||||
}
|
||||
if ( Forms::check( 'emailConfirmation' ) ) {
|
||||
$code = Input::post( 'confirmationCode' );
|
||||
}
|
||||
if ( !self::$user->confirm( $code ) ) {
|
||||
Issues::add( 'error', 'There was an error confirming your account, please try again.' );
|
||||
return Views::view( 'confirmation' );
|
||||
return Views::view( 'auth.confirmation' );
|
||||
}
|
||||
Session::flash( 'success', 'You have successfully confirmed your email address.' );
|
||||
Redirect::to( 'home/index' );
|
||||
@ -52,16 +52,16 @@ class Register extends Controller {
|
||||
return Issues::add( 'notice', 'The site administrator has disable the ability to register a new account.' );
|
||||
}
|
||||
|
||||
Components::set( 'TERMS', Views::simpleView( 'terms' ) );
|
||||
Components::set( 'TERMS', Views::simpleView( 'auth.terms' ) );
|
||||
if ( App::$isLoggedIn ) {
|
||||
return Issues::add( 'notice', 'You are currently logged in.' );
|
||||
}
|
||||
if ( !Input::exists() ) {
|
||||
return Views::view( 'register' );
|
||||
return Views::view( 'auth.register' );
|
||||
}
|
||||
if ( !Forms::check( 'register' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your registration.' => Check::userErrors() ] );
|
||||
return Views::view( 'register' );
|
||||
return Views::view( 'auth.register' );
|
||||
}
|
||||
self::$user->create( [
|
||||
'username' => Input::post( 'username' ),
|
||||
@ -80,7 +80,7 @@ class Register extends Controller {
|
||||
self::$title = 'Recover Account - {SITENAME}';
|
||||
Template::noIndex();
|
||||
if ( !Input::exists() ) {
|
||||
return Views::view( 'forgot' );
|
||||
return Views::view( 'auth.forgot' );
|
||||
}
|
||||
if ( Check::email( Input::post( 'entry' ) ) && self::$user->findByEmail( Input::post( 'entry' ) ) ) {
|
||||
$userData = self::$user->data();
|
||||
@ -96,7 +96,7 @@ class Register extends Controller {
|
||||
Redirect::to( 'home/login' );
|
||||
}
|
||||
Issues::add( 'error', 'User not found.' );
|
||||
Views::view( 'forgot' );
|
||||
Views::view( 'auth.forgot' );
|
||||
}
|
||||
|
||||
public function resend() {
|
||||
@ -109,7 +109,7 @@ class Register extends Controller {
|
||||
return Issues::add( 'notice', 'Your account has already been confirmed.' );
|
||||
}
|
||||
if ( !Forms::check( 'confirmationResend' ) ) {
|
||||
return Views::view( 'confirmation_resend' );
|
||||
return Views::view( 'auth.confirmation_resend' );
|
||||
}
|
||||
Email::send( App::$activeUser->email, 'confirmation', App::$activeUser->confirmationCode, [ 'template' => true ] );
|
||||
Session::flash( 'success', 'Your confirmation email has been sent to the email for your account.' );
|
||||
@ -121,7 +121,7 @@ class Register extends Controller {
|
||||
Template::noIndex();
|
||||
if ( !isset( $code ) && !Input::exists( 'resetCode' ) ) {
|
||||
Issues::add( 'info', 'Please provide a reset code.' );
|
||||
return Views::view( 'password_reset_code' );
|
||||
return Views::view( 'auth.password_reset_code' );
|
||||
}
|
||||
if ( Input::exists( 'resetCode' ) ) {
|
||||
if ( Forms::check( 'passwordResetCode' ) ) {
|
||||
@ -130,15 +130,15 @@ class Register extends Controller {
|
||||
}
|
||||
if ( ! self::$user->checkCode( $code ) ) {
|
||||
Issues::add( 'error', 'There was an error with your reset code. Please try again.' );
|
||||
return Views::view( 'password_reset_code' );
|
||||
return Views::view( 'auth.password_reset_code' );
|
||||
}
|
||||
Components::set( 'resetCode', $code );
|
||||
if ( ! Input::exists('password') ) {
|
||||
return Views::view( 'password_reset' );
|
||||
return Views::view( 'auth.password_reset' );
|
||||
}
|
||||
if ( ! Forms::check( 'passwordReset' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
return Views::view( 'password_reset' );
|
||||
return Views::view( 'auth.password_reset' );
|
||||
}
|
||||
self::$user->changePassword( $code, Input::post( 'password' ) );
|
||||
Email::send( self::$user->data()->email, 'passwordChange', null, [ 'template' => true ] );
|
||||
|
@ -70,7 +70,7 @@ class Usercp extends Controller {
|
||||
self::$title = 'User Control Panel';
|
||||
$menu = Views::simpleView( 'nav.usercp', App::$userCPlinks );
|
||||
Navigation::activePageSelect( $menu, null, true, true );
|
||||
Views::view( 'profile', App::$activeUser );
|
||||
Views::view( 'user_cp.profile', App::$activeUser );
|
||||
}
|
||||
|
||||
public function password() {
|
||||
@ -104,6 +104,10 @@ class Usercp extends Controller {
|
||||
$userPrefs = App::$activePrefs;
|
||||
if ( Input::exists( 'submit' ) ) {
|
||||
$fields = $prefs->convertFormToArray( true, false );
|
||||
// @TODO now i may need to rework the form checker to work with this....
|
||||
// if (!Forms::check('userPrefs')) {
|
||||
// Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
// }
|
||||
self::$user->updatePrefs( $fields, App::$activeUser->ID );
|
||||
Issues::add( 'success', 'Your preferences have been updated.' );
|
||||
// if the image upload fails, need to fall back on original
|
||||
|
Reference in New Issue
Block a user