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,42 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
jimport('joomla.application.component.controller');
class PhocaDownloadController extends BaseController
{
public function display($cachable = false, $urlparams = false)
{
$paramsC = ComponentHelper::getParams('com_phocadownload');
$cache = $paramsC->get( 'enable_cache', 0 );
$cachable = false;
if ($cache == 1) {
$cachable = true;
}
$document = Factory::getDocument();
$safeurlparams = array('catid'=>'INT','id'=>'INT','cid'=>'ARRAY','year'=>'INT','month'=>'INT','limit'=>'INT','limitstart'=>'INT',
'showall'=>'INT','return'=>'BASE64','filter'=>'STRING','filter_order'=>'CMD','filter_order_Dir'=>'CMD','filter-search'=>'STRING','print'=>'BOOLEAN','lang'=>'CMD');
parent::display($cachable,$safeurlparams);
return $this;
}
}
?>

View File

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

View File

@ -0,0 +1,153 @@
<?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\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
class PhocaDownloadControllerUser extends PhocaDownloadController
{
public $loginUrl;
public $loginString;
public $url;
public $itemId;
function __construct() {
parent::__construct();
$this->registerTask( 'unpublish', 'unpublish' );
$app = Factory::getApplication();
$this->itemId = $app->input->get( 'Itemid', 0, 'int' );
$this->loginUrl = Route::_('index.php?option=com_users&view=login', false);
$this->loginString = Text::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION');
$this->url = 'index.php?option=com_phocadownload&view=user&Itemid='. $this->itemId;
}
/*
function display() {
if ( ! Factory::getApplication()->input->getCmd( 'view' ) ) {
$this->input->set('view', 'user' );
}
parent::display();
}*/
function unpublish() {
$app = Factory::getApplication();
$post['id'] = $app->input->get( 'actionid', '', 'int', 0 );
$post['limitstart'] = $app->input->get( 'limitstart', '', 'int', 0 );
$model = $this->getModel('user');
//$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id);
// USER RIGHT - Delete - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
$user = Factory::getUser();
$rightDisplayDelete = 0;
$catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$post['id']);
if (!empty($catAccess)) {
$rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplayDelete) {
if(!$model->publish((int)$post['id'], 0)) {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_UNPUBLISHING_ITEM');
} else {
$msg = Text::_('COM_PHOCADOWNLOAD_SUCCESS_UNPUBLISHING_ITEM');
}
} else {
$app->enqueueMessage($this->loginString, 'error');
$app->redirect($this->loginUrl);
exit;
}
$lSO = '';
if ($post['limitstart'] != '') {
$lSO = '&limitstart='.(int)$post['limitstart'];
}
$this->setRedirect( Route::_($this->url. $lSO, false), $msg );
}
function publish() {
$app = Factory::getApplication();
$post['id'] = $app->input->get( 'actionid', '', 'int', 0 );
$post['limitstart'] = $app->input->get( 'limitstart', '', 'int', 0 );
$model = $this->getModel('user');
//$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id);
// USER RIGHT - Delete - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
$user = Factory::getUser();
$rightDisplayDelete = 0;
$catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$post['id']);
if (!empty($catAccess)) {
$rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplayDelete) {
if(!$model->publish((int)$post['id'], 1)) {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_PUBLISHING_ITEM');
} else {
$msg = Text::_('COM_PHOCADOWNLOAD_SUCCESS_PUBLISHING_ITEM');
}
} else {
$app->enqueueMessage($this->loginString, 'error');
$app->redirect($this->loginUrl);
exit;
}
$lSO = '';
if ($post['limitstart'] != '') {
$lSO = '&limitstart='.(int)$post['limitstart'];
}
$this->setRedirect( Route::_($this->url. $lSO, false), $msg );
}
function delete() {
$app = Factory::getApplication();
$post['id'] = $app->input->get( 'actionid', '', 'int', 0 );
$post['limitstart'] = $app->input->get( 'limitstart', '', 'int', 0 );
$model = $this->getModel('user');
//$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id);
// USER RIGHT - Delete - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
$user = Factory::getUser();
$rightDisplayDelete = 0;
$catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$post['id']);
if (!empty($catAccess)) {
$rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplayDelete) {
if(!$model->delete((int)$post['id'])) {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_DELETING_ITEM');
} else {
$msg = Text::_('COM_PHOCADOWNLOAD_SUCCESS_DELETING_ITEM');
}
} else {
$app->enqueueMessage($this->loginString, 'error');
$app->redirect($this->loginUrl);
exit;
}
$lSO = '';
if ($post['limitstart'] != '') {
$lSO = '&limitstart='.(int)$post['limitstart'];
}
$this->setRedirect( Route::_($this->url. $lSO, false), $msg );
}
}
?>

View File

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

View File

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

View File

@ -0,0 +1,34 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Gallery
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die('Restricted access');
$d = $displayData;
$t = $d['t'];
?><div class="modal fade" id="pdCategoryModal" tabindex="-1" aria-labelledby="pdCategoryModal" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="pdCategoryModalLabel"><?php echo Text::_('COM_PHOCADOWNLOAD_TITLE') ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="<?php echo Text::_('COM_PHOCADOWNLOAD_CLOSE') ?>"></button>
</div>
<div class="modal-body">
<iframe id="pdCategoryModalIframe" height="100%" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo Text::_('COM_PHOCADOWNLOAD_CLOSE') ?></button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,263 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
jimport('joomla.application.component.model');
class PhocaDownloadModelCategories extends BaseDatabaseModel
{
var $_categories = null;
var $_most_viewed_docs = null;
var $_categories_ordering = null;
var $_category_ordering = null;
function __construct() {
$app = Factory::getApplication();
parent::__construct();
$this->setState('filter.language',$app->getLanguageFilter());
}
function getCategoriesList() {
if (empty($this->_categories)) {
$query = $this->_getCategoriesListQuery();
//$this->_categories = $this->_getList( $query );
$categories = $this->_getList( $query );
if (!empty($categories)) {
// Parent Only
foreach ($categories as $k => $v) {
if ($v->parent_id == 0) {
$this->_categories[$v->id] = $categories[$k];
}
}
// Subcategories
foreach ($categories as $k => $v) {
if (isset($this->_categories[$v->parent_id])) {
$this->_categories[$v->parent_id]->subcategories[] = $categories[$k];
$this->_categories[$v->parent_id]->numsubcat++;
}
}
}
/*
$this->categories = $this->_getList( $query );
if (!empty($this->categories)) {
foreach ($this->categories as $key => $value) {
$query = $this->getCategoriesListQuery( $value->id, $categoriesOrdering );
$this->categories[$key]->subcategories = $this->_getList( $query );
}
}*/
}
return $this->_categories;
}
/*
* Get only parent categories
*/
function _getCategoriesListQuery( ) {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
$display_categories = $params->get('display_categories', '');
$hide_categories = $params->get('hide_categoriess', '');
if ( $display_categories != '' ) {
$wheres[] = " cc.id IN (".$display_categories.")";
}
if ( $hide_categories != '' ) {
$wheres[] = " cc.id NOT IN (".$hide_categories.")";
}
//$wheres[] = " cc.parent_id = 0";
$wheres[] = " cc.published = 1";
$wheres[] = " cc.access IN (".$userLevels.")";
if ($this->getState('filter.language')) {
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
$categoriesOrdering = $this->_getCategoryOrdering();
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetCategoriesList', array (&$wheres, &$joins, $params));
// END GWE MOD
}
$query = " SELECT cc.id, cc.parent_id, cc.title, cc.alias, cc.image, cc.access, cc.description, cc.accessuserid, COUNT(c.id) AS numdoc, 0 AS numsubcat"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " GROUP BY cc.id, cc.parent_id, cc.title, cc.image, cc.alias, cc.access, cc.description, cc.accessuserid"
. " ORDER BY ".$categoriesOrdering;
return $query;
}
/*
* Get only first level under parent categories
*/
function _getCategoryListQuery( $parentCatId ) {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
$display_categories = $params->get('display_categories', '');
$hide_categories = $params->get('hide_categoriess', '');
if ( $display_categories != '' ) {
$wheres[] = " cc.id IN (".$display_categories.")";
}
if ( $hide_categories != '' ) {
$wheres[] = " cc.id NOT IN (".$hide_categories.")";
}
$wheres[] = " cc.parent_id = ".(int)$parentCatId;
$wheres[] = " cc.published = 1";
$wheres[] = " cc.access IN (".$userLevels.")";
if ($this->getState('filter.language')) {
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
$categoryOrdering = $this->_getCategoryOrdering();
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetCategoryList', array (&$wheres, &$joins, $params));
// END GWE MOD
}
$query = " SELECT cc.id, cc.title, cc.alias, cc.image, cc.access, cc.accessuserid, COUNT(c.id) AS numdoc"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " GROUP BY cc.id, cc.title, cc.alias, cc.image, cc.access, cc.accessuserid"
. " ORDER BY ".$categoryOrdering;
return $query;
}
function getMostViewedDocsList() {
if (empty($this->_most_viewed_docs)) {
$query = $this->_getMostViewedDocsListQuery();
$this->_most_viewed_docs = $this->_getList( $query );
}
return $this->_most_viewed_docs;
}
function _getMostViewedDocsListQuery() {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
$most_viewed_docs_num = $params->get( 'most_download_files_num', 5 );
$display_categories = $params->get('display_categories', '');
$hide_categories = $params->get('hide_categoriess', '');
if ( $display_categories != '' ) {
$wheres[] = " cc.id IN (".$display_categories.")";
}
if ( $hide_categories != '' ) {
$wheres[] = " cc.id NOT IN (".$hide_categories.")";
}
$wheres[] = " c.catid= cc.id";
$wheres[] = " c.published= 1";
$wheres[] = " c.approved= 1";
$wheres[] = " c.textonly= 0";
$wheres[] = " cc.access IN (".$userLevels.")";
$wheres[] = " c.access IN (".$userLevels.")";
if ($this->getState('filter.language')) {
$wheres[] = ' c.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
// Active
$jnow = Factory::getDate();
$now = $jnow->toSql();
$nullDate = $this->_db->getNullDate();
$wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )';
$wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )';
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetMostViewedDocs', array (&$wheres, &$joins, 0, $params));
// END GWE MOD
}
$query = " SELECT c.id, c.title, c.alias, c.filename, c.date, c.hits, c.image_filename, cc.id AS categoryid, cc.access as cataccess, cc.accessuserid as cataccessuserid, cc.title AS categorytitle, cc.alias AS categoryalias "
." FROM #__phocadownload AS c, #__phocadownload_categories AS cc"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " ORDER BY c.hits DESC"
. " LIMIT ".(int)$most_viewed_docs_num;
return $query;
}
function _getCategoryOrdering() {
if (empty($this->_category_ordering)) {
$app = Factory::getApplication();
$params = $app->getParams();
$ordering = $params->get( 'category_ordering', 1 );
$this->_category_ordering = PhocaDownloadOrdering::getOrderingText($ordering, 2);
}
return $this->_category_ordering;
}
}
?>

View File

@ -0,0 +1,279 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
jimport('joomla.application.component.model');
class PhocaDownloadModelCategory extends BaseDatabaseModel
{
var $_document = null;
var $_category = null;
var $_subcategories = null;
var $_filename = null;
var $_directlink = 0;
var $_file_ordering = null;
var $_category_ordering = null;
var $file_ordering_select = null;
var $category_ordering_select = null;
var $_pagination = null;
var $_total = null;
var $_context = 'com_phocadownload.category';
function __construct() {
$app = Factory::getApplication();
parent::__construct();
$config = Factory::getConfig();
//$paramsC = JComponentHelper::getParams('com_phocadownload') ;
$paramsC = $app->getParams();
$defaultPagination = (int)$paramsC->get( 'default_pagination', '20' );
$file_ordering = $paramsC->get( 'file_ordering', 1 );
$context = $this->_context.'.';
// Get the pagination request variables
$this->setState('limit', $app->getUserStateFromRequest($context.'limit', 'limit', $defaultPagination, 'int'));
$this->setState('limitstart', $app->input->get('limitstart', 0, 'int'));
// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
$this->setState('filter.language',$app->getLanguageFilter());
$this->setState('fileordering', $app->getUserStateFromRequest($context .'fileordering', 'fileordering', $file_ordering, 'int'));
// Get the filter request variables
$this->setState('filter_order', Factory::getApplication()->input->getCmd('filter_order', 'ordering'));
$this->setState('filter_order_dir', Factory::getApplication()->input->getCmd('filter_order_Dir', 'ASC'));
}
function getPagination($categoryId, $tagId) {
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new PhocaDownloadPagination( $this->getTotal($categoryId, $tagId), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
function getTotal($categoryId, $tagId) {
if (empty($this->_total)) {
$query = $this->_getFileListQuery($categoryId, $tagId, 1);
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}
function getFileList($categoryId, $tagId) {
if (empty($this->_document)) {
$query = $this->_getFileListQuery( $categoryId, $tagId);
$this->_document= $this->_getList( $query ,$this->getState('limitstart'), $this->getState('limit'));
}
return $this->_document;
}
function getCategory($categoryId) {
if (empty($this->_category)) {
$query = $this->_getCategoriesQuery( $categoryId, FALSE );
$this->_category = $this->_getList( $query, 0, 1 );
}
return $this->_category;
}
function getSubcategories($categoryId) {
if (empty($this->_subcategories)) {
$query = $this->_getCategoriesQuery( $categoryId, TRUE );
$this->_subcategories = $this->_getList( $query );
}
return $this->_subcategories;
}
function _getFileListQuery( $categoryId, $tagId = 0, $count = 0 ) {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
if ((int)$tagId > 0) {
$wheres[] = ' t.tagid= '.(int)$tagId;
} else {
$wheres[] = ' c.catid= '.(int)$categoryId;
}
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access IN ('.$userLevels.') ) )';
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access IN ('.$userLevels.') ) )';
$wheres[] = ' c.published = 1';
$wheres[] = ' c.approved = 1';
$wheres[] = ' cc.published = 1';
if ($this->getState('filter.language')) {
$wheres[] = ' c.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
// Active
$jnow = Factory::getDate();
$now = $jnow->toSql();
$nullDate = $this->_db->getNullDate();
$wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )';
$wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )';
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetFileList', array (&$wheres, &$joins,$categoryId , $params));
// END GWE MOD
}
$fileOrdering = $this->_getFileOrdering();
if ($count == 1) {
$query = ' SELECT c.id'
.' FROM #__phocadownload AS c'
.' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid';
if ((int)$tagId > 0) {
$query .= ' LEFT JOIN #__phocadownload_tags_ref AS t ON t.fileid = c.id';
}
$query .= ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. ' WHERE ' . implode( ' AND ', $wheres )
//. ' ORDER BY '.$fileOrdering;
. ' ORDER BY c.id';
} else {
$query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid '
.' FROM #__phocadownload AS c'
.' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid';
if ((int)$tagId > 0) {
$query .= ' LEFT JOIN #__phocadownload_tags_ref AS t ON t.fileid = c.id';
}
$query .= ' LEFT JOIN #__phocadownload_file_votes_statistics AS r ON r.fileid = c.id';
$query .= ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. ' WHERE ' . implode( ' AND ', $wheres )
. ' ORDER BY '.$fileOrdering;
}
return $query;
}
function _getCategoriesQuery( $categoryId, $subcategories = FALSE ) {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
// Get the current category or get parent categories of the current category
if ($subcategories) {
$wheres[] = " cc.parent_id = ".(int)$categoryId;
$categoryOrdering = $this->_getCategoryOrdering();
} else {
$wheres[] = " cc.id= ".(int)$categoryId;
}
$wheres[] = " cc.access IN (".$userLevels.")";
$wheres[] = " cc.published = 1";
if ($this->getState('filter.language')) {
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetCategory', array (&$wheres, &$joins,$categoryId , $params));
// END GWE MOD
}
if ($subcategories) {
$query = " SELECT cc.id, cc.title, cc.alias, cc.access as cataccess, cc.accessuserid as cataccessuserid, COUNT(c.id) AS numdoc"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " GROUP BY cc.id, cc.title, cc.alias, cc.access, cc.accessuserid"
. " ORDER BY ".$categoryOrdering;
} else {
$query = " SELECT cc.id, cc.title, cc.alias, cc.access as cataccess, cc.accessuserid as cataccessuserid, cc.description, cc.metakey, cc.metadesc, pc.title as parenttitle, cc.parent_id as parent_id, pc.alias as parentalias"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload_categories AS pc ON pc.id = cc.parent_id"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " ORDER BY cc.ordering";
}
return $query;
}
function _getFileOrdering() {
if (empty($this->_file_ordering)) {
$ordering = $this->getState('fileordering');
$this->_file_ordering = PhocaDownloadOrdering::getOrderingText($ordering);
}
return $this->_file_ordering;
}
public function getFileOrderingSelect() {
if(empty($this->file_ordering_select)) {
$this->file_ordering_select = PhocaDownloadOrdering::renderOrderingFront($this->getState('fileordering'), 1);
}
return $this->file_ordering_select;
}
function _getCategoryOrdering() {
if (empty($this->_category_ordering)) {
$app = Factory::getApplication();
$params = $app->getParams();
$ordering = $params->get( 'category_ordering', 1 );
$this->_category_ordering = PhocaDownloadOrdering::getOrderingText($ordering, 2);
}
return $this->_category_ordering;
}
}
?>

View File

@ -0,0 +1,83 @@
<?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\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
jimport('joomla.application.component.model');
class PhocaDownloadModelDownload extends BaseDatabaseModel
{
var $_file = null;
var $_category = null;
var $_filename = null;
var $_directlink = 0;
function __construct() {
$app = Factory::getApplication();
parent::__construct();
$this->setState('filter.language',$app->getLanguageFilter());
}
function getFile( $downloadToken) {
if (empty($this->_file)) {
$query = $this->_getFileQuery( $downloadToken);
$this->_file = $this->_getList( $query, 0 , 1 );
// Don't display file if user has no access
// - - - - - - - - - - - - - - -
if (empty($this->_file)) {
return null;
}
// - - - - - - - - - - - - - - - -
}
return $this->_file;
}
function _getFileQuery( $downloadToken ) {
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$pQ = $params->get( 'enable_plugin_query', 0 );
$wheres[] = " c.approved = 1";
$wheres[] = " c.published = 1";
$wheres[] = " c.token = " . $this->_db->Quote($downloadToken);
// Active
$jnow = Factory::getDate();
$now = $jnow->toSql();
$nullDate = $this->_db->getNullDate();
$wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )';
$wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )';
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetFile', array (&$wheres, &$joins, $fileId, $params));
// END GWE MOD
}
$query = ' SELECT c.*, lc.title AS licensetitle, lc.description AS licensetext, lc.id AS licenseid'
.' FROM #__phocadownload AS c'
.' LEFT JOIN #__phocadownload_licenses AS lc ON lc.id = c.confirm_license'
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
.' WHERE ' . implode( ' AND ', $wheres )
.' ORDER BY c.ordering';
return $query;
}
}
?>

View File

@ -0,0 +1,177 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Plugin\PluginHelper;
jimport('joomla.application.component.model');
class PhocaDownloadModelFile extends BaseDatabaseModel
{
var $_file = null;
var $_category = null;
var $_section = null;
var $_filename = null;
var $_directlink = 0;
function __construct() {
$app = Factory::getApplication();
parent::__construct();
$this->setState('filter.language',$app->getLanguageFilter());
}
function getFile( $fileId, $limitstartUrl) {
if (empty($this->_file)) {
$query = $this->_getFileQuery( $fileId );
$this->_file = $this->_getList( $query, 0 , 1 );
// Don't display file if user has no access
// - - - - - - - - - - - - - - -
if (empty($this->_file)) {
return null;
}
if (isset($this->_file[0]->access)) {
$app = Factory::getApplication();
$user = Factory::getUser();
if (!in_array($this->_file[0]->access, $user->getAuthorisedViewLevels())) {
//$app->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("Please login to download the file"));
// Return URL
$return = 'index.php?option=com_phocadownload&view=file&catid='.$this->_file[0]->catid.':'.$this->_file[0]->categoryalias
. '&id='.$this->_file[0]->id.':'.$this->_file[0]->alias. $limitstartUrl . '&Itemid='. $app->input->get('Itemid', 0, 'int');
$returnUrl = 'index.php?option=com_users&view=login&return='.base64_encode($return);
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_PLEASE_LOGIN_DOWNLOAD_FILE"), 'error');
$app->redirect(Route::_($returnUrl, false));
return;
}
} else {
return null;
}
// - - - - - - - - - - - - - - - -
}
return $this->_file;
}
function _getFileQuery( $fileId ) {
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
$categoryId = 0;
$category = $this->getCategory($fileId);
if (isset($category[0]->id)) {
$categoryId = $category[0]->id;
}
$wheres[] = " c.catid= ".(int) $categoryId;
$wheres[] = " c.catid= cc.id";
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access IN ('.$userLevels.') ) )';
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access IN ('.$userLevels.') ) )';
$wheres[] = " c.published = 1";
$wheres[] = " c.approved = 1";
$wheres[] = " cc.published = 1";
$wheres[] = " c.id = " . (int) $fileId;
if ($this->getState('filter.language')) {
$wheres[] = ' c.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
// Active
$jnow = Factory::getDate();
$now = $jnow->toSql();
$nullDate = $this->_db->getNullDate();
$wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )';
$wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )';
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetFile', array (&$wheres, &$joins, $fileId, $params));
// END GWE MOD
}
$query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid, lc.title AS licensetitle, lc.description AS licensetext, lc.id AS licenseid'
.' FROM #__phocadownload AS c'
.' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid'
.' LEFT JOIN #__phocadownload_licenses AS lc ON lc.id = c.confirm_license'
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
.' WHERE ' . implode( ' AND ', $wheres )
.' ORDER BY c.ordering';
return $query;
}
function getCategory($fileId) {
if (empty($this->_category)) {
$query = $this->_getCategoryQuery( $fileId );
$this->_category= $this->_getList( $query, 0, 1 );
}
return $this->_category;
}
function _getCategoryQuery( $fileId ) {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
$wheres[] = " c.id= ".(int)$fileId;
$wheres[] = " cc.access IN (".$userLevels.")";
$wheres[] = " cc.published = 1";
if ($this->getState('filter.language')) {
$wheres[] = ' c.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetCategory', array (&$wheres, &$joins, $fileId, $params));
// END GWE MOD
}
$query = " SELECT cc.id, cc.title, cc.alias, cc.description, cc.access as cataccess, cc.accessuserid as cataccessuserid, cc.parent_id as parent_id"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " ORDER BY cc.ordering";
return $query;
}
}
?>

View File

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

View File

@ -0,0 +1,82 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
jimport('joomla.application.component.model');
class PhocaDownloadModelPhocaDownloadLinkCat extends BaseDatabaseModel
{
//var $_data_sec;
var $_data_cat;
function __construct() {
parent::__construct();
}
/*
function &getDataSec() {
if ($this->_loadDataSec()) {
} else {
$this->_initDataSec();
}
return $this->_data_sec;
}*/
function &getDataCat($sectionList) {
if ($this->_loadDataCat($sectionList)) {
} else {
$this->_initDataCat();
}
return $this->_data_cat;
}
/*
function _loadDataSec() {
if (empty($this->_data_sec)) {
$query = 'SELECT s.id, s.title'
. ' FROM #__phocadownload_sections AS s'
. ' WHERE s.published = 1'
. ' ORDER BY s.ordering';
$this->_db->setQuery($query);
$this->_data_sec = $this->_db->loadObjectList();
return (boolean) $this->_data_sec;
}
return true;
}*/
/*
function _loadDataCat($sectionList) {
if (empty($this->_data_cat)) {
$query = 'SELECT c.id, c.title, c.section'
.' FROM #__phocadownload_categories AS c'
.' WHERE c.section IN ( \''.$sectionList.'\' )'
.' AND c.published = 1'
.' ORDER BY c.ordering';
$this->_db->setQuery($query);
$this->_data_cat = $this->_db->loadObjectList();
return (boolean) $this->_data_cat;
}
return true;
}*/
/*
function _initDataSec() {
if (empty($this->_data_sec)) {
return (boolean) array();
}
return true;
}*/
function _initDataCat() {
if (empty($this->_data_cat)) {
return (boolean) array();
}
return true;
}
}
?>

View File

@ -0,0 +1,221 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\Pagination\Pagination;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Pagination\PaginationObject;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
jimport('joomla.application.component.model');
use Joomla\String\StringHelper;
// CUSTOM PAGINATON
class PhocaDownloadViewPhocaDownloadLinkFilePagination extends Pagination
{
protected function _buildDataObject()
{
$data = new stdClass;
$uri = Uri::getInstance();
$uriS = $uri->toString();
// Build the additional URL parameters string.
$params = '';
if (!empty($this->additionalUrlParams))
{
foreach ($this->additionalUrlParams as $key => $value)
{
$params .= '&' . $key . '=' . $value;
}
}
$data->all = new PaginationObject(Text::_('JLIB_HTML_VIEW_ALL'), $this->prefix);
if (!$this->viewall)
{
$data->all->base = '0';
$data->all->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=';
}
// Set the start and previous data objects.
$data->start = new PaginationObject(Text::_('JLIB_HTML_START'), $this->prefix);
$data->previous = new PaginationObject(Text::_('JPREV'), $this->prefix);
if ($this->pagesCurrent > 1)
{
$page = ($this->pagesCurrent - 2) * $this->limit;
// Set the empty for removal from route
// @to do remove code: $page = $page == 0 ? '' : $page;
$data->start->base = '0';
$data->start->link = $uriS . '' . $params . '&' . $this->prefix . 'limitstart=0';
$data->previous->base = $page;
$data->previous->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $page;
}
// Set the next and end data objects.
$data->next = new PaginationObject(Text::_('JNEXT'), $this->prefix);
$data->end = new PaginationObject(Text::_('JLIB_HTML_END'), $this->prefix);
if ($this->pagesCurrent < $this->pagesTotal)
{
$next = $this->pagesCurrent * $this->limit;
$end = ($this->pagesTotal - 1) * $this->limit;
$data->next->base = $next;
$data->next->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $next;
$data->end->base = $end;
$data->end->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $end;
}
$data->pages = array();
$stop = $this->pagesStop;
for ($i = $this->pagesStart; $i <= $stop; $i++)
{
$offset = ($i - 1) * $this->limit;
$data->pages[$i] = new PaginationObject($i, $this->prefix);
if ($i != $this->pagesCurrent || $this->viewall)
{
$data->pages[$i]->base = $offset;
$data->pages[$i]->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $offset;
}
else
{
$data->pages[$i]->active = true;
}
}
return $data;
}
}
class PhocaDownloadModelPhocaDownloadLinkFile extends BaseDatabaseModel
{
var $_data = null;
var $_total = null;
var $_pagination = null;
var $_context = 'com_phocadownload.phocadownloadlinkfile';
function __construct() {
parent::__construct();
$app = Factory::getApplication();
// Get the pagination request variables
$limit = $app->getUserStateFromRequest( $this->_context.'.list.limit', 'limit', $app->get('list_limit'), 'int' );
$limitstart = $app->getUserStateFromRequest( $this->_context.'.limitstart', 'limitstart', 0, 'int' );
// In case limit has been changed, adjust limitstart accordingly
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
}
function getData() {
if (empty($this->_data)) {
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
}
return $this->_data;
}
function getTotal() {
if (empty($this->_total)) {
$query = $this->_buildQuery();
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}
function getPagination() {
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new PhocaDownloadViewPhocaDownloadLinkFilePagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
function _buildQuery() {
$where = $this->_buildContentWhere();
$orderby = $this->_buildContentOrderBy();
$query = ' SELECT a.*, cc.title AS categorytitle, ag.title AS access_level '
. ' FROM #__phocadownload AS a '
. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid '
//. ' LEFT JOIN #__phocadownload_sections AS s ON s.id = a.sectionid '
. ' LEFT JOIN #__viewlevels AS ag ON ag.id = a.access '
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. $where
. $orderby
;
return $query;
}
function _buildContentOrderBy() {
$app = Factory::getApplication();
$filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering','cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
if ($filter_order == 'a.ordering'){
$orderby = ' ORDER BY categorytitle, a.ordering '.$filter_order_Dir;
} else {
$orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.', categorytitle, a.ordering ';
}
return $orderby;
}
function _buildContentWhere() {
$app = Factory::getApplication();
$filter_published = $app->getUserStateFromRequest( $this->_context.'.filter_published', 'filter_published', '', 'word' );
$filter_catid = $app->getUserStateFromRequest( $this->_context.'.catid','catid',0, 'int' );
//$filter_sectionid = $app->getUserStateFromRequest( $this->_context.'.filter_sectionid', 'filter_sectionid', 0, 'int' );
$filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
$search = $app->getUserStateFromRequest( $this->_context.'.search','search','','string' );
$search = StringHelper::strtolower( $search );
$where = array();
if ($filter_catid > 0) {
$where[] = 'a.catid = '.(int) $filter_catid;
}
if ($search) {
$where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%');
}
if ( $filter_published ) {
if ( $filter_published == 'P' ) {
$where[] = 'a.published = 1';
} else if ($filter_published == 'U' ) {
$where[] = 'a.published = 0';
}
}
$where[] = 'a.published = 1';
$where[] = 'a.approved = 1';
$where[] = 'a.textonly <> 1';
$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
return $where;
}
}
?>

View File

@ -0,0 +1,174 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Plugin\PluginHelper;
jimport('joomla.application.component.model');
class PhocaDownloadModelPlay extends BaseDatabaseModel
{
var $_file = null;
var $_category = null;
var $_section = null;
var $_filename = null;
function __construct() {
$app = Factory::getApplication();
parent::__construct();
$this->setState('filter.language',$app->getLanguageFilter());
}
function getFile( $fileId) {
if (empty($this->_file)) {
$query = $this->_getFileQuery( $fileId );
$this->_file = $this->_getList( $query, 0 , 1 );
/* // Don't display file if user has no access
// - - - - - - - - - - - - - - -
if (empty($this->_file)) {
return null;
}
if (isset($this->_file[0]->access)) {
if ($aid !== null) {
if ($this->_file[0]->access > (int) $aid) {
$app->redirect(Route::_('index.php?option=com_users&view=login', false), Text::_("Please login to download the file"));
exit;
}
} else {
return null;
}
} else {
return null;
}
// - - - - - - - - - - - - - - - -*/
}
return $this->_file;
}
function _getFileQuery( $fileId ) {
$app = Factory::getApplication();
$params = $app->getParams();
$categoryId = 0;
$category = $this->getCategory($fileId);
if (isset($category[0]->id)) {
$categoryId = $category[0]->id;
}
$pQ = $params->get( 'enable_plugin_query', 0 );
$wheres[] = " c.catid= ".(int) $categoryId;
$wheres[] = " c.catid= cc.id";
/*if ($aid !== null) {
// Should be not displayed, only in case user will add direct url
// IF unaccessible file = 1 then display unaccessible file for all
// IF unaccessible file = 0 then display it only for them who have access to this file
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access <= ' . (int) $aid.') )';
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access <= ' . (int) $aid.') )';
//$wheres[] = "c.access <= " . (int) $aid;
//$wheres[] = "cc.access <= " . (int) $aid;
}*/
$wheres[] = " c.published = 1";
$wheres[] = " c.approved = 1";
$wheres[] = " cc.published = 1";
$wheres[] = " c.id = " . (int) $fileId;
if ($this->getState('filter.language')) {
$wheres[] = ' c.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
// Active
$jnow = Factory::getDate();
$now = $jnow->toSql();
$nullDate = $this->_db->getNullDate();
$wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )';
$wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )';
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetFile', array (&$wheres, &$joins, $fileId, $params));
// END GWE MOD
}
$query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid, lc.title AS licensetitle, lc.description AS licensetext'
.' FROM #__phocadownload AS c'
.' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid'
.' LEFT JOIN #__phocadownload_licenses AS lc ON lc.id = c.confirm_license'
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
.' WHERE ' . implode( ' AND ', $wheres )
.' ORDER BY c.ordering';
return $query;
}
function getCategory($fileId) {
if (empty($this->_category)) {
$query = $this->_getCategoryQuery( $fileId );
$this->_category= $this->_getList( $query, 0, 1 );
}
return $this->_category;
}
function _getCategoryQuery( $fileId ) {
$wheres = array();
$app = Factory::getApplication();
$params = $app->getParams();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
$pQ = $params->get( 'enable_plugin_query', 0 );
$wheres[] = " c.id= ".(int)$fileId;
$wheres[] = " cc.access IN (".$userLevels.")";
$wheres[] = " cc.published = 1";
if ($this->getState('filter.language')) {
$wheres[] = ' c.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
$wheres[] = ' cc.language IN ('.$this->_db->Quote(Factory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
}
if ($pQ == 1) {
// GWE MOD - to allow for access restrictions
PluginHelper::importPlugin("phoca");
//$dispatcher = JEventDispatcher::getInstance();
$joins = array();
$results = Factory::getApplication()->triggerEvent('onGetCategory', array (&$wheres, &$joins,$categoryId, $params));
// END GWE MOD
}
$query = " SELECT cc.id, cc.title, cc.alias, cc.image, cc.image_position, cc.description"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id"
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " ORDER BY cc.ordering";
return $query;
}
}
?>

View File

@ -0,0 +1,57 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
jimport('joomla.application.component.model');
class PhocaDownloadModelRatingFileA extends BaseDatabaseModel
{
function rate($data) {
$row = $this->getTable('phocadownloadfilevotes');
if (!$row->bind($data)) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}
$row->date = gmdate('Y-m-d H:i:s');
$row->published = 1;
if (!$row->id) {
$where = 'fileid = ' . (int) $row->fileid ;
$row->ordering = $row->getNextOrder( $where );
}
if (!$row->check()) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}
if (!$row->store()) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}
// Update the Vote Statistics
if (!PhocaDownloadRate::updateVoteStatisticsFile( $data['fileid'])) {
return false;
}
return true;
}
}
?>

View File

@ -0,0 +1,692 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Download
* @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\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Client\ClientHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filesystem\Folder;
jimport('joomla.application.component.model');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
use Joomla\String\StringHelper;
class PhocaDownloadModelUser extends BaseDatabaseModel
{
var $_data_files = null;
var $_total_files = null;
var $_pagination_files = null;
var $_context_files = 'com_phocadownload.phocadownloaduserfiles';
protected $event_before_save = null;
protected $event_after_save = null;
function __construct() {
parent::__construct();
//if (isset($config['event_before_save'])) {
// $this->event_before_save = $config['event_before_save'];
//} elseif (empty($this->event_before_save)) {
$this->event_before_save = 'onContentBeforeSave';
//}
$this->event_after_save = 'onContentAfterSave';
$app = Factory::getApplication();
// SubCategory
$limit_files = $app->getUserStateFromRequest( $this->_context_files.'.list.limit', 'limit', 20, 'int' );
$limitstart_files = $app->input->get('limitstart', 0, 'int');
$limitstart_files = ($limit_files != 0 ? (floor($limitstart_files / $limit_files) * $limit_files) : 0);
$this->setState($this->_context_files.'.list.limit', $limit_files);
$this->setState($this->_context_files.'.list.limitstart', $limitstart_files);
}
function getDataFiles($userId) {
if (empty($this->_data_files)) {
$query = $this->_buildQueryFiles($userId);
$this->_data_files = $this->_getList($query, $this->getState($this->_context_files.'.list.limitstart'), $this->getState($this->_context_files.'.list.limit'));
}
return $this->_data_files;
}
function getTotalFiles($userId) {
if (empty($this->_total_files)) {
$query = $this->_buildQueryFiles($userId);
$this->_total_files = $this->_getListCount($query);
}
return $this->_total_files;
}
function getPaginationFiles($userId) {
if (empty($this->_pagination_files)) {
jimport('joomla.html.pagination');
$this->_pagination_files = new Pagination( $this->getTotalFiles($userId), $this->getState($this->_context_files.'.list.limitstart'), $this->getState($this->_context_files.'.list.limit') );
}
return $this->_pagination_files;
}
function _buildQueryFiles($userId) {
$where = $this->_buildContentWhereFiles($userId);
$orderby = $this->_buildContentOrderByFiles();
$query = ' SELECT a.*, cc.title AS categorytitle, u.name AS editor, ag.title AS access_level, us.id AS ownerid, us.username AS ownername '
. ' FROM #__phocadownload AS a '
. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid'
. ' LEFT JOIN #__viewlevels AS ag ON ag.id = a.access'
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out'
. ' LEFT JOIN #__users AS us ON us.id = a.owner_id'
. $where
. $orderby;
return $query;
}
function _buildContentOrderByFiles() {
$app = Factory::getApplication();
$filter_order = $app->getUserStateFromRequest( $this->_context_files.'.filter_order', 'filter_order', 'a.ordering', 'cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context_files.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
if ($filter_order == 'a.ordering'){
$orderby = ' ORDER BY categorytitle, a.ordering '.$filter_order_Dir;
} else {
$orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , categorytitle, a.ordering ';
}
return $orderby;
}
function _buildContentWhereFiles($userId) {
$app = Factory::getApplication();
$filter_published = $app->getUserStateFromRequest( $this->_context_files.'.filter_published','filter_published','', 'word' );
$filter_catid = $app->getUserStateFromRequest( $this->_context_files.'.catid','catid',0,'int' );
//$filter_sectionid = $app->getUserStateFromRequest( $this->_context_files.'.filter_sectionid', 'filter_sectionid', 0, 'int' );
$filter_order = $app->getUserStateFromRequest( $this->_context_files.'.filter_order','filter_order','a.ordering','cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context_files.'.filter_order_Dir','filter_order_Dir_files', '', 'word' );
$search = $app->getUserStateFromRequest( $this->_context_files.'.search', 'search', '', 'string' );
$search = StringHelper::strtolower( $search );
$where = array();
$where[] = 'a.owner_id = '.(int)$userId;
$where[] = 'a.owner_id > 0'; // Ignore -1
if ($filter_catid > 0) {
$where[] = 'a.catid = '.(int) $filter_catid;
}
if ($search) {
$where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%');
}
if ( $filter_published ) {
if ( $filter_published == 'P' ) {
$where[] = 'a.published = 1';
} else if ($filter_published == 'U' ) {
$where[] = 'a.published = 0';
}
}
//if ( $filter_sectionid ) {
// $where[] = 'cc.section = '.(int)$filter_sectionid;
//}
$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
return $where;
}
/*
* Add Image
*/
/*
function storefile($data, $return, $edit = false) {
if (!$edit) {
//If this file doesn't exists don't save it
if (!phocadownloadFile::existsFileOriginal($data['filename'])) {
$this->set Error('File not exists');
return false;
}
$data['imgorigsize'] = phocadownloadFile::getFileSize($data['filename'], 0);
//If there is no title and no alias, use filename as title and alias
if (!isset($data['title']) || (isset($data['title']) && $data['title'] == '')) {
$data['title'] = phocadownloadFile::getTitleFromFile($data['filename']);
}
if (!isset($data['alias']) || (isset($data['alias']) && $data['alias'] == '')) {
$data['alias'] = phocadownloadFile::getTitleFromFile($data['filename']);
}
//clean alias name (no bad characters)
$data['alias'] = phocadownloadText::getAliasName($data['alias']);
} else {
$data['alias'] = phocadownloadText::getAliasName($data['title']);
}
$row = $this->getTable('phocadownload');
if(isset($data['id']) && $data['id'] > 0) {
if (!$row->load($data['id'])) {
throw new Exception($this->_db->getErrorMsg(), 500);
return false;
}
}
// Bind the form fields to the Phoca gallery table
if (!$row->bind($data)) {
throw new Exception($this->_db->getErrorMsg(), 500);
return false;
}
// Create the timestamp for the date
$row->date = gmdate('Y-m-d H:i:s');
// if new item, order last in appropriate group
if (!$row->id) {
$where = 'catid = ' . (int) $row->catid ;
$row->ordering = $row->getNextOrder( $where );
}
// Make sure the Phoca gallery table is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg(), 500);
return false;
}
// Store the Phoca gallery table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg(), 500);
return false;
}
if(!$edit) {
//Create thumbnail small, medium, large
$returnFrontMessage = phocadownloadFileThumbnail::getOrCreateThumbnail($row->filename, $return, 1, 1, 1, 1);
if ($returnFrontMessage == 'Success') {
return true;
} else {
return false;
}
} else {
if (isset($row->id)) {
return $row->id;
} else {
return false;
}
}
}
*/
function singleFileUpload(&$errUploadMsg, $file, $post) {
$app = Factory::getApplication();;
Session::checkToken( 'request' ) or jexit( 'Invalid Token' );
jimport('joomla.client.helper');
$user = Factory::getUser();
$ftp = ClientHelper::setCredentialsFromRequest('ftp');
$path = PhocaDownloadPath::getPathSet();
$folder = $app->input->get( 'folder', '', '', 'path' );
$format = $app->input->get( 'format', 'html', '', 'cmd');
$return = $app->input->get( 'return-url', null, 'post', 'base64' );
$viewBack = $app->input->get( 'viewback', '', 'post', 'string' );
//$catid = $app->input->get( 'catid', '', '', 'int' );
$paramsC = ComponentHelper::getParams('com_phocadownload') ;
$overwriteExistingFiles = $paramsC->get( 'overwrite_existing_files', 0 );
// USER RIGHT - UPLOAD - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
$rightDisplayUpload = 0;
$catAccess = PhocaDownloadAccess::getCategoryAccess((int)$post['catidfiles']);
if (!empty($catAccess)) {
$rightDisplayUpload = PhocaDownloadAccess::getUserRight('uploaduserid', $catAccess->uploaduserid, 2, $user->getAuthorisedViewLevels(), 1, 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
/*$post['sectionid'] = $this->getSection((int)$post['catidfiles']);
if(!$post['sectionid']) {
$errUploadMsg = Text::_('COM_PHOCADOWNLOAD_WRONG_SECTION');
return false;
}*/
//$userFolder = substr(md5($user->username),0, 10);
$userFolder = PhocaDownloadUtils::cleanFolderUrlName(htmlspecialchars(strip_tags($user->username)));
if ($rightDisplayUpload == 1) {
// Make the filename safe
if (isset($file['name'])) {
$file['name'] = File::makeSafe($file['name']);
}
if($file['tmp_name'] == '') {
$errUploadMsg = Text::_("COM_PHOCADOWNLOAD_ERROR_SERVER_NOT_ABLE_TO_STORE_FILE_TEMP_FOLDER");
return false;
}
if (isset($file['name'])) {
$filepath = Path::clean($path['orig_abs_user_upload']. '/'. $userFolder . '/'.$file['name']);
$filepathUserFolder = Path::clean($path['orig_abs_user_upload']. '/'. $userFolder);
if (!PhocaDownloadFileUpload::canUpload( $file, $errUploadMsg, 'file', 2 )) {
if ($errUploadMsg == 'COM_PHOCADOWNLOAD_WARNUSERFILESTOOLARGE') {
$errUploadMsg = Text::_($errUploadMsg) . ' ('.PhocaDownloadFile::getFileSizeReadable($file['size']).')';
} else {
$errUploadMsg = Text::_($errUploadMsg);
}
return false;
}
if (File::exists($filepath) && $overwriteExistingFiles == 0) {
$errUploadMsg = Text::_("COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS");
return false;
}
// Overwrite file and add no new item to database
$fileExists = 0;
if (File::exists($filepath) && $overwriteExistingFiles == 1) {
$fileExists = 1;
}
if (!File::upload($file['tmp_name'], $filepath, false, true)) {
$errUploadMsg = Text::_("COM_PHOCADOWNLOAD_UNABLE_TO_UPLOAD_FILE");
return false;
} else {
// Saving file name into database with relative path
if (!File::exists($filepathUserFolder . '/' ."index.html")) {
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
File::write($filepathUserFolder . '/' ."index.html", $data);
}
$file['namepap'] = $file['name'];
$file['name'] = 'userupload/'.$userFolder.'/' . $file['name'];
$succeeded = false;
// =================================================
// Make a copy for play and preview
$papCopy = $paramsC->get( 'pap_copy', 0 );
if ($papCopy == 1 || $papCopy == 3) {
$canPlay = PhocaDownloadFile::canPlay($file['namepap']);
$canPreview = PhocaDownloadFile::canPreview($file['namepap']);
$filepathPAP = Path::clean($path['orig_abs_user_upload_pap']. '/'. $userFolder . '/'.$file['namepap']);
$filepathUserFolderPAP = Path::clean($path['orig_abs_user_upload_pap']. '/'. $userFolder);
if ($canPlay || $canPreview) {
// 1. UPLOAD - this is real upload to folder
// 2. STORE - this is storing info to database (e.g. download and play/preview files are identical, then there will be no copy of the file but only storing DB info
$uploadPAP = 1;// upload file for preview and play
$storePAP = 0;
// 1. Care about upload
if (File::exists($filepathPAP) && $overwriteExistingFiles == 0) {
//$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS");
//return false;
$uploadPAP = 0; // don't upload if it exists, it is not main file, don't do false and exit
}
// Overwrite file and add no new item to database
$fileExistsPAP = 0;
if (File::exists($filepathPAP) && $overwriteExistingFiles == 1) {
$fileExistsPAP = 1;
}
if ($uploadPAP == 0) {
} else {
if (!Folder::exists($filepathUserFolderPAP)) {
if (Folder::create($filepathUserFolderPAP)) {
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
File::write($filepathUserFolderPAP . '/' ."index.html", $data);
}
// else {
//$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_CREATE_FOLDER");
//return false;
//}
}
if ($filepath === $filepathPAP) {
// Don't try to copy the same file to the same file (including path) because you get error
$storePAP = 1;
} else if (!File::copy($filepath, $filepathPAP)) {
//$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_UPLOAD_FILE");
//return false;
} else {
$storePAP = 1;
}
}
// 2. Care about store
if ($filepath === $filepathPAP) {
// SPECIFIC CASE - administrator set the download folder the same like preview/play folder
// - in such case, there will be no copy because both files including path are identical
// - but we still write the info about play/preview into database
// - so no set uploadPAP to 0
$storePAP = 1;
}
if ($storePAP == 1) {
if ($canPlay == 1) {
$post['filename_play'] = 'userupload/'.$userFolder.'/' . $file['namepap'];
} else if ($canPreview == 1) {
$post['filename_preview'] = 'userupload/'.$userFolder.'/' . $file['namepap'];
}
}
}
}
// ==============================================
if ($this->_save($post, $file['name'], $errUploadMsg, $fileExists)) {
return true;
} else {
return false;
}
}
} else {
$errUploadMsg = Text::_("COM_PHOCADOWNLOAD_WARNFILETYPE");
$redirectUrl = $return;
return false;
}
} else {
$errUploadMsg = Text::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_TO_UPLOAD");
return false;
}
return false;
}
function _save($data, $filename, &$errSaveMsg, $fileExists = 0) {
$user = Factory::getUser();
$app = Factory::getApplication();
$paramsC = ComponentHelper::getParams('com_phocadownload') ;
$default_access = $paramsC->get( 'default_access', 1 );
$frontend_run_events = $paramsC->get( 'frontend_run_events', 0 );
$fileId = false;
if ($fileExists == 1) {
// We not only owerwrite the file but we must update it
if (isset($filename) && $filename != '') {
$db = Factory::getDBO();
$query = 'SELECT a.id AS id'
.' FROM #__phocadownload AS a'
.' WHERE a.filename = '.$db->Quote($filename);
$db->setQuery($query, 0, 1);
$fileId = $db->loadObject();
/*if (!$db->query()) {
throw new Exception($db->getErrorMsg(), 500);
return false;
}*/
}
}
$row = $this->getTable('phocadownload');
$isNew = true;
if (isset($fileId->id) && (int)$fileId->id > 0) {
$data['id'] = (int)$fileId->id;
$isNew = false;
}
$data['filesize'] = PhocaDownloadFile::getFileSize($filename, 0);
$data['userid'] = $user->id;
$data['author_email'] = $data['email'];
$data['author_url'] = $data['website'];
$data['access'] = $default_access;
$data['token'] = PhocaDownloadUtils::getToken($data['title'].$filename);
//$data['token'] = PhocaDownloadUtils::getToken($data['title'].$data['filename']);
// Bind the form fields to the Phoca gallery table
if (!$row->bind($data)) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}
// Create the timestamp for the date
//$row->date = gmdate('Y-m-d H:i:s');
//$row->publish_up = gmdate('Y-m-d H:i:s');
//$jnow =JFactory::getDate();
/*$jnowU = $jnow->toUnix();
if (isset($jnowU)) {
$jnowU = (int)$jnowU - 2; // to not display pending because of 1 second
}*/
$unow = time();
$unow = $unow - 2;//Frontend will display pending if standard $jnow->toSql(); will be used
$jnow = Factory::getDate($unow);// the class JDate construct works with unix date
$now = $jnow->toSql();
$row->date = $now;
$row->publish_up = $now; //date('Y-m-d H:i:s', $jnowU);
//$row->publish_down = null;
$row->publish_down = '0000-00-00 00:00:00';
$row->filename = $filename;
$row->catid = $data['catidfiles'];
// Lang
$userLang = PhocaDownloadUser::getUserLang();
$row->language = $userLang['lang'];
// if new item, order last in appropriate group
if (!$row->id) {
$where = 'catid = ' . (int) $row->catid ;
$row->ordering = $row->getNextOrder( $where );
}
// Make sure the Phoca gallery table is valid
if (!$row->check()) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}
/*
PluginHelper::importPlugin($this->events_map['save']);
$result = $app->triggerEvent($this->event_before_save, array($this->option.'.'.$this->name, $row, $isNew, $data));
if (\in_array(false, $result, true)) {
$this->setError($row->getError());
return false;
}
// Store the data.
/*if (!$table->store()) {
throw new Exception($table->getError(), 500);
return false;
}*/
// Trigger the before save event.
if ($frontend_run_events == 1) {
PluginHelper::importPlugin('content');
$context = $this->option . '.' . 'file';// com_phocadownload.file
$table = $row;
$dispatcher = $this->getDispatcher();
// Before Save
$beforeSaveEvent = new Joomla\CMS\Event\Model\BeforeSaveEvent($this->event_before_save, [
'context' => $context,
'subject' => $table,
'isNew' => $isNew,
'data' => $data,
]);
$result = $dispatcher->dispatch($this->event_before_save, $beforeSaveEvent)->getArgument('result', []);
//$result = $app->triggerEvent($this->event_before_save, array($context, $row, $isNew, $data));
/*if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}*/
}
// Store the Phoca gallery table to the database
if (!$row->store()) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}
if ($frontend_run_events == 1) {
// After Save
$afterSaveEvent = new Joomla\CMS\Event\Model\AfterSaveEvent($this->event_after_save, [
'context' => $context,
'subject' => $table,
'isNew' => $isNew,
'data' => $data,
]);
$result = $dispatcher->dispatch($this->event_after_save, $afterSaveEvent)->getArgument('result', []);
}
PhocaDownloadLog::log($row->id, 2);
return true;
}
/*
function getSection($catid) {
$query = 'SELECT c.section'
. ' FROM #__phocadownload_categories AS c'
. ' WHERE c.id = '.(int)$catid;
$this->_db->setQuery( $query );
$sectionId = $this->_db->loadObject();
if (isset($sectionId->section)) {
return $sectionId->section;
}
return false;
}*/
function isOwnerCategoryFile($userId, $fileId) {
$query = 'SELECT cc.id'
. ' FROM #__phocadownload_categories AS cc'
. ' LEFT JOIN #__phocadownload AS a ON a.catid = cc.id'
. ' WHERE cc.owner_id = '.(int)$userId
. ' AND a.id = '.(int)$fileId;
$this->_db->setQuery( $query );
$ownerCategoryId = $this->_db->loadObject();
if (isset($ownerCategoryId->id)) {
return $ownerCategoryId->id;
}
return false;
}
function publish($id = 0, $publish = 1) {
//$user = JFactory::getUser();
$query = 'UPDATE #__phocadownload AS a'
//. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid '
. ' SET a.published = '.(int) $publish
. ' WHERE a.id = '.(int)$id;
//. ' AND cc.owner_id = '.(int) $user->get('id');
$this->_db->setQuery( $query );
if (!$this->_db->execute()) {
throw new Exception('Database Error Publishing', 500);
return false;
}
return true;
}
function delete($id = 0) {
$paramsC = ComponentHelper::getParams('com_phocadownload');
$deleteExistingFiles = $paramsC->get( 'delete_existing_files', 0 );
// - - - - - - - - - - - - -
// Get all filenames we want to delete from database, we delete all thumbnails from server of this file
$queryd = 'SELECT filename as filename FROM #__phocadownload WHERE id = '.(int)$id;
$this->_db->setQuery($queryd);
$fileObject = $this->_db->loadObjectList();
// - - - - - - - - - - - - -
$query = 'DELETE FROM #__phocadownload'
. ' WHERE id ='.(int)$id;
$this->_db->setQuery( $query );
if(!$this->_db->execute()) {
throw new Exception('Database Error - Delete Files', 500);
return false;
}
//Delete record from statistics table
$query = 'DELETE FROM #__phocadownload_user_stat WHERE fileid='.(int)$id;
$this->_db->setQuery( $query );
if(!$this->_db->execute()) {
throw new Exception('Database Error - Delete User Stats (Files)', 500);
return false;
}
// Delete tags
$query = 'DELETE FROM #__phocadownload_tags_ref'
. ' WHERE fileid ='.(int)$id;
$this->_db->setQuery( $query );
if(!$this->_db->execute()) {
throw new Exception('Database Error - Delete Tags (Files)', 500);
return false;
}
// - - - - - - - - - - - - - -
// DELETE FILES ON SERVER
if ($deleteExistingFiles == 1) {
$path = PhocaDownloadPath::getPathSet();
foreach ($fileObject as $key => $value) {
//The file can be stored in other category - don't delete it from server because other category use it
$querys = "SELECT id as id FROM #__phocadownload WHERE filename='".$value->filename."' ";
$this->_db->setQuery($querys);
$sameFileObject = $this->_db->loadObject();
// same file in other category doesn't exist - we can delete it
if (!$sameFileObject) {
File::delete(Path::clean($path['orig_abs_ds'].$value->filename));
}
}
}
return true;
}
}
?>

View File

@ -0,0 +1,61 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Factory;
if (! class_exists('PhocaDownloadLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocadownload/libraries/loader.php');
}
require_once JPATH_ADMINISTRATOR . '/components/com_phocadownload/libraries/autoloadPhoca.php';
// Require the base controller
require_once( JPATH_COMPONENT.'/controller.php' );
phocadownloadimport('phocadownload.utils.settings');
phocadownloadimport('phocadownload.utils.utils');
phocadownloadimport('phocadownload.path.path');
phocadownloadimport('phocadownload.path.route');
phocadownloadimport('phocadownload.render.layout');
phocadownloadimport('phocadownload.file.file');
phocadownloadimport('phocadownload.file.fileupload');
phocadownloadimport('phocadownload.file.fileuploadmultiple');
phocadownloadimport('phocadownload.file.fileuploadsingle');
phocadownloadimport('phocadownload.download.download');
phocadownloadimport('phocadownload.render.renderfront');
phocadownloadimport('phocadownload.rate.rate');
phocadownloadimport('phocadownload.stat.stat');
phocadownloadimport('phocadownload.mail.mail');
phocadownloadimport('phocadownload.pagination.pagination');
phocadownloadimport('phocadownload.ordering.ordering');
phocadownloadimport('phocadownload.access.access');
phocadownloadimport('phocadownload.category.category');
phocadownloadimport('phocadownload.user.user');
phocadownloadimport('phocadownload.log.log');
phocadownloadimport('phocadownload.utils.utils');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
// Require specific controller if requested
if($controller = Factory::getApplication()->input->get('controller')) {
$path = JPATH_COMPONENT.'/controllers/'.$controller.'.php';
if (file_exists($path)) {
require_once $path;
} else {
$controller = '';
}
}
$classname = 'PhocaDownloadController'.ucfirst((string)$controller);
$controller = new $classname( );
$controller->execute( Factory::getApplication()->input->get('task') );
$controller->redirect();
?>

View File

@ -0,0 +1,325 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_phocadownload
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\Router\RouterView;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Component\Router\RouterViewConfiguration;
use Joomla\CMS\Component\Router\Rules\MenuRules;
use Joomla\CMS\Component\Router\Rules\StandardRules;
use Joomla\CMS\Component\Router\Rules\NomenuRules;
use Joomla\CMS\Factory;
use Joomla\Database\ParameterType;
if (! class_exists('PhocaDownloadLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocadownload/libraries/loader.php');
}
class PhocadownloadRouter extends RouterView
{
protected $noIDs = false;
public function __construct($app = null, $menu = null) {
$params = ComponentHelper::getParams('com_phocadownload');
$this->noIDs = (bool) $params->get('remove_sef_ids');
$categories = new RouterViewConfiguration('categories');
$categories->setKey('id');
$this->registerView($categories);
$category = new RouterViewConfiguration('category');
$category->setKey('id')->setParent($categories, 'parent_id')->setNestable();
$this->registerView($category);
$file = new RouterViewConfiguration('file');
$file->setKey('id')->setParent($category, 'catid');//->setNestable();
$this->registerView($file);
//$play = new RouterViewConfiguration('play');
//$play->setKey('id')->setParent($category, 'catid');//->setNestable();
//$this->registerView($play);
$views = array('play', 'user');
foreach ($views as $k => $v) {
$item = new RouterViewConfiguration($v);
$item->setName($v)->setParent($file, 'id')->setParent($category, 'catid');
$this->registerView($item);
}
$views = array('download');
foreach ($views as $k => $v) {
$item = new RouterViewConfiguration($v);
//$item->setName($v)->setParent($file, 'id')->setParent($category, 'catid');
$item->setName($v)->setParent($file, 'id')->setParent($categories, 'parent_id');
$this->registerView($item);
}
$feed = new RouterViewConfiguration('feed');
$feed->setName('feed')->setKey('id')->setParent($categories, 'parent_id');
$this->registerView($feed);
parent::__construct($app, $menu);
phocadownloadimport('phocadownload.path.routerrules');
phocadownloadimport('phocadownload.category.category');
$this->attachRule(new MenuRules($this));
$this->attachRule(new PhocaDownloadRouterrules($this));
$this->attachRule(new StandardRules($this));
$this->attachRule(new NomenuRules($this));
}
public function getFeedSegment($id, $query) {
if ((int)$id == 0 && isset($query['id']) && (int)$query['id'] > 0) {
$segment = [];
$segment[0] = (int)$query['id'];
return $segment;
} else {
$segment = [];
$segment[0] = (int)$id;
return $segment;
}
}
public function getCategorySegment($id, $query) {
// SPECIFIC CASE TAG - tag search output in category view
// 1. components/com_phocadownload/router.php getCategorySegment() - BUILD
// 2. administrator/components/com_phocadownload/libraries/phocadownload/path/routerrules.php build() - BUILD
// 3. administrator/components/com_phocadownload/libraries/phocadownload/path/routerrules.php parse() - PARSE
if ((int)$id == 0 && isset($query['tagid']) && (int)$query['tagid'] > 0) {
//$path[0] = '1:root';
$path[0] = '0:category';
if ($this->noIDs) {
foreach ($path as &$segment) {
list($id, $segment) = explode(':', $segment, 2);
}
}
return $path;
}
$category = PhocaDownloadCategory::getCategoryById($id);
if (isset($category->id)) {
$path = PhocaDownloadCategory::getPath(array(), (int)$category->id, $category->parent_id, $category->title, $category->alias);
//$path = array_reverse($path, true);
//$path = array_reverse($category->getPath(), true);
$path[0] = '1:root';// we don't use root but it is needed when building urls with joomla methods
if ($this->noIDs) {
foreach ($path as &$segment) {
list($id, $segment) = explode(':', $segment, 2);
}
}
return $path;
}
return array();
}
public function getCategoriesSegment($id, $query) {
return $this->getCategorySegment($id, $query);
}
public function getFileSegment($id, $query) {
if (!strpos($id, ':')) {
$db = Factory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('alias'))
->from($dbquery->qn('#__phocadownload'))
->where('id = ' . $dbquery->q($id));
$db->setQuery($dbquery);
$id .= ':' . $db->loadResult();
}
if ($this->noIDs) {
list($void, $segment) = explode(':', $id, 2);
return array($void => $segment);
}
return array((int) $id => $id);
}
public function getPlaySegment($id, $query) {
if (!strpos($id, ':')) {
$db = Factory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('alias'))
->from($dbquery->qn('#__phocadownload'))
->where('id = ' . $dbquery->q($id));
$db->setQuery($dbquery);
$id .= ':' . $db->loadResult();
}
if ($this->noIDs) {
list($void, $segment) = explode(':', $id, 2);
return array($void => $segment);
}
return array((int) $id => $id);
}
/**
* Method to get the segment(s) for a form
*
* @param string $id ID of the article form to retrieve the segments for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*
* @since 3.7.3
*/
public function getFormSegment($id, $query) {
return $this->getArticleSegment($id, $query);
}
/**
* Method to get the id for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoryId($segment, $query) {
if (!isset($query['id']) && isset($query['view']) && $query['view'] == 'categories') {
$query['id'] = 0;
}
if ($this->noIDs) {
$db = Factory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($db->quoteName('id'))
->from($db->quoteName('#__phocadownload_categories'))
->where(
[
$db->quoteName('alias') . ' = :alias',
$db->quoteName('parent_id') . ' = :parent_id',
]
)
->bind(':alias', $segment)
->bind(':parent_id', $query['id'], ParameterType::INTEGER);
$db->setQuery($dbquery);
return (int) $db->loadResult();
}
$category = false;
if (isset($query['id'])) {
if ((int)$query['id'] > 0) {
$category = PhocaDownloadCategory::getCategoryById($query['id']);
} else if ((int)$segment > 0) {
// to do noids alias
$category = PhocaDownloadCategory::getCategoryById((int)$segment);
if (isset($category->id) && (int)$category->id > 0 && $category->parent_id == 0) {
// We don't have root category with 0 so we need to start with segment one
return (int)$category->id;
}
}
if ($category) {
if (!empty($category->subcategories)){
foreach ($category->subcategories as $child) {
if ($this->noIDs) {
if ($child->alias == $segment) {
return $child->id;
}
} else {
// We need to check full alias because ID can be same for Category and Item
$fullAlias = (int)$child->id . '-'.$child->alias;
if ($fullAlias == $segment) {
return $child->id;
}
}
}
}
}
} else {
// --- under test
// We don't have query ID because of e.g. language
// Should not happen because of modifications in build function here: administrator/components/com_phocacart/libraries/phocacart/path/routerrules.php
/*if ((int)$segment > 0) {
$category = PhocaCartCategory::getCategoryById((int)$segment);
if (isset($category->id) && (int)$category->id > 0 && $category->parent_id == 0) {
// We don't have root category with 0 so we need to start with segment one
return (int)$category->id;
}
}*/
// under test
}
return false;
}
public function getCategoriesId($segment, $query) {
return $this->getCategoryId($segment, $query);
}
public function getFileId($segment, $query) {
if ($this->noIDs)
{
$db = Factory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('id'))
->from($dbquery->qn('#__phocadownload'))
->where('alias = ' . $dbquery->q($segment))
->where('catid = ' . $dbquery->q($query['id']));
$db->setQuery($dbquery);
return (int) $db->loadResult();
}
return (int) $segment;
}
public function parse(&$segments){
return parent::parse($segments);
}
public function build(&$query) {
return parent::build($query);
}
}
function PhocaDownloadBuildRoute(&$query) {
$app = Factory::getApplication();
$router = new PhocadownloadRouter($app, $app->getMenu());
return $router->build($query);
}
function PhocaDownloadParseRoute($segments) {
$app = Factory::getApplication();
$router = new PhocadownloadRouter($app, $app->getMenu());
return $router->parse($segments);
}

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

View File

@ -0,0 +1,215 @@
<?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\Filesystem\Path;
use Joomla\CMS\Filesystem\File;
echo '<div id="phoca-dl-categories-box" class="pd-categories-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 ( $this->t['description'] != '') {
echo '<div class="pd-desc">'. $this->t['description']. '</div>';
}
if (!empty($this->t['categories'])) {
//$i = 1;
echo ' <div class="row row-cols-1 row-cols-md-3 g-4"> ';
foreach ($this->t['categories'] as $value) {
// Categories
$numDoc = 0;
$numSubcat = 0;
$catOutput = '';
// We need $numDoc and $numSubcat always - we need to run this foreach even the subcategories will be not displayed
if (!empty($value->subcategories)) {
foreach ($value->subcategories as $valueCat) {
// USER RIGHT - Access of categories - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!empty($valueCat)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $valueCat->accessuserid, $valueCat->access, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
$catOutput .= '<li class="list-group-item"><span class="pd-subcategory"></span><a href="'. Route::_(PhocaDownloadRoute::getCategoryRoute($valueCat->id, $valueCat->alias))
.'">'. $valueCat->title.'</a>';
if ($this->t['displaynumdocsecs'] == 1) {
$catOutput .=' <small>('.$valueCat->numdoc .')</small>';
}
$catOutput .= '</li>';
$numDoc = (int)$valueCat->numdoc + (int)$numDoc;
$numSubcat++;
}
}
}
if ($this->t['display_main_cat_subcategories'] != 1) {
$catOutput = '';
}
// Don't display parent category
// - if there is no catoutput
// - if there is no rigths for it
// USER RIGHT - Access of parent category - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!empty($value)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $value->accessuserid, $value->access, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
echo '<div class="col">';
echo '<div class="card h-100">';
if (isset($value->image) && $value->image != '') {
echo '<img src="'.$this->t['cssimgpath'].$value->image.'" class="card-img-top" alt="'.htmlspecialchars(strip_tags($value->title)).'" />';
}
echo '<div class="card-body">';
echo '<h3 class="card-title">';
echo '<a href="'. Route::_(PhocaDownloadRoute::getCategoryRoute($value->id, $value->alias)).'">'. $value->title.'</a>';
/*if ($this->t['displaynumdocsecsheader'] == 1) {
$numDocAll = (int)$numDoc + (int)$value->numdoc;
//$numDoc ... only files in subcategories
//$value->numdoc ... only files in the main category
//$numDocAll ... files in category and in subcategories
echo ' <small>('.$numSubcat.'/' . $numDocAll .')</small>';
}*/
echo '</h3>';
if ($this->t['displaymaincatdesc'] == 1) {
echo '<p class="card-text">'.$value->description.'</p>';
}
if ($catOutput != '') {
echo '<ul class="list-group list-group-flush">'.$catOutput. '</ul>';
}
echo '</div>'; // end card body
if ($this->t['displaynumdocsecsheader'] == 1) {
echo '<div class="card-footer pd-categories-card">';
echo '<small class="text-muted float-end">';
if ($this->t['displaynumdocsecsheader'] == 1) {
$numDocAll = (int)$numDoc + (int)$value->numdoc;
//$numDoc ... only files in subcategories
//$value->numdoc ... only files in the main category
//$numDocAll ... files in category and in subcategories
echo '<span class="pd-categories-number">'.Text::_('COM_PHOCADOWNLOAD_CATEGORIES').': '.$numSubcat.'</span>';
echo '<span class="pd-sep-number">&nbsp;/&nbsp;</span>';
echo '<span class="pd-files-number">'.Text::_('COM_PHOCADOWNLOAD_FILES').': '.$numDocAll.'</span>';
}
echo '</small>';
echo '</div>';
}
echo '</div>'; // end card
echo '</div>'; // end col
}
}
echo '</div>';// end row
}
echo '</div>';
echo '<div class="pd-cb"></div>';
// - - - - - - - - - -
// Most viewed docs (files)
// - - - - - - - - - -
$outputFile = '';
if (!empty($this->t['mostvieweddocs']) && $this->t['displaymostdownload'] == 1) {
$l = new PhocaDownloadLayout();
foreach ($this->t['mostvieweddocs'] as $value) {
// 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($value)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $value->cataccessuserid, $value->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
// FILESIZE
if ($value->filename !='') {
$absFile = str_replace('/', '/', Path::clean($this->t['absfilepath'] . $value->filename));
if (File::exists($absFile)) {
$fileSize = PhocaDownloadFile::getFileSizeReadable(filesize($absFile));
} else {
$fileSize = '';
}
}
// IMAGE FILENAME
//$imageFileName = '';
//if ($value->image_filename !='') {
$imageFileName = $l->getImageFileName($value->image_filename, $value->filename, 2);
/*$thumbnail = false;
$thumbnail = preg_match("/phocathumbnail/i", $value->image_filename);
if ($thumbnail) {
$imageFileName = '';
} else {
$imageFileName = 'style="background: url(\''.$this->t['cssimgpath'].$value->image_filename.'\') 0 center no-repeat;"';
}*/
//}
//$outputFile .= '<div class="pd-document'.$this->t['file_icon_size_md'].'" '.$imageFileName.'>';
$outputFile .= '<div class="pd-filename">'. $imageFileName['filenamethumb']
. '<div class="pd-document'.$this->t['file_icon_size_md'].'" '
. $imageFileName['filenamestyle'].'>';
$outputFile .= '<a href="'
. Route::_(PhocaDownloadRoute::getCategoryRoute($value->categoryid,$value->categoryalias))
.'">'. $value->title.'</a>'
.' <small>(' .$value->categorytitle.')</small>';
$outputFile .= PhocaDownloadRenderFront::displayNewIcon($value->date, $this->t['displaynew']);
$outputFile .= PhocaDownloadRenderFront::displayHotIcon($value->hits, $this->t['displayhot']);
$outputFile .= '</div></div>' . "\n";
}
}
if ($outputFile != '') {
echo '<div class="pd-hr ph-cb">&nbsp;</div>';
echo '<div id="phoca-dl-most-viewed-box">';
echo '<div class="pd-documents"><h3>'. Text::_('COM_PHOCADOWNLOAD_MOST_DOWNLOADED_FILES').'</h3>';
echo $outputFile;
echo '</div></div>';
}
}
echo '<div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCADOWNLOAD_CATEGORIES_LIST_LAYOUT">
<message>
<![CDATA[COM_PHOCADOWNLOAD_CATEGORIES_LIST_LAYOUT_DESC]]>
</message>
</layout>
<name>COM_PHOCADOWNLOAD_CATEGORIES_LIST_LAYOUT</name>
<description>COM_PHOCADOWNLOAD_CATEGORIES_LIST_LAYOUT_DESC</description>
<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,182 @@
<?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-categories-box" class="pd-categories-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 ( $this->t['description'] != '') {
echo '<div class="pd-desc">'. $this->t['description']. '</div>';
}
if (!empty($this->t['categories'])) {
//$i = 1;
echo '<div class="row">';
foreach ($this->t['categories'] as $value) {
// Categories
$numDoc = 0;
$numSubcat = 0;
$catOutput = '';
if (!empty($value->subcategories)) {
foreach ($value->subcategories as $valueCat) {
// USER RIGHT - Access of categories - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!empty($valueCat)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $valueCat->accessuserid, $valueCat->access, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
$catOutput .= '<div class="pd-subcategory">';
$catOutput .= '<a href="'. JRoute::_(PhocaDownloadRoute::getCategoryRoute($valueCat->id, $valueCat->alias))
.'">'. $valueCat->title.'</a>';
if ($this->t['displaynumdocsecs'] == 1) {
$catOutput .=' <small>('.$valueCat->numdoc .')</small>';
}
$catOutput .= '</div>' . "\n";
$numDoc = (int)$valueCat->numdoc + (int)$numDoc;
$numSubcat++;
}
}
}
// Don't display parent category
// - if there is no catoutput
// - if there is no rigths for it
// USER RIGHT - Access of parent category - - - - -
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
$rightDisplay = 0;
if (!empty($value)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $value->accessuserid, $value->access, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
echo '<div class="col-sm-4 col-md-4">';
echo '<div class="thumbnail ph-thumbnail">';
echo '<h3>';
echo '<a href="'. JRoute::_(PhocaDownloadRoute::getCategoryRoute($value->id, $value->alias)).'">'. $value->title.'</a>';
if ($this->t['displaynumdocsecsheader'] == 1) {
$numDocAll = (int)$numDoc + (int)$value->numdoc;
//$numDoc ... only files in subcategories
//$value->numdoc ... only files in the main category
//$numDocAll ... files in category and in subcategories
echo ' <small>('.$numSubcat.'/' . $numDocAll .')</small>';
}
echo '</h3>';
if (isset($value->image) && $value->image != '') {
echo '<div class="ph-img"><img src="'.$this->t['cssimgpath'].$value->image.'" alt="'.htmlspecialchars(strip_tags($value->title)).'" /></div>';
}
if ($this->t['displaymaincatdesc'] == 1) {
echo '<div class="ph-desc">'.$value->description.'</div>';
} else {
if ($catOutput != '') {
echo '<div class="ph-subcategories">'.$catOutput. '</div>';
} else {
echo '<div class="pd-no-subcat">'.JText::_('COM_PHOCADOWNLOAD_NO_SUBCATEGORIES').'</div>';
}
}
echo '</div></div>';
}
}
echo '</div>';// end row
}
echo '</div>';
echo '<div class="pd-cb"></div>';
// - - - - - - - - - -
// Most viewed docs (files)
// - - - - - - - - - -
$outputFile = '';
if (!empty($this->t['mostvieweddocs']) && $this->t['displaymostdownload'] == 1) {
$l = new PhocaDownloadLayout();
foreach ($this->t['mostvieweddocs'] as $value) {
// 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($value)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $value->cataccessuserid, $value->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
// FILESIZE
if ($value->filename !='') {
$absFile = str_replace('/', '/', JPath::clean($this->t['absfilepath'] . $value->filename));
if (JFile::exists($absFile)) {
$fileSize = PhocaDownloadFile::getFileSizeReadable(filesize($absFile));
} else {
$fileSize = '';
}
}
// IMAGE FILENAME
//$imageFileName = '';
//if ($value->image_filename !='') {
$imageFileName = $l->getImageFileName($value->image_filename, $value->filename, 2);
/*$thumbnail = false;
$thumbnail = preg_match("/phocathumbnail/i", $value->image_filename);
if ($thumbnail) {
$imageFileName = '';
} else {
$imageFileName = 'style="background: url(\''.$this->t['cssimgpath'].$value->image_filename.'\') 0 center no-repeat;"';
}*/
//}
//$outputFile .= '<div class="pd-document'.$this->t['file_icon_size_md'].'" '.$imageFileName.'>';
$outputFile .= '<div class="pd-filename">'. $imageFileName['filenamethumb']
. '<div class="pd-document'.$this->t['file_icon_size_md'].'" '
. $imageFileName['filenamestyle'].'>';
$outputFile .= '<a href="'
. JRoute::_(PhocaDownloadRoute::getCategoryRoute($value->categoryid,$value->categoryalias))
.'">'. $value->title.'</a>'
.' <small>(' .$value->categorytitle.')</small>';
$outputFile .= PhocaDownloadRenderFront::displayNewIcon($value->date, $this->t['displaynew']);
$outputFile .= PhocaDownloadRenderFront::displayHotIcon($value->hits, $this->t['displayhot']);
$outputFile .= '</div></div>' . "\n";
}
}
if ($outputFile != '') {
echo '<div class="pd-hr" style="clear:both">&nbsp;</div>';
echo '<div id="phoca-dl-most-viewed-box">';
echo '<div class="pd-documents"><h3>'. JText::_('COM_PHOCADOWNLOAD_MOST_DOWNLOADED_FILES').'</h3>';
echo $outputFile;
echo '</div></div>';
}
}
echo '<div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

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

View File

@ -0,0 +1,153 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
jimport( 'joomla.application.component.view');
class PhocaDownloadViewCategories extends HtmlView
{
protected $t;
function display($tpl = null)
{
$app = Factory::getApplication();
$model = $this->getModel();
$document = Factory::getDocument();
$this->t['p'] = $app->getParams();
$this->t['user'] = Factory::getUser();
$this->t['categories'] = $model->getCategoriesList();
$this->t['mostvieweddocs'] = $model->getMostViewedDocsList($this->t['p']);
$this->t['dev'] = PhocaDownloadRenderFront::renderPhocaDownload();
$this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 );
$this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 );
$this->t['displaymostdownload'] = $this->t['p']->get( 'display_most_download', 1 );
$this->t['displaynumdocsecs'] = $this->t['p']->get( 'display_num_doc_secs', 0 );
$this->t['displaynumdocsecsheader'] = $this->t['p']->get( 'display_num_doc_secs_header', 1 );
$this->t['file_icon_size_md'] = $this->t['p']->get( 'file_icon_size_md', 16 );
$this->t['download_metakey'] = $this->t['p']->get( 'download_metakey', '' );
$this->t['download_metadesc'] = $this->t['p']->get( 'download_metadesc', '' );
$this->t['description'] = $this->t['p']->get( 'description', '' );
$this->t['displaymaincatdesc'] = $this->t['p']->get( 'display_main_cat_desc', 0 );
$this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 );
$this->t['display_main_cat_subcategories'] = (int)$this->t['p']->get( 'display_main_cat_subcategories', 1 );
// 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(Uri::root(true).'/media/com_phocadownload/bootstrap/js/bootstrap.min.js');
}
/* $document->addScript(Uri::root(true).'/media/com_phocadownload/js/jquery.matchHeight.js');
$document->addScriptDeclaration(
'jQuery(window).load(function(){
jQuery(\'.ph-thumbnail\').matchHeight();
});');*/
/*$document->addScript(JUri::root(true).'/media/com_phocadownload/js/jquery.equalheights.min.js');
$document->addScriptDeclaration(
'jQuery(window).load(function(){
jQuery(\'.ph-thumbnail\').equalHeights();
});');*//*
}*/
PhocaDownloadRenderFront::renderMainJs();
PhocaDownloadRenderFront::renderAllCSS();
$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->_prepareDocument();
/*if ($this->t['display_bootstrap3_layout'] > 0) {
parent::display('bootstrap');
} else {
parent::display($tpl);
}*/
parent::display($tpl);
}
protected function _prepareDocument() {
$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_heading', '');
if (empty($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);
if (empty($title) || (isset($title) && $title == '')) {
$title = $this->item->title;
}
$this->document->setTitle($title);*/
$title = $this->t['p']->get('page_title', '');
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);
} else if ($app->get('sitename_pagetitles', 0) == 2) {
$title = Text::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->get('sitename')));
}
$this->document->setTitle($title);
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 ($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', ''));
}
}
}
?>

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));
}
}
}
}
?>

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

View File

@ -0,0 +1,91 @@
<?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\Router\Route;
echo '<div id="phoca-dl-download-box" class="pd-download-view'.$this->t['p']->get( 'pageclass_sfx' ).'" >';
echo '<div class="pd-download">';
if ($this->t['found'] == 1) {
if(isset($this->file[0]->id) && (int)$this->file[0]->id > 0 && isset($this->file[0]->token) && $this->file[0]->token != '') {
$v = $this->file[0];
$downloadLink = PhocaDownloadRoute::getDownloadRoute((int)$v->id, (int)$v->catid, $v->token);
$l = new PhocaDownloadLayout();
//echo '<h3 class="pdfv-name">'.$l->getName($v->title, $v->filename, 1). '</h3>';
$pdTitle = '';
if ($v->title != '') {
$pdTitle .= '<div class="pd-title">'.$v->title.'</div>';
}
$pdImage = '';
if ($v->image_download != '') {
$pdImage .= '<div class="pd-image">'.$l->getImageDownload($v->image_download).'</div>';
}
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 - FILE VIEW = DOWNLOAD FILE
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";
}
echo '<div class="pd-downloadbox-direct">'
.$pdFile
.'<div style="clear:both"></div>'
.'<div class="pd-center pd-download-direct"><a class="btn btn-success btn-large" href="'.Route::_($downloadLink).'">'.Text::_('COM_PHOCADOWNLOAD_DOWNLOAD_FILE').'</a></div></div>';
}
} else {
echo '<div class="pd-not-found">'.Text::_('COM_PHOCADOWNLOAD_FILE_NOT_FOUND').'</div>';
}
echo '</div></div><div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCADOWNLOAD_DOWNLOAD_LAYOUT">
<message>
<![CDATA[COM_PHOCADOWNLOAD_DOWNLOAD_LAYOUT_DESC]]>
</message>
</layout>
<name>COM_PHOCADOWNLOAD_DOWNLOAD_LAYOUT</name>
<description>COM_PHOCADOWNLOAD_DOWNLOAD_LAYOUT_DESC</description>
</metadata>

View File

@ -0,0 +1,89 @@
<?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-download-box" class="pd-download-view'.$this->t['p']->get( 'pageclass_sfx' ).'" >';
echo '<div class="pd-download">';
if ($this->t['found'] == 1) {
if(isset($this->file[0]->id) && (int)$this->file[0]->id > 0 && isset($this->file[0]->token) && $this->file[0]->token != '') {
$v = $this->file[0];
$downloadLink = PhocaDownloadRoute::getDownloadRoute((int)$v->id, (int)$v->catid, $v->token);
$l = new PhocaDownloadLayout();
//echo '<h3 class="pdfv-name">'.$l->getName($v->title, $v->filename, 1). '</h3>';
$pdTitle = '';
if ($v->title != '') {
$pdTitle .= '<div class="pd-title">'.$v->title.'</div>';
}
$pdImage = '';
if ($v->image_download != '') {
$pdImage .= '<div class="pd-image">'.$l->getImageDownload($v->image_download).'</div>';
}
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 - FILE VIEW = DOWNLOAD FILE
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";
}
echo '<div class="pd-downloadbox-direct">'
.$pdFile
.'<div style="clear:both"></div>'
.'<div class="pd-center pd-download-direct"><a class="btn btn-success btn-large" href="'.JRoute::_($downloadLink).'">'.JText::_('COM_PHOCADOWNLOAD_DOWNLOAD_FILE').'</a></div></div>';
}
} else {
echo '<div class="pd-not-found">'.JText::_('COM_PHOCADOWNLOAD_FILE_NOT_FOUND').'</div>';
}
echo '</div></div><div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View File

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

View File

@ -0,0 +1,258 @@
<?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\Session\Session;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
class PhocaDownloadViewDownload 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();
$downloadToken = $app->input->get('id', '', 'string');// Token string
$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']);
// 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['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['file_icon_size'] = $this->t['p']->get( 'file_icon_size', 16 );
$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['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 );
$this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 );
$this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 );
$this->t['enable_token_download'] = $this->t['p']->get( 'enable_token_download', 0 );
$this->t['display_tags_links'] = $this->t['p']->get( 'display_tags_links', 0 );
PhocaDownloadRenderFront::renderMainJs();
PhocaDownloadRenderFront::renderAllCSS();
$this->t['found'] = 0;
if ($this->t['enable_token_download'] == 0) {
$this->t['found'] = 0;
} else if ($downloadToken == '') {
$this->t['found'] = 0;
} else {
$this->file = $model->getFile($downloadToken);
if(isset($this->file[0]->id) && (int)$this->file[0]->id > 0 && isset($this->file[0]->token) && $this->file[0]->token != '') {
$this->t['found'] = 1;
}
/*$document->addCustomTag('<script type="text/javascript" src="'.JUri::root().'components/com_phocadownload/assets/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);*/
// DOWNLOAD
// - - - - - - - - - - - - - - -
$download = $app->input->get( 'download', 0, 'int' );
//$licenseAgree = $app->input->get( 'license_agree', '', 'string' );
$downloadId = 0;
if (isset($this->file[0]->id)) {
$downloadId = (int) $this->file[0]->id;
}
if ($download == 1 ) {
if (isset($this->file[0]->id)) {
$currentLink = 'index.php?option=com_phocadownload&view=download&id='.htmlspecialchars($downloadToken). $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('get')) {
$app->enqueueMessage(Text::_("COM_PHOCADOWNLOAD_INVALID_TOKEN"), 'error');
$app->redirect(Route::_('index.php', false));
exit;
}
// Check License Agreement
/*if (empty($licenseAgree)) {
$app->redirect(Route::_($currentLink, false), Text::_('COM_PHOCADOWNLOAD_WARNING_AGREE_LICENSE_TERMS'));
exit;
}*/
$fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink, 1);
PhocaDownloadDownload::download($fileData, $downloadId, $currentLink, 1);
}
// - - - - - - - - - - - - - - -
/*$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]);
}*/
}
parent::display($tpl);
// 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);
}
*/
}
protected function _prepareDocument( $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', ''));
}
/*if (!empty($file->title)) {
$pathway->addItem($file->title);
}*/
}
}
?>

View File

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

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view hidden="true" />
</metadata>

View File

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

View File

@ -0,0 +1,155 @@
<?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
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
use Joomla\CMS\Language\Text;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Document\Feed\FeedItem;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;
jimport( 'joomla.application.component.view');
class PhocaDownloadViewFeed extends HtmlView
{
function display($tpl = null)
{
$app = Factory::getApplication();
$user = Factory::getUser();
$userLevels = implode (',', $user->getAuthorisedViewLevels());
//$db = JFactory::getDBO();
//$menu = $app->getMenu();
$document = Factory::getDocument();
//$params = $app->getParams();
$moduleId = $app->input->get('id', 0, 'int');
//$table = JTable::getInstance('module');
if ((int)$moduleId > 0) {
$db = Factory::getDBO();
$query = 'SELECT a.params'
. ' FROM #__modules AS a'
. ' WHERE a.published = 1'
. ' AND a.id ='.(int)$moduleId
. ' ORDER BY a.ordering';
$db->setQuery( $query );
/*if (!$db->query()) {
throw new Exception($db->getErrorMsg(), 500);
return false;
}*/
$module = $db->loadObject();
if (isset($module->params) && $module->params != '') {
jimport( 'joomla.html.parameter' );
$paramsM = new Registry;
$paramsM->loadString($module->params);
//$paramsM->loadJSON($module->params);
// Params
$categories = $paramsM->get( 'category_ids', '' );
$ordering = $paramsM->get( 'file_ordering', 6 );
$fileCount = $paramsM->get( 'file_count', 5 );
$feedTitle = $paramsM->get( 'feed_title', Text::_('COM_PHOCADOWNLOAD_DOWNLOAD') );
$displayDateType = $paramsM->get( 'display_date_type', 1 );
$document->setTitle($this->escape( html_entity_decode($feedTitle)));
$wheres = array();
if (is_array($categories) && count($categories) > 0) {
ArrayHelper::toInteger($categories);
$categoriesString = implode(',', $categories);
$wheres[] = ' c.catid IN ( '.$categoriesString.' ) ';
} else if ((int)$categories > 0) {
$wheres[] = ' c.catid IN ( '.$categories.' ) ';
}
$wheres[] = ' c.catid= cc.id';
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access IN ('.$userLevels.') ) )';
$wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access IN ('.$userLevels.') ) )';
$wheres[] = ' c.published = 1';
$wheres[] = ' c.approved = 1';
$wheres[] = ' cc.published = 1';
$wheres[] = ' c.textonly = 0';
// Active
$jnow = Factory::getDate();
$now = $jnow->toSql();
$nullDate = $db->getNullDate();
$wheres[] = ' ( c.publish_up = '.$db->Quote($nullDate).' OR c.publish_up <= '.$db->Quote($now).' )';
$wheres[] = ' ( c.publish_down = '.$db->Quote($nullDate).' OR c.publish_down >= '.$db->Quote($now).' )';
$fileOrdering = PhocaDownloadOrdering::getOrderingText($ordering);
$query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid '
. ' FROM #__phocadownload AS c'
. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid'
. ' WHERE ' . implode( ' AND ', $wheres )
. ' ORDER BY '.$fileOrdering;
$db->setQuery( $query , 0, $fileCount );
$files = $db->loadObjectList( );
foreach ($files as $keyDoc => $valueDoc) {
// 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($valueDoc)) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $valueDoc->cataccessuserid, $valueDoc->cataccess, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
$item = new FeedItem();
$title = $this->escape( $valueDoc->title . ' ('.PhocaDownloadFile::getTitleFromFilenameWithExt( $valueDoc->filename ).')' );
$title = html_entity_decode( $title );
$item->title = $title;
$link = PhocaDownloadRoute::getCategoryRoute($valueDoc->categoryid, $valueDoc->categoryalias);
$item->link = Route::_($link);
// FILEDATE
$fileDate = '';
if ((int)$displayDateType > 0) {
if ($valueDoc->filename !='') {
$fileDate = PhocaDownloadFile::getFileTime($valueDoc->filename, $displayDateType, "Y-m-d H:M:S");
}
} else {
$fileDate = HTMLHelper::Date($valueDoc->date, "Y-m-d H:i:s");
}
if ($fileDate != '') {
$item->date = $fileDate;
}
//$item->description = $valueDoc->description;
// $item->description = '<div><img src="media/com_phocadownload/images/phoca-download.png" alt="" /></div><div>New file "' .$valueDoc->title . '" ('. $valueDoc->filename.') released on '. $dateDesc.' is available on <a href="https://www.phoca.cz/download">Phoca download site</a></div>'.$valueDoc->description;
$item->description = '<div><img src="media/com_phocadownload/images/phoca-download.png" alt="" /></div>'.$valueDoc->description;
$item->category = $valueDoc->categorytitle;
// $item->section = $valueDoc->sectiontitle;
if ($valueDoc->author != '') {
$item->author = $valueDoc->author;
}
$document->addItem( $item );
}
}
}
}
}
}
?>

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

View 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">&nbsp;</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>&nbsp;</div>';// end of box
} else {
echo '<div>&nbsp;</div>';
}
echo '</div></div>';
echo '<div class="pd-cb">&nbsp;</div>';
echo PhocaDownloadUtils::getInfo();
?>

View 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>

View File

@ -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">&nbsp;</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>&nbsp;</div>';// end of box
} else {
echo '<div>&nbsp;</div>';
}
echo '</div></div>';
echo '<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 @@
<html><body bgcolor="#FFFFFF"></body></html>

View 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);
}
}
?>

View File

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

View File

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

View File

@ -0,0 +1,104 @@
<?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\Language\Text;
//JHtml::_('behavior.tooltip');
?>
<script type="text/javascript">
function insertLink() {
if (!Joomla.getOptions('xtd-phocadownload')) {
return false;
}
var _Joomla$getOptions = Joomla.getOptions('xtd-phocadownload'), editor = _Joomla$getOptions.editor;
var title = document.getElementById("title").value;
if (title != '') {
title = "|text=" + title;
}
var target = document.getElementById("target").value;
if (target != '') {
target = "|target=" + target;
}
var categoryIdOutput;
var categoryid = document.getElementById("catid").value;
if (categoryid != '' && parseInt(categoryid) > 0) {
categoryIdOutput = "|id=" + categoryid;
} else {
categoryIdOutput = '';
}
if (categoryIdOutput != '' && parseInt(categoryid) > 0) {
var tag = "{phocadownload view=category" + categoryIdOutput + title + target + "}";
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
if (window.parent.Joomla.Modal) {
window.parent.Joomla.Modal.getCurrent().close();
}
return false;
} else {
alert("<?php echo Text::_('COM_PHOCADOWNLOAD_YOU_MUST_SELECT_CATEGORY', true); ?>");
return false;
}
}
</script>
<div id="phocadownload-links">
<fieldset class="adminform options-menu options-form">
<legend><?php echo Text::_('COM_PHOCADOWNLOAD_CATEGORY'); ?></legend>
<form name="adminForm" id="adminForm">
<div class="control-group">
<div class="control-label">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_CATEGORY'); ?>
</label>
</div>
<div class="controls">
<?php echo $this->t['lists']['catid']; ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_TITLE'); ?>
</label>
</div>
<div class="controls">
<input type="text" id="title" name="title" class="form-control"/>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="target">
<?php echo Text::_('COM_PHOCADOWNLOAD_TARGET'); ?>
</label>
<
</div>
<div class="controls">
<select name="target" id="target" class="form-select">
<option value="s" selected="selected"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_SELF'); ?></option>
<option value="b"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_BLANK'); ?></option>
<option value="t"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_TOP'); ?></option>
<option value="p"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_PARENT'); ?></option>
</select>
</div>
</div>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
</fieldset>
<div class="btn-box-back"><a class="btn btn-light" href="<?php echo $this->t['backlink']; ?>"><span class="icon-arrow-left"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_BACK') ?></a></div>
</div>

View File

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

View File

@ -0,0 +1,76 @@
<?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\Language\Text;
jimport('joomla.application.component.view');
phocadownloadimport('phocadownload.render.renderadminviews');
class phocaDownloadViewphocaDownloadLinkCat extends HtmlView
{
protected $t;
protected $r;
function display($tpl = null) {
$app = Factory::getApplication();
$db = Factory::getDBO();
$this->r = new PhocaDownloadRenderAdminViews();
$this->t = PhocaDownloadUtils::setVars('linkcat');
//Frontend Changes
$tUri = '';
if (!$app->isClient('administrator')) {
$tUri = Uri::base();
}
$editor = $app->input->getCmd('editor', '');
if (!empty($editor)) {
$this->document->addScriptOptions('xtd-phocadownload', array('editor' => $editor));
}
$document = Factory::getDocument();
$uri = Uri::getInstance();
HTMLHelper::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
HTMLHelper::stylesheet( 'media/plg_editors-xtd_phocadownload/css/phocadownload.css' );
$eName = Factory::getApplication()->input->get('editor');
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinks&amp;tmpl=component&amp;editor='.$this->t['ename'];
$model = $this->getModel();
// build list of categories
//$javascript = 'class="form-control" size="1" onchange="submitform( );"';
$attr = 'class="form-select" size="1"';
$filter_catid = '';
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parent_id'
. ' FROM #__phocadownload_categories AS a'
. ' WHERE a.published = 1'
//. ' AND a.approved = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$phocadownloads = $db->loadObjectList();
$tree = array();
$text = '';
$tree = PhocaDownloadCategory::CategoryTreeOption($phocadownloads, $tree, 0, $text, -1);
array_unshift($tree, HTMLHelper::_('select.option', '0', '- '.Text::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -', 'value', 'text'));
$lists['catid'] = HTMLHelper::_( 'select.genericlist', $tree, 'catid', $attr , 'value', 'text', $filter_catid );
//-----------------------------------------------------------------------
//$this->assignRef('lists', $lists);
$this->t['lists'] = $lists;
parent::display($tpl);
}
}
?>

View File

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

View File

@ -0,0 +1,89 @@
<?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\Language\Text;
?>
<script type="text/javascript">
function insertLink() {
if (!Joomla.getOptions('xtd-phocadownload')) {
return false;
}
var _Joomla$getOptions = Joomla.getOptions('xtd-phocadownload'), editor = _Joomla$getOptions.editor;
var title = document.getElementById("title").value;
if (title != '') {
title = "|text=" + title;
}
var target = document.getElementById("target").value;
if (target != '') {
target = "|target=" + target;
}
var tag = "{phocadownload view=categories" + title + target + "}";
<?php /*
//window.parent.jInsertEditorText(tag, '<?php echo $this->t['ename']; ?>');
//window.parent.document.getElementById('sbox-window').close();
//window.parent.SqueezeBox.close();
*/ ?>
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
if (window.parent.Joomla.Modal) {
window.parent.Joomla.Modal.getCurrent().close();
}
return false;
}
</script>
<div id="phocadownload-links">
<fieldset class="adminform options-menu options-form">
<legend><?php echo Text::_('COM_PHOCADOWNLOAD_CATEGORIES'); ?></legend>
<form name="adminFormLink" id="adminFormLink">
<div class="control-group">
<div class="control-label">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_TITLE'); ?>
</label>
</div>
<div class="controls">
<input type="text" id="title" name="title" class="form-control"/>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="target">
<?php echo Text::_('COM_PHOCADOWNLOAD_TARGET'); ?>
</label>
</div>
<div class="controls">
<select name="target" id="target" class="form-select">
<option value="s" selected="selected"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_SELF'); ?></option>
<option value="b"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_BLANK'); ?></option>
<option value="t"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_TOP'); ?></option>
<option value="p"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_PARENT'); ?></option>
</select>
</div>
</div>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
</fieldset>
<div class="btn-box-back"><a class="btn btn-light" href="<?php echo $this->t['backlink']; ?>"><span class="icon-arrow-left"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_BACK') ?></a></div>
</div>

View File

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

View File

@ -0,0 +1,85 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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;
jimport( 'joomla.application.component.view' );
phocadownloadimport('phocadownload.render.renderadminviews');
class phocaDownloadViewphocaDownloadLinkCats extends HtmlView
{
protected $t;
protected $r;
function display($tpl = null) {
$app = Factory::getApplication();
$this->r = new PhocaDownloadRenderAdminViews();
$this->t = PhocaDownloadUtils::setVars('linkcats');
//Frontend Changes
$tUri = '';
if (!$app->isClient('administrator')) {
$tUri = Uri::base();
}
$editor = $app->input->getCmd('editor', '');
if (!empty($editor)) {
$this->document->addScriptOptions('xtd-phocadownload', array('editor' => $editor));
}
HTMLHelper::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
HTMLHelper::stylesheet( 'media/plg_editors-xtd_phocadownload/css/phocadownload.css' );
$document = Factory::getDocument();
$uri = Uri::getInstance();
$eName = $app->input->get('editor');
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinks&amp;tmpl=component&amp;editor='.$this->t['ename'];
/* // Category Tree
$db = Factory::getDBO();
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parent_id'
. ' FROM #__phocadownload_categories AS a'
// . ' WHERE a.published = 1' You can hide not published and not authorized categories too
// . ' AND a.approved = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$categories = $db->loadObjectList();
$tree = array();
$text = '';
$tree = PhocaDownloadCategory::CategoryTreeOption($categories, $tree, 0, $text, -1);
//-----------------------------------------------------------------------
// Multiple
$ctrl = 'hidecategories';
$attribs = ' ';
$attribs .= ' size="5"';
//$attribs .= 'class="'.$v.'"';
$attribs .= ' class="form-control"';
$attribs .= ' multiple="multiple"';
$ctrl .= '';
//$value = implode( '|', )
$categoriesOutput = HTMLHelper::_('select.genericlist', $tree, $ctrl, $attribs, 'value', 'text', 0, 'hidecategories' );
//$this->assignRef('categoriesoutput', $categoriesOutput);
//$this->assignRef('tmpl', $this->t);*/
parent::display($tpl);
}
}
?>

View File

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

View File

@ -0,0 +1,419 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
$user = Factory::getUser();
//Ordering allowed ?
$ordering = ($this->t['lists']['order'] == 'a.ordering');
if ($this->t['type'] == 0) {
$view = 'file';
} else if ($this->t['type'] == 1) {
$view = 'fileplaylink';
} else if ($this->t['type'] == 2) {
$view = 'fileplay';
} else if ($this->t['type'] == 3) {
$view = 'filepreviewlink';
} else if ($this->t['type'] == 4) {
$view = 'filelist';
}
$js = '';
$js .= '
function insertLink() {
if (!Joomla.getOptions(\'xtd-phocadownload\')) {
return false;
}
var _Joomla$getOptions = Joomla.getOptions(\'xtd-phocadownload\'), editor = _Joomla$getOptions.editor;
var title = document.getElementById("title").value;
if (title != "") {
title = "|text="+title;
}';
if ($this->t['type'] == 0) {
$js .= 'var target = document.getElementById("target").value;
if (target != "") {
target = "|target="+target;
}';
} else if ($this->t['type'] == 1 || $this->t['type'] == 2) {
$js .= 'var playerwidth = document.getElementById("playerwidth").value;
if (playerwidth != "") {
playerwidth = "|playerwidth="+playerwidth;
}
var playerheight = document.getElementById("playerheight").value;
if (playerheight != "") {
playerheight = "|playerheight="+playerheight;
}
var playerheightmp3 = document.getElementById("playerheightmp3").value;
if (playerheightmp3 != "") {
playerheightmp3 = "|playerheightmp3="+playerheightmp3;
}';
} else if ($this->t['type'] == 3) {
$js .= 'var previewwidth = document.getElementById("previewwidth").value;
if (previewwidth != "") {
previewwidth = "|previewwidth="+previewwidth;
}
var previewheight = document.getElementById("previewheight").value;
if (previewheight != "") {
previewheight = "|previewheight="+previewheight;
}';
} else if ($this->t['type'] == 4) {
$js .= 'var limit = document.getElementById("limit").value;
if (limit != "") {
limit = "|limit="+limit;
}
var categoryid = document.getElementById("catid").value;
if (categoryid != "" && parseInt(categoryid) > 0) {
categoryIdOutput = "|id="+categoryid;
} else {
categoryIdOutput = "";
}';
}
$js .= 'var fileIdOutput;
fileIdOutput = "";
len = document.getElementsByName("fileid").length;
for (i = 0; i <len; i++) {
if (document.getElementsByName(\'fileid\')[i].checked) {
fileid = document.getElementsByName(\'fileid\')[i].value;
if (fileid != "" && parseInt(fileid) > 0) {
fileIdOutput = "|id="+fileid;
} else {
fileIdOutput = "";
}
}
}
if (fileIdOutput != "" && parseInt(fileid) > 0) {';
if ($this->t['type'] == 0) {
$js .= 'var tag = "{phocadownload view=' . $view . '"+fileIdOutput+title+target+"}";';
} else if ($this->t['type'] == 1) {
$js .= 'var tag = "{phocadownload view=' . $view . '"+fileIdOutput+title+playerwidth+playerheight+playerheightmp3+"}";';
} else if ($this->t['type'] == 2) {
$js .= 'var tag = "{phocadownload view=' . $view . '"+fileIdOutput+title+playerwidth+playerheight+playerheightmp3+"}";';
} else if ($this->t['type'] == 3) {
$js .= 'var tag = "{phocadownload view=' . $view . '"+fileIdOutput+title+previewwidth+previewheight+"}";';
} else if ($this->t['type'] == 4) {
$js .= 'var tag = "{phocadownload view=' . $view . '"+fileIdOutput+limit+"}";';
}
/*$js .= 'window.parent.jInsertEditorText(tag, \''. htmlspecialchars($this->t['ename']).'\');';
//window.parent.document.getElementById('sbox-window').close();
$js .= 'window.parent.SqueezeBox.close();
return false;*/
$js .= 'window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
if (window.parent.Joomla.Modal) {
window.parent.Joomla.Modal.getCurrent().close();
}
return false;
} else {';
if ($this->t['type'] == 4) {
$js .= 'if (categoryIdOutput != \'\' && parseInt(categoryid) > 0) {
var tag = "{phocadownload view=' . $view . '"+categoryIdOutput+limit+"}";';
$js .= 'window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
if (window.parent.Joomla.Modal) {
window.parent.Joomla.Modal.getCurrent().close();
}
return false;
} else {
alert("' . Text::_('COM_PHOCADOWNLOAD_YOU_MUST_SELECT_CATEGORY', true) . '");
return false;
}';
} else {
$js .= 'alert("' . Text::_('COM_PHOCADOWNLOAD_YOU_MUST_SELECT_FILE', true) . '");
return false;';
}
$js .= '}';
$js .= '}';
Factory::getDocument()->addScriptDeclaration($js); ?>
<div id="phocadownload-links">
<fieldset class="adminform options-menu options-form">
<legend><?php echo Text::_('COM_PHOCADOWNLOAD_FILE'); ?></legend>
<form action="<?php echo $this->t['request_url']; ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->t['type'] != 4) { ?>
<table class="admintable" width="100%">
<tr>
<td class="key" align="right" width="20%">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_FILTER'); ?>
</label>
</td>
<td width="80%">
<div class="input-append"><input type="text" name="search" id="search" value="<?php echo PhocaDownloadUtils::filterValue($this->t['lists']['search'], 'text'); ?>" class="form-control"
onchange="document.adminForm.submit();"/>
<button class="btn btn-primary" onclick="this.form.submit();"><?php echo Text::_('COM_PHOCADOWNLOAD_FILTER'); ?></button>
<button class="btn btn-primary" onclick="document.getElementById('search').value='';this.form.submit();"><?php echo Text::_('COM_PHOCADOWNLOAD_RESET'); ?></button>
</div>
</td>
</tr>
<tr>
<td class="key" align="right" nowrap="nowrap">
<label for="title" nowrap="nowrap"><?php echo Text::_('COM_PHOCADOWNLOAD_CATEGORY'); ?></label>
</td>
<td><?php echo $this->t['lists']['catid']; ?></td>
</tr>
</table>
<?php } ?>
<?php if ($this->t['type'] != 4) { ?>
<div id="editcell">
<table class="adminlist plg-button-tbl">
<thead>
<tr>
<th width="5%"><?php echo Text::_('COM_PHOCADOWNLOAD_NUM'); ?></th>
<th width="5%"></th>
<th class="title" width="60%"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_TITLE', 'a.title', $this->t['lists']['order_Dir'], $this->t['lists']['order']); ?>
</th>
<th width="20%" nowrap="nowrap"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_FILENAME', 'a.filename', $this->t['lists']['order_Dir'], $this->t['lists']['order']); ?>
</th>
<th width="10%" nowrap="nowrap"><?php echo HTMLHelper::_('grid.sort', 'COM_PHOCADOWNLOAD_ID', 'a.id', $this->t['lists']['order_Dir'], $this->t['lists']['order']); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5"><?php echo $this->t['pagination']->getListFooter(); ?></td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
for ($i = 0, $n = count($this->t['items']); $i < $n; $i++) {
$row = &$this->t['items'][$i];
?>
<tr class="<?php echo "row$k"; ?>">
<td><?php echo $this->t['pagination']->getRowOffset($i); ?></td>
<td><label style="width: 100%; display: inline-block;"><input type="radio" name="fileid" value="<?php echo $row->id ?>"/></label></td>
<td><?php echo $row->title; ?></td>
<td><?php echo $row->filename; ?></td>
<td align="center"><?php echo $row->id; ?></td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
</div>
<?php } ?>
<input type="hidden" name="controller" value="phocadownloadlinkfile"/>
<input type="hidden" name="type" value="<?php echo $this->t['type']; ?>"/>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<input type="hidden" name="filter_order" value="<?php echo $this->t['lists']['order']; ?>"/>
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->t['lists']['order_Dir']; ?>"/>
<input type="hidden" name="editor" value="<?php echo $this->t['ename'] ?>"/>
</form>
<hr>
<?php
if ($this->t['type'] == 0) {
?>
<form name="adminFormLink" id="adminFormLink">
<div class="control-group">
<div class="control-label">
<label for="title"><?php echo Text::_('COM_PHOCADOWNLOAD_TITLE'); ?></label>
</div>
<div class="controls"><input class="form-control" type="text" id="title" name="title"/>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="target">
<?php echo Text::_('COM_PHOCADOWNLOAD_TARGET'); ?>
</label>
</div>
<div class="controls">
<select name="target" id="target" class="form-select">
<option value="s" selected="selected"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_SELF'); ?></option>
<option value="b"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_BLANK'); ?></option>
<option value="t"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_TOP'); ?></option>
<option value="p"><?php echo Text::_('COM_PHOCADOWNLOAD_TARGET_PARENT'); ?></option>
</select>
</div>
</div>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
<?php
} else if ($this->t['type'] == 1 || $this->t['type'] == 2) {
?>
<form name="adminFormLink" id="adminFormLink">
<div class="control-group">
<?php if ($this->t['type'] == 1) { ?>
<div class="control-label">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_TITLE'); ?>
</label>
</div>
<div class="controls">
<input class="form-control" type="text" id="title" name="title"/>
</div>
<?php } else { ?>
<input type="hidden" id="title" name="title"/>
<?php } ?>
</div>
<div class="control-group">
<div class="control-label">
<label for="playerwidth">
<?php echo Text::_('COM_PHOCADOWNLOAD_PLAYER_WIDTH'); ?>
</label>
</div>
<div class="controls">
<input class="form-control" type="text" id="playerwidth" name="playerwidth" value="328"/>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="playerheight">
<?php echo Text::_('COM_PHOCADOWNLOAD_PLAYER_HEIGHT'); ?>
</label>
</div>
<div class="controls">
<input class="form-control" type="text" id="playerheight" name="playerheight" value="200"/>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="playerheightmp3">
<?php echo Text::_('COM_PHOCADOWNLOAD_PLAYER_HEIGHT_MP3'); ?>
</label>
</div>
<div class="controls">
<input class="form-control" type="text" id="playerheightmp3" name="playerheightmp3" value="30"/>
</div>
</div>
<?php if ($this->t['type'] == 1) { ?>
<div class="ph-warning"><?php echo Text::_('COM_PHOCADOWNLOAD_WARNING_PLAYER_SIZE') ?></div>
<?php } ?>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
<?php
} else if ($this->t['type'] == 3) {
?>
<form name="adminFormLink" id="adminFormLink">
<div class="control-group">
<?php if ($this->t['type'] == 1) { ?>
<div class="control-label">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_TITLE'); ?>
</label>
</div>
<div class="controls">
<input class="form-control" type="text" id="title" name="title"/>
</div>
<?php } else { ?>
<input type="hidden" id="title" name="title"/>
<?php } ?>
</div>
<div class="control-group">
<div class="control-label">
<label for="previewwidth">
<?php echo Text::_('COM_PHOCADOWNLOAD_PREVIEW_WIDTH'); ?>
</label>
</div>
<div class="controls">
<input class="form-control" type="text" id="previewwidth" name="previewwidth" value="640"/>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label for="previewheight">
<?php echo Text::_('COM_PHOCADOWNLOAD_PREVIEW_HEIGHT'); ?>
</label>
</div>
<div class="controls">
<input type="text" class="form-control" id="previewheight" name="previewheight" value="480"/>
</div>
</div>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
<?php
} else if ($this->t['type'] == 4) {
?>
<form name="adminFormLink" id="adminFormLink">
<div class="control-group">
<div class="control-label">
<label for="title" nowrap="nowrap"><?php echo Text::_('COM_PHOCADOWNLOAD_CATEGORY'); ?></label>
</div>
<div class="controls"><?php echo $this->t['lists']['catid']; ?></div>
</div>
<div class="control-group">
<div class="control-label">
<label for="title">
<?php echo Text::_('COM_PHOCADOWNLOAD_LIMIT'); ?>
</label>
</div>
<div class="controls">
<input type="text" id="limit" name="limit" class="form-control"/>
<input type="hidden" id="title" name="title"/>
</div>
</div>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
<?php
}
?>
</fieldset>
<div class="btn-box-back"><a class="btn btn-light" href="<?php echo $this->t['backlink']; ?>"><span class="icon-arrow-left"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_BACK') ?></a></div>
</div>

View File

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

View File

@ -0,0 +1,148 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper;
jimport( 'joomla.application.component.view' );
phocadownloadimport('phocadownload.render.renderadminviews');
use Joomla\String\StringHelper;
class PhocaDownloadViewPhocaDownloadLinkFile extends HtmlView
{
public $_context = 'com_phocadownload.phocadownloadlinkfile';
protected $t;
protected $r;
function display($tpl = null) {
$app = Factory::getApplication();
$this->r = new PhocaDownloadRenderAdminViews();
$this->t = PhocaDownloadUtils::setVars('linkfile');
$uri = Uri::getInstance();
$document = Factory::getDocument();
$db = Factory::getDBO();
//Frontend Changes
$tUri = '';
if (!$app->isClient('administrator')) {
$tUri = Uri::base();
}
$editor = $app->input->getCmd('editor', '');
if (!empty($editor)) {
$this->document->addScriptOptions('xtd-phocadownload', array('editor' => $editor));
}
HTMLHelper::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
HTMLHelper::stylesheet( 'media/plg_editors-xtd_phocadownload/css/phocadownload.css' );
//JHtml::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
$eName = $app->input->get('editor');
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
$this->t['type'] = $app->input->get( 'type', 1, '', 'int' );
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinks&amp;tmpl=component&amp;editor='.$this->t['ename'];
$params = ComponentHelper::getParams('com_phocadownload') ;
//Filter
$context = 'com_phocadownload.phocadownload.list.';
//$sectionid = $app->input->get( 'sectionid', -1, '', 'int' );
//$redirect = $sectionid;
$option = Factory::getApplication()->input->getCmd( 'option' );
$filter_published = $app->getUserStateFromRequest( $this->_context.'.filter_published', 'filter_published', '', 'word' );
$filter_catid = $app->getUserStateFromRequest( $this->_context.'.filter_catid', 'filter_catid', 0, 'int' );
$catid = $app->getUserStateFromRequest( $this->_context.'.catid', 'catid', 0, 'int');
// $filter_sectionid = $app->getUserStateFromRequest( $this->_context.'.filter_sectionid','filter_sectionid', -1, 'int');
$filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
$search = $app->getUserStateFromRequest( $this->_context.'.search','search', '', 'string' );
$search = StringHelper::strtolower( $search );
// Get data from the model
$items = $this->get( 'Data');
$total = $this->get( 'Total');
$pagination = $this->get( 'Pagination' );
// build list of categories
if ($this->t['type'] != 4) {
$javascript = 'class="form-control" size="1" onchange="submitform( );"';
} else {
$javascript = '';
}
// get list of categories for dropdown filter
$filter = '';
//if ($filter_sectionid > 0) {
// $filter = ' WHERE cc.section = '.$db->Quote($filter_sectionid);
//}
// get list of categories for dropdown filter
$query = 'SELECT cc.id AS value, cc.title AS text' .
' FROM #__phocadownload_categories AS cc' .
$filter .
' ORDER BY cc.ordering';
if ($this->t['type'] != 4) {
$lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, true, true);
} else {
$lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, false, true);
}
/*
if ($this->t['type'] != 4) {
$lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, true);
} else {
$lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, false);
}*/
// sectionid
/*$query = 'SELECT s.title AS text, s.id AS value'
. ' FROM #__phocadownload_sections AS s'
. ' WHERE s.published = 1'
. ' ORDER BY s.ordering';
$lists['sectionid'] = PhocaDownloadCategory::filterSection($query, $filter_sectionid);*/
// state filter
$lists['state'] = HTMLHelper::_('grid.state', $filter_published );
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
// search filter
$lists['search']= $search;
$user = Factory::getUser();
$uriS = $uri->toString();
//$this->assignRef('user', $user);
//$this->assignRef('lists', $lists);
$this->t['lists'] = $lists;
//$this->assignRef('items', $items);
$this->t['items'] = $items;
//$this->assignRef('pagination', $pagination);
$this->t['pagination'] = $pagination;
//$this->assignRef('request_url', $uriS);
$this->t['request_url'] = $uriS;
parent::display($tpl);
}
}
?>

View File

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

View File

@ -0,0 +1,28 @@
<?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;
echo '<div id="phocadownload-links">'
.'<fieldset class="adminform">'
.'<legend>'.Text::_( 'COM_PHOCADOWNLOAD_SELECT_TYPE' ).'</legend>'
.'<ul>'
.'<li class="ph-icon-16-edb-categories"><a href="'.$this->t['linkcategories'].'">'.Text::_('COM_PHOCADOWNLOAD_LINK_TO_CATEGORIES').'</a></li>'
.'<li class="ph-icon-16-edb-category"><a href="'.$this->t['linkcategory'].'">'.Text::_('COM_PHOCADOWNLOAD_LINK_TO_CATEGORY').'</a></li>'
.'<li class="ph-icon-16-edb-file"><a href="'.$this->t['linkfile'].'&type=0">'.Text::_('COM_PHOCADOWNLOAD_LINK_TO_FILE').'</a></li>'
.'<li class="ph-icon-16-edb-play"><a href="'.$this->t['linkfile'].'&type=1">'.Text::_('COM_PHOCADOWNLOAD_PLAY_FILE_LINK').'</a> <a href="'.$this->t['linkfile'].'&type=2">'.Text::_('COM_PHOCADOWNLOAD_PLAY_FILE_DIRECT').'</a></li>'
.'<li class="ph-icon-16-edb-preview"><a href="'.$this->t['linkfile'].'&type=3">'.Text::_('COM_PHOCADOWNLOAD_PREVIEW_FILE_LINK').'</a></li>'
.'<li class="ph-icon-16-edb-file"><a href="'.$this->t['linkfile'].'&type=4">'.Text::_('COM_PHOCADOWNLOAD_FILELIST').'</a></li>'
.'<li class="ph-icon-16-edb-play"><a href="'.$this->t['linkytb'].'">'.Text::_('COM_PHOCADOWNLOAD_YOUTUBE_VIDEO').'</a></li>'
.'</ul>'
.'</div>'
.'</fieldset>'
.'</div>';
?>

View File

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

View File

@ -0,0 +1,58 @@
<?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;
jimport( 'joomla.application.component.view' );
phocadownloadimport('phocadownload.render.renderadminviews');
class phocaDownloadViewphocaDownloadLinks extends HtmlView
{
protected $t;
protected $r;
function display($tpl = null) {
$app = Factory::getApplication();
$this->r = new PhocaDownloadRenderAdminViews();
$this->t = PhocaDownloadUtils::setVars('links');
//Frontend Changes
$tUri = '';
if (!$app->isClient('administrator')) {
$tUri = Uri::base();
}
$editor = $app->input->getCmd('editor', '');
if (!empty($editor)) {
$this->document->addScriptOptions('xtd-phocadownload', array('editor' => $editor));
}
$document = Factory::getDocument();
$uri = Uri::getInstance();
HTMLHelper::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
HTMLHelper::stylesheet( 'media/plg_editors-xtd_phocadownload/css/phocadownload.css' );
$eName = Factory::getApplication()->input->get('editor');
$eName = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
$this->t['linkcategories'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinkcats&amp;tmpl=component&amp;editor='.$eName;
$this->t['linkcategory'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinkcat&amp;tmpl=component&amp;editor='.$eName;
$this->t['linkfile'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinkfile&amp;tmpl=component&amp;editor='.$eName;
$this->t['linkytb'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinkytb&amp;tmpl=component&amp;editor='.$eName;
parent::display($tpl);
}
}
?>

View File

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

View File

@ -0,0 +1,70 @@
<?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\Factory;
$js = '';
$js .= '
function insertLink() {
if (!Joomla.getOptions(\'xtd-phocadownload\')) {
return false;
}
var _Joomla$getOptions = Joomla.getOptions(\'xtd-phocadownload\'), editor = _Joomla$getOptions.editor;
var urlOutput;
var url = document.getElementById("url").value;
if (url != \'\' ) {
urlOutput = "|url="+url;
}
if (urlOutput != \'\' && urlOutput) {
var tag = "{phocadownload view=youtube"+urlOutput+"}";
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
if (window.parent.Joomla.Modal) {
window.parent.Joomla.Modal.getCurrent().close();
}
return false;
} else {
alert("' . Text::_('COM_PHOCADOWNLOAD_WARNING_SET_YOUTUBE_URL', true) . '");
return false;
}
}';
Factory::getDocument()->addScriptDeclaration($js); ?>
<div id="phocadownload-links">
<fieldset class="adminform options-menu options-form">
<legend><?php echo Text::_('COM_PHOCADOWNLOAD_YOUTUBE_VIDEO'); ?></legend>
<form name="adminFormLink" id="adminFormLink">
<div class="control-group">
<div class="control-label">
<label for="url">
<?php echo Text::_('COM_PHOCADOWNLOAD_YOUTUBE_URL'); ?>
</label>
</div>
<div class="controls">
<input type="text" id="url" name="url" class="form-control"/>
</div>
</div>
<div class="btn-box-submit">
<button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_INSERT_CODE'); ?></button>
</div>
</form>
</fieldset>
<div class="btn-box-back"><a class="btn btn-light" href="<?php echo $this->t['backlink']; ?>"><span class="icon-arrow-left"></span> <?php echo Text::_('COM_PHOCADOWNLOAD_BACK') ?></a></div>
</div>

View File

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

View File

@ -0,0 +1,57 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\HTML\HTMLHelper;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
jimport( 'joomla.application.component.view' );
phocadownloadimport('phocadownload.render.renderadminviews');
class phocaDownloadViewphocaDownloadLinkYtb extends HtmlView
{
protected $t;
protected $r;
function display($tpl = null) {
$app = Factory::getApplication();
$this->r = new PhocaDownloadRenderAdminViews();
$this->t = PhocaDownloadUtils::setVars('linkytb');
$document = Factory::getDocument();
$uri = Uri::getInstance();
//Frontend Changes
$tUri = '';
if (!$app->isClient('administrator')) {
$tUri = Uri::base();
}
$editor = $app->input->getCmd('editor', '');
if (!empty($editor)) {
$this->document->addScriptOptions('xtd-phocadownload', array('editor' => $editor));
}
HTMLHelper::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
HTMLHelper::stylesheet( 'media/plg_editors-xtd_phocadownload/css/phocadownload.css' );
$eName = Factory::getApplication()->input->get('editor');
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&amp;view=phocadownloadlinks&amp;tmpl=component&amp;editor='.$this->t['ename'];
parent::display($tpl);
}
}
?>

View File

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

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view hidden="true" />
</metadata>

View File

@ -0,0 +1,96 @@
<?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
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
// 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->t['file'][0])) {
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->t['file'][0]->cataccessuserid, $this->t['file'][0]->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplay == 1) {
if ($this->t['html5_play'] == 1 && $this->t['filetype'] != 'flv') {
// style because of iframe
echo '<div style="display: flex;align-items: center;justify-content: center;" class="ph-media-iframe-box">';
if ($this->t['filetype'] == 'mp3') {
echo '<audio width="'.$this->t['playerwidth'].'" height="'.$this->t['playerheight'].'" style="margin-top: 10px;" controls>';
echo '<source src="'.$this->t['playfilewithpath'].'" type="audio/mpeg">';
echo Text::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
echo '</audio>'. "\n";
} else if ($this->t['filetype'] == 'mp4') {
echo '<video width="'.$this->t['playerwidth'].'" height="'.$this->t['playerheight'].'" style="margin-top: 10px;" controls>';
echo '<source src="'.$this->t['playfilewithpath'].'" type="video/mp4">';
echo Text::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
echo '</video>'. "\n";
} else if ($this->t['filetype'] == 'ogg') {
echo '<audio width="'.$this->t['playerwidth'].'" height="'.$this->t['playerheight'].'" style="margin-top: 10px;" controls>';
echo '<source src="'.$this->t['playfilewithpath'].'" type="audio/ogg">';
echo Text::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
echo '</audio>'. "\n";
} else if ($this->t['filetype'] == 'ogv') {
echo '<video width="'.$this->t['playerwidth'].'" height="'.$this->t['playerheight'].'" style="margin-top: 10px;" controls>';
echo '<source src="'.$this->t['playfilewithpath'].'" type="video/ogg">';
echo Text::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
echo '</video>'. "\n";
} else if ($this->t['filetype'] == 'webm') {
echo '<video width="'.$this->t['playerwidth'].'" height="'.$this->t['playerheight'].'" style="margin-top: 10px;" controls>';
echo '<source src="'.$this->t['playfilewithpath'].'" type="video/webm">';
echo Text::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
echo '</video>'. "\n";
} /*else if ($this->t['filetype'] == 'flv') {
echo '<video width="'.$this->t['playerwidth'].'" height="'.$this->t['playerheight'].'" style="margin-top: 10px;" controls>';
echo '<source src="'.$this->t['playfilewithpath'].'" type="video/x-flv">';
echo Text::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
echo '</video>'. "\n";
}*/
echo '</div>';
} else {
//Flow Player
$versionFLP = '3.2.2';
$versionFLPJS = '3.2.2';
$document = Factory::getDocument();
//$document->addScript($this->t['playerpath'].'flowplayer-'.$versionFLPJS.'.min.js');
?>
<div style="text-align:center;">
<div style="margin: 10px auto;text-align:center; width:<?php echo $this->t['playerwidth']; ?>px"><a href="<?php echo $this->t['playfilewithpath']; ?>" style="display:block;width:<?php echo $this->t['playerwidth']; ?>px;height:<?php echo $this->t['playerheight']; ?>px" id="player"></a><?php
if ($this->t['filetype'] == 'mp3') {
?><script>
flowplayer("player", "<?php echo $this->t['playerpath']; ?>flowplayer-<?php echo $versionFLP ?>.swf",
{
plugins: {
controls: {
fullscreen: false,
height: <?php echo $this->t['playerheight']; ?>
}
}
}
);</script><?php
} else {
?><script>
flowplayer("player", "<?php echo $this->t['playerpath']; ?>flowplayer-<?php echo $versionFLP ?>.swf");</script><?php
}
?></div></div><?php
}
} else {
echo Text::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY');
}

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
</metadata>

View File

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

View File

@ -0,0 +1,75 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\Language\Text;
jimport( 'joomla.application.component.view');
class PhocaDownloadViewPlay extends HtmlView
{
function display($tpl = null){
$app = Factory::getApplication();
$params = $app->getParams();
$this->t = array();
$this->t['user'] = Factory::getUser();
$uri = Uri::getInstance();
$model = $this->getModel();
$document = Factory::getDocument();
$fileId = $app->input->get('id', 0, 'int');
$file = $model->getFile($fileId);
$fileExt = '';
$filePath = PhocaDownloadPath::getPathSet('fileplay');
$filePath = str_replace ( '../', Uri::base(false).'', $filePath['orig_rel_ds']);
if (isset($file[0]->filename_play) && $file[0]->filename_play != '') {
$fileExt = PhocaDownloadFile::getExtension($file[0]->filename_play);
$canPlay = PhocaDownloadFile::canPlay($file[0]->filename_play);
if ($canPlay) {
$this->t['playfilewithpath'] = $filePath . $file[0]->filename_play;
//$this->t['playerpath'] = JUri::base().'components/com_phocadownload/assets/jwplayer/';
//$this->t['playerpath'] = Uri::base().'media/com_phocadownload/js/flowplayer/';
$this->t['playerwidth'] = $params->get( 'player_width', 328 );
$this->t['playerheight'] = $params->get( 'player_height', 200 );
$this->t['html5_play'] = 1;//$params->get( 'html5_play', 1 );
} else {
echo Text::_('COM_PHOCADOWNLOAD_ERROR_NO_CORRECT_FILE_TO_PLAY_FOUND');exit;
}
} else {
echo Text::_('COM_PHOCADOWNLOAD_ERROR_NO_FILE_TO_PLAY_FOUND');exit;
}
$this->t['filetype'] = $fileExt;
if ($fileExt == 'mp3') {
$this->t['filetype'] = 'mp3';
$this->t['playerheight'] = $params->get( 'player_mp3_height', 30 );
} else if ($fileExt == 'ogg') {
$this->t['filetype'] = 'ogg';
$this->t['playerheight'] = $params->get( 'player_mp3_height', 30 );
}
$this->t['file'] = $file;
//$this->assignRef('file', $file);
//$this->assignRef('tmpl', $this->t);
//$this->assignRef('params', $params);
//$uriT = $uri->toString();
//$this->assignRef('request_url', $uriT);
parent::display($tpl);
}
}
?>

View File

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

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view hidden="true" />
</metadata>

View File

@ -0,0 +1,9 @@
<?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'); ?>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
</metadata>

View File

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

View File

@ -0,0 +1,153 @@
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\Session\Session;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport( 'joomla.application.component.view');
class PhocaDownloadViewRatingFileA extends HtmlView
{
function display($tpl = null){
if (!Session::checkToken('request')) {
$response = array(
'status' => '0',
'error' => Text::_('JINVALID_TOKEN')
);
echo json_encode($response);
return;
}
$app = Factory::getApplication();
$params = $app->getParams();
$ratingVote = $app->input->get( 'ratingVote', 0, 'post', 'int' );
$ratingId = $app->input->get( 'ratingId', 0, 'post', 'int' );// ID of File
$format = $app->input->get( 'format', '', 'post', 'string' );
$task = $app->input->get( 'task', '', 'get', 'string' );
$view = $app->input->get( 'view', '', 'get', 'string' );
$small = $app->input->get( 'small', 1, 'get', 'string' );//small or large rating icons
$paramsC = ComponentHelper::getParams('com_phocadownload');
$param['displayratingfile'] = $paramsC->get( 'display_rating_file', 0 );
// Check if rating is enabled - if not then user should not be able to rate or to see updated reating
if ($task == 'refreshrate' && (int)$param['displayratingfile'] > 0) {
$ratingOutput = PhocaDownloadRate::renderRateFile((int)$ratingId, 1, $small, true);// ID of File
$response = array(
'status' => '0',
'message' => $ratingOutput);
echo json_encode($response);
return;
//return $ratingOutput;
} else if ($task == 'rate') {
$user = Factory::getUser();
//$view = $app->input->get( 'view', '', 'get', '', J R EQUEST_NOTRIM );
//$Itemid = $app->input->get( 'Itemid', 0, 'int');
$neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels();
$access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels);
$post['fileid'] = (int)$ratingId;
$post['userid'] = $user->id;
$post['rating'] = (int)$ratingVote;
if ($format != 'json') {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_WRONG_RATING') ;
$response = array(
'status' => '0',
'error' => $msg);
echo json_encode($response);
return;
}
if ((int)$post['fileid'] < 1) {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_FILE_NOT_EXISTS');
$response = array(
'status' => '0',
'error' => $msg);
echo json_encode($response);
return;
}
$model = $this->getModel();
$checkUserVote = PhocaDownloadRate::checkUserVoteFile( $post['fileid'], $post['userid'] );
// User has already rated this category
if ($checkUserVote) {
$msg = Text::_('COM_PHOCADOWNLOAD_RATING_ALREADY_RATED_FILE');
$response = array(
'status' => '0',
'error' => '',
'message' => $msg);
echo json_encode($response);
return;
} else {
if ((int)$post['rating'] < 1 || (int)$post['rating'] > 5) {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_WRONG_RATING');
$response = array(
'status' => '0',
'error' => $msg);
echo json_encode($response);
return;
}
if ($access > 0 && $user->id > 0) {
if(!$model->rate($post)) {
$msg = Text::_('COM_PHOCADOWNLOAD_ERROR_RATING_FILE');
$response = array(
'status' => '0',
'error' => $msg);
echo json_encode($response);
return;
} else {
$msg = Text::_('COM_PHOCADOWNLOAD_SUCCESS_RATING_FILE');
$response = array(
'status' => '1',
'error' => '',
'message' => $msg);
echo json_encode($response);
return;
}
} else {
$msg = Text::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION');
$response = array(
'status' => '0',
'error' => $msg);
echo json_encode($response);
return;
}
}
} else {
$msg = Text::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION');
$response = array(
'status' => '0',
'error' => $msg);
echo json_encode($response);
return;
}
}
}
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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