| Server IP : 74.208.250.37 / Your IP : 216.73.217.68 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/brainwavemx/resources/templates/admin/ |
Upload File : |
<?php
$this->layout('admin/layout/mainEdit', ['title' => $post['action']]);
if (!isset($post['id_post']) ) {
$id_post = 0;
$title = '';
$resume = '';
$content = '';
$metaD = '';
$tags = '';
$id_author = 1;
$publish = date('Y-m-d H:i:s');
$image = '';
$modalTitle = 'Add Image';
} else {
$id_post = $post['id_post'];
$title = $post['title'];
$resume = $post['resume'];
$content = $post['content'];
$metaD = '';
$tags = '';
$id_author = 1;
$publish = date('Y-m-d H:i:s');
$image = $post['image'];
$modalTitle = 'Update Image';
}
?>
<div id="main">
<div class="container">
<div class="row pt-2 mb-2 border-bottom">
<h4 class="text-dark font-weight-bolder"><?= $post['action'] . ' ' . $title ?></h4>
</div>
<div class="py-5">
<form method="post">
<input type="hidden" name="id_post" id="id_post" value="<?= $id_post ?>">
<div class="row">
<div class="col-md-8">
<div class="form-group pb-2">
<div class="pb-2">
<label for="author" class="h4">Author</label>
</div>
<select name="author" id="author" class="form-control">
<?php
$selected = $id_author == 1 ? 'selected' : '';
?>
<option value="0">Select</option>
<option value="1" <?= $selected ?>>Strider</option>
</select>
</div>
<div class="form-group pb-2">
<label for="title" class="h4">Post Title</label>
<input id="postTitle" type="text" name="title" value="<?= $title ?>" class="form-control" />
</div>
<div class="form-group pb-2">
<label for="metaDescription" class="h4">Meta Description</label>
<input id="metaDescription" type="text" name="metaDescription" value="<?= $metaD ?>" class="form-control" />
</div>
<div class="form-group pb-2">
<label for="tags" class="h4">Tags</label>
<input id="tags" type="text" name="tags" value="<?= $tags ?>" class="form-control" />
</div>
<div class="form-group pb-2">
<label for="publishDate" class="h4">Publish Date</label>
<input id="publishDate" type="text" name="publishDate" value="<?= $publish ?>" class="form-control" />
</div>
</div>
<div class="col-md-4">
<div class="row">
<div class="col-6">
<label for="image" class="h4">Post Image</label>
</div>
<div class="col-6">
<?php if (!empty($image)) : ?>
<div id="update_image" class="btn btn-primary ms-2 mb-2" data-bs-toggle="modal" data-bs-target="#imageModal">Edit Image</div>
<?php else : ?>
<div id="create_image"class="btn btn-warning ms-2 mb-2" data-bs-toggle="modal" data-bs-target="#imageModal">Add Image</div>
<?php endif; ?>
</div>
</div>
<input id="image" type="text" name="image" value="<?= $image ?>" class="form-control" />
<div id="image_box" class="pt-2" >
<img src="<?= $image ?>" class="img-fluid">
</div>
</div>
</div>
<div class="form-group pb-2">
<label for="title" class="h4">Post Resume</label>
<textarea id="postResume" class="form-control"><?= $resume ?></textarea>
</div>
<div class="form-group pb-2">
<label for="title" class="h4">Post Content</label>
<div id="postForm"><?= $content ?></div>
</div>
<div class="pb-2">
<div id="postSubmit" class="btn btn-primary form-control">submit</div>
</div>
</form>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><?= $modalTitle ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="fileupload" action="/post/imageupload" method="POST" enctype="multipart/form-data">
<!-- Redirect browsers with JavaScript disabled to the origin page -->
<noscript><input
type="hidden"
name="redirect"
value="/post/imageupload"
/></noscript>
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="row fileupload-buttonbar">
<div class="col-lg-7">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button">
<i class="glyphicon glyphicon-plus"></i>
<span>Add file</span>
<input type="file" name="files[]" multiple="">
</span>
<button type="submit" class="btn btn-primary start">
<i class="glyphicon glyphicon-upload"></i>
<span>Start upload</span>
</button>
<button type="reset" class="btn btn-warning cancel">
<i class="glyphicon glyphicon-ban-circle"></i>
<span>Cancel upload</span>
</button>
<button type="button" class="btn btn-danger delete">
<i class="glyphicon glyphicon-trash"></i>
<span>Delete selected</span>
</button>
<input type="checkbox" class="toggle">
<!-- The global file processing state -->
<span class="fileupload-process"></span>
</div>
<!-- The global progress state -->
<div class="col-lg-5 fileupload-progress fade">
<!-- The global progress bar -->
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar progress-bar-success" style="width: 0%;"></div>
</div>
<!-- The extended global progress state -->
<div class="progress-extended"> </div>
</div>
</div>
<!-- The table listing the files available for upload/download -->
<table role="presentation" class="table table-striped">
<tbody class="files"></tbody>
</table>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<script>
$('#postSubmit').on('click', function(){
var id_post = $('#id_post').val();
var content = tinymce.activeEditor.getContent();
var resume = $('#postResume').val();
var title = $('#postTitle').val();
console.debug('resume: ' + title);
console.debug('resume: ' + resume);
console.debug(content);
$.ajax({
type : 'POST',
url : '/post/process',
data : {'id_post' : id_post, 'title' : title, 'resume' : resume, 'content' : content},
success : function(response) {
console.log('response' + response);
}
});
});
</script>
</div>
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload {%=o.options.loadImageFileTypes.test(file.type)?' image':''%}">
<td>
<span class="preview"></span>
</td>
<td>
<p class="name">{%=file.name%}</p>
<strong class="error text-danger"></strong>
</td>
<td>
<p class="size">Processing...</p>
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
</td>
<td>
{% if (!o.options.autoUpload && o.options.edit && o.options.loadImageFileTypes.test(file.type)) { %}
<button class="btn btn-success edit" data-index="{%=i%}" disabled>
<i class="glyphicon glyphicon-edit"></i>
<span>Edit</span>
</button>
{% } %}
{% if (!i && !o.options.autoUpload) { %}
<button class="btn btn-primary start" disabled>
<i class="glyphicon glyphicon-upload"></i>
<span>Start</span>
</button>
{% } %}
{% if (!i) { %}
<button class="btn btn-warning cancel">
<i class="glyphicon glyphicon-ban-circle"></i>
<span>Cancel</span>
</button>
{% } %}
</td>
</tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-download {%=file.thumbnailUrl?' image':''%}">
<td>
<span class="preview">
{% if (file.thumbnailUrl) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
{% } %}
</span>
</td>
<td>
<p class="name">
{% if (file.url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
{% } else { %}
<span>{%=file.name%}</span>
{% } %}
</p>
{% if (file.error) { %}
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
{% } %}
</td>
<td>
<span class="size">{%=o.formatFileSize(file.size)%}</span>
</td>
<td>
{% if (file.deleteUrl) { %}
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
<i class="glyphicon glyphicon-trash"></i>
<span>Delete</span>
</button>
<input type="checkbox" name="delete" value="1" class="toggle">
{% } else { %}
<button class="btn btn-warning cancel">
<i class="glyphicon glyphicon-ban-circle"></i>
<span>Cancel</span>
</button>
{% } %}
</td>
</tr>
{% } %}
</script>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"
integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ"
crossorigin="anonymous"
></script>
<!-- blueimp Gallery script -->
<script src="https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
<script src="/assets/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="/assets/node_modules/blueimp-file-upload/js/vendor/jquery.ui.widget.js"></script>
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="/assets/node_modules/blueimp-tmpl/js/tmpl.min.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="/assets/node_modules/blueimp-load-image/js/load-image.all.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="/assets/node_modules/blueimp-file-upload/js/jquery.iframe-transport.js"></script>
<script src="/assets/node_modules/blueimp-canvas-to-blob/js/canvas-to-blob.min.js"></script>
<!-- The basic File Upload plugin -->
<script src="/assets/node_modules/blueimp-file-upload/js/jquery.fileupload.js"></script>
<!-- The File Upload processing plugin -->
<script src="/assets/node_modules/blueimp-file-upload/js/jquery.fileupload-process.js"></script>
<!-- The File Upload image preview & resize plugin -->
<script src="/assets/node_modules/blueimp-file-upload/js/jquery.fileupload-image.js"></script>
<!-- The File Upload validation plugin -->
<script src="/assets/node_modules/blueimp-file-upload/js/jquery.fileupload-validate.js"></script>
<!-- The File Upload user interface plugin -->
<script src="/assets/node_modules/blueimp-file-upload/js/jquery.fileupload-ui.js"></script>
<!-- The main application script -->
<script src="/assets/js/uploaddemo.js"></script>
<?php
/*
<script type="text/javascript">
$(function () {
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p></p>').text(file.name).appendTo(document.body);
});
}
});
});
*/
?>
</script>
<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 -->
<!--[if (gte IE 8)&(lt IE 10)]>
<script src="js/cors/jquery.xdr-transport.js"></script>
<![endif]-->
<script type="module">
// import Pintura Image Editor functionality:
import { openDefaultEditor } from '/assets/node_modules/@pqina/pintura/pintura.js';
$(function () {
$('#fileupload').fileupload('option', {
// When editing a file use Pintura Image Editor:
edit: function (file) {
return new Promise((resolve, reject) => {
const editor = openDefaultEditor({ src: file });
editor.on('process', ({ dest }) => { resolve(dest); });
editor.on('close', () => { resolve(file); });
});
}
});
});
</script>