primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="_COM_PHOCADOWNLOAD_USER_UPLOAD_GROUP">
<message><![CDATA[_COM_PHOCADOWNLOAD_USER_UPLOAD_GROUP_DESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,29 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
//if ( $this->t['p']->get( 'show_page_heading' ) ) {
// echo '<h1>'. $this->escape($this->t['p']->get('page_heading')) . '</h1>';
//}
echo PhocaDownloadRenderFront::renderHeader(array());
//echo '<ul class="nav nav-tabs">';
//echo '<li role="phtabupload" class="active"><a href="#">'.Text::_('COM_PHOCADOWNLOAD_UPLOAD').'</a></li>';
//echo '</ul>';
echo '<h3>'.Text::_('COM_PHOCADOWNLOAD_UPLOAD').'</h3>';
//echo '<div id="phtabupload">';
//echo JHtml::_('tabs.panel', JHtml::_( 'image', $this->t['pi'].'icon-document-16.png', '') . '&nbsp;'.JText::_('COM_PHOCADOWNLOAD_UPLOAD'), 'files' );
echo $this->loadTemplate('files');
//echo '</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCADOWNLOAD_USER_UPLOAD_LAYOUT">
<message>
<![CDATA[COM_PHOCADOWNLOAD_USER_UPLOAD_LAYOUT_DESC]]>
</message>
</layout>
<name>COM_PHOCADOWNLOAD_USER_UPLOAD_LAYOUT</name>
<description>COM_PHOCADOWNLOAD_USER_UPLOAD_LAYOUT_DESC</description>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_phocadownload/models/fields" >
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,27 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
//if ( $this->t['p']->get( 'show_page_heading' ) ) {
// echo '<h1>'. $this->escape($this->t['p']->get('page_heading')) . '</h1>';
//}
echo PhocaDownloadRenderFront::renderHeader(array());
echo '<ul class="nav nav-tabs">';
echo '<li role="phtabupload" class="active"><a href="#">'.JText::_('COM_PHOCADOWNLOAD_UPLOAD').'</a></li>';
echo '</ul>';
echo '<div id="phtabupload">';
//echo Joomla\CMS\HTML\HTMLHelper::_('tabs.panel', Joomla\CMS\HTML\HTMLHelper::_( 'image', $this->t['pi'].'icon-document-16.png', '') . '&nbsp;'.JText::_('COM_PHOCADOWNLOAD_UPLOAD'), 'files' );
echo $this->loadTemplate('files_bootstrap');
echo '</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

@ -0,0 +1,388 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
$app = Factory::getApplication();
$db = Factory::getDBO();
$user = Factory::getUser();
$config = Factory::getConfig();
$nullDate = $db->getNullDate();
$now = Factory::getDate();
echo '<div id="phocadownload-upload">';
if ($this->t['displayupload'] == 1) {
?>
<script type="text/javascript">
Joomla.submitbutton = function(task, id)
{
if (id > 0) {
document.getElementById('adminForm').actionid.value = id;
}
Joomla.submitform(task, document.getElementById('adminForm'));
}
jQuery(document).on('change', '.btn-file :file', function() {
var input = jQuery(this);
/* numFiles = input.get(0).files ? input.get(0).files.length : 1,*/
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
jQuery('#file-upload-filename').val(label);
});
</script>
<h4><?php echo Text::_( 'COM_PHOCADOWNLOAD_UPLOADED_FILES' ); ?></h4>
<?php
if ($this->t['catidfiles'] == 0 || $this->t['catidfiles'] == '') {
echo '<div class="alert alert-danger">'.Text::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY_TO_BE_ABLE_TO_UPLOAD_FILES').'</div>';
}
?>
<form action="<?php echo htmlspecialchars($this->t['action']);?>" method="post" name="phocadownloadfilesform" id="adminForm">
<div class="row">
<div class="col-sm-12 col-md-4">
<div class="input-group">
<?php /*<label for="filter_search" class="element-invisible"><?php echo JText::_( 'COM_PHOCADOWNLOAD_FILTER' ); ?></label> */ ?>
<input type="text" name="search" id="pdsearch" placeholder="<?php echo Text::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>" value="<?php echo $this->t['listsfiles']['search'];?>" title="<?php echo Text::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-primary tip hasTooltip" type="submit" onclick="this.form.submit();" title="<?php echo Text::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>"><span class="icon-fw icon-search"></span></button>
<button class="btn btn-primary tip hasTooltip" type="button" onclick="document.getElementById('pdsearch').value='';document.phocadownloadfilesform.submit();" title="<?php echo Text::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>"><span class="icon-fw icon-remove"></span></button>
</span>
</div>
</div>
<div class="col-sm-12 col-md-4"></div>
<div class="col-sm-12 col-md-4 ph-right"><?php echo $this->t['listsfiles']['catid'] ?></div>
</div>
<table class="table">
<thead>
<tr>
<th class="title ph-th-50"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_TITLE', 'a.title', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image'); ?></th>
<th class="ph-th-3"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_PUBLISHED', 'a.published', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
<th class="ph-th-3"><?php echo Text::_('COM_PHOCADOWNLOAD_DELETE'); ?></th>
<th class="ph-th-3"><?php echo Text::_('COM_PHOCADOWNLOAD_ACTIVE'); ?></th>
<th class="ph-th-3"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_APPROVED', 'a.approved', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
<th class="ph-th-3"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_DATE_UPLOAD', 'a.date', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
<th class="ph-th-3"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_CATEGORY', 'a.catid', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
</thead>
<tbody><?php
$k = 0;
$i = 0;
$n = count( $this->t['filesitems'] );
$rows = &$this->t['filesitems'];
if (is_array($rows)) {
foreach ($rows as $row) {
// USER RIGHT - Delete (Publish/Unpublish) - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
// because we cannot check the access and delete in one time
$user = Factory::getUser();
$rightDisplayDelete = 0;
$catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$row->id);
if (!empty($catAccess)) {
$rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
?><tr class="<?php echo "row$k"; ?>">
<td><?php
$icon = PhocaDownloadFile::getMimeTypeIcon($row->filename);
echo $icon . ' ' . $row->title;
?></td>
<?php
// Publish Unpublish
echo '<td class="ph-td-center">';
if ($row->published == 1) {
if ($rightDisplayDelete) {
echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'unpublish\', '.(int)$row->id.');" >';
//echo HTMLHelper::_('image', $this->t['pi'].'icon-publish.png', Text::_('COM_PHOCADOWNLOAD_PUBLISHED'));
echo '<span class="icon-fw icon-check-circle phc-green" title="'.Text::_('COM_PHOCADOWNLOAD_PUBLISHED').'"></span>';
echo '</a>';
} else {
//echo HTMLHelper::_('image', $this->t['pi'].'icon-publish-g.png', Text::_('COM_PHOCADOWNLOAD_PUBLISHED'));
echo '<span class="icon-fw icon-check-circle phc-green" title="'.Text::_('COM_PHOCADOWNLOAD_PUBLISHED').'"></span>';
}
}
if ($row->published == 0) {
if ($rightDisplayDelete) {
echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'publish\', '.(int)$row->id.');" >';
//echo HTMLHelper::_('image', $this->t['pi'].'icon-unpublish.png', Text::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
echo '<span class="icon-fw icon-minus-circle phc-red" title="'.Text::_('COM_PHOCADOWNLOAD_UNPUBLISHED').'"></span>';
echo '</a>';
} else {
//echo HTMLHelper::_('image', $this->t['pi'].'icon-unpublish-g.png', Text::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
echo '<span class="icon-fw icon-minus-circle phc-red" title="'.Text::_('COM_PHOCADOWNLOAD_UNPUBLISHED').'"></span>';
}
}
echo '</td>';
echo '<td class="ph-td-center">';
if ($rightDisplayDelete) {
echo '<a href="javascript:void(0)" onclick="javascript: if (confirm(\''.Text::_('COM_PHOCADOWNLOAD_WARNING_DELETE_ITEMS').'\')) {Joomla.submitbutton(\'delete\', '.(int)$row->id.');}" >';
//echo HTMLHelper::_('image', $this->t['pi'].'icon-trash.png', Text::_('COM_PHOCADOWNLOAD_DELETE'));
echo '<span class="icon-fw icon-trash phc-red" title="'.Text::_('COM_PHOCADOWNLOAD_DELETE').'"></span>';
echo '</a>';
} else {
//echo HTMLHelper::_('image', $this->t['pi'].'icon-trash-g.png', Text::_('COM_PHOCADOWNLOAD_DELETE'));
echo '<span class="icon-fw icon-trash phc-grey" title="'.Text::_('COM_PHOCADOWNLOAD_DELETE').'"></span>';
}
echo '</td>';
echo '<td class="ph-td-center">';
// User should get info about active/not active file (if e.g. admin change the active status)
$publish_up = Factory::getDate($row->publish_up);
$publish_down = Factory::getDate($row->publish_down);
$tz = new DateTimeZone($config->get('offset'));
$publish_up->setTimezone($tz);
$publish_down->setTimezone($tz);
if ( $now->toUnix() <= $publish_up->toUnix() ) {
$text = Text::_( 'COM_PHOCADOWNLOAD_PENDING' );
} else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) ) {
$text = Text::_( 'COM_PHOCADOWNLOAD_ACTIVE' );
} else if ( $now->toUnix() > $publish_down->toUnix() ) {
$text = Text::_( 'COM_PHOCADOWNLOAD_EXPIRED' );
}
$times = '';
if (isset($row->publish_up)) {
if ($row->publish_up == $nullDate) {
$times .= "\n".Text::_( 'COM_PHOCADOWNLOAD_START') . ': '.Text::_( 'COM_PHOCADOWNLOAD_ALWAYS' );
} else {
$times .= "\n".Text::_( 'COM_PHOCADOWNLOAD_START') .": ". $publish_up->format("D, d M Y H:i:s");
}
}
if (isset($row->publish_down)) {
if ($row->publish_down == $nullDate) {
$times .= "\n". Text::_( 'COM_PHOCADOWNLOAD_FINISH'). ': '. Text::_('COM_PHOCADOWNLOAD_NO_EXPIRY' );
} else {
$times .= "\n". Text::_( 'COM_PHOCADOWNLOAD_FINISH') .": ". $publish_up->format("D, d M Y H:i:s");
}
}
if ( $times ) {
echo '<span class="editlinktip hasTip" title="'. Text::_( 'COM_PHOCADOWNLOAD_PUBLISH_INFORMATION' ).': '. $times.'">'
.'<a href="javascript:void(0);" >'. $text.'</a></span>';
}
echo '</td>';
// Approved
echo '<td class="ph-td-center">';
if ($row->approved == 1) {
//echo HTMLHelper::_('image', $this->t['pi'].'icon-publish.png', Text::_('COM_PHOCADOWNLOAD_APPROVED'));
echo '<span class="icon-fw icon-check-circle phc-green" title="'.Text::_('COM_PHOCADOWNLOAD_APPROVED').'"></span>';
} else {
//echo HTMLHelper::_('image', $this->t['pi'].'icon-unpublish.png', Text::_('COM_PHOCADOWNLOAD_NOT_APPROVED'));
echo '<span class="icon-fw icon-minus-circle phc-red" title="'.Text::_('COM_PHOCADOWNLOAD_NOT_APPROVED').'"></span>';
}
echo '</td>';
$upload_date = Factory::getDate($row->date);
$upload_date->setTimezone($tz);
echo '<td class="ph-td-center">'. $upload_date .'</td>';
//echo '<td class="ph-td-center">'. $row->date .'</td>';
echo '<td class="ph-td-center">'. $row->categorytitle .'</td>'
//echo '<td class="ph-td-center">'. $row->id .'</td>'
.'</tr>';
$k = 1 - $k;
$i++;
}
}
?></tbody>
<tfoot>
<tr>
<td colspan="7" class="footer"><?php
//$this->t['filespagination']->setTab($this->t['currenttab']['files']);
if (!empty($this->t['filesitems'])) {
echo '<div class="pd-center pagination">';
echo '<div class="pd-inline">';
echo '<div style="margin:0 10px 0 10px;display:inline;">'
.Text::_('COM_PHOCADOWNLOAD_DISPLAY_NUM') .'&nbsp;'
.$this->t['filespagination']->getLimitBox()
.'</div>';
echo '<div class="sectiontablefooter'.$this->t['p']->get( 'pageclass_sfx' ).'" style="margin:0 10px 0 10px;display:inline;" >'
.$this->t['filespagination']->getPagesLinks()
.'</div>';
echo '<div class="pagecounter" style="margin:0 10px 0 10px;display:inline;">'
.$this->t['filespagination']->getPagesCounter()
.'</div>';
echo '</div></div>';
}
?></td>
</tr>
</tfoot>
</table>
<?php echo HTMLHelper::_( 'form.token' ); ?>
<input type="hidden" name="controller" value="user" />
<input type="hidden" name="task" value=""/>
<input type="hidden" name="view" value="user"/>
<input type="hidden" name="actionid" value=""/>
<input type="hidden" name="tab" value="<?php echo $this->t['currenttab']['files'];?>" />
<input type="hidden" name="limitstart" value="<?php echo $this->t['filespagination']->limitstart;?>" />
<input type="hidden" name="Itemid" value="<?php echo $app->input->get('Itemid', 0, 'int') ?>"/>
<input type="hidden" name="filter_order" value="<?php echo $this->t['listsfiles']['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
</form>
<?php
// Upload
$currentFolder = '';
if (isset($this->state->folder) && $this->state->folder != '') {
$currentFolder = $this->state->folder;
}
?>
<h4><?php
echo Text::_( 'COM_PHOCADOWNLOAD_UPLOAD_FILE' ).' [ '. Text::_( 'COM_PHOCADOWNLOAD_MAX_SIZE' ).':&nbsp;'.$this->t['uploadmaxsizeread'].']';
?></h4>
<?php
if ($this->t['errorcatid'] != '') {
echo '<div class="alert alert-danger alert-danger alert-dismissible" role="alert">'
.'' . $this->t['errorcatid'] . '<button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>';
} ?>
<form onsubmit="return OnUploadSubmitFile();" action="<?php echo $this->t['actionamp'] ?>task=upload&amp;<?php echo $this->t['session']->getName().'='.$this->t['session']->getId(); ?>&amp;<?php echo Session::getFormToken();?>=1" name="phocadownloaduploadform" id="phocadownload-upload-form" method="post" enctype="multipart/form-data">
<table class="pd-user-upload-table">
<tr>
<td><strong><?php echo Text::_('COM_PHOCADOWNLOAD_FILENAME');?>:</strong></td><td>
<div class="input-append input-group pd-file-upload-form">
<span class="input-group-btn">
<span class="btn btn-primary btn-file"> <?php echo Text::_('COM_PHOCADOWNLOAD_SELECT_FILE')?>
<input type="file" id="file-upload" class="form-control phfileuploadcheckcat" name="Filedata" />
</span>
</span>
<input class="form-control" id="file-upload-filename" readonly="" type="text">
<button class="btn btn-primary" id="file-upload-submit"><span class="icon-fw icon-upload"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_START_UPLOAD')?></button>
<span id="upload-clear"></span>
</div>
</td>
</tr>
<?php
if ($this->t['errorfile'] != '') {
echo '<tr><td></td><td><div class="alert alert-danger alert-danger alert-dismissible" role="alert">'
.'' . $this->t['errorfile'] . '<button type="button" class="btn-close" data-bs-dismiss="alert"></button></div></td></tr>';
} ?>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_FILE_TITLE' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-title" name="phocadownloaduploadtitle" value="<?php echo $this->t['formdata']->title ?>" maxlength="255" class="form-control comment-input" /></td>
</tr>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_DESCRIPTION' ); ?>:</strong></td>
<td><textarea id="phocadownload-upload-description" name="phocadownloaduploaddescription" onkeyup="countCharsUpload();" rows="7" class="form-control comment-input pd-comment-input"><?php echo $this->t['formdata']->description ?></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><?php echo Text::_('COM_PHOCADOWNLOAD_CHARACTERS_WRITTEN');?> <input name="phocadownloaduploadcountin" value="0" readonly="readonly" class="form-control comment-input2" /> <?php echo Text::_('COM_PHOCADOWNLOAD_AND_LEFT_FOR_DESCRIPTION');?> <input name="phocadownloaduploadcountleft" value="<?php echo $this->t['maxuploadchar'];?>" readonly="readonly" class="form-control comment-input2" />
</td>
</tr>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_AUTHOR' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-author" name="phocadownloaduploadauthor" value="<?php echo $this->t['formdata']->author ?>" maxlength="255" class="form-control comment-input" /></td>
</tr>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_AUTHOR_EMAIL' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-email" name="phocadownloaduploademail" value="<?php echo $this->t['formdata']->email ?>" maxlength="255" class="form-control comment-input" /></td>
</tr>
<?php
if ($this->t['erroremail'] != '') {
echo '<tr><td></td><td><div class="alert alert-danger alert-danger alert-dismissible" role="alert">'
.'' . $this->t['erroremail'] . '<button type="button" class="btn-close" data-bs-dismiss="alert"></button></div></td></tr>';
} ?>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_AUTHOR_WEBSITE' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-website" name="phocadownloaduploadwebsite" value="<?php echo $this->t['formdata']->website ?>" maxlength="255" class="form-control comment-input" /></td>
</tr>
<?php
if ($this->t['errorwebsite'] != '') {
echo '<tr><td></td><td><div class="alert alert-danger alert-danger alert-dismissible" role="alert">'
.'' . $this->t['errorwebsite'] . '<button type="button" class="btn-close" data-bs-dismiss="alert"></button></div></td></tr>';
} ?>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_LICENSE' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-license" name="phocadownloaduploadlicense" value="<?php echo $this->t['formdata']->license ?>" maxlength="255" class="form-control comment-input" /></td>
</tr>
<tr>
<td><strong><?php echo Text::_( 'COM_PHOCADOWNLOAD_VERSION' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-version" name="phocadownloaduploadversion" value="<?php echo $this->t['formdata']->version ?>" maxlength="255" class="form-control comment-input" /></td>
</tr>
</table>
<ul class="upload-queue" id="upload-queue"><li style="display: none" ></li></ul>
<?php /*<input type="hidden" name="controller" value="user" /> */ ?>
<input type="hidden" name="viewback" value="user" />
<input type="hidden" name="view" value="user"/>
<input type="hidden" name="task" value="upload"/>
<input type="hidden" name="tab" value="<?php echo $this->t['currenttab']['files'];?>" />
<input type="hidden" name="Itemid" value="<?php echo $app->input->get('Itemid', 0, 'int') ?>"/>
<input type="hidden" name="filter_order" value="<?php echo $this->t['listsfiles']['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
<input type="hidden" name="catidfiles" value="<?php echo $this->t['catidfiles'] ?>"/>
</form>
<div id="loading-label-file"><?php echo HTMLHelper::_('image', $this->t['pi'].'icon-loading.gif', '') . Text::_('COM_PHOCADOWNLOAD_LOADING'); ?></div>
<div id="loading-label-user" class="ph-loading-text ph-loading-hidden">
<div class="ph-lds-ellipsis"><div></div><div></div><div></div><div></div></div>
<div><?php echo Text::_('COM_PHOCADOWNLOAD_LOADING') ?></div>
</div>
<?php
}
echo '</div>';
?>

View File

@ -0,0 +1,371 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$config = JFactory::getConfig();
$nullDate = $db->getNullDate();
$now = JFactory::getDate();
echo '<div id="phocadownload-upload">';
if ($this->t['displayupload'] == 1) {
?>
<script type="text/javascript">
Joomla.submitbutton = function(task, id)
{
if (id > 0) {
document.getElementById('adminForm').actionid.value = id;
}
Joomla.submitform(task, document.getElementById('adminForm'));
}
jQuery(document).on('change', '.btn-file :file', function() {
var input = jQuery(this);
/* numFiles = input.get(0).files ? input.get(0).files.length : 1,*/
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
jQuery('#file-upload-filename').val(label);
});
</script>
<h4><?php echo JText::_( 'COM_PHOCADOWNLOAD_UPLOADED_FILES' ); ?></h4>
<?php
if ($this->t['catidfiles'] == 0 || $this->t['catidfiles'] == '') {
echo '<div class="alert alert-error">'.JText::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY_TO_BE_ABLE_TO_UPLOAD_FILES').'</div>';
}
?>
<form action="<?php echo htmlspecialchars($this->t['action']);?>" method="post" name="phocadownloadfilesform" id="adminForm">
<div class="row">
<div class="col-sm-12 col-md-4">
<div class="input-group">
<?php /*<label for="filter_search" class="element-invisible"><?php echo JText::_( 'COM_PHOCADOWNLOAD_FILTER' ); ?></label> */ ?>
<input type="text" name="search" id="pdsearch" placeholder="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>" value="<?php echo $this->t['listsfiles']['search'];?>" title="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-default tip hasTooltip" type="submit" onclick="this.form.submit();" title="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>"><span class="glyphicon glyphicon-search"></span></button>
<button class="btn btn-default tip hasTooltip" type="button" onclick="document.getElementById('pdsearch').value='';document.phocadownloadfilesform.submit();" title="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>"><span class="glyphicon glyphicon-remove"></span></button>
</span>
</div>
</div>
<div class="col-sm-12 col-md-4"></div>
<div class="col-sm-12 col-md-4 ph-right"><?php echo $this->t['listsfiles']['catid'] ?></div>
</div>
<table class="table">
<thead>
<tr>
<th class="title ph-th-50"><?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_TITLE', 'a.title', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image'); ?></th>
<th class="ph-th-3"><?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_PUBLISHED', 'a.published', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
<th class="ph-th-3"><?php echo JText::_('COM_PHOCADOWNLOAD_DELETE'); ?></th>
<th class="ph-th-3"><?php echo JText::_('COM_PHOCADOWNLOAD_ACTIVE'); ?></th>
<th class="ph-th-3"><?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_APPROVED', 'a.approved', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
<th class="ph-th-3"><?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_DATE_UPLOAD', 'a.date', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
<th class="ph-th-3"><?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_CATEGORY', 'a.catid', $this->t['listsfiles']['order_Dir'], $this->t['listsfiles']['order'], 'image' ); ?></th>
</thead>
<tbody><?php
$k = 0;
$i = 0;
$n = count( $this->t['filesitems'] );
$rows = &$this->t['filesitems'];
if (is_array($rows)) {
foreach ($rows as $row) {
// USER RIGHT - Delete (Publish/Unpublish) - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
// because we cannot check the access and delete in one time
$user = JFactory::getUser();
$rightDisplayDelete = 0;
$catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$row->id);
if (!empty($catAccess)) {
$rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
?><tr class="<?php echo "row$k"; ?>">
<td><?php
$icon = PhocaDownloadFile::getMimeTypeIcon($row->filename);
echo $icon . ' ' . $row->title;
?></td>
<?php
// Publish Unpublish
echo '<td class="ph-td-center">';
if ($row->published == 1) {
if ($rightDisplayDelete) {
echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'unpublish\', '.(int)$row->id.');" >';
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED'));
echo '</a>';
} else {
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-publish-g.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED'));
}
}
if ($row->published == 0) {
if ($rightDisplayDelete) {
echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'publish\', '.(int)$row->id.');" >';
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
echo '</a>';
} else {
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-unpublish-g.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
}
}
echo '</td>';
echo '<td class="ph-td-center">';
if ($rightDisplayDelete) {
echo '<a href="javascript:void(0)" onclick="javascript: if (confirm(\''.JText::_('COM_PHOCADOWNLOAD_WARNING_DELETE_ITEMS').'\')) {Joomla.submitbutton(\'delete\', '.(int)$row->id.');}" >';
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-trash.png', JText::_('COM_PHOCADOWNLOAD_DELETE'));
echo '</a>';
} else {
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-trash-g.png', JText::_('COM_PHOCADOWNLOAD_DELETE'));
}
echo '</td>';
echo '<td class="ph-td-center">';
// User should get info about active/not active file (if e.g. admin change the active status)
$publish_up = JFactory::getDate($row->publish_up);
$publish_down = JFactory::getDate($row->publish_down);
$tz = new DateTimeZone($config->get('offset'));
$publish_up->setTimezone($tz);
$publish_down->setTimezone($tz);
if ( $now->toUnix() <= $publish_up->toUnix() ) {
$text = JText::_( 'COM_PHOCADOWNLOAD_PENDING' );
} else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) ) {
$text = JText::_( 'COM_PHOCADOWNLOAD_ACTIVE' );
} else if ( $now->toUnix() > $publish_down->toUnix() ) {
$text = JText::_( 'COM_PHOCADOWNLOAD_EXPIRED' );
}
$times = '';
if (isset($row->publish_up)) {
if ($row->publish_up == $nullDate) {
$times .= "\n".JText::_( 'COM_PHOCADOWNLOAD_START') . ': '.JText::_( 'COM_PHOCADOWNLOAD_ALWAYS' );
} else {
$times .= "\n".JText::_( 'COM_PHOCADOWNLOAD_START') .": ". $publish_up->format("D, d M Y H:i:s");
}
}
if (isset($row->publish_down)) {
if ($row->publish_down == $nullDate) {
$times .= "\n". JText::_( 'COM_PHOCADOWNLOAD_FINISH'). ': '. JText::_('COM_PHOCADOWNLOAD_NO_EXPIRY' );
} else {
$times .= "\n". JText::_( 'COM_PHOCADOWNLOAD_FINISH') .": ". $publish_up->format("D, d M Y H:i:s");
}
}
if ( $times ) {
echo '<span class="editlinktip hasTip" title="'. JText::_( 'COM_PHOCADOWNLOAD_PUBLISH_INFORMATION' ).': '. $times.'">'
.'<a href="javascript:void(0);" >'. $text.'</a></span>';
}
echo '</td>';
// Approved
echo '<td class="ph-td-center">';
if ($row->approved == 1) {
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_APPROVED'));
} else {
echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_NOT_APPROVED'));
}
echo '</td>';
$upload_date = JFactory::getDate($row->date);
$upload_date->setTimezone($tz);
echo '<td class="ph-td-center">'. $upload_date .'</td>';
//echo '<td class="ph-td-center">'. $row->date .'</td>';
echo '<td class="ph-td-center">'. $row->categorytitle .'</td>'
//echo '<td class="ph-td-center">'. $row->id .'</td>'
.'</tr>';
$k = 1 - $k;
$i++;
}
}
?></tbody>
<tfoot>
<tr>
<td colspan="7" class="footer"><?php
//$this->t['filespagination']->setTab($this->t['currenttab']['files']);
if (!empty($this->t['filesitems'])) {
echo '<div class="pd-center pagination">';
echo '<div class="pd-inline">';
echo '<div style="margin:0 10px 0 10px;display:inline;">'
.JText::_('COM_PHOCADOWNLOAD_DISPLAY_NUM') .'&nbsp;'
.$this->t['filespagination']->getLimitBox()
.'</div>';
echo '<div class="sectiontablefooter'.$this->t['p']->get( 'pageclass_sfx' ).'" style="margin:0 10px 0 10px;display:inline;" >'
.$this->t['filespagination']->getPagesLinks()
.'</div>';
echo '<div class="pagecounter" style="margin:0 10px 0 10px;display:inline;">'
.$this->t['filespagination']->getPagesCounter()
.'</div>';
echo '</div></div>';
}
?></td>
</tr>
</tfoot>
</table>
<?php echo Joomla\CMS\HTML\HTMLHelper::_( 'form.token' ); ?>
<input type="hidden" name="controller" value="user" />
<input type="hidden" name="task" value=""/>
<input type="hidden" name="view" value="user"/>
<input type="hidden" name="actionid" value=""/>
<input type="hidden" name="tab" value="<?php echo $this->t['currenttab']['files'];?>" />
<input type="hidden" name="limitstart" value="<?php echo $this->t['filespagination']->limitstart;?>" />
<input type="hidden" name="Itemid" value="<?php echo $app->input->get('Itemid', 0, 'int') ?>"/>
<input type="hidden" name="filter_order" value="<?php echo $this->t['listsfiles']['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
</form>
<?php
// Upload
$currentFolder = '';
if (isset($this->state->folder) && $this->state->folder != '') {
$currentFolder = $this->state->folder;
}
?>
<h4><?php
echo JText::_( 'COM_PHOCADOWNLOAD_UPLOAD_FILE' ).' [ '. JText::_( 'COM_PHOCADOWNLOAD_MAX_SIZE' ).':&nbsp;'.$this->t['uploadmaxsizeread'].']';
?></h4>
<?php
if ($this->t['errorcatid'] != '') {
echo '<div class="alert alert-error alert-danger">'
.'<button type="button" class="close" data-dismiss="alert">&times;</button>' . $this->t['errorcatid'] . '</div>';
} ?>
<form onsubmit="return OnUploadSubmitFile();" action="<?php echo $this->t['actionamp'] ?>task=upload&amp;<?php echo $this->t['session']->getName().'='.$this->t['session']->getId(); ?>&amp;<?php echo JSession::getFormToken();?>=1" name="phocadownloaduploadform" id="phocadownload-upload-form" method="post" enctype="multipart/form-data">
<table class="pd-user-upload-table">
<tr>
<td><strong><?php echo JText::_('COM_PHOCADOWNLOAD_FILENAME');?>:</strong></td><td>
<div class="input-group pd-file-upload-form">
<span class="input-group-btn">
<span class="btn btn-primary btn-file"> <?php echo JText::_('COM_PHOCADOWNLOAD_SELECT_FILE')?>
<input type="file" id="file-upload" class="phfileuploadcheckcat" name="Filedata" />
</span>
</span>
<input class="form-control pd-input-small" id="file-upload-filename" readonly="" type="text">
<button class="btn btn-primary" id="file-upload-submit"><span class="glyphicon glyphicon-upload"></span> <?php echo JText::_('COM_PHOCADOWNLOAD_START_UPLOAD')?></button>
<span id="upload-clear"></span>
</div>
</td>
</tr>
<?php
if ($this->t['errorfile'] != '') {
echo '<tr><td></td><td><div class="alert alert-error alert-danger">'
.'<button type="button" class="close" data-dismiss="alert">&times;</button>' . $this->t['errorfile'] . '</div></td></tr>';
} ?>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_FILE_TITLE' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-title" name="phocadownloaduploadtitle" value="<?php echo $this->t['formdata']->title ?>" maxlength="255" class="comment-input" /></td>
</tr>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_DESCRIPTION' ); ?>:</strong></td>
<td><textarea id="phocadownload-upload-description" name="phocadownloaduploaddescription" onkeyup="countCharsUpload();" rows="7" class="comment-input pd-comment-input"><?php echo $this->t['formdata']->description ?></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><?php echo JText::_('COM_PHOCADOWNLOAD_CHARACTERS_WRITTEN');?> <input name="phocadownloaduploadcountin" value="0" readonly="readonly" class="comment-input2" /> <?php echo JText::_('COM_PHOCADOWNLOAD_AND_LEFT_FOR_DESCRIPTION');?> <input name="phocadownloaduploadcountleft" value="<?php echo $this->t['maxuploadchar'];?>" readonly="readonly" class="comment-input2" />
</td>
</tr>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_AUTHOR' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-author" name="phocadownloaduploadauthor" value="<?php echo $this->t['formdata']->author ?>" maxlength="255" class="comment-input" /></td>
</tr>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_AUTHOR_EMAIL' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-email" name="phocadownloaduploademail" value="<?php echo $this->t['formdata']->email ?>" maxlength="255" class="comment-input" /></td>
</tr>
<?php
if ($this->t['erroremail'] != '') {
echo '<tr><td></td><td><div class="alert alert-error alert-danger">'
.'<button type="button" class="close" data-dismiss="alert">&times;</button>' . $this->t['erroremail'] . '</div></td></tr>';
} ?>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_AUTHOR_WEBSITE' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-website" name="phocadownloaduploadwebsite" value="<?php echo $this->t['formdata']->website ?>" maxlength="255" class="comment-input" /></td>
</tr>
<?php
if ($this->t['errorwebsite'] != '') {
echo '<tr><td></td><td><div class="alert alert-error alert-danger">'
.'<button type="button" class="close" data-dismiss="alert">&times;</button>' . $this->t['errorwebsite'] . '</div></td></tr>';
} ?>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_LICENSE' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-license" name="phocadownloaduploadlicense" value="<?php echo $this->t['formdata']->license ?>" maxlength="255" class="comment-input" /></td>
</tr>
<tr>
<td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_VERSION' ); ?>:</strong></td>
<td><input type="text" id="phocadownload-upload-version" name="phocadownloaduploadversion" value="<?php echo $this->t['formdata']->version ?>" maxlength="255" class="comment-input" /></td>
</tr>
</table>
<ul class="upload-queue" id="upload-queue"><li style="display: none" ></li></ul>
<?php /*<input type="hidden" name="controller" value="user" /> */ ?>
<input type="hidden" name="viewback" value="user" />
<input type="hidden" name="view" value="user"/>
<input type="hidden" name="task" value="upload"/>
<input type="hidden" name="tab" value="<?php echo $this->t['currenttab']['files'];?>" />
<input type="hidden" name="Itemid" value="<?php echo $app->input->get('Itemid', 0, 'int') ?>"/>
<input type="hidden" name="filter_order" value="<?php echo $this->t['listsfiles']['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
<input type="hidden" name="catidfiles" value="<?php echo $this->t['catidfiles'] ?>"/>
</form>
<div id="loading-label-file"><?php echo Joomla\CMS\HTML\HTMLHelper::_('image', $this->t['pi'].'icon-loading.gif', '') . JText::_('COM_PHOCADOWNLOAD_LOADING'); ?></div>
<?php
}
echo '</div>';
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,381 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\Client\ClientHelper;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Mail\MailHelper;
jimport( 'joomla.client.helper' );
jimport( 'joomla.application.component.view' );
jimport( 'joomla.html.pane' );
use Joomla\String\StringHelper;
class PhocaDownloadViewUser extends HtmlView
{
protected $_context_files = 'com_phocadownload.phocadownloaduserfiles';
protected $r;
function display($tpl = null) {
$app = Factory::getApplication();
$document = Factory::getDocument();
$uri = Uri::getInstance();
$menus = $app->getMenu();
$menu = $menus->getActive();
$this->t['p'] = $app->getParams();
$user = Factory::getUser();
$db = Factory::getDBO();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$this->t['pi'] = 'media/com_phocadownload/images/';
$this->t['pp'] = 'index.php?option=com_phocadownload&view=user&controller=user';
$this->t['pl'] = 'index.php?option=com_users&view=login&return='.base64_encode($this->t['pp'].'&Itemid='. $app->input->get('Itemid', 0, 'int'));
$neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels();
$access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels);
if (!$access) {
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION"), 'error');
$app->redirect(Route::_($this->t['pl'], false));
return;
}
PhocaDownloadRenderFront::renderMainJs();
PhocaDownloadRenderFront::renderAllCSS();
HTMLHelper::_('jquery.framework', false);
$document = Factory::getDocument();
$document->addScriptDeclaration(
'jQuery(document).ready(function(){
jQuery(\'.phfileuploadcheckcat\').click(function(){
if( !jQuery(\'#catid\').val() || jQuery(\'#catid\').val() == 0) {
alert(\''.Text::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY').'\'); return false;
} else {
return true;
}
})});'
);
// = = = = = = = = = = =
// PANE
// = = = = = = = = = = =
// - - - - - - - - - -
// ALL TABS
// - - - - - - - - - -
// UCP is disabled (security reasons)
if ((int)$this->t['p']->get( 'enable_user_cp', 0 ) == 0) {
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_USER_UPLOAD_DISABLED"), 'error');
$app->redirect(Uri::base(false));
exit;
}
$this->t['tab'] = $app->input->get('tab', 0, 'string');
$this->t['maxuploadchar'] = $this->t['p']->get( 'max_upload_char', 1000 );
$this->t['enableuseruploadapprove'] = $this->t['p']->get( 'enable_user_upload_approve', 0 );
$this->t['showpageheading'] = $this->t['p']->get( 'show_page_heading', 1 );
$this->t['uploadmaxsize'] = $this->t['p']->get( 'user_file_upload_size', 3145728 );
$this->t['uploadmaxsizeread'] = PhocaDownloadFile::getFileSizeReadable($this->t['uploadmaxsize']);
$this->t['userfilesmaxcount'] = $this->t['p']->get( 'user_files_max_count', 5 );
$this->t['userfilesmaxsize'] = $this->t['p']->get( 'user_files_max_size', 20971520 );
$this->t['send_mail_upload'] = $this->t['p']->get( 'send_mail_upload', 0 );
$this->t['pw'] = PhocaDownloadRenderFront::renderPhocaDownload();
//Subcateogry
//$this->t['parent_id'] = $app->input->get('parentcategoryid', 0, 'int');
//$document->addScript(JUri::base(true).'/components/com_phocadownload/assets/js/comments.js');
$document->addCustomTag(PhocaDownloadRenderFront::renderOnUploadJS());
$document->addCustomTag(PhocaDownloadRenderFront::renderDescriptionUploadJS((int)$this->t['maxuploadchar']));
$document->addCustomTag(PhocaDownloadRenderFront::userTabOrdering());
$model = $this->getModel('user');
// Upload Form - - - - - - - - - - - - - - -
$ftp = !ClientHelper::hasCredentials('ftp');// Set FTP form
$session = Factory::getSession();
$this->t['session'] = $session;
// END Upload Form - - - - - - - - - - - - -
$this->t['displayupload'] = 1;
// - - - - - - - - - -
// FORM
// - - - - - - - - - -
// No Controller because of returning back the values in case some form field is not OK
// Set default for returning back
$formData = new CMSObject();
$formData->set('title', '');
$formData->set('description','');
$formData->set('author','');
$formData->set('email','');
$formData->set('license','');
$formData->set('website','');
$formData->set('version','');
$this->t['errorcatid'] = '';
$this->t['erroremail'] = '';
$this->t['errorwebsite'] = '';
$this->t['errorfile'] = '';
$task = $app->input->get( 'task', '', 'string' );
if($task == 'upload') {
$post['title'] = $app->input->get( 'phocadownloaduploadtitle', '', 'string' );
$post['description'] = $app->input->get( 'phocadownloaduploaddescription', '', 'string' );
$post['catidfiles'] = $app->input->get( 'catidfiles', 0, 'int' );
$post['description'] = substr($post['description'], 0, (int)$this->t['maxuploadchar']);
$post['approved'] = 0;
$post['published'] = 1;
$post['owner_id'] = $user->id;
if ($this->t['enableuseruploadapprove'] == 0) {
$post['approved'] = 1;
}
$post['author'] = $app->input->get( 'phocadownloaduploadauthor', '', 'string' );
$post['email'] = $app->input->get( 'phocadownloaduploademail', '', 'string' );
$post['website'] = $app->input->get( 'phocadownloaduploadwebsite', '', 'string' );
$post['license'] = $app->input->get( 'phocadownloaduploadlicense', '', 'string' );
$post['version'] = $app->input->get( 'phocadownloaduploadversion', '', 'string' );
if ($post['title'] != '') {$formData->set('title', $post['title']);}
if ($post['description'] != '') {$formData->set('description', $post['description']);}
if ($post['author'] != '') {$formData->set('author', $post['author']);}
if ($post['email'] != '') {$formData->set('email', $post['email']);}
if ($post['website'] != '') {$formData->set('website', $post['website']);}
if ($post['license'] != '') {$formData->set('license', $post['license']);}
if ($post['version'] != '') {$formData->set('version', $post['version']);}
//catid
$returnForm = 0;
if ($post['catidfiles'] < 1) {
$this->t['errorcatid'] = Text::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY');
$returnForm = 1;
}
jimport('joomla.mail.helper');
if ($post['email'] != '' && !MailHelper::isEmailAddress($post['email']) ) {
$this->t['erroremail'] = Text::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_EMAIL_ADDRESS');
$returnForm = 1;
}
if ($post['website'] != '' && !PhocaDownloadUtils::isURLAddress($post['website']) ) {
$this->t['errorwebsite'] = Text::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_WEBSITE');
$returnForm = 1;
}
// Upload
$errUploadMsg = '';
$redirectUrl = '';
$fileArray = Factory::getApplication()->input->files->get( 'Filedata', null, 'raw');
if(empty($fileArray)) {
$this->t['errorfile'] = Text::_('COM_PHOCADOWNLOAD_PLEASE_ADD_FILE_OR_IF_ADDED_CHECK_IF_IT_HAS_RIGHT_FORMAT_AND_SIZE');
$returnForm = 1;
} else if (isset($fileArray[0]) && $fileArray[0] == ''){
$this->t['errorfile'] = Text::_('COM_PHOCADOWNLOAD_PLEASE_ADD_FILE_OR_IF_ADDED_CHECK_IF_IT_HAS_RIGHT_FORMAT_AND_SIZE');
$returnForm = 1;
$fileArray['name'] = '';
} else if (isset($fileArray['name']) && $fileArray['name'] == '') {
$this->t['errorfile'] = Text::_('COM_PHOCADOWNLOAD_PLEASE_ADD_FILE_OR_IF_ADDED_CHECK_IF_IT_HAS_RIGHT_FORMAT_AND_SIZE');
$returnForm = 1;
}
if ($post['title'] == '') {
$post['title'] = PhocaDownloadFile::removeExtension($fileArray['name']);
}
$post['alias'] = PhocaDownloadUtils::getAliasName($post['title']);
if ($returnForm == 0) {
$errorUploadMsg = '';
if($model->singleFileUpload($errorUploadMsg, $fileArray, $post)) {
if ($this->t['send_mail_upload'] > 0) {
PhocaDownloadMail::sendMail((int)$this->t['send_mail_upload'], $post['title'], 2);
}
$Itemid = $app->input->get( 'Itemid', 0, 'int');
$limitStart = $app->input->get( 'limitstart', 0, 'int');
if ($limitStart > 0) {
$limitStartUrl = '&limitstart='.$limitStart;
} else {
$limitStartUrl = '';
}
$link = 'index.php?option=com_phocadownload&view=user&Itemid='. $Itemid . $limitStartUrl;
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOADED"), 'success');
$app->redirect(Route::_($link, false));
exit;
} else {
$this->t['errorfile'] = Text::_('COM_PHOCADOWNLOAD_ERROR_FILE_UPLOADED');
if ($errorUploadMsg != '') {
$this->t['errorfile'] .= '<br />' . $errorUploadMsg;
}
}
}
}
// - - - - - - - - - - -
// FILES
// - - - - - - - - - - -
$this->t['filesitems'] = $model->getDataFiles($user->id);
$this->t['filestotal'] = $model->getTotalFiles($user->id);
$this->t['filespagination'] = $model->getPaginationFiles($user->id);
$filter_published_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_published','filter_published', '','word');
$filter_catid_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_catid','filter_catid',0, 'int' );
$catid_files = $app->getUserStateFromRequest( $this->_context_files. '.catid', 'catid', 0, 'int');
//$filter_sectionid_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_sectionid', 'filter_sectionid', 0, 'int' );
$filter_order_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_order','filter_order','a.ordering', 'cmd' );
$filter_order_Dir_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_order_Dir','filter_order_Dir', '', 'word' );
$search_files = $app->getUserStateFromRequest( $this->_context_files.'.search', 'search', '', 'string' );
$search_files = StringHelper::strtolower( $search_files );
// build list of categories
$javascript = 'class="form-control" size="1" onchange="document.phocadownloadfilesform.submit();"';
// get list of categories for dropdown filter
$whereC = array();
//if ($filter_sectionid_files > 0) {
// $whereC[] = ' cc.section = '.$db->Quote($filter_sectionid_files);
//}
//$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')";
//$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."}' OR cc.uploaduserid LIKE '{".(int)$user->id."},%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."},%' OR cc.uploaduserid ={".(int)$user->id."} )";
$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )";
$whereC = ( count( $whereC ) ? ' WHERE '. implode( ' AND ', $whereC ) : '' );
// get list of categories for dropdown filter
$query = 'SELECT cc.id AS value, cc.title AS text, cc.parent_id as parent_id' .
' FROM #__phocadownload_categories AS cc' .
$whereC.
' ORDER BY cc.ordering';
$lists_files['catid'] = PhocaDownloadCategory::filterCategory($query, $catid_files, TRUE, TRUE, TRUE);
/*$whereS = array();
//$whereS[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')";
$whereS[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )";
$whereS[] = 's.published = 1';
$whereS = ( count( $whereS ) ? ' WHERE '. implode( ' AND ', $whereS ) : '' );
// sectionid
$query = 'SELECT s.title AS text, s.id AS value'
. ' FROM #__phocadownload_sections AS s'
. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.section = s.id'
. $whereS
. ' GROUP BY s.id'
. ' ORDER BY s.ordering';
// state filter
/* $state_files[] = JHtml::_('select.option', '', '- '. JText::_( 'Select State' ) .' -' );
$state_files[] = HTMLHelper::_('select.option', 'P', Text::_( 'Published' ) );
$state_files[] = HTMLHelper::_('select.option', 'U', Text::_( 'Unpublished') );
$lists_image['state'] = JHtml::_('select.genericlist', $state_files, 'filter_published', 'class="form-control" size="1" onchange="document.phocadownloadfilesform.submit();"', 'value', 'text', $filter_published );*/
//$lists_files['sectionid'] = PhocaDownloadCategory::filterSection($query, $filter_sectionid_files, TRUE);
// state filter
$lists_files['state'] = HTMLHelper::_('grid.state', $filter_published_files );
// table ordering
$lists_files['order_Dir'] = $filter_order_Dir_files;
$lists_files['order'] = $filter_order_files;
// search filter
$lists_files['search']= $search_files;
$this->t['catidfiles'] = $catid_files;
$this->t['filestab'] = 1;
// Tabs
$displayTabs = 0;
if ((int)$this->t['filestab'] == 0) {
$currentTab['files'] = -1;
} else {
$currentTab['files'] = $displayTabs;
$displayTabs++;
}
$this->t['displaytabs'] = $displayTabs;
$this->t['currenttab'] = $currentTab;
// ACTION
$this->t['action'] = $uri->toString();
// SEF problem
$isThereQM = false;
$isThereQM = preg_match("/\?/i", $this->t['action']);
if ($isThereQM) {
$amp = '&amp;';
} else {
$amp = '?';
}
$this->t['actionamp'] = htmlspecialchars($this->t['action']) . $amp;
$this->t['istheretab'] = false;
$this->t['istheretab'] = preg_match("/tab=/i", $this->t['action']);
$this->t['ps'] = '&tab='. $this->t['currenttab']['files']
. '&limitstart='.$this->t['filespagination']->limitstart;
// ASIGN
//$this->assignRef( 'listsfiles', $lists_files);
$this->t['listsfiles'] = $lists_files;
//$this->assignRef( 'formdata', $formData);
$this->t['formdata'] = $formData;
//$this->assignRef( 'tmpl', $this->t);
//$this->assignRef( 'params', $this->t['p']);
//$session = JFactory::getSession();
//$this->assignRef('session', $session);
// Bootstrap 3 Layout
/*$this->t['display_bootstrap3_layout'] = $this->t['p']->get( 'display_bootstrap3_layout', 0 );
if ($this->t['display_bootstrap3_layout'] > 0) {
HTMLHelper::_('jquery.framework', false);
if ((int)$this->t['display_bootstrap3_layout'] == 2) {
HTMLHelper::stylesheet('media/com_phocadownload/bootstrap/css/bootstrap.min.css' );
HTMLHelper::stylesheet('media/com_phocadownload/bootstrap/css/bootstrap.extended.css' );
}
// Loaded by jquery.framework;
//$document->addScript(JUri::root(true).'/media/com_phocadownload/bootstrap/js/bootstrap.min.js');
/* $document->addScript(Uri::root(true).'/media/com_phocadownload/js/jquery.equalheights.min.js');
$document->addScriptDeclaration(
'jQuery(window).load(function(){
jQuery(\'.ph-thumbnail\').equalHeights();
});');*//*
}
if ($this->t['display_bootstrap3_layout'] > 0) {
parent::display('bootstrap');
} else {
parent::display($tpl);
}*/
parent::display($tpl);
}
}
?>