* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Controllers; use TheTempusProject\Hermes\Functions\Redirect; use TheTempusProject\Bedrock\Functions\Session; use TheTempusProject\Bedrock\Functions\Check; use TheTempusProject\Bedrock\Functions\Input; use TheTempusProject\Hermes\Functions\Route as Routes; use TheTempusProject\Houdini\Classes\Issues; use TheTempusProject\Houdini\Classes\Views; use TheTempusProject\Houdini\Classes\Components; use TheTempusProject\Houdini\Classes\Template; use TheTempusProject\Classes\Controller; use TheTempusProject\Classes\Forms; use TheTempusProject\TheTempusProject as App; class Home extends Controller { public function index() { self::$title = '{SITENAME}'; self::$pageDescription = 'This is the homepage of your new Tempus Project Installation. Thank you for installing. find more info at https://thetempusproject.com'; $optionValues = [ (object) [ "option" => "Full-Stack Developer" ], (object) [ "option" => "DevOps Engineer" ], (object) [ "option" => "Web Developer" ], (object) [ "option" => "App Developer" ], (object) [ "option" => "Senior PHP Developer" ], (object) [ "option" => "Server/Waiter" ], (object) [ "option" => "Cook" ], (object) [ "option" => "Farm-Hand" ], (object) [ "option" => "Dish-Boy" ], (object) [ "option" => "Brother" ], (object) [ "option" => "Son" ], (object) [ "option" => "Friend" ], (object) [ "option" => "Student" ], (object) [ "option" => "Polymath" ], (object) [ "option" => "Geek" ], (object) [ "option" => "Nerd" ], ]; shuffle($optionValues); Views::view( 'test', $optionValues ); } public function login() { self::$title = 'Portal - {SITENAME}'; self::$pageDescription = 'Please log in to access all of the great features {SITENAME} has to offer.'; if ( App::$isLoggedIn ) { return Issues::add( 'notice', 'You are already logged in. Please click here to log out.' ); } if ( !Input::exists() ) { return Views::view( 'login' ); } if ( !Forms::check( 'login' ) ) { Issues::add( 'error', [ 'There was an error with your login.' => Check::userErrors() ] ); return Views::view( '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' ); } Session::flash( 'success', 'You have been logged in.' ); if ( Input::exists( 'rurl' ) ) { Redirect::to( Input::post( 'rurl' ) ); } else { Redirect::to( 'home/index' ); } } public function logout() { self::$title = 'Log Out - {SITENAME}'; Template::noIndex(); if ( !App::$isLoggedIn ) { return Issues::add( 'notice', 'You are not logged in.' ); } self::$user->logOut(); Session::flash( 'success', 'You have been logged out.' ); Redirect::to( 'home/index' ); } public function profile( $id = null ) { self::$title = 'User Profile - {SITENAME}'; self::$pageDescription = 'User Profile - {SITENAME}'; if ( !App::$isLoggedIn ) { return Issues::add( 'notice', 'You must be logged in to view this page.' ); } $user = self::$user->get( $id ); if ( !$user ) { return Issues::add( 'notice', 'No user found.' ); } self::$title = $user->username . '\'s Profile - {SITENAME}'; self::$pageDescription = 'User Profile for ' . $user->username . ' - {SITENAME}'; Views::view( 'profile', $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' ) ); Views::view( 'termsPage' ); } public function about() { self::$title = 'About - {SITENAME}'; self::$pageDescription = '{SITENAME} was started by a developer with years of industry experience which has lead to a refined no-nonsense tool for everyone. Find out more about us here.'; Views::view( 'about' ); } public function about() { self::$title = 'About - {SITENAME}'; self::$pageDescription = 'Just a bit more info on me.'; Views::view( 'about' ); } public function hire() { self::$title = 'Consulting and Freelance - {SITENAME}'; self::$pageDescription = 'More details on how to hire me for consulting or freelance work.'; Views::view( 'hire' ); } }