Files
thetempusproject/app/classes/api_controller.php
2024-12-02 19:00:00 -05:00

33 lines
1017 B
PHP

<?php
/**
* app/classes/api_controller.php
*
* This is the base api controller. Every other api controller should
* extend this class.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Classes;
use TheTempusProject\Houdini\Classes\Template;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Bedrock\Functions\Session;
class ApiController extends Controller {
public function __construct() {
parent::__construct();
if ( ! App::verifyApiRequest() ) {
Session::flash( 'error', 'You do not have permission to view this page.' );
return Redirect::home();
}
Template::noFollow();
Template::noIndex();
Template::addHeader( 'Content-Type: application/json; charset=utf-8' );
Template::setTemplate( 'api' );
}
}