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_CATEGORY_GROUP">
<message><![CDATA[_COM_PHOCADOWNLOAD_CATEGORY_GROUP_DESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,154 @@
<?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\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Component\ComponentHelper;
echo '<div id="phoca-dl-category-box" class="pd-category-view'.$this->t['p']->get( 'pageclass_sfx' ).'">';
//if ( $this->t['p']->get( 'show_page_heading' ) ) {
// echo '<h1>'. $this->escape($this->t['p']->get('page_heading')) . '</h1>';
//}
echo PhocaDownloadRenderFront::renderHeader(array());
// Search by tags - the category rights must be checked for every file
$this->checkRights = 1;
// -------------------------------------------------------------------
if ((int)$this->t['tagid'] > 0) {
echo $this->loadTemplate('files');
$this->checkRights = 1;
if (!empty($this->files)) {
echo $this->loadTemplate('pagination');
}
} else {
if (!empty($this->category[0])) {
echo '<div class="pd-category">';
if ($this->t['display_up_icon'] == 1) {
if (isset($this->category[0]->parent_id)) {
if ($this->category[0]->parent_id == 0) {
$linkUp = Route::_(PhocaDownloadRoute::getCategoriesRoute());
$linkUpText = Text::_('COM_PHOCADOWNLOAD_CATEGORIES');
} else if ($this->category[0]->parent_id > 0) {
$linkUp = Route::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parent_id, $this->category[0]->parentalias));
$linkUpText = $this->category[0]->parenttitle;
} else {
$linkUp = '#';
$linkUpText = '';
}
echo '<div class="ph-top">'
.'<a class="btn btn-primary" title="'.$linkUpText.'" href="'. $linkUp.'" ><span class="icon-fw icon-arrow-left"></span> '
. $linkUpText
.'</a></div>';
}
}
} else {
echo '<div class="pd-category"><div class="pdtop"></div>';
}
if (!empty($this->category[0])) {
// USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!empty($this->category[0])) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->category[0]->cataccessuserid, $this->category[0]->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
$this->checkRights = 0;
$l = new PhocaDownloadLayout();
//echo '<h3>'.$this->category[0]->title. '</h3>';
echo PhocaDownloadRenderFront::renderSubHeader(array($this->category[0]->title), '', 'pd-ctitle');
// Description
/*if ($l->isValueEditor($this->category[0]->description)) {
echo '<div class="pd-cdesc">'.$this->category[0]->description.'</div>';
}*/
// Description
if ($l->isValueEditor($this->category[0]->description)) {
echo '<div class="pd-cdesc">';
echo HTMLHelper::_('content.prepare', $this->category[0]->description);
echo '</div>';
}
if (!empty($this->subcategories)) {
foreach ($this->subcategories as $valueSubCat) {
$rightDisplaySub = 0;
if (!empty($valueSubCat)) {
$rightDisplaySub = PhocaDownloadAccess::getUserRight('accessuserid', $valueSubCat->cataccessuserid, $valueSubCat->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplaySub == 1) {
echo '<div class="pd-subcategory">';
echo '<a href="'. Route::_(PhocaDownloadRoute::getCategoryRoute($valueSubCat->id, $valueSubCat->alias))
.'">'. $valueSubCat->title.'</a>';
echo ' <small>('.$valueSubCat->numdoc.')</small></div>' . "\n";
$subcategory = 1;
}
}
echo '<div class="pd-hr-cb"></div>';
}
// =====================================================================================
// BEGIN LAYOUT AREA
// =====================================================================================
echo $this->loadTemplate('files');
// =====================================================================================
// END LAYOUT AREA
// =====================================================================================
if (!empty($this->category)) {
echo $this->loadTemplate('pagination');
}
/* if ($this->t['display_category_comments'] == 1) {
if (ComponentHelper::isEnabled('com_jcomments', true)) {
include_once(JPATH_BASE.'/components/com_jcomments/jcomments.php');
echo JComments::showComments($this->category[0]->id, 'com_phocadownload', Text::_('COM_PHOCADOWNLOAD_CATEGORY') .' '. $this->category[0]->title);
}
}
if ($this->t['display_category_comments'] == 2) {
echo '<div class="pd-fbcomments">'.$this->loadTemplate('comments-fb').'</div>';
}*/
} else {
echo '<h3>'.Text::_('COM_PHOCADOWNLOAD_CATEGORY'). '</h3>';
echo '<div class="alert alert-danger alert-danger">'.Text::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'</div>';
}
echo '</div>';
} else {
//echo '<h3>&nbsp;</h3>';
echo '</div>';
}
}
echo $this->t['bootstrapmodal'];
echo '</div><div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCADOWNLOAD_CATEGORY_LIST_LAYOUT">
<message>
<![CDATA[COM_PHOCADOWNLOAD_CATEGORY_LIST_LAYOUT_DESC]]>
</message>
</layout>
<name>COM_PHOCADOWNLOAD_CATEGORY_LIST_LAYOUT</name>
<description>COM_PHOCADOWNLOAD_CATEGORY_LIST_LAYOUT_DESC</description>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_phocadownload/models/fields">
<field name="id" type="phocadownloadcategory" section="com_phocadownload" default="" typemethod="menulink" label="COM_PHOCADOWNLOAD_FIELD_SELECT_CATEGORY_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SELECT_CATEGORY_DESC" required="true" />
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_phocadownload/models/fields" >
<field name="show_pagination" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_DESC">
<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
</field>
<field name="show_pagination_limit" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_DESC">
<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
</field>
<field name="show_ordering_files" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_ORDERING_CATEGORY_VIEW_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_ORDERING_CATEGORY_VIEW_DESC">
<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
</field>
<field name="file_ordering" type="list" useglobal="true" label="COM_PHOCADOWNLOAD_FIELD_FILE_ORDERING_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FILE_ORDERING_DESC">
<option value="1">COM_PHOCADOWNLOAD_ORDERING_ASC</option>
<option value="2">COM_PHOCADOWNLOAD_ORDERING_DESC</option>
<option value="3">COM_PHOCADOWNLOAD_TITLE_ASC</option>
<option value="4">COM_PHOCADOWNLOAD_TITLE_DESC</option>
<option value="5">COM_PHOCADOWNLOAD_DATE_ASC</option>
<option value="6">COM_PHOCADOWNLOAD_DATE_DESC</option>
<option value="7">COM_PHOCADOWNLOAD_ID_ASC</option>
<option value="8">COM_PHOCADOWNLOAD_ID_DESC</option>
<option value="11">COM_PHOCADOWNLOAD_FILENAME_ASC</option>
<option value="12">COM_PHOCADOWNLOAD_FILENAME_DESC</option>
<option value="15">COM_PHOCADOWNLOAD_RATING_COUNT_ASC</option>
<option value="16">COM_PHOCADOWNLOAD_RATING_COUNT_DESC</option>
<option value="13">COM_PHOCADOWNLOAD_AVERAGE_ASC</option>
<option value="14">COM_PHOCADOWNLOAD_AVERAGE_DESC</option>
<option value="9">COM_PHOCADOWNLOAD_DOWNLOADS_ASC</option>
<option value="10">COM_PHOCADOWNLOAD_DOWNLOADS_DESC</option>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,150 @@
<?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');
echo '<div id="phoca-dl-category-box" class="pd-category-view'.$this->t['p']->get( 'pageclass_sfx' ).'">';
//if ( $this->t['p']->get( 'show_page_heading' ) ) {
// echo '<h1>'. $this->escape($this->t['p']->get('page_heading')) . '</h1>';
//}
echo PhocaDownloadRenderFront::renderHeader(array());
// Search by tags - the category rights must be checked for every file
$this->checkRights = 1;
// -------------------------------------------------------------------
if ((int)$this->t['tagid'] > 0) {
echo $this->loadTemplate('files');
$this->checkRights = 1;
if (!empty($this->files)) {
echo $this->loadTemplate('pagination');
}
} else {
if (!empty($this->category[0])) {
echo '<div class="pd-category">';
if ($this->t['display_up_icon'] == 1) {
if (isset($this->category[0]->parentid)) {
if ($this->category[0]->parentid == 0) {
$linkUp = JRoute::_(PhocaDownloadRoute::getCategoriesRoute());
$linkUpText = JText::_('COM_PHOCADOWNLOAD_CATEGORIES');
} else if ($this->category[0]->parentid > 0) {
$linkUp = JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias));
$linkUpText = $this->category[0]->parenttitle;
} else {
$linkUp = '#';
$linkUpText = '';
}
echo '<div class="ph-top">'
.'<a class="btn btn-default" title="'.$linkUpText.'" href="'. $linkUp.'" ><span class="glyphicon glyphicon-arrow-left"></span> '
. $linkUpText
.'</a></div>';
}
}
} else {
echo '<div class="pd-category"><div class="pdtop"></div>';
}
if (!empty($this->category[0])) {
// USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!empty($this->category[0])) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->category[0]->cataccessuserid, $this->category[0]->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
$this->checkRights = 0;
$l = new PhocaDownloadLayout();
//echo '<h3>'.$this->category[0]->title. '</h3>';
echo PhocaDownloadRenderFront::renderSubHeader(array($this->category[0]->title), '', 'pd-ctitle');
// Description
/*if ($l->isValueEditor($this->category[0]->description)) {
echo '<div class="pd-cdesc">'.$this->category[0]->description.'</div>';
}*/
// Description
if ($l->isValueEditor($this->category[0]->description)) {
echo '<div class="pd-cdesc">';
echo Joomla\CMS\HTML\HTMLHelper::_('content.prepare', $this->category[0]->description);
echo '</div>';
}
if (!empty($this->subcategories)) {
foreach ($this->subcategories as $valueSubCat) {
$rightDisplaySub = 0;
if (!empty($valueSubCat)) {
$rightDisplaySub = PhocaDownloadAccess::getUserRight('accessuserid', $valueSubCat->cataccessuserid, $valueSubCat->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplaySub == 1) {
echo '<div class="pd-subcategory">';
echo '<a href="'. JRoute::_(PhocaDownloadRoute::getCategoryRoute($valueSubCat->id, $valueSubCat->alias))
.'">'. $valueSubCat->title.'</a>';
echo ' <small>('.$valueSubCat->numdoc.')</small></div>' . "\n";
$subcategory = 1;
}
}
echo '<div class="pd-hr-cb"></div>';
}
// =====================================================================================
// BEGIN LAYOUT AREA
// =====================================================================================
echo $this->loadTemplate('files_bootstrap');
// =====================================================================================
// END LAYOUT AREA
// =====================================================================================
if (!empty($this->category)) {
echo $this->loadTemplate('pagination');
}
if ($this->t['display_category_comments'] == 1) {
if (JComponentHelper::isEnabled('com_jcomments', true)) {
include_once(JPATH_BASE.'/components/com_jcomments/jcomments.php');
echo JComments::showComments($this->category[0]->id, 'com_phocadownload', JText::_('COM_PHOCADOWNLOAD_CATEGORY') .' '. $this->category[0]->title);
}
}
if ($this->t['display_category_comments'] == 2) {
echo '<div class="pd-fbcomments">'.$this->loadTemplate('comments-fb').'</div>';
}
} else {
echo '<h3>'.JText::_('COM_PHOCADOWNLOAD_CATEGORY'). '</h3>';
echo '<div class="alert alert-error alert-danger">'.JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'</div>';
}
echo '</div>';
} else {
//echo '<h3>&nbsp;</h3>';
echo '</div>';
}
}
echo $this->t['bootstrapmodal'];
echo '</div><div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

@ -0,0 +1,50 @@
<?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');
?><div id="phocadownload-comments"><?php
$uri = \Joomla\CMS\Uri\Uri::getInstance();
$getParamsArray = explode(',', 'start,limitstart,template,fb_comment_id');
if (!empty($getParamsArray) ) {
foreach($getParamsArray as $key => $value) {
$uri->delVar($value);
}
}
if ($this->t['fb_comment_app_id'] == '') {
echo JText::_('COM_PHOCADOWNLOAD_ERROR_FB_APP_ID_EMPTY');
} else {
$cCount = '';
if ((int)$this->t['fb_comment_count'] > 0) {
$cCount = 'numposts="'.$this->t['fb_comment_count'].'"';
}
?><fb:comments href="<?php echo $uri->toString(); ?>" simple="1" <?php echo $cCount;?> width="<?php echo (int)$this->t['fb_comment_width'] ?>"></fb:comments>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo $this->t['fb_comment_app_id'] ?>',
status: true,
cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/<?php echo $this->t['fb_comment_lang']; ?>/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php } ?>
</div>

View File

@ -0,0 +1,630 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
$l = new PhocaDownloadLayout();
$layoutCM = new FileLayout('category_modal', null, array('component' => 'com_phocadownload'));
if (!empty($this->files)) {
foreach ($this->files as $v) {
if ($this->checkRights == 1) {
// USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!isset($v->cataccessuserid)) {
$v->cataccessuserid = 0;
}
if (isset($v->catid) && isset($v->cataccessuserid) && isset($v->cataccess)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
} else {
$rightDisplay = 1;
}
if ($rightDisplay == 1) {
// Test if we have information about category - if we are displaying items by e.g. search outcomes - tags
// we don't have any ID of category so we need to load it for each file.
$this->catitem[$v->id] = new StdClass();
$this->catitem[$v->id]->id = 0;
$this->catitem[$v->id]->alias = '';
if (isset($this->category[0]->id) && isset($this->category[0]->alias)) {
$this->catitem[$v->id]->id = (int)$this->category[0]->id;
$this->catitem[$v->id]->alias = $this->category[0]->alias;
} else {
$catDb = PhocaDownloadCategory::getCategoryByFile($v->id);
if (isset($catDb->id) && isset($catDb->alias)) {
$this->catitem[$v->id]->id = (int)$catDb->id;
$this->catitem[$v->id]->alias = $catDb->alias;
}
$categorySetTemp = 1;
}
// General
$linkDownloadB = '';
$linkDownloadE = '';
if ((int)$v->confirm_license > 0 || $this->t['display_file_view'] == 1) {
$linkDownloadB = '<a class="" href="'. Route::_(PhocaDownloadRoute::getFileRoute($v->id, $v->catid,$v->alias, $v->categoryalias, $v->sectionid). $this->t['limitstarturl']).'" >'; // we need pagination to go back
$linkDownloadE ='</a>';
} else {
if ($v->link_external != '' && $v->directlink == 1) {
$linkDownloadB = '<a class="" href="'.$v->link_external.'" target="'.$this->t['download_external_link'].'" >';
$linkDownloadE ='</a>';
} else {
$linkDownloadB = '<a class="" href="'. Route::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, $v->sectionid, 'download').$this->t['limitstarturl']).'" >';
$linkDownloadE ='</a>';
}
}
// pdfile
if ($v->filename != '') {
$imageFileName = $l->getImageFileName($v->image_filename, $v->filename);
$pdFile = '<div class="pd-filenamebox-bt">';
if ($this->t['filename_or_name'] == 'filenametitle') {
$pdFile .= '<div class="pd-title">'. $v->title . '</div>';
}
$pdFile .= '<div class="pd-filename">'. $imageFileName['filenamethumb']
. '<div class="pd-document'.$this->t['file_icon_size'].'" '
. $imageFileName['filenamestyle'].'>';
$pdFile .= '<div class="pd-float">';
$pdFile .= $linkDownloadB .$l->getName($v->title, $v->filename) .$linkDownloadE;
$pdFile .= '</div>';
$pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']);
$pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']);
// String Tags - title suffix
$tagsS = $l->displayTagsString($v->tags_string);
if ($tagsS != '') {
$pdFile .= '<div class="pd-float">'.$tagsS.'</div>';
}
// Tags - title suffix
if ($this->t['display_tags_links'] == 4 || $this->t['display_tags_links'] == 6) {
$tags = $l->displayTags($v->id, 1);
if ($tags != '') {
$pdFile .= '<div class="pd-float">'.$tags.'</div>';
}
}
// Specific icons
if (isset($v->image_filename_spec1) && $v->image_filename_spec1 != '') {
$pdFile .= '<div class="pd-float">'.$l->getImageDownload($v->image_filename_spec1).'</div>';
}
if (isset($v->image_filename_spec2) && $v->image_filename_spec2 != '') {
$pdFile .= '<div class="pd-float">'.$l->getImageDownload($v->image_filename_spec2).'</div>';
}
$pdFile .= '</div></div></div>' . "\n";
}
// pdbuttonplay
$pdButtonPlay = '';
if ($this->t['display_play'] == 1 && isset($v->filename_play) && $v->filename_play != '') {
$fileExt = PhocaDownloadFile::getExtension($v->filename_play);
$canPlay = PhocaDownloadFile::canPlay($v->filename_play);
if ($canPlay) {
$playLink = Route::_(PhocaDownloadRoute::getFileRoute($v->id,$v->catid,$v->alias, $v->categoryalias,0, 'play').$this->t['limitstarturl']);
//$pdButtonPlay .= '<div class="pd-button-play">';
if ($this->t['play_popup_window'] == 1) {
// Special height for music only
$buttonPlOptions = $this->t['buttonpl']->options;
$dataType = 'play';
if ($fileExt == 'mp3' || $fileExt == 'ogg') {
$buttonPlOptions = $this->t['buttonpl']->optionsmp3;
$dataType="play-thin";
}
$pdButtonPlay = '<a class="btn btn-danger" href="'.$playLink.'" onclick="'. $buttonPlOptions.'" >'. Text::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
} else {
// Special height for music only
$buttonPlOptions = $this->t['buttonpl']->optionsB;
$dataType = 'play';
if ($fileExt == 'mp3' || $fileExt == 'ogg') {
$buttonPlOptions = $this->t['buttonpl']->optionsmp3B;
$dataType="play-thin";
}
//$pdButtonPlay .= '<a class="btn btn-danger pd-bs-modal-button" href="'.$playLink.'" rel="'. $buttonPlOptions.'" >'. JText::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
//$pdButtonPlay = '<a class="btn btn-danger pd-bs-modal-button" data-toggle="modal" data-target="#phModalPlay" data-href="'.$playLink.'" '.$buttonPlOptions.' >'. Text::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
$pdButtonPlay = '<a class="btn btn-danger pd-bs-modal-button" data-type="'.$dataType.'" data-title="'. Text::_('COM_PHOCADOWNLOAD_PLAY').'" href="'.$playLink.'">'. Text::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
}
//$pdButtonPlay .= '</div>';
}
}
// pdbuttonpreview
$pdButtonPreview = '';
if ($this->t['display_preview'] == 1 && isset($v->filename_preview) && $v->filename_preview != '') {
$fileExt = PhocaDownloadFile::getExtension($v->filename_preview);
if ($fileExt == 'pdf' || $fileExt == 'jpeg' || $fileExt == 'jpg' || $fileExt == 'png' || $fileExt == 'gif') {
$dataType = 'image';
if ($fileExt == 'pdf') {
$dataType = 'document';
}
$filePath = PhocaDownloadPath::getPathSet('filepreview');
$filePath = str_replace ( '../', Uri::base(true).'/', $filePath['orig_rel_ds']);
$previewLink = $filePath . $v->filename_preview;
//$pdButtonPreview .= '<div class="pd-button-preview">';
if ($this->t['preview_popup_window'] == 1) {
$pdButtonPreview .= '<a class="btn btn-warning" href="'.$previewLink.'" onclick="'. $this->t['buttonpr']->options.'" >'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
} else {
if ($fileExt == 'pdf') {
// Iframe - modal
//$pdButtonPreview .= '<a class="btn btn-warning pd-bs-modal-button" href="'.$previewLink.'" rel="'. $this->t['buttonpr']->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
//$pdButtonPreview = '<a class="btn btn-warning pd-bs-modal-button" data-toggle="modal" data-target="#phModalPreview" data-href="'.$previewLink.'" '. $this->t['buttonpr']->optionsB.' >'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
$pdButtonPreview = '<a class="btn btn-warning pd-bs-modal-button" data-type="'.$dataType.'" data-title="'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'" href="'.$previewLink.'">'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
} else {
// Image - modal
//$pdButtonPreview .= '<a class="btn btn-warning pd-bs-modal-button" href="'.$previewLink.'" rel="'. $this->t['buttonpr']->optionsimg.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
//$pdButtonPreview = '<a class="btn btn-warning pd-bs-modal-button" data-toggle="modal" data-target="#phModalPreview" data-href="'.$previewLink.'" '. $this->t['buttonpr']->optionsimgB.' >'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
$pdButtonPreview = '<a class="btn btn-warning pd-bs-modal-button" data-type="'.$dataType.'" data-title="'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'" href="'.$previewLink.'">'. Text::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
}
}
//$pdButtonPreview .= '</div>';
}
}
// pdbuttondownload
//$pdButtonDownload = '<div class="pd-button-download">';
$pdButtonDownload = str_replace('class=""', 'class="btn btn-success"', $linkDownloadB) . Text::_('COM_PHOCADOWNLOAD_DOWNLOAD') .$linkDownloadE;
//$pdButtonDownload .= '</div>';
// pdbuttondetails
$d = '';
$pdTitle = '';
if ($v->title != '') {
$pdTitle .= '<div class="pd-title pd-colfull">'.$v->title.'</div>';
$d .= $pdTitle;
}
$pdImage = '';
if ($v->image_download != '') {
$pdImage .= '<div class="pd-image pd-colfull">'.$l->getImageDownload($v->image_download).'</div>';
$d .= $pdImage;
}
$pdDescription = '';
if ($l->isValueEditor($v->description) && $this->t['display_description'] != 1 & $this->t['display_description'] != 2 & $this->t['display_description'] != 3) {
$pdDescription .= '<div class="pd-fdesc pd-colfull">'.$v->description.'</div>';
$d .= $pdDescription;
}
$pdFileSize = '';
$fileSize = $l->getFilesize($v->filename);
if ($fileSize != '') {
$pdFileSize .= '<div class="pd-filesize-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_FILESIZE').':</div>';
$pdFileSize .= '<div class="pd-fl-m pd-col2">'.$fileSize.'</div>';
$d .= $pdFileSize;
}
$pdVersion = '';
if ($v->version != '') {
$pdVersion .= '<div class="pd-version-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_VERSION').':</div>';
$pdVersion .= '<div class="pd-fl-m pd-col2">'.$v->version.'</div>';
$d .= $pdVersion;
}
$pdLicense = '';
if ($v->license != '') {
if ($v->license_url != '') {
$pdLicense .= '<div class="pd-license-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_LICENSE').':</div>';
$pdLicense .= '<div class="pd-fl-m pd-col2"><a href="'.$v->license_url.'" target="_blank">'.$v->license.'</a></div>';
} else {
$pdLicense .= '<div class="pd-license-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_LICENSE').':</div>';
$pdLicense .= '<div class="pd-fl-m pd-col2">'.$v->license.'</div>';
}
$d .= $pdLicense;
}
$pdAuthor = '';
if ($v->author != '') {
if ($v->author_url != '') {
$pdAuthor .= '<div class="pd-author-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_AUTHOR').':</div>';
$pdAuthor .= '<div class="pd-fl-m pd-col2"><a href="'.$v->author_url.'" target="_blank">'.$v->author.'</a></div>';
} else {
$pdAuthor .= '<div class="pd-author-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_AUTHOR').':</div>';
$pdAuthor .= '<div class="pd-fl-m pd-col2">'.$v->author.'</div>';
}
$d .= $pdAuthor;
}
$pdAuthorEmail = '';
if ($v->author_email != '') {
$pdAuthorEmail .= '<div class="pd-email-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_EMAIL').':</div>';
$pdAuthorEmail .= '<div class="pd-fl-m pd-col2">'. $l->getProtectEmail($v->author_email).'</div>';
$d .= $pdAuthorEmail;
}
$pdFileDate = '';
$fileDate = $l->getFileDate($v->filename, $v->date);
if ($fileDate != '') {
$pdFileDate .= '<div class="pd-date-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_DATE').':</div>';
$pdFileDate .= '<div class="pd-fl-m pd-col2">'.$fileDate.'</div>';
$d .= $pdFileDate;
}
$pdDownloads = '';
if ($this->t['display_downloads'] == 1) {
$pdDownloads .= '<div class="pd-downloads-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_DOWNLOADS').':</div>';
$pdDownloads .= '<div class="pd-fl-m pd-col2">'.$v->hits.' x</div>';
$d .= $pdDownloads;
}
$pdFeatures = '';
if ($l->isValueEditor($v->features)) {
$pdFeatures .= '<div class="pd-features-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_FEATURES').'</div>';
$pdFeatures .= '<div class="pd-features pd-col2">'.$v->features.'</div>';
}
$pdChangelog = '';
if ($l->isValueEditor($v->changelog)) {
$pdChangelog .= '<div class="pd-changelog-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_CHANGELOG').'</div>';
$pdChangelog .= '<div class="pd-changelog pd-col2">'.$v->changelog.'</div>';
}
$pdNotes = '';
if ($l->isValueEditor($v->notes)) {
$pdNotes .= '<div class="pd-notes-txt pd-col1">'.Text::_('COM_PHOCADOWNLOAD_NOTES').'</div>';
$pdNotes .= '<div class="pd-notes pd-col2">'.$v->notes.'</div>';
}
// pdfiledesc
$description = $l->isValueEditor($v->description);
$pdFileDescTop = '';
$pdFileDescBottom = '';
$oFileDesc = '';
if ($description) {
switch ($this->t['display_description']) {
case 1:
$pdFileDescTop = '<div class="pd-fdesc">' . $v->description . '</div>';
break;
case 2:
$pdFileDescBottom = '<div class="pd-fdesc">' . $v->description . '</div>';
break;
case 3:
$oFileDesc = '<div class="pd-fdesc">' . $v->description . '</div>';
break;
case 4:
$pdFileDescTop = '<div class="pd-fdesc">' . $v->description . '</div>';
$oFileDesc = '<div class="pd-fdesc">' . PhocaDownloadUtils::strTrimAll($d) . '</div>';
break;
case 5:
$pdFileDescBottom = '<div class="pd-fdesc">' . $v->description . '</div>';
$oFileDesc = '<div class="pd-fdesc">' . PhocaDownloadUtils::strTrimAll($d) . '</div>';
break;
case 6:
$pdFileDescTop = '<div class="pd-fdesc">' . $d . '</div>';
$oFileDesc = '<div class="pd-fdesc">' . PhocaDownloadUtils::strTrimAll($d) . '</div>';
break;
case 7:
$pdFileDescBottom = '<div class="pd-fdesc">' . $d . '</div>';
$oFileDesc = '<div class="pd-fdesc">' . PhocaDownloadUtils::strTrimAll($d) . '</div>';
break;
case 8:
$oFileDesc = '<div class="pd-fdesc">' . PhocaDownloadUtils::strTrimAll($d) . '</div>';
break;
default:
break;
}
}
// Detail Button
if ($this->t['display_detail'] == 1) {
if ($oFileDesc != '') {
$tooltipcontent = $oFileDesc;
} else {
$tooltipcontent = $d;
}
$tooltipcontent = str_replace('"', '\'', $tooltipcontent);
//$sA = array(utf8_encode(chr(11)), utf8_encode(chr(160)));
$eA = array("\t", "\n", "\r", "\0");
//$tooltipcontent = str_replace($sA, ' ', $tooltipcontent);
$tooltipcontent = str_replace($eA, '', $tooltipcontent);
//$textO = htmlspecialchars(addslashes('<div style=\'text-align:left;padding:5px\'>'.$tooltipcontent.'</div>'));
//$overlib = "\n\n" ."onmouseover=\"return overlib('".$textO."', CAPTION, '".Text::_('COM_PHOCADOWNLOAD_DETAILS')."', BELOW, RIGHT, CSSCLASS, TEXTFONTCLASS, 'fontPhocaPDClass', FGCLASS, 'fgPhocaPDClass', BGCLASS, 'bgPhocaPDClass', CAPTIONFONTCLASS,'capfontPhocaPDClass', CLOSEFONTCLASS, 'capfontclosePhocaPDClass', STICKY, MOUSEOFF, CLOSETEXT, '".Text::_('COM_PHOCADOWNLOAD_CLOSE')."');\"";
//$overlib .= " onmouseout=\"return nd();\"" . "\n";
//$pdButtonDetails = '<div class="pd-button-details">';
//$pdButtonDetails = '<a class="btn btn-info" '.$overlib.' href="javascript:void(0)">'. Text::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
/*$pdButtonDetails .= '<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-html="true" title="<div class=\'te-st\'><em>Tooltip</em> <u>with</u> <b>HTML</b></div><div><em>Tooltip</em> <u>with</u> <b>HTML</b></div><div><em>Tooltip</em> <u>with</u> <b>HTML</b></div>">
Tooltip with HTML
</button>';*/
$tooltipcontent = '<div class=\'pd-tooltip-box\'>' . $tooltipcontent . '</div>';
$pdButtonDetails = '<a class="btn btn-info" title="'.$tooltipcontent.'" data-bs-toggle="tooltip" data-bs-html="true">'. Text::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails = '</div>';
} else if ($this->t['display_detail'] == 2) {
// Bootstrap
$buttonDOptions = $this->t['buttond']->options;
$detailLink = Route::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, 0, 'detail').$this->t['limitstarturl']);
//$pdButtonDetails = '<div class="pd-button-details">';
$pdButtonDetails = '<a class="btn btn-info pd-bs-modal-button" data-type="detail" data-title="'. Text::_('COM_PHOCADOWNLOAD_DETAILS').'" href="'.$detailLink.'">'. Text::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails .= '</div>';
//$pdButtonDetails = '<div class="pd-button-details">';
//$pdButtonDetails = '<a class="btn btn-info pd-bs-modal-button" href="'.$detailLink.'" onclick="'. $buttonDOptions.'">'. Text::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails .= '</div>';
} else if ($this->t['display_detail'] == 3) {
$detailLink = Route::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, 0, 'detail').$this->t['limitstarturl']);
//$pdButtonDetails = '<div class="pd-button-details">';
$buttonDOptions = $this->t['buttond']->options;
$pdButtonDetails = '<a class="btn btn-info" href="'.$detailLink.'" onclick="'. $buttonDOptions.'">'. Text::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails .= '</div>';
} else {
$pdButtonDetails = '';
}
/// pdmirrorlink1
$pdMirrorLink1 = '';
$mirrorOutput1 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror1link, $v->mirror1title, $v->mirror1target);
if ($mirrorOutput1 != '') {
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
$classMirror = '';//'pd-button-mirror1';
$mirrorOutput1 = str_replace('class=""', 'class="btn btn-primary "', $mirrorOutput1);
} else {
$classMirror = 'pd-mirror-bp';
}
$pdMirrorLink1 = '<div class="'.$classMirror.'">'.$mirrorOutput1.'</div>';
}
/// pdmirrorlink2
$pdMirrorLink2 = '';
$mirrorOutput2 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror2link, $v->mirror2title, $v->mirror2target);
if ($mirrorOutput2 != '') {
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
$classMirror = '';//'pd-button-mirror2';
$mirrorOutput2 = str_replace('class=""', 'class="btn btn-primary "', $mirrorOutput2);
} else {
$classMirror = 'pd-mirror-bp';
}
$pdMirrorLink2 = '<div class="'.$classMirror.'">'.$mirrorOutput2.'</div>';
}
/// pdreportlink
$pdReportLink = PhocaDownloadRenderFront::displayReportLink(1, $v->title);
/// pdrating
$pdRating = PhocaDownloadRate::renderRateFile($v->id, $this->t['display_rating_file']);
/// pdtags
$pdTags = '';
if ($this->t['display_tags_links'] == 1 || $this->t['display_tags_links'] == 3) {
$tags2 = $l->displayTags($v->id);
if ($tags2 != '') {
$pdTags .= '<div class="pd-float">'.$tags2.'</div>';
}
}
/// pdvideo
$pdVideo = $l->displayVideo($v->video_filename, 0);
// ---------------------------------------------------
// Output
// ---------------------------------------------------
if ($v->textonly == 1) {
echo '<div class="row pd-row2-bp">';
echo '<div class="col-sm-12 col-md-12">';
echo $v->description;
echo '</div>';
echo '</div>';// end row
} else {
// ======= ROW 1 LEFT
echo '<div class="row ">';
if ($pdFileDescTop != '') {
echo '<div class="col-sm-12 col-md-12">';
echo $pdFileDescTop;
echo '</div>';
}
echo '<div class="col-sm-'.$this->t['bt_cat_col_left'].' col-md-'.$this->t['bt_cat_col_left'].'">';
echo $pdFile;
echo '</div>';
// ======= ROW 1 RIGHT
echo '<div class="col-sm-'.$this->t['bt_cat_col_right'].' col-md-'.$this->t['bt_cat_col_right'].'">';
echo '<div class="pd-button-box-bt">'.$pdButtonDownload . '</div>';
echo '<div class="pd-button-box-bt">'.$pdButtonDetails . '</div>';
echo '<div class="pd-button-box-bt">'.$pdButtonPreview . '</div>';
echo '<div class="pd-button-box-bt">'.$pdButtonPlay . '</div>';
echo '</div>';
echo '</div>';// end row
// ======== ROW 2 LEFT
echo '<div class="row pd-row2-bp">';
echo '<div class="col-sm-6 col-md-6">';
if ($pdVideo != '') {
echo '<div class="pd-video">'.$pdVideo.'</div>';
}
echo '<div class="pd-rating">'.$pdRating.'</div>';
echo '</div>';
// ======== ROW 2 RIGHT
echo '<div class="col-sm-6 col-md-6">';
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
if ($pdMirrorLink2 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink2.'</div>';
}
if ($pdMirrorLink1 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink1.'</div>';
}
} else if ($this->t['display_mirror_links'] == 1 || $this->t['display_mirror_links'] == 3) {
echo '<div class="pd-mirrors">'.$pdMirrorLink2.$pdMirrorLink1.'</div>';
}
if ($pdTags != '') {
echo '<div class="pd-tags-bp">'.$pdTags.'</div>';
}
if ($pdReportLink != '') {
echo '<div class="pd-report-bp">'.$pdReportLink.'</div>';
}
echo '</div>';
if ($pdFileDescBottom != '') {
echo '<div class="col-sm-12 col-md-12">';
echo $pdFileDescBottom;
echo '</div>';
}
echo '</div>';// end row
/*echo '<div class="pd-filebox">';
echo $pdFileDescTop;
echo $pdFile;
echo '<div class="pd-buttons">'.$pdButtonDownload.'</div>';
/*
if ($this->t['display_detail'] == 1 || $this->t['display_detail'] == 2) {
echo '<div class="pd-buttons">'.$pdButtonDetails.'</div>';
}
if ($this->t['display_preview'] == 1 && $pdButtonPreview != '') {
echo '<div class="pd-buttons">'.$pdButtonPreview.'</div>';
}
if ($this->t['display_play'] == 1 && $pdButtonPlay != '') {
echo '<div class="pd-buttons">'.$pdButtonPlay.'</div>';
}
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
if ($pdMirrorLink2 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink2.'</div>';
}
if ($pdMirrorLink1 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink1.'</div>';
}
} else if ($this->t['display_mirror_links'] == 1 || $this->t['display_mirror_links'] == 3) {
echo '<div class="pd-mirrors">'.$pdMirrorLink2.$pdMirrorLink1.'</div>';
}
if ($pdVideo != '') {
echo '<div class="pd-video">'.$pdVideo.'</div>';
}
if ($pdReportLink != '') {
echo '<div class="pd-report">'.$pdReportLink.'</div>';
}
if ($pdRating != '') {
echo '<div class="pd-rating">'.$pdRating.'</div>';
}
if ($pdTags != '') {
echo '<div class="pd-tags">'.$pdTags.'</div>';
}
echo $pdFileDescBottom;
echo '<div class="pd-cb"></div>';
echo '</div>';*/
// ---------------------------------------------------
}
}
}
$d = array();
$d['t'] = $this->t;
echo $layoutCM->render($d);
}
?>

View File

@ -0,0 +1,566 @@
<?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');
$l = new PhocaDownloadLayout();
if (!empty($this->files)) {
foreach ($this->files as $v) {
if ($this->checkRights == 1) {
// USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!isset($v->cataccessuserid)) {
$v->cataccessuserid = 0;
}
if (isset($v->catid) && isset($v->cataccessuserid) && isset($v->cataccess)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
} else {
$rightDisplay = 1;
}
if ($rightDisplay == 1) {
// Test if we have information about category - if we are displaying items by e.g. search outcomes - tags
// we don't have any ID of category so we need to load it for each file.
$this->catitem[$v->id] = new StdClass();
$this->catitem[$v->id]->id = 0;
$this->catitem[$v->id]->alias = '';
if (isset($this->category[0]->id) && isset($this->category[0]->alias)) {
$this->catitem[$v->id]->id = (int)$this->category[0]->id;
$this->catitem[$v->id]->alias = $this->category[0]->alias;
} else {
$catDb = PhocaDownloadCategory::getCategoryByFile($v->id);
if (isset($catDb->id) && isset($catDb->alias)) {
$this->catitem[$v->id]->id = (int)$catDb->id;
$this->catitem[$v->id]->alias = $catDb->alias;
}
$categorySetTemp = 1;
}
// General
$linkDownloadB = '';
$linkDownloadE = '';
if ((int)$v->confirm_license > 0 || $this->t['display_file_view'] == 1) {
$linkDownloadB = '<a class="" href="'. JRoute::_(PhocaDownloadRoute::getFileRoute($v->id, $v->catid,$v->alias, $v->categoryalias, $v->sectionid). $this->t['limitstarturl']).'" >'; // we need pagination to go back
$linkDownloadE ='</a>';
} else {
if ($v->link_external != '' && $v->directlink == 1) {
$linkDownloadB = '<a class="" href="'.$v->link_external.'" target="'.$this->t['download_external_link'].'" >';
$linkDownloadE ='</a>';
} else {
$linkDownloadB = '<a class="" href="'. JRoute::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, $v->sectionid, 'download').$this->t['limitstarturl']).'" >';
$linkDownloadE ='</a>';
}
}
// pdfile
if ($v->filename != '') {
$imageFileName = $l->getImageFileName($v->image_filename, $v->filename);
$pdFile = '<div class="pd-filenamebox-bt">';
if ($this->t['filename_or_name'] == 'filenametitle') {
$pdFile .= '<div class="pd-title">'. $v->title . '</div>';
}
$pdFile .= '<div class="pd-filename">'. $imageFileName['filenamethumb']
. '<div class="pd-document'.$this->t['file_icon_size'].'" '
. $imageFileName['filenamestyle'].'>';
$pdFile .= '<div class="pd-float">';
$pdFile .= $linkDownloadB .$l->getName($v->title, $v->filename) .$linkDownloadE;
$pdFile .= '</div>';
$pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']);
$pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']);
// String Tags - title suffix
$tagsS = $l->displayTagsString($v->tags_string);
if ($tagsS != '') {
$pdFile .= '<div class="pd-float">'.$tagsS.'</div>';
}
// Tags - title suffix
if ($this->t['display_tags_links'] == 4 || $this->t['display_tags_links'] == 6) {
$tags = $l->displayTags($v->id, 1);
if ($tags != '') {
$pdFile .= '<div class="pd-float">'.$tags.'</div>';
}
}
// Specific icons
if (isset($v->image_filename_spec1) && $v->image_filename_spec1 != '') {
$pdFile .= '<div class="pd-float">'.$l->getImageDownload($v->image_filename_spec1).'</div>';
}
if (isset($v->image_filename_spec2) && $v->image_filename_spec2 != '') {
$pdFile .= '<div class="pd-float">'.$l->getImageDownload($v->image_filename_spec2).'</div>';
}
$pdFile .= '</div></div></div>' . "\n";
}
// pdbuttonplay
$pdButtonPlay = '';
if (isset($v->filename_play) && $v->filename_play != '') {
$fileExt = PhocaDownloadFile::getExtension($v->filename_play);
$canPlay = PhocaDownloadFile::canPlay($v->filename_play);
if ($canPlay) {
// Special height for music only
$buttonPlOptions = $this->t['buttonpl']->optionsB;
if ($fileExt == 'mp3' || $fileExt == 'ogg') {
$buttonPlOptions = $this->t['buttonpl']->optionsmp3B;
}
$playLink = JRoute::_(PhocaDownloadRoute::getFileRoute($v->id,$v->catid,$v->alias, $v->categoryalias,0, 'play').$this->t['limitstarturl']);
//$pdButtonPlay .= '<div class="pd-button-play">';
if ($this->t['play_popup_window'] == 1) {
$pdButtonPlay = '<a class="btn btn-danger" href="'.$playLink.'" onclick="'. $buttonPlOptions.'" >'. JText::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
} else {
//$pdButtonPlay .= '<a class="btn btn-danger pd-modal-button" href="'.$playLink.'" rel="'. $buttonPlOptions.'" >'. JText::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
$pdButtonPlay = '<a class="btn btn-danger pd-modal-button" data-toggle="modal" data-target="#phModalPlay" data-href="'.$playLink.'" '.$buttonPlOptions.' >'. JText::_('COM_PHOCADOWNLOAD_PLAY').'</a>';
}
//$pdButtonPlay .= '</div>';
}
}
// pdbuttonpreview
$pdButtonPreview = '';
if (isset($v->filename_preview) && $v->filename_preview != '') {
$fileExt = PhocaDownloadFile::getExtension($v->filename_preview);
if ($fileExt == 'pdf' || $fileExt == 'jpeg' || $fileExt == 'jpg' || $fileExt == 'png' || $fileExt == 'gif') {
$filePath = PhocaDownloadPath::getPathSet('filepreview');
$filePath = str_replace ( '../', JURI::base(true).'/', $filePath['orig_rel_ds']);
$previewLink = $filePath . $v->filename_preview;
//$pdButtonPreview .= '<div class="pd-button-preview">';
if ($this->t['preview_popup_window'] == 1) {
$pdButtonPreview .= '<a class="btn btn-warning" href="'.$previewLink.'" onclick="'. $this->t['buttonpr']->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
} else {
if ($fileExt == 'pdf') {
// Iframe - modal
//$pdButtonPreview .= '<a class="btn btn-warning pd-modal-button" href="'.$previewLink.'" rel="'. $this->t['buttonpr']->options.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
$pdButtonPreview = '<a class="btn btn-warning pd-modal-button" data-toggle="modal" data-target="#phModalPreview" data-href="'.$previewLink.'" '. $this->t['buttonpr']->optionsB.' >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
} else {
// Image - modal
//$pdButtonPreview .= '<a class="btn btn-warning pd-modal-button" href="'.$previewLink.'" rel="'. $this->t['buttonpr']->optionsimg.'" >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
$pdButtonPreview = '<a class="btn btn-warning pd-modal-button" data-toggle="modal" data-target="#phModalPreview" data-href="'.$previewLink.'" '. $this->t['buttonpr']->optionsimgB.' >'. JText::_('COM_PHOCADOWNLOAD_PREVIEW').'</a>';
}
}
//$pdButtonPreview .= '</div>';
}
}
// pdbuttondownload
//$pdButtonDownload = '<div class="pd-button-download">';
$pdButtonDownload = str_replace('class=""', 'class="btn btn-success"', $linkDownloadB) . JText::_('COM_PHOCADOWNLOAD_DOWNLOAD') .$linkDownloadE;
//$pdButtonDownload .= '</div>';
// pdbuttondetails
$d = '';
$pdTitle = '';
if ($v->title != '') {
$pdTitle .= '<div class="pd-title">'.$v->title.'</div>';
$d .= $pdTitle;
}
$pdImage = '';
if ($v->image_download != '') {
$pdImage .= '<div class="pd-image">'.$l->getImageDownload($v->image_download).'</div>';
$d .= $pdImage;
}
$pdFileSize = '';
$fileSize = $l->getFilesize($v->filename);
if ($fileSize != '') {
$pdFileSize .= '<div class="pd-filesize-txt">'.JText::_('COM_PHOCADOWNLOAD_FILESIZE').':</div>';
$pdFileSize .= '<div class="pd-fl-m">'.$fileSize.'</div>';
$d .= $pdFileSize;
}
$pdVersion = '';
if ($v->version != '') {
$pdVersion .= '<div class="pd-version-txt">'.JText::_('COM_PHOCADOWNLOAD_VERSION').':</div>';
$pdVersion .= '<div class="pd-fl-m">'.$v->version.'</div>';
$d .= $pdVersion;
}
$pdLicense = '';
if ($v->license != '') {
if ($v->license_url != '') {
$pdLicense .= '<div class="pd-license-txt">'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':</div>';
$pdLicense .= '<div class="pd-fl-m"><a href="'.$v->license_url.'" target="_blank">'.$v->license.'</a></div>';
} else {
$pdLicense .= '<div class="pd-license-txt">'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':</div>';
$pdLicense .= '<div class="pd-fl-m">'.$v->license.'</div>';
}
$d .= $pdLicense;
}
$pdAuthor = '';
if ($v->author != '') {
if ($v->author_url != '') {
$pdAuthor .= '<div class="pd-author-txt">'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':</div>';
$pdAuthor .= '<div class="pd-fl-m"><a href="'.$v->author_url.'" target="_blank">'.$v->author.'</a></div>';
} else {
$pdAuthor .= '<div class="pd-author-txt">'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':</div>';
$pdAuthor .= '<div class="pd-fl-m">'.$v->author.'</div>';
}
$d .= $pdAuthor;
}
$pdAuthorEmail = '';
if ($v->author_email != '') {
$pdAuthorEmail .= '<div class="pd-email-txt">'.JText::_('COM_PHOCADOWNLOAD_EMAIL').':</div>';
$pdAuthorEmail .= '<div class="pd-fl-m">'. $l->getProtectEmail($v->author_email).'</div>';
$d .= $pdAuthorEmail;
}
$pdFileDate = '';
$fileDate = $l->getFileDate($v->filename, $v->date);
if ($fileDate != '') {
$pdFileDate .= '<div class="pd-date-txt">'.JText::_('COM_PHOCADOWNLOAD_DATE').':</div>';
$pdFileDate .= '<div class="pd-fl-m">'.$fileDate.'</div>';
$d .= $pdFileDate;
}
$pdDownloads = '';
if ($this->t['display_downloads'] == 1) {
$pdDownloads .= '<div class="pd-downloads-txt">'.JText::_('COM_PHOCADOWNLOAD_DOWNLOADS').':</div>';
$pdDownloads .= '<div class="pd-fl-m">'.$v->hits.' x</div>';
$d .= $pdDownloads;
}
$pdDescription = '';
if ($l->isValueEditor($v->description) && $this->t['display_description'] != 1 & $this->t['display_description'] != 2 & $this->t['display_description'] != 3) {
$pdDescription .= '<div class="pd-fdesc">'.$v->description.'</div>';
$d .= $pdDescription;
}
$pdFeatures = '';
if ($l->isValueEditor($v->features)) {
$pdFeatures .= '<div class="pd-features-txt">'.JText::_('COM_PHOCADOWNLOAD_FEATURES').'</div>';
$pdFeatures .= '<div class="pd-features">'.$v->features.'</div>';
}
$pdChangelog = '';
if ($l->isValueEditor($v->changelog)) {
$pdChangelog .= '<div class="pd-changelog-txt">'.JText::_('COM_PHOCADOWNLOAD_CHANGELOG').'</div>';
$pdChangelog .= '<div class="pd-changelog">'.$v->changelog.'</div>';
}
$pdNotes = '';
if ($l->isValueEditor($v->notes)) {
$pdNotes .= '<div class="pd-notes-txt">'.JText::_('COM_PHOCADOWNLOAD_NOTES').'</div>';
$pdNotes .= '<div class="pd-notes">'.$v->notes.'</div>';
}
// pdfiledesc
$description = $l->isValueEditor($v->description);
$pdFileDescTop = '';
$pdFileDescBottom = '';
$oFileDesc = '';
if ($description) {
switch($this->t['display_description']) {
case 1:
$pdFileDescTop = '<div class="pd-fdesc">'.$v->description.'</div>';
break;
case 2:
$pdFileDescBottom = '<div class="pd-fdesc">'.$v->description.'</div>';
break;
case 3:
$oFileDesc = '<div class="pd-fdesc">'.$v->description.'</div>';
break;
case 4:
$pdFileDescTop = '<div class="pd-fdesc">'.$v->description.'</div>';
$oFileDesc = '<div class="pd-fdesc">'.PhocaDownloadUtils::strTrimAll($d).'</div>';
break;
case 5:
$pdFileDescBottom = '<div class="pd-fdesc">'.$v->description.'</div>';
$oFileDesc = '<div class="pd-fdesc">'.PhocaDownloadUtils::strTrimAll($d).'</div>';
break;
case 6:
$pdFileDescTop = '<div class="pd-fdesc">'.$d.'</div>';
$oFileDesc = '<div class="pd-fdesc">'.PhocaDownloadUtils::strTrimAll($d).'</div>';
break;
case 7:
$pdFileDescBottom = '<div class="pd-fdesc">'.$d.'</div>';
$oFileDesc = '<div class="pd-fdesc">'.PhocaDownloadUtils::strTrimAll($d).'</div>';
break;
case 8:
$oFileDesc = '<div class="pd-fdesc">'.PhocaDownloadUtils::strTrimAll($d).'</div>';
break;
default:
break;
}
}
// Detail Button
if ($this->t['display_detail'] == 1) {
if ($oFileDesc != '') {
$overlibcontent = $oFileDesc;
} else {
$overlibcontent = $d;
}
$overlibcontent = str_replace('"', '\'', $overlibcontent);
$sA = array(utf8_encode(chr(11)), utf8_encode(chr(160)));
$eA = array("\t", "\n", "\r", "\0");
$overlibcontent = str_replace($sA, ' ', $overlibcontent);
$overlibcontent = str_replace($eA, '', $overlibcontent);
$textO = htmlspecialchars(addslashes('<div style=\'text-align:left;padding:5px\'>'.$overlibcontent.'</div>'));
$overlib = "\n\n" ."onmouseover=\"return overlib('".$textO."', CAPTION, '".JText::_('COM_PHOCADOWNLOAD_DETAILS')."', BELOW, RIGHT, CSSCLASS, TEXTFONTCLASS, 'fontPhocaPDClass', FGCLASS, 'fgPhocaPDClass', BGCLASS, 'bgPhocaPDClass', CAPTIONFONTCLASS,'capfontPhocaPDClass', CLOSEFONTCLASS, 'capfontclosePhocaPDClass', STICKY, MOUSEOFF, CLOSETEXT, '".JText::_('COM_PHOCADOWNLOAD_CLOSE')."');\"";
$overlib .= " onmouseout=\"return nd();\"" . "\n";
//$pdButtonDetails = '<div class="pd-button-details">';
$pdButtonDetails = '<a class="btn btn-info" '.$overlib.' href="javascript:void(0)">'. JText::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails = '</div>';
} else if ($this->t['display_detail'] == 2) {
$detailLink = JRoute::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, 0, 'detail').$this->t['limitstarturl']);
//$pdButtonDetails = '<div class="pd-button-details">';
$pdButtonDetails = '<a class="btn btn-info pd-modal-button" data-toggle="modal" data-target="#phModalDetail" data-href="'.$detailLink.'" data-height="300px" data-width="auto">'. JText::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails .= '</div>';
} else if ($this->t['display_detail'] == 3) {
$detailLink = JRoute::_(PhocaDownloadRoute::getFileRoute($v->id, $this->catitem[$v->id]->id,$v->alias, $this->catitem[$v->id]->alias, 0, 'detail').$this->t['limitstarturl']);
//$pdButtonDetails = '<div class="pd-button-details">';
$buttonDOptions = $this->t['buttond']->options;
$pdButtonDetails = '<a class="btn btn-info pd-modal-button" href="'.$detailLink.'" onclick="'. $buttonDOptions.'">'. JText::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
//$pdButtonDetails .= '</div>';
} else {
$pdButtonDetails = '';
}
/// pdmirrorlink1
$pdMirrorLink1 = '';
$mirrorOutput1 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror1link, $v->mirror1title, $v->mirror1target);
if ($mirrorOutput1 != '') {
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
$classMirror = '';//'pd-button-mirror1';
$mirrorOutput1 = str_replace('class=""', 'class="btn btn-primary "', $mirrorOutput1);
} else {
$classMirror = 'pd-mirror-bp';
}
$pdMirrorLink1 = '<div class="'.$classMirror.'">'.$mirrorOutput1.'</div>';
}
/// pdmirrorlink2
$pdMirrorLink2 = '';
$mirrorOutput2 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror2link, $v->mirror2title, $v->mirror2target);
if ($mirrorOutput2 != '') {
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
$classMirror = '';//'pd-button-mirror2';
$mirrorOutput2 = str_replace('class=""', 'class="btn btn-primary "', $mirrorOutput2);
} else {
$classMirror = 'pd-mirror-bp';
}
$pdMirrorLink2 = '<div class="'.$classMirror.'">'.$mirrorOutput2.'</div>';
}
/// pdreportlink
$pdReportLink = PhocaDownloadRenderFront::displayReportLink(1, $v->title);
/// pdrating
$pdRating = PhocaDownloadRate::renderRateFile($v->id, $this->t['display_rating_file']);
/// pdtags
$pdTags = '';
if ($this->t['display_tags_links'] == 1 || $this->t['display_tags_links'] == 3) {
$tags2 = $l->displayTags($v->id);
if ($tags2 != '') {
$pdTags .= '<div class="pd-float">'.$tags2.'</div>';
}
}
/// pdvideo
$pdVideo = $l->displayVideo($v->video_filename, 0);
// ---------------------------------------------------
// Output
// ---------------------------------------------------
if ($v->textonly == 1) {
echo '<div class="row pd-row2-bp">';
echo '<div class="col-sm-12 col-md-12">';
echo $v->description;
echo '</div>';
echo '</div>';// end row
} else {
// ======= ROW 1 LEFT
echo '<div class="row ">';
if ($pdFileDescTop != '') {
echo '<div class="col-sm-12 col-md-12">';
echo $pdFileDescTop;
echo '</div>';
}
echo '<div class="col-sm-'.$this->t['bt_cat_col_left'].' col-md-'.$this->t['bt_cat_col_left'].'">';
echo $pdFile;
echo '</div>';
// ======= ROW 1 RIGHT
echo '<div class="col-sm-'.$this->t['bt_cat_col_right'].' col-md-'.$this->t['bt_cat_col_right'].'">';
echo '<div class="pd-button-box-bt">'.$pdButtonDownload . '</div>';
echo '<div class="pd-button-box-bt">'.$pdButtonDetails . '</div>';
echo '<div class="pd-button-box-bt">'.$pdButtonPreview . '</div>';
echo '<div class="pd-button-box-bt">'.$pdButtonPlay . '</div>';
echo '</div>';
echo '</div>';// end row
// ======== ROW 2 LEFT
echo '<div class="row pd-row2-bp">';
echo '<div class="col-sm-6 col-md-6">';
if ($pdVideo != '') {
echo '<div class="pd-video">'.$pdVideo.'</div>';
}
echo '<div class="pd-rating">'.$pdRating.'</div>';
echo '</div>';
// ======== ROW 2 RIGHT
echo '<div class="col-sm-6 col-md-6">';
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
if ($pdMirrorLink2 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink2.'</div>';
}
if ($pdMirrorLink1 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink1.'</div>';
}
} else if ($this->t['display_mirror_links'] == 1 || $this->t['display_mirror_links'] == 3) {
echo '<div class="pd-mirrors">'.$pdMirrorLink2.$pdMirrorLink1.'</div>';
}
if ($pdTags != '') {
echo '<div class="pd-tags-bp">'.$pdTags.'</div>';
}
if ($pdReportLink != '') {
echo '<div class="pd-report-bp">'.$pdReportLink.'</div>';
}
echo '</div>';
if ($pdFileDescBottom != '') {
echo '<div class="col-sm-12 col-md-12">';
echo $pdFileDescBottom;
echo '</div>';
}
echo '</div>';// end row
/*echo '<div class="pd-filebox">';
echo $pdFileDescTop;
echo $pdFile;
echo '<div class="pd-buttons">'.$pdButtonDownload.'</div>';
/*
if ($this->t['display_detail'] == 1 || $this->t['display_detail'] == 2) {
echo '<div class="pd-buttons">'.$pdButtonDetails.'</div>';
}
if ($this->t['display_preview'] == 1 && $pdButtonPreview != '') {
echo '<div class="pd-buttons">'.$pdButtonPreview.'</div>';
}
if ($this->t['display_play'] == 1 && $pdButtonPlay != '') {
echo '<div class="pd-buttons">'.$pdButtonPlay.'</div>';
}
if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) {
if ($pdMirrorLink2 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink2.'</div>';
}
if ($pdMirrorLink1 != '') {
echo '<div class="pd-buttons">'.$pdMirrorLink1.'</div>';
}
} else if ($this->t['display_mirror_links'] == 1 || $this->t['display_mirror_links'] == 3) {
echo '<div class="pd-mirrors">'.$pdMirrorLink2.$pdMirrorLink1.'</div>';
}
if ($pdVideo != '') {
echo '<div class="pd-video">'.$pdVideo.'</div>';
}
if ($pdReportLink != '') {
echo '<div class="pd-report">'.$pdReportLink.'</div>';
}
if ($pdRating != '') {
echo '<div class="pd-rating">'.$pdRating.'</div>';
}
if ($pdTags != '') {
echo '<div class="pd-tags">'.$pdTags.'</div>';
}
echo $pdFileDescBottom;
echo '<div class="pd-cb"></div>';
echo '</div>';*/
// ---------------------------------------------------
}
}
}
}
?>

View File

@ -0,0 +1,102 @@
<?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;
use Joomla\CMS\HTML\HTMLHelper;
$this->t['action'] = str_replace('&amp;', '&', $this->t['action']);
//$this->t['action'] = str_replace('&', '&amp;', $this->t['action']);
$this->t['action'] = htmlspecialchars($this->t['action']);
if ($this->t['p']->get('show_ordering_files') || $this->t['p']->get('show_pagination_limit') || $this->t['p']->get('show_pagination')) {
echo '<form action="'.$this->t['action'].'" method="post" name="adminForm">'. "\n";
if (count($this->files)) {
echo '<div class="pagination pagination-centered">';
if ($this->t['p']->get('show_ordering_files')) {
echo Text::_('COM_PHOCADOWNLOAD_ORDER_FRONT') .'&nbsp;'.$this->t['ordering'];
}
if ($this->t['p']->get('show_pagination_limit')) {
echo Text::_('COM_PHOCADOWNLOAD_DISPLAY_NUM') .'&nbsp;'.$this->t['pagination']->getLimitBox();
}
if ($this->t['p']->get('show_pagination')) {
echo '<div class="counter pull-right">'.$this->t['pagination']->getPagesCounter().'</div>'
.'<div class="pagination pagination-centered">'.$this->t['pagination']->getPagesLinks().'</div>';
}
echo '</div>'. "\n";
}
echo '<input type="hidden" name="controller" value="category" />';
echo HTMLHelper::_( 'form.token' );
echo '</form>';
echo '<div class="ph-cb pd-cv-paginaton">&nbsp;</div>';
} else {
echo '<div class="ph-cb pd-csv-paginaton">&nbsp;</div>';
}
/*
echo '<div class="pagination pagination-centered">';
if ($this->t['p']->get('show_ordering_files') || $this->t['p']->get('show_pagination_limit') || $this->t['p']->get('show_pagination')) {
echo '<div class="pginline">';
if ($this->t['p']->get('show_ordering_files')) {
echo Text::_('COM_PHOCADOWNLOAD_ORDER_FRONT') .'&nbsp;'.$this->t['ordering']. ' &nbsp;';
}
if ($this->t['p']->get('show_pagination_limit')) {
echo Text::_('COM_PHOCADOWNLOAD_DISPLAY_NUM') .'&nbsp;'
.$this->t['pagination']->getLimitBox() . ' &nbsp;';
}
if ($this->t['p']->get('show_pagination')) {
echo $this->t['pagination']->getPagesCounter();
}
echo '</div>';
}
if ($this->t['p']->get('show_pagination')) {
echo '<div style="margin:0 10px 0 10px;display:inline;" class="sectiontablefooter'.$this->t['p']->get( 'pageclass_sfx' ).'" id="pg-pagination" >'
.$this->t['pagination']->getPagesLinks()
.'</div>';
/*.'<div style="margin:0 10px 0 10px;display:inline;" class="pagecounter">'
.$this->t['pagination']->getPagesCounter()
.'</div>';*//*
}
echo '</div></div>'. "\n";
//echo '<input type="hidden" name="controller" value="category" />';
echo HTMLHelper::_( 'form.token' );
echo '</form>';
*/
?>

View File

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

View File

@ -0,0 +1,475 @@
<?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\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
class PhocaDownloadViewCategory extends HtmlView
{
protected $category;
protected $subcategories;
protected $files;
protected $t;
function display($tpl = null) {
$app = Factory::getApplication();
$this->t['p'] = $app->getParams();
$this->t['user'] = Factory::getUser();
$uri = Uri::getInstance();
$model = $this->getModel();
$document = Factory::getDocument();
$this->t['categoryid'] = $app->input->get( 'id', 0, 'int' );
$this->t['tagid'] = $app->input->get( 'tagid', 0, 'int' );
//if ($this->t['categoryid'] == 0 && $this->t['tagid'] == 0) {
//throw new Exception(JText::_('COM_PHOCADOWNLOAD_CATEGORY_NOT_FOUND'), 404);
//}
$limitStart = $app->input->get( 'limitstart', 0, 'int' );
$this->t['mediapath'] = PhocaDownloadPath::getPathMedia();
$this->category = $model->getCategory($this->t['categoryid']);
$this->subcategories = $model->getSubcategories($this->t['categoryid']);
$this->files = $model->getFileList($this->t['categoryid'], $this->t['tagid']);
$this->t['pagination'] = $model->getPagination($this->t['categoryid'], $this->t['tagid']);
PhocaDownloadRenderFront::renderMainJs();
PhocaDownloadRenderFront::renderAllCSS();
HTMLHelper::_('bootstrap.popover', '.hasPopover', ['trigger' => 'hover focus']);// Tooltips
//$document->addCustomTag('<script type="text/javascript" src="'.Uri::root().'media/com_phocadownload/js/overlib/overlib_mini.js"></script>');
if ($limitStart > 0 ) {
$this->t['limitstarturl'] = '&start='.$limitStart;
} else {
$this->t['limitstarturl'] = '';
}
$this->t['download_external_link'] = $this->t['p']->get( 'download_external_link', '_self' );
$this->t['filename_or_name'] = $this->t['p']->get( 'filename_or_name', 'filenametitle' );
$this->t['display_downloads'] = $this->t['p']->get( 'display_downloads', 0 );
$this->t['display_description'] = $this->t['p']->get( 'display_description', 3 );
$this->t['display_detail'] = $this->t['p']->get( 'display_detail', 1 );
$this->t['display_play'] = $this->t['p']->get( 'display_play', 0 );
$this->t['playerwidth'] = $this->t['p']->get( 'player_width', 328 );
$this->t['playerheight'] = $this->t['p']->get( 'player_height', 200 );
$this->t['playermp3height'] = $this->t['p']->get( 'player_mp3_height', 30 );
$this->t['previewwidth'] = $this->t['p']->get( 'preview_width', 640 );
$this->t['previewheight'] = $this->t['p']->get( 'preview_height', 480 );
$this->t['display_preview'] = $this->t['p']->get( 'display_preview', 0 );
$this->t['play_popup_window'] = $this->t['p']->get( 'play_popup_window', 0 );
$this->t['preview_popup_window'] = $this->t['p']->get( 'preview_popup_window', 0 );
$this->t['file_icon_size'] = $this->t['p']->get( 'file_icon_size', 16 );
$this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 );
$this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 );
$this->t['display_up_icon'] = $this->t['p']->get( 'display_up_icon', 1 );
$this->t['allowed_file_types'] = $this->t['p']->get( 'allowed_file_types', '' );
$this->t['disallowed_file_types'] = $this->t['p']->get( 'disallowed_file_types', '' );
$this->t['enable_user_statistics'] = $this->t['p']->get( 'enable_user_statistics', 1 );
$this->t['display_category_comments']= $this->t['p']->get( 'display_category_comments', 0 );
$this->t['display_date_type'] = $this->t['p']->get( 'display_date_type', 0 );
$this->t['display_file_view'] = $this->t['p']->get('display_file_view', 0);
$this->t['download_metakey'] = $this->t['p']->get( 'download_metakey', '' );
$this->t['download_metadesc'] = $this->t['p']->get( 'download_metadesc', '' );
$this->t['display_rating_file'] = $this->t['p']->get( 'display_rating_file', 0 );
$this->t['display_mirror_links'] = $this->t['p']->get( 'display_mirror_links', 0 );
$this->t['display_report_link'] = $this->t['p']->get( 'display_report_link', 0 );
$this->t['send_mail_download'] = $this->t['p']->get( 'send_mail_download', 0 );// not boolean but id of user
//$this->t['send_mail_upload'] = $this->t['p']->get( 'send_mail_upload', 0 );
$this->t['display_tags_links'] = $this->t['p']->get( 'display_tags_links', 0 );
$this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 );
$this->t['fb_comment_app_id'] = $this->t['p']->get( 'fb_comment_app_id', '' );
$this->t['fb_comment_width'] = $this->t['p']->get( 'fb_comment_width', '550' );
$this->t['fb_comment_lang'] = $this->t['p']->get( 'fb_comment_lang', 'en_US' );
$this->t['fb_comment_count'] = $this->t['p']->get( 'fb_comment_count', '' );
$this->t['html5_play'] = 1;//$this->t['p']->get( 'html5_play', 1 );
$this->t['bt_cat_col_left'] = (int)$this->t['p']->get( 'bt_cat_col_left', 6 );
if ($this->t['bt_cat_col_left'] == 12) {
$this->t['bt_cat_col_right'] = 12;
} else {
$this->t['bt_cat_col_right'] = 12 - $this->t['bt_cat_col_left'];
}
// Rating
if ($this->t['display_rating_file'] == 1 || $this->t['display_rating_file'] == 3) {
HTMLHelper::_('jquery.framework', false);
PhocaDownloadRate::renderRateFileJS(1);
$this->t['display_rating_file'] = 1;
} else {
$this->t['display_rating_file'] = 0;
}
$this->t['afd'] = PhocaDownloadRenderFront::renderPhocaDownload();
// DOWNLOAD
// - - - - - - - - - - - - - - -
$download = $app->input->get( 'download', array(0),'array' );
$downloadId = (int) $download[0];
if ($downloadId > 0) {
if (isset($this->category[0]->id) && (int)$this->category[0]->id > 0 ) {
$currentLink = 'index.php?option=com_phocadownload&view=category&id='.$this->category[0]->id.':'.$this->category[0]->alias.$this->t['limitstarturl'] . '&Itemid='. $app->input->get('Itemid', 0, 'int');
} else {
$currentLink = $uri;
}
$fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink);
PhocaDownloadDownload::download($fileData, $downloadId, $currentLink);
}
// - - - - - - - - - - - - - - -
// DETAIL
// - - - - - - - - - - - - - - -
// BOOTSTRAP
$this->t['bootstrapmodal'] = '';
//PhocaDownloadRenderFront::renderBootstrapModalJs('.pd-bs-modal-button');
if ($this->t['display_detail'] == 2) {
$this->t['buttond'] = new CMSObject();
$this->t['buttond']->set('methodname', 'modal-button');
$this->t['buttond']->set('name', 'detail');
$this->t['buttond']->set('modal', true);
$this->t['buttond']->set('options', "{handler: 'iframe', size: {x: 600, y: 500}, overlayOpacity: 0.7, classWindow: 'phocadownloaddetailwindow', classOverlay: 'phocadownloaddetailoverlay'}");
// BOOTSTRAP
$this->t['bootstrapmodal'] .= PhocaDownloadRenderFront::bootstrapModalHtml('phModalDetail' , Text::_('COM_PHOCADOWNLOAD_DETAILS'));
} else if ($this->t['display_detail'] == 3) {
$this->t['buttond'] = new CMSObject();
$this->t['buttond']->set('methodname', 'js-button');
$this->t['buttond']->set('name', 'detail');
$this->t['buttond']->set('options', "window.open(this.href,'win2','width=600,height=500,scrollbars=yes,menubar=no,resizable=yes'); return false;");
}
// PLAY - - - - - - - - - - - -
$windowWidthPl = (int)$this->t['playerwidth'] + 20;
$windowHeightPl = (int)$this->t['playerheight'] + 20;
if ($this->t['html5_play'] == 1) {
$windowWidthPl = (int)$this->t['playerwidth'] + 50;
} else {
$windowWidthPl = (int)$this->t['playerwidth'] + 50;
}
$windowHeightPlMP3 = (int)$this->t['playermp3height'] + 30;
if ($this->t['play_popup_window'] == 1) {
$this->t['buttonpl'] = new CMSObject();
$this->t['buttonpl']->set('methodname', 'js-button');
$this->t['buttonpl']->set('options', "window.open(this.href,'win2','width=".$windowWidthPl.",height=".$windowHeightPl.",scrollbars=yes,menubar=no,resizable=yes'); return false;");
$this->t['buttonpl']->set('optionsmp3', "window.open(this.href,'win2','width=".$windowWidthPl.",height=".$windowHeightPlMP3.",scrollbars=yes,menubar=no,resizable=yes'); return false;");
} else {
$document->addCustomTag( "<style type=\"text/css\"> \n"
." #sbox-window.phocadownloadplaywindow {background-color:#fff;padding:2px} \n"
." #sbox-overlay.phocadownloadplayoverlay {background-color:#000;} \n"
." </style> \n");
$this->t['buttonpl'] = new CMSObject();
$this->t['buttonpl']->set('name', 'image');
$this->t['buttonpl']->set('modal', true);
$this->t['buttonpl']->set('methodname', 'modal-button');
$this->t['buttonpl']->set('options', "{handler: 'iframe', size: {x: ".$windowWidthPl.", y: ".$windowHeightPl."}, overlayOpacity: 0.7, classWindow: 'phocadownloadplaywindow', classOverlay: 'phocadownloadplayoverlay'}");
$this->t['buttonpl']->set('optionsmp3', "{handler: 'iframe', size: {x: ".$windowWidthPl.", y: ".$windowHeightPlMP3."}, overlayOpacity: 0.7, classWindow: 'phocadownloadplaywindow', classOverlay: 'phocadownloadplayoverlay'}");
// BOOTSTRAP
$this->t['buttonpl']->set('optionsB', ' data-width-dialog="'.$windowWidthPl.'" data-height-dialog="'.$windowHeightPl.'"');
$this->t['buttonpl']->set('optionsmp3B', ' data-width-dialog="'.$windowWidthPl.'" data-height-dialog="'.$windowHeightPlMP3.'"');
$this->t['bootstrapmodal'] .= PhocaDownloadRenderFront::bootstrapModalHtml('phModalPlay' , Text::_('COM_PHOCADOWNLOAD_PLAY'));
}
// - - - - - - - - - - - - - - -
// PREVIEW - - - - - - - - - - - -
$windowWidthPr = (int)$this->t['previewwidth'] + 20;
$windowHeightPr = (int)$this->t['previewheight'] + 20;
if ($this->t['preview_popup_window'] == 1) {
$this->t['buttonpr'] = new CMSObject();
$this->t['buttonpr']->set('methodname', 'js-button');
$this->t['buttonpr']->set('options', "window.open(this.href,'win2','width=".$windowWidthPr.",height=".$windowHeightPr.",scrollbars=yes,menubar=no,resizable=yes'); return false;");
} else {
$document->addCustomTag( "<style type=\"text/css\"> \n"
." #sbox-window.phocadownloadpreviewwindow {background-color:#fff;padding:2px} \n"
." #sbox-overlay.phocadownloadpreviewoverlay {background-color:#000;} \n"
." </style> \n");
$this->t['buttonpr'] = new CMSObject();
$this->t['buttonpr']->set('name', 'image');
$this->t['buttonpr']->set('modal', true);
$this->t['buttonpr']->set('methodname', 'modal-button');
$this->t['buttonpr']->set('options', "{handler: 'iframe', size: {x: ".$windowWidthPr.", y: ".$windowHeightPr."}, overlayOpacity: 0.7, classWindow: 'phocadownloadpreviewwindow', classOverlay: 'phocadownloadpreviewoverlay'}");
$this->t['buttonpr']->set('optionsimg', "{handler: 'image', size: {x: 200, y: 150}, overlayOpacity: 0.7, classWindow: 'phocadownloadpreviewwindow', classOverlay: 'phocadownloadpreviewoverlay'}");
// BOOTSTRAP
$this->t['buttonpr']->set('optionsB', ' data-type="document" data-width-dialog="'.$windowWidthPr.'" data-height-dialog="'.$windowHeightPr.'"');
$this->t['buttonpr']->set('optionsimgB', 'data-type="image"');
$this->t['bootstrapmodal'] .= PhocaDownloadRenderFront::bootstrapModalHtml('phModalPreview' , Text::_('COM_PHOCADOWNLOAD_PREVIEW'));
}
// - - - - - - - - - - - - - - -
$this->t['ordering'] = $model->getFileOrderingSelect();
$imagePath = PhocaDownloadPath::getPathSet('icon');
$this->t['cssimgpath'] = str_replace ( '../', Uri::base(true).'/', $imagePath['orig_rel_ds']);
$filePath = PhocaDownloadPath::getPathSet('file');
$this->t['absfilepath'] = $filePath['orig_abs_ds'];
$this->t['action'] = $uri->toString();
if (isset($this->category[0]) && is_object($this->category[0])){
$this->_prepareDocument($this->category[0]);
}
// Breadcrumb display:
// 0 - only menu link
// 1 - menu link - category name
// 2 - only category name
$this->_addBreadCrumbs( isset($menu->query['id']) ? $menu->query['id'] : 0, 1);
parent::display($tpl);
// Bootstrap 3 Layout
/* $this->t['display_bootstrap3_layout'] = $this->t['p']->get( 'display_bootstrap3_layout', 0 );
if ((int)$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(JUri::root(true).'/media/com_phocadownload/js/jquery.equalheights.min.js');
$document->addScriptDeclaration(
'jQuery(window).load(function(){
jQuery(\'.ph-thumbnail\').equalHeights();
});');*//*
} else {
// Because of modals
//HTMLHelper::_('behavior.modal', 'a.pd-bs-modal-button');
}*/
/* if (isset($this->category[0]) && is_object($this->category[0])){
$this->_prepareDocument($this->category[0]);
}
if ($this->t['display_bootstrap3_layout'] > 0) {
parent::display('bootstrap');
} else {
parent::display($tpl);
}*/
}
protected function _prepareDocument($category) {
$app = Factory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
//$this->t['p'] = &$app->getParams();
$title = null;
$this->t['downloadmetakey'] = $this->t['p']->get( 'download_metakey', '' );
$this->t['downloadmetadesc'] = $this->t['p']->get( 'download_metadesc', '' );
$this->t['disable_breadcrumbs_category_view'] = $this->t['p']->get( 'disable_breadcrumbs_category_view',0 );
$menu = $menus->getActive();
if ($menu) {
$this->t['p']->def('page_heading', $this->t['p']->get('page_title', $menu->title));
} else {
$this->t['p']->def('page_heading', Text::_('JGLOBAL_ARTICLES'));
}
/*
$title = $this->t['p']->get('page_title', '');
if (empty($title) || (isset($title) && $title == '')) {
$title = $this->item->title;
}
if (empty($title) || (isset($title) && $title == '')) {
$title = htmlspecialchars_decode($app->get('sitename'));
} else if ($app->get('sitename_pagetitles', 0)) {
$title = Text::sprintf('JPAGETITLE', htmlspecialchars_decode($app->get('sitename')), $title);
}
//$this->document->setTitle($title);
$this->document->setTitle($title);*/
$title = $this->t['p']->get('page_title', '');
$this->t['display_cat_name_title'] = 1;
if (empty($title)) {
$title = htmlspecialchars_decode($app->get('sitename'));
} else if ($app->get('sitename_pagetitles', 0) == 1) {
$title = Text::sprintf('JPAGETITLE', htmlspecialchars_decode($app->get('sitename')), $title);
if ($this->t['display_cat_name_title'] == 1 && isset($category->title) && $category->title != '') {
$title = $title .' - ' . $category->title;
}
} else if ($app->get('sitename_pagetitles', 0) == 2) {
if ($this->t['display_cat_name_title'] == 1 && isset($category->title) && $category->title != '') {
$title = $title .' - ' . $category->title;
}
$title = Text::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->get('sitename')));
}
$this->document->setTitle($title);
if ($category->metadesc != '') {
$this->document->setDescription($category->metadesc);
} else if ($this->t['downloadmetadesc'] != '') {
$this->document->setDescription($this->t['downloadmetadesc']);
} else if ($this->t['p']->get('menu-meta_description', '')) {
$this->document->setDescription($this->t['p']->get('menu-meta_description', ''));
}
if ($category->metakey != '') {
$this->document->setMetadata('keywords', $category->metakey);
} else if ($this->t['downloadmetakey'] != '') {
$this->document->setMetadata('keywords', $this->t['downloadmetakey']);
} else if ($this->t['p']->get('menu-meta_keywords', '')) {
$this->document->setMetadata('keywords', $this->t['p']->get('menu-meta_keywords', ''));
}
if ($app->get('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) {
$this->document->setMetaData('title', $this->t['p']->get('page_title', ''));
}
// Breadcrumbs TO DO (Add the whole tree)
/*$pathway = $app->getPathway();
if (isset($this->category[0]->parent_id)) {
if ($this->category[0]->parent_id == 0) {
// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadRoute::getCategoriesRoute()));
} else if ($this->category[0]->parent_id > 0) {
$pathway->addItem($this->category[0]->parenttitle, Route::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parent_id, $this->category[0]->parentalias)));
}
}
if (!empty($this->category[0]->title)) {
$pathway->addItem($this->category[0]->title);
}*/
// Start comment if problem with duplicated pathway
/*if ($this->t['disable_breadcrumbs_category_view'] == 1) {
if (isset($this->category[0]->parent_id)) {
if ($this->category[0]->parent_id == 0) {
// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadRoute::getCategoriesRoute()));
} else if ($this->category[0]->parent_id > 0) {
$curpath = $pathway->getPathwayNames();
if(isset($this->category[0]->parenttitle) && isset($curpath[count($curpath)-1]) && $this->category[0]->parenttitle != $curpath[count($curpath)-1]){
$pathway->addItem($this->category[0]->parenttitle, Route::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parent_id, $this->category[0]->parentalias)));
}
}
}
}
// End comment when problem with duplicated pathway
if (!empty($this->category[0]->title)) {
$curpath = $pathway->getPathwayNames();
if(isset($this->category[0]->title) && isset($curpath[count($curpath)-1]) && $this->category[0]->title != $curpath[count($curpath)-1]){
$pathway->addItem($this->category[0]->title);
}
}*/
}
/**
* Method to add Breadcrubms in Phoca Download
* @param array $this->category Object array of Category
* @param int $rootId Id of Root Category
* @param int $displayStyle Displaying of Breadcrubm - Nothing, Category Name, Menu link with Name
* @return string Breadcrumbs
*/
function _addBreadCrumbs($rootId, $displayStyle)
{
$app = Factory::getApplication();
$i = 0;
if (isset($this->category[0])) {
$category = $this->category[0];
while (isset($category->id)) {
$crumbList[$i++] = $category;
if ($category->id == $rootId) {
break;
}
$db = Factory::getDBO();
$query = 'SELECT *' .
' FROM #__phocadownload_categories AS c' .
' WHERE c.id = ' . (int)$category->parent_id . // $category->parent_id
' AND c.published = 1';
$db->setQuery($query);
$rows = $db->loadObjectList('id');
if (!empty($rows)) {
$category = $rows[$category->parent_id];
} else {
$category = '';
}
// $category = $rows[$category->parent_id];
}
}
$pathway = $app->getPathway();
$pathWayItems = $pathway->getPathWay();
$lastItemIndex = count($pathWayItems) - 1;
for ($i--; $i >= 0; $i--)
{
// special handling of the root category
if ($crumbList[$i]->id == $rootId)
{
switch ($displayStyle)
{
case 0: // 0 - only menu link
// do nothing
break;
case 1: // 1 - menu link with category name
// replace the last item in the breadcrumb (menu link title) with the current value plus the category title
$pathway->setItemName($lastItemIndex, $pathWayItems[$lastItemIndex]->name . ' - ' . $crumbList[$i]->title);
break;
case 2: // 2 - only category name
// replace the last item in the breadcrumb (menu link title) with the category title
$pathway->setItemName($lastItemIndex, $crumbList[$i]->title);
break;
}
}
else
{
//$link = 'index.php?option=com_phocadownload&view=category&id='. $crumbList[$i]->id.':'.$crumbList[$i]->alias.'&Itemid='. $this->itemId;
$link = PhocaDownloadRoute::getCategoryRoute($crumbList[$i]->id, $crumbList[$i]->alias);
$pathway->addItem($crumbList[$i]->title, Route::_($link));
}
}
}
}
?>