| Current Path : /home/megadansyp/www/administrator/components/com_eventgallery/views/upload/tmpl/ |
| Current File : /home/megadansyp/www/administrator/components/com_eventgallery/views/upload/tmpl/default.php |
<?php
/**
* @package Sven.Bluege
* @subpackage com_eventgallery
*
* @copyright Copyright (C) 2005 - 2019 Sven Bluege All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die('Restricted access');
/**
* @var EventgalleryLibraryFolder $folder
*/
$folder = $this->folder;
$safeFolderName = JFolder::makeSafe($folder->getFolderName());
$validFolderName = strcmp($folder->getFolderName(), $safeFolderName) == 0 ? true : false;
// Returns a file size limit in bytes based on the PHP upload_max_filesize
// and post_max_size
function file_upload_max_size() {
static $max_size = -1;
if ($max_size < 0) {
// Start with post_max_size.
$post_max_size = parse_size(ini_get('post_max_size'));
if ($post_max_size > 0) {
$max_size = $post_max_size;
}
// If upload_max_size is less, then reduce. Except if upload_max_size is
// zero, which indicates no limit.
$upload_max = parse_size(ini_get('upload_max_filesize'));
if ($upload_max > 0 && $upload_max < $max_size) {
$max_size = $upload_max;
}
}
return $max_size;
}
function parse_size($size) {
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
$size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
if ($unit) {
// Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
}
else {
return round($size);
}
}
if (!$folder->supportsFileUpload()) {
echo JText::_('COM_EVENTGALLERY_EVENT_UPLOAD_NOT_SUPPORTED');
return;
}
?>
<div class="card">
<?php IF (!$validFolderName): ?>
<div class="card-body">
<?php echo JText::sprintf('COM_EVENTGALLERY_SYNC_DATABASE_SYNC_ERROR_FOLDERNAME', $folder->getFolderName(), $safeFolderName);?>
</div>
<?php ELSE: ?>
<h2 class="card-header"><?php echo $folder->getFolderName()?></h2>
<div class="card-body">
<div id="uploader"
data-max-file-size="<?php echo file_upload_max_size() ?>"
data-upload-url="<?php echo JRoute::_("index.php?option=com_eventgallery&view=upload&task=upload.upload&folder=".htmlspecialchars($folder->getFolderName(), ENT_QUOTES, 'UTF-8')."&format=raw&",false); ?>"
data-i18n-COM_EVENTGALLERY_EVENT_UPLOAD_FILES_TO_UPLOAD="<?php echo JText::_( 'COM_EVENTGALLERY_EVENT_UPLOAD_FILES_TO_UPLOAD' ); ?>"
data-i18n-COM_EVENTGALLERY_EVENT_UPLOAD_PENDING="<?php echo JText::_( 'COM_EVENTGALLERY_EVENT_UPLOAD_PENDING' ); ?>";
data-i18n-COM_EVENTGALLERY_EVENT_UPLOAD_FINISHED="<?php echo JText::_( 'COM_EVENTGALLERY_EVENT_UPLOAD_FINISHED' ); ?>";
></div>
</div>
<?PHP ENDIF ?>
</div>
<form action="<?php echo JRoute::_('index.php'); ?>" method="post" name="adminForm" id="adminForm">
<input type="hidden" name="option" value="com_eventgallery" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>