primo commit
This commit is contained in:
1
components/com_phocadownload/views/file/index.html
Normal file
1
components/com_phocadownload/views/file/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
6
components/com_phocadownload/views/file/metadata.xml
Normal file
6
components/com_phocadownload/views/file/metadata.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="_COM_PHOCADOWNLOAD_FILE_GROUP">
|
||||
<message><![CDATA[_COM_PHOCADOWNLOAD_FILE_GROUP_DESC]]></message>
|
||||
</view>
|
||||
</metadata>
|
||||
416
components/com_phocadownload/views/file/tmpl/default.php
Normal file
416
components/com_phocadownload/views/file/tmpl/default.php
Normal file
@ -0,0 +1,416 @@
|
||||
<?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\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
|
||||
echo '<div id="phoca-dl-file-box" class="pd-file-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());
|
||||
|
||||
if (!empty($this->category[0])) {
|
||||
echo '<div class="pd-file">';
|
||||
if ($this->t['display_up_icon'] == 1 && $this->t['tmplr'] == 0) {
|
||||
|
||||
if (isset($this->category[0]->id)) {
|
||||
if ($this->category[0]->id > 0) {
|
||||
$linkUp = Route::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->id, $this->category[0]->alias));
|
||||
$linkUpText = $this->category[0]->title;
|
||||
} 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-file"><div class="ph-top"></div>';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($this->file[0])) {
|
||||
$v = $this->file[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', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
if ($rightDisplay == 1) {
|
||||
|
||||
$l = new PhocaDownloadLayout();
|
||||
|
||||
//echo '<h3 class="pdfv-name">'.$l->getName($v->title, $v->filename, 1). '</h3>';
|
||||
echo PhocaDownloadRenderFront::renderSubHeader(array($l->getName($v->title, $v->filename, 1)), '', 'pd-ctitle pdfv-name');
|
||||
|
||||
|
||||
// =====================================================================================
|
||||
// BEGIN LAYOUT AREA
|
||||
// =====================================================================================
|
||||
|
||||
// Is this direct menu link to File View
|
||||
$directFv = 0;
|
||||
$app = Factory::getApplication();
|
||||
$itemId = $app->input->get('Itemid', 0, 'int');
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getItem($itemId);
|
||||
if (isset($item->query['view']) && $item->query['view'] == 'file') {
|
||||
$directFv = 1;
|
||||
}
|
||||
// End direct menu link to File View
|
||||
|
||||
if ((int)$this->t['display_file_view'] == 1
|
||||
|| (int)$this->t['display_file_view'] == 2
|
||||
|| (int)$v->confirm_license > 0
|
||||
|| (int)$this->t['display_detail'] == 2
|
||||
|| (int)$this->t['display_detail'] == 3
|
||||
|| (int)$directFv == 1) {
|
||||
|
||||
$pdTitle = '';
|
||||
if ($v->title != '' && $this->t['filename_or_name'] != 'filenametitle') {
|
||||
$pdTitle .= '<div class="pd-title">'.$v->title.'</div>';
|
||||
}
|
||||
|
||||
$pdImage = '';
|
||||
if ($v->image_download != '') {
|
||||
$pdImage .= '<div class="pd-image">'.$l->getImageDownload($v->image_download).'</div>';
|
||||
}
|
||||
|
||||
$pdVideo = '';
|
||||
$pdVideo = $l->displayVideo($v->video_filename, 1);
|
||||
|
||||
if ($v->filename != '') {
|
||||
$imageFileName = $l->getImageFileName($v->image_filename, $v->filename);
|
||||
|
||||
$pdFile = '<div class="pd-filenamebox">';
|
||||
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 .= $l->getName($v->title, $v->filename);
|
||||
$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'] == 5 || $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";
|
||||
}
|
||||
|
||||
$pdFileSize = '';
|
||||
$fileSize = $l->getFilesize($v->filename);
|
||||
if ($fileSize != '') {
|
||||
$pdFileSize .= '<div class="pd-filesize-txt">'.Text::_('COM_PHOCADOWNLOAD_FILESIZE').':</div>';
|
||||
$pdFileSize .= '<div class="pd-fl-m">'.$fileSize.'</div>';
|
||||
}
|
||||
|
||||
$pdVersion = '';
|
||||
if ($v->version != '') {
|
||||
$pdVersion .= '<div class="pd-version-txt">'.Text::_('COM_PHOCADOWNLOAD_VERSION').':</div>';
|
||||
$pdVersion .= '<div class="pd-fl-m">'.$v->version.'</div>';
|
||||
}
|
||||
|
||||
$pdLicense = '';
|
||||
if ($v->license != '') {
|
||||
if ($v->license_url != '') {
|
||||
$pdLicense .= '<div class="pd-license-txt">'.Text::_('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">'.Text::_('COM_PHOCADOWNLOAD_LICENSE').':</div>';
|
||||
$pdLicense .= '<div class="pd-fl-m">'.$v->license.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$pdAuthor = '';
|
||||
if ($v->author != '') {
|
||||
if ($v->author_url != '') {
|
||||
$pdAuthor .= '<div class="pd-author-txt">'.Text::_('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">'.Text::_('COM_PHOCADOWNLOAD_AUTHOR').':</div>';
|
||||
$pdAuthor .= '<div class="pd-fl-m">'.$v->author.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$pdAuthorEmail = '';
|
||||
if ($v->author_email != '') {
|
||||
$pdAuthorEmail .= '<div class="pd-email-txt">'.Text::_('COM_PHOCADOWNLOAD_EMAIL').':</div>';
|
||||
$pdAuthorEmail .= '<div class="pd-fl-m">'. $l->getProtectEmail($v->author_email).'</div>';
|
||||
}
|
||||
|
||||
$pdFileDate = '';
|
||||
$fileDate = $l->getFileDate($v->filename, $v->date);
|
||||
if ($fileDate != '') {
|
||||
$pdFileDate .= '<div class="pd-date-txt">'.Text::_('COM_PHOCADOWNLOAD_DATE').':</div>';
|
||||
$pdFileDate .= '<div class="pd-fl-m">'.$fileDate.'</div>';
|
||||
}
|
||||
|
||||
$pdDownloads = '';
|
||||
if ($this->t['display_downloads'] == 1) {
|
||||
$pdDownloads .= '<div class="pd-downloads-txt">'.Text::_('COM_PHOCADOWNLOAD_DOWNLOADS').':</div>';
|
||||
$pdDownloads .= '<div class="pd-fl-m">'.$v->hits.' x</div>';
|
||||
|
||||
/*for ($i = 2; $i < 1001; $i++) {
|
||||
if (($v->hits > 1 && $v->hits < 5)
|
||||
|| ($v->hits > $i * 10 + 1 && $v->hits < $i * 10 + 5)) {
|
||||
$numD = 'COM_PHOCADOWNLOAD_NUMBER_OF_DOWNLOADS_3';
|
||||
break;
|
||||
} elseif (($v->hits == 0)
|
||||
|| ($v->hits > 4 && $v->hits < 22)
|
||||
|| ($v->hits > $i * 10 + 4 && $v->hits < $i * 10 + 12)) {
|
||||
$numD = 'COM_PHOCADOWNLOAD_NUMBER_OF_DOWNLOADS_2';
|
||||
break;
|
||||
} elseif ($v->hits == 1) {
|
||||
$numD = 'COM_PHOCADOWNLOAD_NUMBER_OF_DOWNLOADS_1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$pdDownloads .= '<div class="pd-fl-m">'.$v->hits.' '.Text::_($numD).'</div>';
|
||||
*/
|
||||
}
|
||||
|
||||
$pdDescription = '';
|
||||
if ($l->isValueEditor($v->description)) {
|
||||
//$pdDescription .= '<div class="pd-fdesc">'.$v->description.'</div>';
|
||||
$pdDescription .= '<div class="pd-fdesc">'. HTMLHelper::_('content.prepare', $v->description) . '</div>';
|
||||
}
|
||||
|
||||
$pdFeatures = '';
|
||||
if ($l->isValueEditor($v->features)) {
|
||||
$pdFeatures .= '<div class="pd-features-txt">'.Text::_('COM_PHOCADOWNLOAD_FEATURES').'</div>';
|
||||
$pdFeatures .= '<div class="pd-features">'.$v->features.'</div>';
|
||||
}
|
||||
|
||||
$pdChangelog = '';
|
||||
if ($l->isValueEditor($v->changelog)) {
|
||||
$pdChangelog .= '<div class="pd-changelog-txt">'.Text::_('COM_PHOCADOWNLOAD_CHANGELOG').'</div>';
|
||||
$pdChangelog .= '<div class="pd-changelog">'.$v->changelog.'</div>';
|
||||
}
|
||||
|
||||
$pdNotes = '';
|
||||
if ($l->isValueEditor($v->notes)) {
|
||||
$pdNotes .= '<div class="pd-notes-txt">'.Text::_('COM_PHOCADOWNLOAD_NOTES').'</div>';
|
||||
$pdNotes .= '<div class="pd-notes">'.$v->notes.'</div>';
|
||||
}
|
||||
|
||||
|
||||
/// 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'] == 2 || $this->t['display_tags_links'] == 3) {
|
||||
$tags2 = $l->displayTags($v->id);
|
||||
if ($tags2 != '') {
|
||||
$pdTags .= '<div class="pd-float">'.$tags2.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// RENDER
|
||||
echo '<div class="pd-filebox">';
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
echo $pdTitle;
|
||||
echo $pdImage;
|
||||
echo $pdFile;
|
||||
echo $pdFileSize;
|
||||
echo $pdVersion;
|
||||
echo $pdLicense;
|
||||
echo $pdAuthor;
|
||||
echo $pdAuthorEmail;
|
||||
echo $pdFileDate;
|
||||
echo $pdDownloads;
|
||||
echo $pdDescription;
|
||||
echo $pdFeatures;
|
||||
echo $pdChangelog;
|
||||
echo $pdNotes;
|
||||
if ($pdVideo != '') {
|
||||
echo '<div class="pd-video">' . $pdVideo . '</div>';
|
||||
}
|
||||
if ($pdRating != '') {
|
||||
echo '<div class="pd-rating">' . $pdRating . '</div>';
|
||||
}
|
||||
echo '</div></div>'; // end col, end row
|
||||
|
||||
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
if ($this->t['display_mirror_links'] == 5 || $this->t['display_mirror_links'] == 6) {
|
||||
echo '<div class="pd-buttons-bp">'.$pdMirrorLink2.'</div>';
|
||||
echo '<div class="pd-buttons-bp">'.$pdMirrorLink1.'</div>';
|
||||
} else if ($this->t['display_mirror_links'] == 2 || $this->t['display_mirror_links'] == 3) {
|
||||
echo '<div class="pd-mirrors">'.$pdMirrorLink2.$pdMirrorLink1.'</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($pdReportLink != '') {
|
||||
echo '<div class="pd-report">' . $pdReportLink . '</div>';
|
||||
}
|
||||
if ($pdReportLink != '') {
|
||||
echo '<div class="pd-tags">'.$pdTags.'</div>';
|
||||
}
|
||||
|
||||
echo '<div class="pd-cb"></div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</div></div>'; // end col, end row
|
||||
|
||||
|
||||
/// $o = '<div class="pd-cb"> </div>';
|
||||
$o = '';
|
||||
if ((int)$v->confirm_license > 0) {
|
||||
$o .= '<h4 class="pdfv-confirm-lic-text">'.Text::_('COM_PHOCADOWNLOAD_LICENSE_AGREEMENT').'</h4>';
|
||||
$o .= '<div id="phoca-dl-license" style="height:'.(int)$this->t['licenseboxheight'].'px">'.$v->licensetext.'</div>';
|
||||
|
||||
// External link
|
||||
if ($v->link_external != '' && $v->directlink == 1) {
|
||||
$o .= '<form action="" name="phocaDownloadForm" id="phocadownloadform" target="'.$this->t['download_external_link'].'">';
|
||||
$o .= '<input type="checkbox" name="license_agree" onclick="enableDownloadPD()" /> <span>'.Text::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').'</span> ';
|
||||
$o .= '<input class="btn btn-success" type="button" name="submit" onClick="location.href=\''.$v->link_external.'\';" id="pdlicensesubmit" value="'.Text::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
} else {
|
||||
$o .= '<form action="'.htmlspecialchars($this->t['action']).'" method="post" name="phocaDownloadForm" id="phocadownloadform">';
|
||||
$o .= '<input type="checkbox" name="license_agree" onclick="enableDownloadPD()" /> <span>'.Text::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').'</span> ';
|
||||
$o .= '<input class="btn btn-success" type="submit" name="submit" id="pdlicensesubmit" value="'.Text::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
$o .= '<input type="hidden" name="download" value="'.$v->id.'" />';
|
||||
$o .= '<input type="hidden" name="'. Session::getFormToken().'" value="1" />';
|
||||
}
|
||||
$o .= '</form>';
|
||||
|
||||
// For users who have disabled Javascript
|
||||
$o .= '<script type=\'text/javascript\'>document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=true</script>';
|
||||
} else {
|
||||
// External link
|
||||
if ($v->link_external != '') {
|
||||
|
||||
if ($v->directlink == 1){
|
||||
$finalLink = $v->link_external;
|
||||
} else {
|
||||
$finalLink = Route::_(PhocaDownloadRoute::getFileRoute($v->id, $v->categoryid,$v->alias, $v->categoryalias, 0, 'download'));
|
||||
}
|
||||
|
||||
$o .= '<form action="" name="phocaDownloadForm" id="phocadownloadform" target="'.$this->t['download_external_link'].'">';
|
||||
$o .= '<input class="btn btn-success" type="button" name="submit" onClick="location.href=\''.$finalLink.'\';" id="pdlicensesubmit" value="'.Text::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
} else {
|
||||
$o .= '<form action="'.htmlspecialchars($this->t['action']).'" method="post" name="phocaDownloadForm" id="phocadownloadform">';
|
||||
$o .= '<input class="btn btn-success" type="submit" name="submit" id="pdlicensesubmit" value="'.Text::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
$o .= '<input type="hidden" name="license_agree" value="1" />';
|
||||
$o .= '<input type="hidden" name="download" value="'.$v->id.'" />';
|
||||
$o .= '<input type="hidden" name="'. Session::getFormToken().'" value="1" />';
|
||||
}
|
||||
$o .= '</form>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* if ($this->t['display_file_comments'] == 1) {
|
||||
if (ComponentHelper::isEnabled('com_jcomments', true)) {
|
||||
include_once(JPATH_BASE.'/components/com_jcomments/jcomments.php');
|
||||
$o .= JComments::showComments($v->id, 'com_phocadownload_files', Text::_('COM_PHOCADOWNLOAD_FILE') .' '. $v->title);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->t['display_file_comments'] == 2) {
|
||||
$o .= '<div class="pd-fbcomments">'.$this->loadTemplate('comments-fb').'</div>';
|
||||
}*/
|
||||
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
echo $o;
|
||||
echo '</div></div>'; // end col, end row
|
||||
|
||||
} else {
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
echo '<h3 class="pd-filename-txt">'.Text::_('COM_PHOCADOWNLOAD_FILE') .'</h3>';
|
||||
echo '<div class="pd-error">'.Text::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'</div>';
|
||||
echo '</div></div>'; // end col, end row
|
||||
}
|
||||
}
|
||||
echo '<div> </div>';// end of box
|
||||
} else {
|
||||
echo '<div> </div>';
|
||||
}
|
||||
echo '</div></div>';
|
||||
echo '<div class="pd-cb"> </div>';
|
||||
echo PhocaDownloadUtils::getInfo();
|
||||
?>
|
||||
40
components/com_phocadownload/views/file/tmpl/default.xml
Normal file
40
components/com_phocadownload/views/file/tmpl/default.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_PHOCADOWNLOAD_FILE_LAYOUT">
|
||||
<message>
|
||||
<![CDATA[COM_PHOCADOWNLOAD_FILE_LAYOUT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<name>COM_PHOCADOWNLOAD_FILE_LAYOUT</name>
|
||||
<description>COM_PHOCADOWNLOAD_FILE_LAYOUT_DESC</description>
|
||||
<fields name="request">
|
||||
<fieldset name="request" addfieldpath="/administrator/components/com_phocadownload/models/fields">
|
||||
|
||||
<field
|
||||
name="id"
|
||||
type="phocadownloadfile"
|
||||
section="com_phocadownload"
|
||||
class="form-control"
|
||||
default="0"
|
||||
label="COM_PHOCADOWNLOAD_FIELD_SELECT_FILE_LABEL"
|
||||
description="COM_PHOCADOWNLOAD_FIELD_SELECT_FILE_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>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
</metadata>
|
||||
@ -0,0 +1,392 @@
|
||||
<?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-file-box" class="pd-file-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());
|
||||
|
||||
if (!empty($this->category[0])) {
|
||||
echo '<div class="pd-file">';
|
||||
if ($this->t['display_up_icon'] == 1 && $this->t['tmplr'] == 0) {
|
||||
|
||||
if (isset($this->category[0]->id)) {
|
||||
if ($this->category[0]->id > 0) {
|
||||
$linkUp = JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->id, $this->category[0]->alias));
|
||||
$linkUpText = $this->category[0]->title;
|
||||
} 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-file"><div class="ph-top"></div>';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($this->file[0])) {
|
||||
$v = $this->file[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', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
if ($rightDisplay == 1) {
|
||||
|
||||
$l = new PhocaDownloadLayout();
|
||||
|
||||
//echo '<h3 class="pdfv-name">'.$l->getName($v->title, $v->filename, 1). '</h3>';
|
||||
echo PhocaDownloadRenderFront::renderSubHeader(array($l->getName($v->title, $v->filename, 1)), '', 'pd-ctitle pdfv-name');
|
||||
|
||||
|
||||
// =====================================================================================
|
||||
// BEGIN LAYOUT AREA
|
||||
// =====================================================================================
|
||||
|
||||
// Is this direct menu link to File View
|
||||
$directFv = 0;
|
||||
$app = JFactory::getApplication();
|
||||
$itemId = $app->input->get('Itemid', 0, 'int');
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getItem($itemId);
|
||||
if (isset($item->query['view']) && $item->query['view'] == 'file') {
|
||||
$directFv = 1;
|
||||
}
|
||||
// End direct menu link to File View
|
||||
|
||||
if ((int)$this->t['display_file_view'] == 1
|
||||
|| (int)$this->t['display_file_view'] == 2
|
||||
|| (int)$v->confirm_license > 0
|
||||
|| (int)$this->t['display_detail'] == 2
|
||||
|| (int)$this->t['display_detail'] == 3
|
||||
|| (int)$directFv == 1) {
|
||||
|
||||
$pdTitle = '';
|
||||
if ($v->title != '' && $this->t['filename_or_name'] != 'filenametitle') {
|
||||
$pdTitle .= '<div class="pd-title">'.$v->title.'</div>';
|
||||
}
|
||||
|
||||
$pdImage = '';
|
||||
if ($v->image_download != '') {
|
||||
$pdImage .= '<div class="pd-image">'.$l->getImageDownload($v->image_download).'</div>';
|
||||
}
|
||||
|
||||
$pdVideo = '';
|
||||
$pdVideo = $l->displayVideo($v->video_filename, 1);
|
||||
|
||||
if ($v->filename != '') {
|
||||
$imageFileName = $l->getImageFileName($v->image_filename, $v->filename);
|
||||
|
||||
$pdFile = '<div class="pd-filenamebox">';
|
||||
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 .= $l->getName($v->title, $v->filename);
|
||||
$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'] == 5 || $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";
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
|
||||
$pdVersion = '';
|
||||
if ($v->version != '') {
|
||||
$pdVersion .= '<div class="pd-version-txt">'.JText::_('COM_PHOCADOWNLOAD_VERSION').':</div>';
|
||||
$pdVersion .= '<div class="pd-fl-m">'.$v->version.'</div>';
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
|
||||
$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>';
|
||||
|
||||
/*for ($i = 2; $i < 1001; $i++) {
|
||||
if (($v->hits > 1 && $v->hits < 5)
|
||||
|| ($v->hits > $i * 10 + 1 && $v->hits < $i * 10 + 5)) {
|
||||
$numD = 'COM_PHOCADOWNLOAD_NUMBER_OF_DOWNLOADS_3';
|
||||
break;
|
||||
} elseif (($v->hits == 0)
|
||||
|| ($v->hits > 4 && $v->hits < 22)
|
||||
|| ($v->hits > $i * 10 + 4 && $v->hits < $i * 10 + 12)) {
|
||||
$numD = 'COM_PHOCADOWNLOAD_NUMBER_OF_DOWNLOADS_2';
|
||||
break;
|
||||
} elseif ($v->hits == 1) {
|
||||
$numD = 'COM_PHOCADOWNLOAD_NUMBER_OF_DOWNLOADS_1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$pdDownloads .= '<div class="pd-fl-m">'.$v->hits.' '.JText::_($numD).'</div>';
|
||||
*/
|
||||
}
|
||||
|
||||
$pdDescription = '';
|
||||
if ($l->isValueEditor($v->description)) {
|
||||
//$pdDescription .= '<div class="pd-fdesc">'.$v->description.'</div>';
|
||||
$pdDescription .= '<div class="pd-fdesc">'. Joomla\CMS\HTML\HTMLHelper::_('content.prepare', $v->description) . '</div>';
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
|
||||
|
||||
/// 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'] == 2 || $this->t['display_tags_links'] == 3) {
|
||||
$tags2 = $l->displayTags($v->id);
|
||||
if ($tags2 != '') {
|
||||
$pdTags .= '<div class="pd-float">'.$tags2.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// RENDER
|
||||
echo '<div class="pd-filebox">';
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
echo $pdTitle;
|
||||
echo $pdImage;
|
||||
echo $pdFile;
|
||||
echo $pdFileSize;
|
||||
echo $pdVersion;
|
||||
echo $pdLicense;
|
||||
echo $pdAuthor;
|
||||
echo $pdAuthorEmail;
|
||||
echo $pdFileDate;
|
||||
echo $pdDownloads;
|
||||
echo $pdDescription;
|
||||
echo $pdFeatures;
|
||||
echo $pdChangelog;
|
||||
echo $pdNotes;
|
||||
echo '<div class="pd-video">'.$pdVideo.'</div>';
|
||||
echo '<div class="pd-rating">'.$pdRating.'</div>';
|
||||
echo '</div></div>'; // end col, end row
|
||||
|
||||
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
if ($this->t['display_mirror_links'] == 5 || $this->t['display_mirror_links'] == 6) {
|
||||
echo '<div class="pd-buttons-bp">'.$pdMirrorLink2.'</div>';
|
||||
echo '<div class="pd-buttons-bp">'.$pdMirrorLink1.'</div>';
|
||||
} else if ($this->t['display_mirror_links'] == 2 || $this->t['display_mirror_links'] == 3) {
|
||||
echo '<div class="pd-mirrors">'.$pdMirrorLink2.$pdMirrorLink1.'</div>';
|
||||
}
|
||||
|
||||
echo '<div class="pd-report">'.$pdReportLink.'</div>';
|
||||
echo '<div class="pd-tags">'.$pdTags.'</div>';
|
||||
echo '<div class="pd-cb"></div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</div></div>'; // end col, end row
|
||||
|
||||
|
||||
$o = '<div class="pd-cb"> </div>';
|
||||
|
||||
if ((int)$v->confirm_license > 0) {
|
||||
$o .= '<h4 class="pdfv-confirm-lic-text">'.JText::_('COM_PHOCADOWNLOAD_LICENSE_AGREEMENT').'</h4>';
|
||||
$o .= '<div id="phoca-dl-license" style="height:'.(int)$this->t['licenseboxheight'].'px">'.$v->licensetext.'</div>';
|
||||
|
||||
// External link
|
||||
if ($v->link_external != '' && $v->directlink == 1) {
|
||||
$o .= '<form action="" name="phocaDownloadForm" id="phocadownloadform" target="'.$this->t['download_external_link'].'">';
|
||||
$o .= '<input type="checkbox" name="license_agree" onclick="enableDownloadPD()" /> <span>'.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').'</span> ';
|
||||
$o .= '<input class="btn btn-success" type="button" name="submit" onClick="location.href=\''.$v->link_external.'\';" id="pdlicensesubmit" value="'.JText::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
} else {
|
||||
$o .= '<form action="'.htmlspecialchars($this->t['action']).'" method="post" name="phocaDownloadForm" id="phocadownloadform">';
|
||||
$o .= '<input type="checkbox" name="license_agree" onclick="enableDownloadPD()" /> <span>'.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').'</span> ';
|
||||
$o .= '<input class="btn btn-success" type="submit" name="submit" id="pdlicensesubmit" value="'.JText::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
$o .= '<input type="hidden" name="download" value="'.$v->id.'" />';
|
||||
$o .= '<input type="hidden" name="'. JSession::getFormToken().'" value="1" />';
|
||||
}
|
||||
$o .= '</form>';
|
||||
|
||||
// For users who have disabled Javascript
|
||||
$o .= '<script type=\'text/javascript\'>document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=true</script>';
|
||||
} else {
|
||||
// External link
|
||||
if ($v->link_external != '') {
|
||||
$o .= '<form action="" name="phocaDownloadForm" id="phocadownloadform" target="'.$this->t['download_external_link'].'">';
|
||||
$o .= '<input class="btn btn-success" type="button" name="submit" onClick="location.href=\''.$v->link_external.'\';" id="pdlicensesubmit" value="'.JText::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
} else {
|
||||
$o .= '<form action="'.htmlspecialchars($this->t['action']).'" method="post" name="phocaDownloadForm" id="phocadownloadform">';
|
||||
$o .= '<input class="btn btn-success" type="submit" name="submit" id="pdlicensesubmit" value="'.JText::_('COM_PHOCADOWNLOAD_DOWNLOAD').'" />';
|
||||
$o .= '<input type="hidden" name="license_agree" value="1" />';
|
||||
$o .= '<input type="hidden" name="download" value="'.$v->id.'" />';
|
||||
$o .= '<input type="hidden" name="'. JSession::getFormToken().'" value="1" />';
|
||||
}
|
||||
$o .= '</form>';
|
||||
}
|
||||
|
||||
|
||||
if ($this->t['display_file_comments'] == 1) {
|
||||
if (JComponentHelper::isEnabled('com_jcomments', true)) {
|
||||
include_once(JPATH_BASE.'/components/com_jcomments/jcomments.php');
|
||||
$o .= JComments::showComments($v->id, 'com_phocadownload_files', JText::_('COM_PHOCADOWNLOAD_FILE') .' '. $v->title);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->t['display_file_comments'] == 2) {
|
||||
$o .= '<div class="pd-fbcomments">'.$this->loadTemplate('comments-fb').'</div>';
|
||||
}
|
||||
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
echo $o;
|
||||
echo '</div></div>'; // end col, end row
|
||||
|
||||
} else {
|
||||
echo '<div class="row ">';
|
||||
echo '<div class="col-sm-12 col-md-12">';
|
||||
echo '<h3 class="pd-filename-txt">'.JText::_('COM_PHOCADOWNLOAD_FILE') .'</h3>';
|
||||
echo '<div class="pd-error">'.JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'</div>';
|
||||
echo '</div></div>'; // end col, end row
|
||||
}
|
||||
}
|
||||
echo '<div> </div>';// end of box
|
||||
} else {
|
||||
echo '<div> </div>';
|
||||
}
|
||||
echo '</div></div>';
|
||||
echo '<div class="pd-cb"> </div>';
|
||||
echo PhocaDownloadUtils::getInfo();
|
||||
?>
|
||||
@ -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>
|
||||
1
components/com_phocadownload/views/file/tmpl/index.html
Normal file
1
components/com_phocadownload/views/file/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
362
components/com_phocadownload/views/file/view.html.php
Normal file
362
components/com_phocadownload/views/file/view.html.php
Normal file
@ -0,0 +1,362 @@
|
||||
<?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\Session\Session;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
jimport( 'joomla.application.component.view');
|
||||
jimport( 'joomla.filesystem.folder' );
|
||||
jimport( 'joomla.filesystem.file' );
|
||||
|
||||
class PhocaDownloadViewFile extends HtmlView
|
||||
{
|
||||
protected $file;
|
||||
protected $category;
|
||||
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();
|
||||
$fileId = $app->input->get('id', 0, 'int');
|
||||
|
||||
//if ($fileId == 0) {
|
||||
// throw new Exception(JText::_('COM_PHOCADOWNLOAD_FILE_NOT_FOUND'), 404);
|
||||
//}
|
||||
|
||||
$this->t['limitstart'] = $app->input->get( 'start', 0, 'int');// we need it for category back link
|
||||
$this->t['tmpl'] = $app->input->get( 'tmpl', '', 'string' );
|
||||
$this->t['mediapath'] = PhocaDownloadPath::getPathMedia();
|
||||
|
||||
$this->t['tmplr'] = 0;
|
||||
if ($this->t['tmpl'] == 'component') {
|
||||
$this->t['tmplr'] = 1;
|
||||
}
|
||||
|
||||
if ($this->t['limitstart'] > 0 ) {
|
||||
$this->t['limitstarturl'] = '&start='.$this->t['limitstart'];
|
||||
} else {
|
||||
$this->t['limitstarturl'] = '';
|
||||
}
|
||||
|
||||
$this->category = $model->getCategory($fileId);
|
||||
$this->file = $model->getFile($fileId, $this->t['limitstarturl']);
|
||||
|
||||
PhocaDownloadRenderFront::renderMainJs();
|
||||
PhocaDownloadRenderFront::renderAllCSS();
|
||||
|
||||
$document->addCustomTag('<script type="text/javascript" src="'.Uri::root().'media/com_phocadownload/js/overlib/overlib_mini.js"></script>');
|
||||
$js = 'var enableDownloadButtonPD = 0;'
|
||||
.'function enableDownloadPD() {'
|
||||
.' if (enableDownloadButtonPD == 0) {'
|
||||
.' document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=false;'
|
||||
.' enableDownloadButtonPD = 1;'
|
||||
.' } else {'
|
||||
.' document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=true;'
|
||||
.' enableDownloadButtonPD = 0;'
|
||||
.' }'
|
||||
.'}';
|
||||
$document->addScriptDeclaration($js);
|
||||
|
||||
|
||||
// Params
|
||||
$this->t['licenseboxheight'] = $this->t['p']->get( 'license_box_height', 300 );
|
||||
$this->t['filename_or_name'] = $this->t['p']->get( 'filename_or_name', 'filename' );
|
||||
$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_file_comments'] = $this->t['p']->get( 'display_file_comments', 0 );
|
||||
$this->t['file_icon_size'] = $this->t['p']->get( 'file_icon_size', 16 );
|
||||
$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_downloads'] = $this->t['p']->get( 'display_downloads', 0 );
|
||||
$this->t['display_date_type'] = $this->t['p']->get( 'display_date_type', 0 );
|
||||
$this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 );
|
||||
$this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 );
|
||||
$this->t['pw'] = PhocaDownloadRenderFront::renderPhocaDownload();
|
||||
$this->t['download_external_link'] = $this->t['p']->get( 'download_external_link', '_self' );
|
||||
$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_rating_file'] = $this->t['p']->get( 'display_rating_file', 0 );
|
||||
$this->t['display_tags_links'] = $this->t['p']->get( 'display_tags_links', 0 );
|
||||
$this->t['display_mirror_links'] = $this->t['p']->get( 'display_mirror_links', 0 );
|
||||
$this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 );
|
||||
$this->t['display_detail'] = $this->t['p']->get( 'display_detail', 1);
|
||||
$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', '' );
|
||||
|
||||
// Rating
|
||||
if ($this->t['display_rating_file'] == 2 || $this->t['display_rating_file'] == 3 ) {
|
||||
HTMLHelper::_('jquery.framework', true);
|
||||
PhocaDownloadRate::renderRateFileJS(1);
|
||||
$this->t['display_rating_file'] = 1;
|
||||
} else {
|
||||
$this->t['display_rating_file'] = 0;
|
||||
}
|
||||
|
||||
// DOWNLOAD
|
||||
// - - - - - - - - - - - - - - -
|
||||
$download = $app->input->get( 'download', array(0), 'array' );
|
||||
$licenseAgree = $app->input->get( 'license_agree', '', 'string' );
|
||||
$downloadId = (int) $download[0];
|
||||
if ($downloadId > 0) {
|
||||
if (isset($this->file[0]->id)) {
|
||||
$currentLink = 'index.php?option=com_phocadownload&view=file&id='.$this->file[0]->id.':'.$this->file[0]->alias. $this->t['limitstarturl'] . '&Itemid='. $app->input->get('Itemid', 0, 'int');
|
||||
} else {
|
||||
$currentLink = 'index.php?option=com_phocadownload&view=categories&Itemid='. $app->input->get('Itemid', 0, 'int');
|
||||
}
|
||||
|
||||
// Check Token
|
||||
if (!Session::checkToken()) {
|
||||
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_INVALID_TOKEN"), 'error');
|
||||
$app->redirect(Route::_('index.php', false));
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check License Agreement
|
||||
if (empty($licenseAgree)) {
|
||||
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_WARNING_AGREE_LICENSE_TERMS"), 'error');
|
||||
$app->redirect(Route::_($currentLink, false));
|
||||
exit;
|
||||
}
|
||||
|
||||
$fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink);
|
||||
PhocaDownloadDownload::download($fileData, $downloadId, $currentLink);
|
||||
}
|
||||
// - - - - - - - - - - - - - - -
|
||||
|
||||
$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]) && isset($this->file[0]) && is_object($this->file[0])){
|
||||
$this->_prepareDocument($this->category[0], $this->file[0]);
|
||||
}
|
||||
|
||||
|
||||
// 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(JUri::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);
|
||||
}
|
||||
*/
|
||||
|
||||
// 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, $this->file[0]);
|
||||
|
||||
|
||||
parent::display($tpl);
|
||||
|
||||
}
|
||||
|
||||
protected function _prepareDocument($category, $file) {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$menu = $menus->getActive();
|
||||
$pathway = $app->getPathway();
|
||||
$title = null;
|
||||
|
||||
$this->t['downloadmetakey'] = $this->t['p']->get( 'download_metakey', '' );
|
||||
$this->t['downloadmetadesc'] = $this->t['p']->get( 'download_metadesc', '' );
|
||||
|
||||
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_file_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_file_name_title'] == 1 && isset($file->title) && $file->title != '') {
|
||||
$title = $title .' - ' . $file->title;
|
||||
}
|
||||
|
||||
} else if ($app->get('sitename_pagetitles', 0) == 2) {
|
||||
|
||||
if ($this->t['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') {
|
||||
$title = $title .' - ' . $file->title;
|
||||
}
|
||||
|
||||
$title = Text::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->get('sitename')));
|
||||
}
|
||||
|
||||
$this->document->setTitle($title);
|
||||
|
||||
|
||||
if ($file->metadesc != '') {
|
||||
$this->document->setDescription($file->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 ($file->metakey != '') {
|
||||
$this->document->setMetadata('keywords', $file->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($category->id)) {
|
||||
if ($category->id > 0) {
|
||||
$pathway->addItem($category->title, Route::_(PhocaDownloadRoute::getCategoryRoute($category->id, $category->alias)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($file->title)) {
|
||||
$pathway->addItem($file->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, $file)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$i = 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));
|
||||
}
|
||||
}
|
||||
|
||||
// Add the file title
|
||||
$pathway->addItem($file->title);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user