various updates
remove dependence on jQuery add image delete Admin ui fix for mobile image updates to new style update comments
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the admin log controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the composer controller. Its only very effective when using composer for autoloading.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the error logs controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the groups admin controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the admin dashboard controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the admin app/user tokens controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
@ -36,6 +36,8 @@ class Images extends AdminController {
|
||||
APP_ROOT_DIRECTORY . 'app/plugins'
|
||||
];
|
||||
|
||||
private $spacer = [];
|
||||
|
||||
private $excludedDirectories = [
|
||||
'.',
|
||||
'..',
|
||||
@ -97,12 +99,13 @@ class Images extends AdminController {
|
||||
$names = explode( DIRECTORY_SEPARATOR, $folder );
|
||||
$folderName = array_pop( $names );
|
||||
$out = [
|
||||
'spacer' => implode( '', $this->spacer ),
|
||||
'folderName' => $folderName,
|
||||
'location' => $folder,
|
||||
'subdirs' => $subdirs,
|
||||
];
|
||||
if ( ! empty( $subdirs ) ) {
|
||||
$out['folderexpand'] = '<i class="fa-solid fa-caret-down justify-content-end"></i>';
|
||||
$out['folderexpand'] = '<i class="fa fa-caret-down"></i>';
|
||||
} else {
|
||||
$out['folderexpand'] = '';
|
||||
}
|
||||
@ -116,7 +119,9 @@ class Images extends AdminController {
|
||||
if ( $top == $sub ) {
|
||||
$html = '';
|
||||
} else {
|
||||
$this->spacer[] = '-> ';
|
||||
$children = $this->generateFolderHtml( $sub );
|
||||
array_pop( $this->spacer );
|
||||
Components::set( 'parentfolderName', $object->folderName );
|
||||
$html = Views::simpleView( 'forms.folderSelectParent', $children );
|
||||
Components::set( 'parentfolderName', '' );
|
||||
@ -223,10 +228,36 @@ class Images extends AdminController {
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
if ( self::$token->delete( [ $id ] ) ) {
|
||||
Session::flash( 'success', 'Token deleted.' );
|
||||
if ( ! Input::exists( 'fileLocation' ) ) {
|
||||
Session::flash( 'warning', 'Unknown image.' );
|
||||
Redirect::to( 'admin/images' );
|
||||
}
|
||||
Redirect::to( 'admin/images' );
|
||||
|
||||
$fileLocation = Input::get('fileLocation');
|
||||
|
||||
// Ensure the file exists
|
||||
if ( ! file_exists( $fileLocation ) ) {
|
||||
Session::flash('error', 'File does not exist.');
|
||||
Redirect::to('admin/images');
|
||||
}
|
||||
|
||||
// Check if the file is an image
|
||||
$validMimeTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||
$fileMimeType = mime_content_type( $fileLocation );
|
||||
|
||||
if ( ! in_array( $fileMimeType, $validMimeTypes ) ) {
|
||||
Session::flash('error', 'Invalid file type. Only images can be deleted.');
|
||||
Redirect::to('admin/images');
|
||||
}
|
||||
|
||||
// Attempt to delete the file
|
||||
if (@unlink($fileLocation)) {
|
||||
Session::flash('success', 'Image deleted.');
|
||||
} else {
|
||||
Session::flash('error', 'Failed to delete the image.');
|
||||
}
|
||||
|
||||
Redirect::to('admin/images');
|
||||
}
|
||||
|
||||
public function rename() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the login logs controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the generic logs controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the installed plugins controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the admin routes/redirects controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the admin email controller. The only real use is to send out emails to the various lists.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the configuration and settings controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the admin app/user tokens controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the users admin controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the api authentication controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the api authentication controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the users' api controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the error controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the home or 'index' controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the user registration controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* This is the user control panel controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @version 5.0.1
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
@ -31,7 +31,7 @@ use TheTempusProject\Bedrock\Functions\Session;
|
||||
class Usercp extends Controller {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
if ( !App::$isLoggedIn ) {
|
||||
if ( ! App::$isLoggedIn ) {
|
||||
Session::flash( 'notice', 'You must be logged in to view this page!' );
|
||||
Redirect::home();
|
||||
}
|
||||
|
Reference in New Issue
Block a user