v-wordpress-plugin-updater/update-api/views/thupdate.php
nikolai@vontainment.com 7d1c4a4288 modified: .gitignore
modified:   README.md
	modified:   mu-plugin/v-sys-plugin-updater-mu.php
	modified:   mu-plugin/v-sys-plugin-updater.php
	modified:   mu-plugin/v-sys-theme-updater.php
	deleted:    update-api/app/forms/home-forms.php
	deleted:    update-api/app/forms/plupdate-forms.php
	deleted:    update-api/app/forms/thupdate-forms.php
	deleted:    update-api/app/helpers/home-helper.php
	deleted:    update-api/app/helpers/logs-helper.php
	deleted:    update-api/app/helpers/plupdate-helper.php
	deleted:    update-api/app/helpers/thupdate-helper.php
	new file:   update-api/classes/forms/HomeFormHandler.php
	new file:   update-api/classes/forms/PlFormHandler.php
	new file:   update-api/classes/forms/ThFormHandler.php
	new file:   update-api/classes/helpers/HomeHelper.php
	new file:   update-api/classes/helpers/LogsHelper.php
	new file:   update-api/classes/helpers/PlHelper.php
	new file:   update-api/classes/helpers/ThHelper.php
	new file:   update-api/classes/util/security.php
	modified:   update-api/lib/auth-lib.php
	new file:   update-api/lib/class-lib.php
	modified:   update-api/lib/load-lib.php
	deleted:    update-api/lib/waf-lib.php
	modified:   update-api/public/.htaccess
	new file:   update-api/public/api.php
	modified:   update-api/public/assets/css/login.css
	modified:   update-api/public/assets/css/mobile.css
	deleted:    update-api/public/assets/css/pages.css
	modified:   update-api/public/assets/css/styles.css
	modified:   update-api/public/index.php
	modified:   update-api/public/login.php
	deleted:    update-api/public/plugins/api.php
	deleted:    update-api/public/plugins/download.php
	deleted:    update-api/public/themes/api.php
	deleted:    update-api/public/themes/download.php
	renamed:    update-api/app/pages/home.php -> update-api/views/home.php
	renamed:    update-api/app/pages/logs.php -> update-api/views/logs.php
	renamed:    update-api/app/pages/plupdate.php -> update-api/views/plupdate.php
	renamed:    update-api/app/pages/thupdate.php -> update-api/views/thupdate.php
2025-06-29 14:59:47 -04:00

79 lines
2.3 KiB
PHP

<?php
/*
* Project: Update API
* Author: Vontainment
* URL: https://vontainment.com
* File: thupdate.php
* Description: WordPress Update API
*/
use UpdateApi\helpers\ThHelper;
use UpdateApi\forms\ThFormHandler;
$handler = new ThFormHandler();
$handler->handleRequest();
$themesTableHtml = ThHelper::getThemesTableHtml();
?>
<div class="content-box">
<h2>Themes</h2>
<div id="Themes_table">
<?php echo $themesTableHtml; ?>
</div>
<div class="plupload section">
<div id="upload-container">
<h2>Upload Theme</h2>
<form action="/thupdate" method="post" enctype="multipart/form-data" class="dropzone" id="upload_theme_form">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token'] ?? ''); ?>">
<div class="fallback">
<input name="theme_file[]" type="file" multiple />
</div>
</form>
<button class="reload-btn" onclick="window.location = '/thupdate'; window.location.reload();">Reload Page</button>
</div>
<div id="message-container">
<h2>Upload Status</h2>
</div>
</div>
</div>
<script>
Dropzone.autoDiscover = false;
$(document).ready(function() {
var myDropzone = new Dropzone("#upload_theme_form", {
paramName: "theme_file[]",
maxFilesize: 200,
acceptedFiles: "application/zip,application/x-zip-compressed,multipart/x-zip",
autoProcessQueue: true,
parallelUploads: 6,
init: function() {
var dz = this;
this.on("success", function(file, response) {
// File uploaded successfully
console.log(response); // You can handle the response from the server here
// Create a success message element
var successMsg = $('<div class="success-message">Successfully uploaded file: ' + file.name + '</div>');
// Insert the success message below the form
$('#message-container').append(successMsg);
});
this.on("error", function(file, errorMessage) {
// File upload error
console.log(errorMessage);
// Create an error message element
var errorMsg = $('<div class="error-message">Error uploading file: ' + file.name + '</div>');
// Insert the error message below the form
$('#message-container').append(errorMsg);
});
}
});
});
</script>