53 lines
2.1 KiB
PHP
53 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* app/plugins/bugreport/controllers/bugreport.php
|
|
*
|
|
* This is the bug reports controller.
|
|
*
|
|
* @package TP BugReports
|
|
* @version 3.0
|
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
* @link https://TheTempusProject.com
|
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
*/
|
|
namespace TheTempusProject\Controllers;
|
|
|
|
use TheTempusProject\Hermes\Functions\Redirect;
|
|
use TheTempusProject\Bedrock\Functions\Check;
|
|
use TheTempusProject\Bedrock\Functions\Input;
|
|
use TheTempusProject\Bedrock\Functions\Session;
|
|
use TheTempusProject\Houdini\Classes\Issues;
|
|
use TheTempusProject\Houdini\Classes\Views;
|
|
use TheTempusProject\Classes\Controller;
|
|
use TheTempusProject\Classes\Forms;
|
|
use TheTempusProject\Models\Bugreport as BugreportModel;
|
|
use TheTempusProject\TheTempusProject as App;
|
|
|
|
class Bugreport extends Controller {
|
|
protected static $bugreport;
|
|
|
|
public function index() {
|
|
self::$bugreport = new BugreportModel;
|
|
self::$title = 'Bug Report - {SITENAME}';
|
|
self::$pageDescription = 'On this page you can submit a bug report for the site.';
|
|
if ( !App::$isLoggedIn ) {
|
|
return Issues::add( 'notice', 'You must be logged in to report bugs.' );
|
|
}
|
|
if ( !Input::exists() ) {
|
|
return Views::view( 'bugreport.create' );
|
|
}
|
|
if ( !Forms::check( 'bugreport' ) ) {
|
|
Issues::add( 'error', [ 'There was an error with your report.' => Check::userErrors() ] );
|
|
return Views::view( 'bugreport.create' );
|
|
}
|
|
$result = self::$bugreport->create( App::$activeUser->ID, Input::post( 'url' ), Input::post( 'ourl' ), Input::post( 'repeat' ), Input::post( 'entry' ) );
|
|
if ( true === $result ) {
|
|
Session::flash( 'success', 'Your Bug Report has been received. We may contact you for more information at the email address you provided.' );
|
|
Redirect::to( 'home/index' );
|
|
} else {
|
|
Issues::add( 'error', 'There was an unresolved error while submitting your report.' );
|
|
return Views::view( 'bugreport.create' );
|
|
}
|
|
}
|
|
}
|