Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

View File

@ -0,0 +1,92 @@
<?php
/**
* app/plugins/bugtracker/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @package TP BugTracker
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Bugreport;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Classes\Forms;
class BugTrackerForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'newBugTracker', __CLASS__, 'newBugTracker' );
self::addHandler( 'editBugTracker', __CLASS__, 'editBugTracker' );
}
/**
* Validates the bug tracker create form.
*
* @return {bool}
*/
public static function newBugTracker() {
if ( !empty(Input::post( 'url' )) && !self::url( Input::post( 'url' ) ) ) {
self::addUserError( 'Invalid url: <code>' . Input::post( 'url' ) . '</code>' );
return false;
}
if ( !self::tf( Input::post( 'repeat' ) ) ) {
self::addUserError( 'Invalid repeat value: ' . Input::post( 'repeat' ) );
return false;
}
if ( !Input::exists( 'title' ) ) {
self::addUserError( 'You must specify title' );
return false;
}
if ( !self::dataTitle( Input::post( 'title' ) ) ) {
self::addUserError( 'Invalid title' );
return false;
}
if ( !Input::exists( 'description' ) ) {
self::addUserError( 'You must specify a description' );
return false;
}
// if ( !self::token() ) {
// return false;
// }
return true;
}
/**
* Validates the bug tracker create form.
*
* @return {bool}
*/
public static function editBugTracker() {
if ( !empty(Input::post( 'url' )) && !self::url( Input::post( 'url' ) ) ) {
self::addUserError( 'Invalid url.' . Input::post( 'url' ) );
return false;
}
if ( !self::tf( Input::post( 'repeat' ) ) ) {
self::addUserError( 'Invalid repeat value.' );
return false;
}
if ( !Input::exists( 'title' ) ) {
self::addUserError( 'You must specify title' );
return false;
}
if ( !self::dataTitle( Input::post( 'title' ) ) ) {
self::addUserError( 'Invalid title' );
return false;
}
if ( !Input::exists( 'description' ) ) {
self::addUserError( 'You must specify a description' );
return false;
}
// if ( !self::token() ) {
// return false;
// }
return true;
}
}
new BugTrackerForms;