feat(pkg): add Phoca Download 3.1.2 (pristine upstream)
Pristine Phoca Download 3.1.2 manifest-mapped from github.com/PhocaCz/PhocaDownload @3.1.2 via lib/jmap.py. Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
556dd4cdc0
commit
2563f54f83
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
4
packages/phocadownload/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js
vendored
Normal file
4
packages/phocadownload/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,39 @@
|
|||||||
|
<?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' );
|
||||||
|
|
||||||
|
jimport('joomla.application.component.controller');
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
public function display($cachable = false, $urlparams = false)
|
||||||
|
{
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$cache = $paramsC->get( 'enable_cache', 0 );
|
||||||
|
$cachable = false;
|
||||||
|
if ($cache == 1) {
|
||||||
|
$cachable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$document = JFactory::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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
<?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();
|
||||||
|
|
||||||
|
class PhocaDownloadControllerUser extends PhocaDownloadController
|
||||||
|
{
|
||||||
|
public $loginUrl;
|
||||||
|
public $loginString;
|
||||||
|
public $url;
|
||||||
|
public $itemId;
|
||||||
|
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->registerTask( 'unpublish', 'unpublish' );
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->itemId = $app->input->get( 'Itemid', 0, 'int' );
|
||||||
|
$this->loginUrl = JRoute::_('index.php?option=com_users&view=login', false);
|
||||||
|
$this->loginString = JText::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION');
|
||||||
|
$this->url = 'index.php?option=com_phocadownload&view=user&Itemid='. $this->itemId;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
function display() {
|
||||||
|
if ( ! JRequest::getCmd( 'view' ) ) {
|
||||||
|
$this->input->set('view', 'user' );
|
||||||
|
}
|
||||||
|
parent::display();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
function unpublish() {
|
||||||
|
|
||||||
|
$app = JFactory::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 = JFactory::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 = JText::_('COM_PHOCADOWNLOAD_ERROR_UNPUBLISHING_ITEM');
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_UNPUBLISHING_ITEM');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$app->redirect($this->loginUrl, $this->loginString);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lSO = '';
|
||||||
|
if ($post['limitstart'] != '') {
|
||||||
|
$lSO = '&limitstart='.(int)$post['limitstart'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_($this->url. $lSO, false), $msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
function publish() {
|
||||||
|
$app = JFactory::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 = JFactory::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 = JText::_('COM_PHOCADOWNLOAD_ERROR_PUBLISHING_ITEM');
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_PUBLISHING_ITEM');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$app->redirect($this->loginUrl, $this->loginString);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lSO = '';
|
||||||
|
if ($post['limitstart'] != '') {
|
||||||
|
$lSO = '&limitstart='.(int)$post['limitstart'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_($this->url. $lSO, false), $msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete() {
|
||||||
|
|
||||||
|
$app = JFactory::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 = JFactory::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 = JText::_('COM_PHOCADOWNLOAD_ERROR_DELETING_ITEM');
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_DELETING_ITEM');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$app->redirect($this->loginUrl, $this->loginString);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lSO = '';
|
||||||
|
if ($post['limitstart'] != '') {
|
||||||
|
$lSO = '&limitstart='.(int)$post['limitstart'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_($this->url. $lSO, false), $msg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,260 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadModelCategories extends JModelLegacy
|
||||||
|
{
|
||||||
|
var $_categories = null;
|
||||||
|
var $_most_viewed_docs = null;
|
||||||
|
var $_categories_ordering = null;
|
||||||
|
var $_category_ordering = null;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$app = JFactory::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 = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$categoriesOrdering = $this->_getCategoryOrdering();
|
||||||
|
|
||||||
|
if ($pQ == 1) {
|
||||||
|
// GWE MOD - to allow for access restrictions
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('onGetCategoriesList', array (&$wheres, &$joins, $params));
|
||||||
|
// END GWE MOD
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = " SELECT cc.id, cc.parent_id, cc.title, cc.alias, 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"
|
||||||
|
. " ORDER BY cc.".$categoriesOrdering;
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get only first level under parent categories
|
||||||
|
*/
|
||||||
|
function _getCategoryListQuery( $parentCatId ) {
|
||||||
|
|
||||||
|
$wheres = array();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$categoryOrdering = $this->_getCategoryOrdering();
|
||||||
|
|
||||||
|
if ($pQ == 1) {
|
||||||
|
// GWE MOD - to allow for access restrictions
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('onGetCategoryList', array (&$wheres, &$joins, $params));
|
||||||
|
// END GWE MOD
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = " SELECT cc.id, cc.title, cc.alias, 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"
|
||||||
|
. " ORDER BY cc.".$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 = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$userLevels = implode (',', $user->getAuthorisedViewLevels());
|
||||||
|
|
||||||
|
$pQ = $params->get( 'enable_plugin_query', 0 );
|
||||||
|
$most_viewed_docs_num = $params->get( 'most_viewed_docs_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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
$wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Active
|
||||||
|
$jnow = JFactory::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
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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 = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$ordering = $params->get( 'category_ordering', 1 );
|
||||||
|
$this->_category_ordering = PhocaDownloadOrdering::getOrderingText($ordering);
|
||||||
|
|
||||||
|
}
|
||||||
|
return $this->_category_ordering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,235 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
class PhocaDownloadModelCategory extends JModelLegacy
|
||||||
|
{
|
||||||
|
var $_document = null;
|
||||||
|
var $_category = null;
|
||||||
|
var $_subcategories = null;
|
||||||
|
var $_filename = null;
|
||||||
|
var $_directlink = 0;
|
||||||
|
var $_file_ordering = null;
|
||||||
|
var $_category_ordering = null;
|
||||||
|
var $_pagination = null;
|
||||||
|
var $_total = null;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$config = JFactory::getConfig();
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload') ;
|
||||||
|
$defaultPagination = $paramsC->get( 'default_pagination', '20' );
|
||||||
|
|
||||||
|
// Get the pagination request variables
|
||||||
|
$this->setState('limit', $app->getUserStateFromRequest('com_phocadownload.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());
|
||||||
|
|
||||||
|
// Get the filter request variables
|
||||||
|
$this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering'));
|
||||||
|
$this->setState('filter_order_dir', JRequest::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);
|
||||||
|
$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 ) {
|
||||||
|
|
||||||
|
$wheres = array();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
$wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Active
|
||||||
|
$jnow = JFactory::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
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('onGetFileList', array (&$wheres, &$joins,$categoryId , $params));
|
||||||
|
// END GWE MOD
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileOrdering = $this->_getFileOrdering();
|
||||||
|
|
||||||
|
$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 .= ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
|
||||||
|
. ' WHERE ' . implode( ' AND ', $wheres )
|
||||||
|
. ' ORDER BY c.'.$fileOrdering;
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function _getCategoriesQuery( $categoryId, $subcategories = FALSE ) {
|
||||||
|
|
||||||
|
$wheres = array();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($pQ == 1) {
|
||||||
|
// GWE MOD - to allow for access restrictions
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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"
|
||||||
|
. " ORDER BY cc.".$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 parentid, 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)) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$ordering = $params->get( 'file_ordering', 1 );
|
||||||
|
$this->_file_ordering = PhocaDownloadOrdering::getOrderingText($ordering);
|
||||||
|
|
||||||
|
}
|
||||||
|
return $this->_file_ordering;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getCategoryOrdering() {
|
||||||
|
if (empty($this->_category_ordering)) {
|
||||||
|
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$ordering = $params->get( 'category_ordering', 1 );
|
||||||
|
$this->_category_ordering = PhocaDownloadOrdering::getOrderingText($ordering);
|
||||||
|
|
||||||
|
}
|
||||||
|
return $this->_category_ordering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadModelDownload extends JModelLegacy
|
||||||
|
{
|
||||||
|
var $_file = null;
|
||||||
|
var $_category = null;
|
||||||
|
var $_filename = null;
|
||||||
|
var $_directlink = 0;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$app = JFactory::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 = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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 = JFactory::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
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadModelFile extends JModelLegacy
|
||||||
|
{
|
||||||
|
var $_file = null;
|
||||||
|
var $_category = null;
|
||||||
|
var $_section = null;
|
||||||
|
var $_filename = null;
|
||||||
|
var $_directlink = 0;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
|
||||||
|
$app = JFactory::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 = JFactory::getApplication();
|
||||||
|
$user = JFactory::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&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->redirect(JRoute::_($returnUrl, false), JText::_('COM_PHOCADOWNLOAD_PLEASE_LOGIN_DOWNLOAD_FILE'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - - -
|
||||||
|
}
|
||||||
|
return $this->_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getFileQuery( $fileId ) {
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
$wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Active
|
||||||
|
$jnow = JFactory::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
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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 = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
$wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pQ == 1) {
|
||||||
|
// GWE MOD - to allow for access restrictions
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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"
|
||||||
|
. " 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
class PhocaDownloadModelPhocaDownloadLinkCat extends JModelLegacy
|
||||||
|
{
|
||||||
|
//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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,214 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
// CUSTOM PAGINATON
|
||||||
|
class PhocaDownloadViewPhocaDownloadLinkFilePagination extends JPagination
|
||||||
|
{
|
||||||
|
protected function _buildDataObject()
|
||||||
|
{
|
||||||
|
$data = new stdClass;
|
||||||
|
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$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 JPaginationObject(JText::_('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 JPaginationObject(JText::_('JLIB_HTML_START'), $this->prefix);
|
||||||
|
$data->previous = new JPaginationObject(JText::_('JPREV'), $this->prefix);
|
||||||
|
|
||||||
|
if ($this->pagesCurrent > 1)
|
||||||
|
{
|
||||||
|
$page = ($this->pagesCurrent - 2) * $this->limit;
|
||||||
|
|
||||||
|
// Set the empty for removal from route
|
||||||
|
// @todo 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 JPaginationObject(JText::_('JNEXT'), $this->prefix);
|
||||||
|
$data->end = new JPaginationObject(JText::_('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 JPaginationObject($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 JModelLegacy
|
||||||
|
{
|
||||||
|
var $_data = null;
|
||||||
|
var $_total = null;
|
||||||
|
var $_pagination = null;
|
||||||
|
var $_context = 'com_phocadownload.phocadownloadlinkfile';
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
// Get the pagination request variables
|
||||||
|
$limit = $app->getUserStateFromRequest( $this->_context.'.list.limit', 'limit', $app->getCfg('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 = JFactory::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 = JFactory::getApplication();
|
||||||
|
$filter_state = $app->getUserStateFromRequest( $this->_context.'.filter_state', 'filter_state', '', '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 = JString::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_state ) {
|
||||||
|
if ( $filter_state == 'P' ) {
|
||||||
|
$where[] = 'a.published = 1';
|
||||||
|
} else if ($filter_state == '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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,169 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
class PhocaDownloadModelPlay extends JModelLegacy
|
||||||
|
{
|
||||||
|
var $_file = null;
|
||||||
|
var $_category = null;
|
||||||
|
var $_section = null;
|
||||||
|
var $_filename = null;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
|
||||||
|
$app = JFactory::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(JRoute::_('index.php?option=com_users&view=login', false), JText::_("Please login to download the file"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - - -*/
|
||||||
|
}
|
||||||
|
return $this->_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getFileQuery( $fileId ) {
|
||||||
|
|
||||||
|
$app = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
$wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Active
|
||||||
|
$jnow = JFactory::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
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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 = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::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(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
$wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pQ == 1) {
|
||||||
|
// GWE MOD - to allow for access restrictions
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadModelRatingFileA extends JModelLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
function rate($data) {
|
||||||
|
$row = $this->getTable('phocadownloadfilevotes');
|
||||||
|
|
||||||
|
if (!$row->bind($data)) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
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()) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$row->store()) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the Vote Statistics
|
||||||
|
if (!PhocaDownloadRate::updateVoteStatisticsFile( $data['fileid'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,580 @@
|
|||||||
|
<?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();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
jimport( 'joomla.filesystem.file' );
|
||||||
|
|
||||||
|
class PhocaDownloadModelUser extends JModelLegacy
|
||||||
|
{
|
||||||
|
var $_data_files = null;
|
||||||
|
var $_total_files = null;
|
||||||
|
var $_pagination_files = null;
|
||||||
|
var $_context_files = 'com_phocadownload.phocadownloaduserfiles';
|
||||||
|
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$app = JFactory::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 JPagination( $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 = JFactory::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 = JFactory::getApplication();
|
||||||
|
$filter_state = $app->getUserStateFromRequest( $this->_context_files.'.filter_state','filter_state','', '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 = JString::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_state ) {
|
||||||
|
if ( $filter_state == 'P' ) {
|
||||||
|
$where[] = 'a.published = 1';
|
||||||
|
} else if ($filter_state == '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->setError('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'])) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind the form fields to the Phoca gallery table
|
||||||
|
if (!$row->bind($data)) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
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()) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the Phoca gallery table to the database
|
||||||
|
if (!$row->store()) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
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 = JFactory::getApplication();;
|
||||||
|
JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' );
|
||||||
|
jimport('joomla.client.helper');
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$ftp = JClientHelper::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 = JComponentHelper::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, array(0 => 2), $user->get('id', 0), 0);
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|
||||||
|
/*$post['sectionid'] = $this->getSection((int)$post['catidfiles']);
|
||||||
|
if(!$post['sectionid']) {
|
||||||
|
$errUploadMsg = JText::_('COM_PHOCADOWNLOAD_WRONG_SECTION');
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//$userFolder = substr(md5($user->username),0, 10);
|
||||||
|
$userFolder = htmlspecialchars(strip_tags($user->username));
|
||||||
|
if ($rightDisplayUpload == 1) {
|
||||||
|
|
||||||
|
// Make the filename safe
|
||||||
|
if (isset($file['name'])) {
|
||||||
|
$file['name'] = JFile::makeSafe($file['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($file['tmp_name'] == '') {
|
||||||
|
$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_ERROR_SERVER_NOT_ABLE_TO_STORE_FILE_TEMP_FOLDER");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($file['name'])) {
|
||||||
|
$filepath = JPath::clean($path['orig_abs_user_upload']. DS. $userFolder . DS.$file['name']);
|
||||||
|
$filepathUserFolder = JPath::clean($path['orig_abs_user_upload']. DS. $userFolder);
|
||||||
|
if (!PhocaDownloadFileUpload::canUpload( $file, $errUploadMsg, 'file', 2 )) {
|
||||||
|
|
||||||
|
if ($errUploadMsg == 'COM_PHOCADOWNLOAD_WARNUSERFILESTOOLARGE') {
|
||||||
|
$errUploadMsg = JText::_($errUploadMsg) . ' ('.PhocaDownloadFile::getFileSizeReadable($file['size']).')';
|
||||||
|
} else {
|
||||||
|
$errUploadMsg = JText::_($errUploadMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JFile::exists($filepath) && $overwriteExistingFiles == 0) {
|
||||||
|
$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overwrite file and add no new item to database
|
||||||
|
$fileExists = 0;
|
||||||
|
if (JFile::exists($filepath) && $overwriteExistingFiles == 1) {
|
||||||
|
$fileExists = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JFile::upload($file['tmp_name'], $filepath)) {
|
||||||
|
$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_UPLOAD_FILE");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Saving file name into database with relative path
|
||||||
|
if (!JFile::exists($filepathUserFolder . DS ."index.html")) {
|
||||||
|
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||||
|
JFile::write($filepathUserFolder . DS ."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 = JPath::clean($path['orig_abs_user_upload_pap']. DS. $userFolder . DS.$file['namepap']);
|
||||||
|
$filepathUserFolderPAP = JPath::clean($path['orig_abs_user_upload_pap']. DS. $userFolder);
|
||||||
|
|
||||||
|
if ($canPlay || $canPreview) {
|
||||||
|
|
||||||
|
$uploadPAP = 1;// upload file for preview and play
|
||||||
|
if (JFile::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 (JFile::exists($filepathPAP) && $overwriteExistingFiles == 1) {
|
||||||
|
$fileExistsPAP = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($uploadPAP == 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (!JFolder::exists($filepathUserFolderPAP)) {
|
||||||
|
if (JFolder::create($filepathUserFolderPAP)) {
|
||||||
|
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||||
|
JFile::write($filepathUserFolderPAP . DS ."index.html", $data);
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
//$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_CREATE_FOLDER");
|
||||||
|
//return false;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JFile::copy($filepath, $filepathPAP)) {
|
||||||
|
|
||||||
|
//$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_UPLOAD_FILE");
|
||||||
|
//return false;
|
||||||
|
} else {
|
||||||
|
// Saving file name into database with relative path
|
||||||
|
if (!JFile::exists($filepathUserFolderPAP . DS ."index.html")) {
|
||||||
|
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||||
|
JFile::write($filepathUserFolderPAP . DS ."index.html", $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = JText::_("COM_PHOCADOWNLOAD_WARNFILETYPE");
|
||||||
|
$redirectUrl = $return;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_TO_UPLOAD");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function _save($data, $filename, &$errSaveMsg, $fileExists = 0) {
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$fileId = false;
|
||||||
|
if ($fileExists == 1) {
|
||||||
|
// We not only owerwrite the file but we must update it
|
||||||
|
if (isset($filename) && $filename != '') {
|
||||||
|
|
||||||
|
$db = JFactory::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()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = $this->getTable('phocadownload');
|
||||||
|
|
||||||
|
if (isset($fileId->id) && (int)$fileId->id > 0) {
|
||||||
|
$data['id'] = (int)$fileId->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$data['filesize'] = PhocaDownloadFile::getFileSize($filename, 0);
|
||||||
|
|
||||||
|
$data['userid'] = $user->id;
|
||||||
|
$data['author_email'] = $data['email'];
|
||||||
|
$data['author_url'] = $data['website'];
|
||||||
|
|
||||||
|
$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)) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
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 = JFactory::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->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()) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the Phoca gallery table to the database
|
||||||
|
if (!$row->store()) {
|
||||||
|
$this->setError($this->_db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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->query()) {
|
||||||
|
$this->setError('Database Error Publishing');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete($id = 0) {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::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->query()) {
|
||||||
|
$this->setError('Database Error - Delete Files');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete tags
|
||||||
|
$query = 'DELETE FROM #__phocadownload_tags_ref'
|
||||||
|
. ' WHERE fileid ='.(int)$id;
|
||||||
|
|
||||||
|
$this->_db->setQuery( $query );
|
||||||
|
if(!$this->_db->query()) {
|
||||||
|
$this->setError('Database Error - Delete Tags (Files)');
|
||||||
|
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) {
|
||||||
|
JFile::delete(JPath::clean($path['orig_abs_ds'].$value->filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
<?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(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
|
if (! class_exists('PhocaDownloadLoader')) {
|
||||||
|
require_once( JPATH_ADMINISTRATOR.DS.'components/com_phocadownload/libraries/loader.php');
|
||||||
|
}
|
||||||
|
// Require the base controller
|
||||||
|
require_once( JPATH_COMPONENT.DS.'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');
|
||||||
|
|
||||||
|
|
||||||
|
// Require specific controller if requested
|
||||||
|
if($controller = JRequest::getWord('controller')) {
|
||||||
|
$path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
|
||||||
|
if (file_exists($path)) {
|
||||||
|
require_once $path;
|
||||||
|
} else {
|
||||||
|
$controller = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$classname = 'PhocaDownloadController'.ucfirst($controller);
|
||||||
|
$controller = new $classname( );
|
||||||
|
$controller->execute( JFactory::getApplication()->input->get('task') );
|
||||||
|
$controller->redirect();
|
||||||
|
?>
|
||||||
228
packages/phocadownload/components/com_phocadownload/router.php
Normal file
228
packages/phocadownload/components/com_phocadownload/router.php
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to build Route
|
||||||
|
* @param array $query
|
||||||
|
*/
|
||||||
|
function PhocaDownloadBuildRoute(&$query)
|
||||||
|
{
|
||||||
|
|
||||||
|
static $items;
|
||||||
|
$segments = array();
|
||||||
|
$itemid = null;
|
||||||
|
|
||||||
|
|
||||||
|
// Break up the weblink/category id into numeric and alias values.
|
||||||
|
if (isset($query['id']) && strpos($query['id'], ':')) {
|
||||||
|
list($query['id'], $query['alias']) = explode(':', $query['id'], 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Break up the category id into numeric and alias values.
|
||||||
|
/* if (isset($query['catid']) && strpos($query['catid'], ':')) {
|
||||||
|
list($query['catid'], $query['catalias']) = explode(':', $query['catid'], 2);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Get the menu items for this component.
|
||||||
|
if (!$items) {
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$items = $menu->getItems('component', 'com_phocadownload');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for an appropriate menu item.
|
||||||
|
if (is_array($items))
|
||||||
|
{
|
||||||
|
// If only the option and itemid are specified in the query, return that item.
|
||||||
|
if (!isset($query['view']) && !isset($query['id']) && !isset($query['catid']) && !isset($query['download']) && isset($query['Itemid'])) {
|
||||||
|
$itemid = (int) $query['Itemid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------
|
||||||
|
// Search for a specific link based on the critera given.
|
||||||
|
if (!$itemid)
|
||||||
|
{
|
||||||
|
foreach ($items as $item)
|
||||||
|
{
|
||||||
|
// Check if this menu item links to this view.
|
||||||
|
if (isset($item->query['view']) && $item->query['view'] == 'category'
|
||||||
|
|
||||||
|
&& isset($query['view']) && $query['view'] != 'file'
|
||||||
|
&& isset($query['view']) && $query['view'] != 'play'
|
||||||
|
&& isset($item->query['id']) && isset($query['id']) && $item->query['id'] == $query['id']) {
|
||||||
|
$itemid = $item->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (isset($item->query['view']) && $item->query['view'] == 'file'
|
||||||
|
&& isset($query['view']) && $query['view'] != 'category'
|
||||||
|
|
||||||
|
&& isset($query['view']) && $query['view'] != 'play'
|
||||||
|
&& isset($item->query['id']) && isset($query['id']) && $item->query['id'] == $query['id']) {
|
||||||
|
$itemid = $item->id;
|
||||||
|
}
|
||||||
|
else if (isset($item->query['view']) && $item->query['view'] == 'play'
|
||||||
|
&& isset($query['view']) && $query['view'] != 'category'
|
||||||
|
|
||||||
|
&& isset($query['view']) && $query['view'] != 'file'
|
||||||
|
&& isset($item->query['id']) && isset($query['id']) && $item->query['id'] == $query['id']) {
|
||||||
|
$itemid = $item->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the router found an appropriate itemid.
|
||||||
|
if (!$itemid) {
|
||||||
|
// Check if a category was specified
|
||||||
|
if (isset($query['id'])) { // Check if a id was specified.
|
||||||
|
if (isset($query['alias'])) {
|
||||||
|
$query['id'] .= ':'.$query['alias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Push the id onto the stack.
|
||||||
|
//$segments[] = $query['id'];
|
||||||
|
if(isset($query['view'])) {$segments[] = $query['view'];}
|
||||||
|
$segments[] = $query['id'];
|
||||||
|
unset($query['view']);
|
||||||
|
unset($query['id']);
|
||||||
|
unset($query['alias']);
|
||||||
|
unset($query['catid']);
|
||||||
|
unset($query['catalias']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Categories view.
|
||||||
|
unset($query['view']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$query['Itemid'] = $itemid;
|
||||||
|
// Remove the unnecessary URL segments.
|
||||||
|
unset($query['view']);
|
||||||
|
unset($query['id']);
|
||||||
|
unset($query['alias']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to parse Route
|
||||||
|
* @param array $segments
|
||||||
|
*/
|
||||||
|
function PhocaDownloadParseRoute($segments)
|
||||||
|
{
|
||||||
|
$vars = array();
|
||||||
|
|
||||||
|
//Get the active menu item
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$item = $menu->getActive();
|
||||||
|
|
||||||
|
|
||||||
|
// Count route segments
|
||||||
|
$count = count($segments);
|
||||||
|
|
||||||
|
//Standard routing
|
||||||
|
if(!isset($item)) {
|
||||||
|
if($count == 3 ) {
|
||||||
|
$vars['view'] = $segments[$count - 3];
|
||||||
|
} else if ($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count - 2];
|
||||||
|
} else {
|
||||||
|
$vars['view'] = 'category';
|
||||||
|
}
|
||||||
|
$vars['id'] = $segments[$count - 1];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//Handle View and Identifier
|
||||||
|
|
||||||
|
switch($item->query['view'])
|
||||||
|
{
|
||||||
|
case 'categories' :
|
||||||
|
if($count == 1) {
|
||||||
|
$vars['view'] = 'categories';
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count-2];
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case 'category' :
|
||||||
|
if($count == 1) {
|
||||||
|
$vars['view'] = 'category';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count-2];
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'file' :
|
||||||
|
if($count == 1) {
|
||||||
|
$vars['view'] = 'file';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count-2];
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'play' :
|
||||||
|
if($count == 1) {
|
||||||
|
$vars['view'] = 'play';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count-2];
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Guestbook Report
|
||||||
|
case 'guestbook' :
|
||||||
|
if($count == 1) {
|
||||||
|
$vars['view'] = 'guestbook';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count-2];
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'download' :
|
||||||
|
if($count == 1) {
|
||||||
|
$vars['view'] = 'download';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($count == 2) {
|
||||||
|
$vars['view'] = $segments[$count-2];
|
||||||
|
$vars['id'] = $segments[$count-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $vars;
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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>
|
||||||
@ -0,0 +1,204 @@
|
|||||||
|
<?php
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->t['description'] != '') {
|
||||||
|
echo '<div class="pd-desc">'. $this->t['description']. '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($this->t['categories'])) {
|
||||||
|
$i = 1;
|
||||||
|
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) {
|
||||||
|
|
||||||
|
// =====================================================================================
|
||||||
|
// BEGIN LAYOUT AREA
|
||||||
|
// =====================================================================================
|
||||||
|
|
||||||
|
$pdTitle = '<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
|
||||||
|
$pdTitle .= ' <small>('.$numSubcat.'/' . $numDocAll .')</small>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$pdDesc = '';
|
||||||
|
$pdSubcategories = '';
|
||||||
|
if ($this->t['displaymaincatdesc'] == 1) {
|
||||||
|
$pdDesc .= $value->description;
|
||||||
|
} else {
|
||||||
|
if ($catOutput != '') {
|
||||||
|
$pdSubcategories .= $catOutput;
|
||||||
|
} else {
|
||||||
|
$pdSubcategories .= '<div class="pd-no-subcat">'.JText::_('COM_PHOCADOWNLOAD_NO_SUBCATEGORIES').'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdClear = '';
|
||||||
|
if ($i%3==0) {
|
||||||
|
$pdClear .= '<div class="pd-cb"></div>';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
//Convert
|
||||||
|
// ---------------------------------------------------
|
||||||
|
if ($this->t['display_specific_layout'] == 0) {
|
||||||
|
echo '<div class="pd-categoriesbox">';
|
||||||
|
echo '<div class="pd-title">'.$pdTitle.'</div>';
|
||||||
|
if ($pdDesc != '') { echo '<div class="pd-desc">'.$pdDesc.'</div>';}
|
||||||
|
echo $pdSubcategories;
|
||||||
|
echo '</div>';
|
||||||
|
echo $pdClear;
|
||||||
|
} else {
|
||||||
|
$categoriesLayout = PhocaDownloadSettings::getLayoutText('categories');
|
||||||
|
|
||||||
|
/*'<div class="pd-categoriesbox">
|
||||||
|
<div class="pd-title">{pdtitle}</div>
|
||||||
|
{pdsubcategories}
|
||||||
|
{pdclear}
|
||||||
|
</div>';
|
||||||
|
//<div class="pd-desc">{pdDescription}</div>*/
|
||||||
|
|
||||||
|
$categoriesLayoutParams = PhocaDownloadSettings::getLayoutParams('categories');
|
||||||
|
|
||||||
|
$replace = array($pdTitle, $pdDesc, $pdSubcategories, $pdClear);
|
||||||
|
$output = str_replace($categoriesLayoutParams['search'], $replace, $categoriesLayout);
|
||||||
|
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</div>'
|
||||||
|
.'<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('/', DS, 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"> </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"> </div>';
|
||||||
|
echo $this->t['dw'];
|
||||||
|
?>
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?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="radio" 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="radio" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
|
||||||
|
class PhocaDownloadViewCategories extends JViewLegacy
|
||||||
|
{
|
||||||
|
protected $t;
|
||||||
|
|
||||||
|
function display($tpl = null)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$model = $this->getModel();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$this->t['dw'] = PhocaDownloadRenderFront::renderPhocaDownload();
|
||||||
|
$this->t['p'] = $app->getParams();
|
||||||
|
$this->t['user'] = JFactory::getUser();
|
||||||
|
$this->t['categories'] = $model->getCategoriesList();
|
||||||
|
$this->t['mostvieweddocs'] = $model->getMostViewedDocsList($this->t['p']);
|
||||||
|
|
||||||
|
$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 );
|
||||||
|
|
||||||
|
PhocaDownloadRenderFront::renderAllCSS();
|
||||||
|
|
||||||
|
$imagePath = PhocaDownloadPath::getPathSet('icon');
|
||||||
|
$this->t['cssimgpath'] = str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']);
|
||||||
|
$filePath = PhocaDownloadPath::getPathSet('file');
|
||||||
|
$this->t['absfilepath'] = $filePath['orig_abs_ds'];
|
||||||
|
|
||||||
|
$this->_prepareDocument();
|
||||||
|
parent::display($tpl);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _prepareDocument() {
|
||||||
|
|
||||||
|
$app = JFactory::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', JText::_('JGLOBAL_ARTICLES'));
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
$title = $this->t['p']->get('page_heading', '');
|
||||||
|
if (empty($title)) {
|
||||||
|
$title = htmlspecialchars_decode($app->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0)) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('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->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 1) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 2) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('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->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) {
|
||||||
|
$this->document->setMetaData('title', $this->t['p']->get('page_title', ''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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>
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
// 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 (count($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="pdtop">'
|
||||||
|
.'<a title="'.$linkUpText.'" href="'. $linkUp.'" >'
|
||||||
|
.JHTML::_('image', $this->t['mediapath']->media_img_rel . 'up.png', JText::_('COM_PHOCADOWNLOAD_UP'))
|
||||||
|
.'</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 class="pd-ctitle">'.$this->category[0]->title. '</h3>';
|
||||||
|
|
||||||
|
// 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 JHTML::_('content.prepare', $this->category[0]->description);
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subcategories
|
||||||
|
|
||||||
|
if (!empty($this->subcategories)) {
|
||||||
|
foreach ($this->subcategories as $valueSubCat) {
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
// =====================================================================================
|
||||||
|
// END LAYOUT AREA
|
||||||
|
// =====================================================================================
|
||||||
|
|
||||||
|
if (count($this->category[0])) {
|
||||||
|
echo $this->loadTemplate('pagination');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->t['display_category_comments'] == 1) {
|
||||||
|
if (JComponentHelper::isEnabled('com_jcomments', true)) {
|
||||||
|
include_once(JPATH_BASE.DS.'components'.DS.'com_jcomments'.DS.'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="pd-error">'.JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
} else {
|
||||||
|
//echo '<h3> </h3>';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</div><div class="pd-cb"> </div>';
|
||||||
|
echo $this->t['dg'];
|
||||||
|
?>
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?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="0" 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="radio" 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="radio" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
?><div id="phocadownload-comments"><?php
|
||||||
|
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$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>
|
||||||
@ -0,0 +1,441 @@
|
|||||||
|
<?php
|
||||||
|
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->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) {
|
||||||
|
|
||||||
|
// 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->category[0]->id,$v->alias, $this->category[0]->alias, $v->sectionid, 'download').$this->t['limitstarturl']).'" >';
|
||||||
|
$linkDownloadE ='</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// pdtextonly
|
||||||
|
$pdTextOnly = '<div class="pd-textonly">'.$v->description.'</div>' . "\n";
|
||||||
|
|
||||||
|
// pdfile
|
||||||
|
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 .= $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']);
|
||||||
|
|
||||||
|
//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']->options;
|
||||||
|
if ($fileExt == 'mp3' || $fileExt == 'ogg') {
|
||||||
|
$buttonPlOptions = $this->t['buttonpl']->optionsmp3;
|
||||||
|
}
|
||||||
|
$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 .= '</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>';
|
||||||
|
} 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 .= '</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="#">'. JText::_('COM_PHOCADOWNLOAD_DETAILS').'</a>';
|
||||||
|
$pdButtonDetails .= '</div>';
|
||||||
|
} else if ($this->t['display_detail'] == 2) {
|
||||||
|
$buttonDOptions = $this->t['buttond']->options;
|
||||||
|
$detailLink = JRoute::_(PhocaDownloadRoute::getFileRoute($v->id,$this->category[0]->id,$v->alias, $v->categoryalias, 0, 'detail').$this->t['limitstarturl']);
|
||||||
|
$pdButtonDetails = '<div class="pd-button-details">';
|
||||||
|
$pdButtonDetails .= '<a class="btn btn-info pd-modal-button" href="'.$detailLink.'" rel="'. $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"', $mirrorOutput1);
|
||||||
|
} else {
|
||||||
|
$classMirror = 'pd-mirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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"', $mirrorOutput2);
|
||||||
|
} else {
|
||||||
|
$classMirror = 'pd-mirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
if ($l->displayTags($v->id) != '') {
|
||||||
|
$pdTags .= $l->displayTags($v->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//pdvideo
|
||||||
|
$pdVideo = $l->displayVideo($v->video_filename, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
//Convert
|
||||||
|
// ---------------------------------------------------
|
||||||
|
if ($v->textonly == 1) {
|
||||||
|
echo '<div class="pd-textonly">'. $pdTextOnly . '</div>';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ($this->t['display_specific_layout'] == 0) {
|
||||||
|
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>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/*$categoryLayout = '<div class="pd-filebox">
|
||||||
|
{pdfiledesctop}
|
||||||
|
{pdfile}
|
||||||
|
<div class="pd-buttons">{pdbuttondownload}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttondetails}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonpreview}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonplay}</div>
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
{pdfiledescbottom}
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>';*/
|
||||||
|
|
||||||
|
$categoryLayout = PhocaDownloadSettings::getLayoutText('category');
|
||||||
|
$categoryLayoutParams = PhocaDownloadSettings::getLayoutParams('category');
|
||||||
|
|
||||||
|
$replace = array($pdTitle, $pdImage, $pdFile, $pdFileSize, $pdVersion, $pdLicense, $pdAuthor, $pdAuthorEmail, $pdFileDate, $pdDownloads, $pdDescription, $pdFeatures, $pdChangelog, $pdNotes, $pdMirrorLink1, $pdMirrorLink2, $pdReportLink, $pdRating, $pdTags, $pdFileDescTop, $pdFileDescBottom, $pdButtonDownload, $pdButtonDetails, $pdButtonPreview, $pdButtonPlay, $pdVideo );
|
||||||
|
$output = str_replace($categoryLayoutParams['search'], $replace, $categoryLayout);
|
||||||
|
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
$this->t['action'] = str_replace('&', '&', $this->t['action']);
|
||||||
|
//$this->t['action'] = str_replace('&', '&', $this->t['action']);
|
||||||
|
$this->t['action'] = htmlspecialchars($this->t['action']);
|
||||||
|
|
||||||
|
echo '<form action="'.$this->t['action'].'" method="post" name="adminForm">'. "\n";
|
||||||
|
echo '<div class="pd-cb"> </div>';
|
||||||
|
echo '<div class="pgcenter"><div class="pagination">';
|
||||||
|
|
||||||
|
if ($this->t['p']->get('show_pagination_limit')) {
|
||||||
|
echo '<div class="pginline">'
|
||||||
|
.JText::_('COM_PHOCADOWNLOAD_DISPLAY_NUM') .' '
|
||||||
|
.$this->t['pagination']->getLimitBox()
|
||||||
|
.'</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 JHTML::_( 'form.token' );
|
||||||
|
echo '</form>';
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,301 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
jimport( 'joomla.filesystem.file' );
|
||||||
|
|
||||||
|
class PhocaDownloadViewCategory extends JViewLegacy
|
||||||
|
{
|
||||||
|
protected $category;
|
||||||
|
protected $subcategories;
|
||||||
|
protected $files;
|
||||||
|
protected $t;
|
||||||
|
|
||||||
|
function display($tpl = null) {
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->t['p'] = $app->getParams();
|
||||||
|
$this->t['user'] = JFactory::getUser();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$model = $this->getModel();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$this->t['categoryid'] = $app->input->get( 'id', 0, 'int' );
|
||||||
|
$this->t['tagid'] = $app->input->get( 'tagid', 0, 'int' );
|
||||||
|
$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::renderAllCSS();
|
||||||
|
$document->addCustomTag('<script type="text/javascript" src="'.JURI::root().'components/com_phocadownload/assets/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'] = $this->t['p']->get( 'html5_play', 0 );
|
||||||
|
|
||||||
|
|
||||||
|
// Rating
|
||||||
|
if ($this->t['display_rating_file'] == 1 || $this->t['display_rating_file'] == 3) {
|
||||||
|
JHTML::_('behavior.framework', true);
|
||||||
|
PhocaDownloadRate::renderRateFileJS(1);
|
||||||
|
$this->t['display_rating_file'] = 1;
|
||||||
|
} else {
|
||||||
|
$this->t['display_rating_file'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->t['dg'] = 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
|
||||||
|
// - - - - - - - - - - - - - - -
|
||||||
|
if ($this->t['display_detail'] == 2) {
|
||||||
|
$this->t['buttond'] = new JObject();
|
||||||
|
$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'}");
|
||||||
|
}
|
||||||
|
|
||||||
|
JHTML::_('behavior.modal', 'a.pd-modal-button');
|
||||||
|
// PLAY - - - - - - - - - - - -
|
||||||
|
$windowWidthPl = (int)$this->t['playerwidth'] + 20;
|
||||||
|
$windowHeightPl = (int)$this->t['playerheight'] + 20;
|
||||||
|
|
||||||
|
if ($this->t['html5_play'] == 1) {
|
||||||
|
$windowWidthPl = (int)$this->t['playerwidth'] + 40;
|
||||||
|
} else {
|
||||||
|
$windowWidthPl = (int)$this->t['playerwidth'] + 50;
|
||||||
|
}
|
||||||
|
$windowHeightPlMP3 = (int)$this->t['playermp3height'] + 20;
|
||||||
|
if ($this->t['play_popup_window'] == 1) {
|
||||||
|
$this->t['buttonpl'] = new JObject();
|
||||||
|
$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 JObject();
|
||||||
|
$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'}");
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - -
|
||||||
|
// PREVIEW - - - - - - - - - - - -
|
||||||
|
$windowWidthPr = (int)$this->t['previewwidth'] + 20;
|
||||||
|
$windowHeightPr = (int)$this->t['previewheight'] + 20;
|
||||||
|
if ($this->t['preview_popup_window'] == 1) {
|
||||||
|
$this->t['buttonpr'] = new JObject();
|
||||||
|
$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 JObject();
|
||||||
|
$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'}");
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
$imagePath = PhocaDownloadPath::getPathSet('icon');
|
||||||
|
$this->t['cssimgpath'] = str_replace ( '../', JURI::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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::display($tpl);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _prepareDocument($category) {
|
||||||
|
|
||||||
|
$app = JFactory::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', '' );
|
||||||
|
|
||||||
|
|
||||||
|
$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', JText::_('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->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0)) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
}
|
||||||
|
//$this->document->setTitle($title);
|
||||||
|
|
||||||
|
|
||||||
|
$this->document->setTitle($title);*/
|
||||||
|
|
||||||
|
$title = $this->t['p']->get('page_title', '');
|
||||||
|
$this->tmpl['display_cat_name_title'] = 1;
|
||||||
|
if (empty($title)) {
|
||||||
|
$title = htmlspecialchars_decode($app->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 1) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
|
||||||
|
if ($this->tmpl['display_cat_name_title'] == 1 && isset($category->title) && $category->title != '') {
|
||||||
|
$title = $title .' - ' . $category->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 2) {
|
||||||
|
|
||||||
|
if ($this->tmpl['display_cat_name_title'] == 1 && isset($category->title) && $category->title != '') {
|
||||||
|
$title = $title .' - ' . $category->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('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->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) {
|
||||||
|
$this->document->setMetaData('title', $this->t['p']->get('page_title', ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Breadcrumbs TODO (Add the whole tree)
|
||||||
|
/*$pathway = $app->getPathway();
|
||||||
|
if (isset($this->category[0]->parentid)) {
|
||||||
|
if ($this->category[0]->parentid == 0) {
|
||||||
|
// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadRoute::getCategoriesRoute()));
|
||||||
|
} else if ($this->category[0]->parentid > 0) {
|
||||||
|
$pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->category[0]->title)) {
|
||||||
|
$pathway->addItem($this->category[0]->title);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Breadcrumbs TODO (Add the whole tree)
|
||||||
|
$pathway = $app->getPathway();
|
||||||
|
if (isset($this->category[0]->parentid)) {
|
||||||
|
if ($this->category[0]->parentid == 0) {
|
||||||
|
// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadRoute::getCategoriesRoute()));
|
||||||
|
} else if ($this->category[0]->parentid > 0) {
|
||||||
|
$curpath = $pathway->getPathwayNames();
|
||||||
|
if($this->category[0]->parenttitle != $curpath[count($curpath)-1]){
|
||||||
|
$pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->category[0]->title)) {
|
||||||
|
$curpath = $pathway->getPathwayNames();
|
||||||
|
if($this->category[0]->title != $curpath[count($curpath)-1]){
|
||||||
|
$pathway->addItem($this->category[0]->title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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>
|
||||||
@ -0,0 +1,429 @@
|
|||||||
|
<?php
|
||||||
|
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']);
|
||||||
|
|
||||||
|
//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 pd-button-download"><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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ( $this->t['p']->get( 'show_page_heading' ) ) {
|
||||||
|
echo '<h1>'. $this->escape($this->t['p']->get('page_heading')) . '</h1>';
|
||||||
|
}
|
||||||
|
|
||||||
|
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="pdtop">'
|
||||||
|
.'<a title="'.$linkUpText.'" href="'. $linkUp.'" >'
|
||||||
|
.JHTML::_('image', $this->t['mediapath']->media_img_rel . 'up.png', JText::_('COM_PHOCADOWNLOAD_UP'))
|
||||||
|
.'</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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>';
|
||||||
|
|
||||||
|
|
||||||
|
// =====================================================================================
|
||||||
|
// 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)$directFv == 1) {
|
||||||
|
|
||||||
|
$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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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']);
|
||||||
|
|
||||||
|
//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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdDescription = '';
|
||||||
|
if ($l->isValueEditor($v->description)) {
|
||||||
|
$pdDescription .= '<div class="pd-fdesc">'.$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';
|
||||||
|
} else {
|
||||||
|
$classMirror = 'pd-mirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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';
|
||||||
|
} else {
|
||||||
|
$classMirror = 'pd-mirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
if ($l->displayTags($v->id) != '') {
|
||||||
|
$pdTags .= $l->displayTags($v->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
//Convert
|
||||||
|
// ---------------------------------------------------
|
||||||
|
if ($this->t['display_specific_layout'] == 0) {
|
||||||
|
echo '<div class="pd-filebox">';
|
||||||
|
//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 ($this->t['display_mirror_links'] == 5 || $this->t['display_mirror_links'] == 6) {
|
||||||
|
echo '<div class="pd-buttons">'.$pdMirrorLink2.'</div>';
|
||||||
|
echo '<div class="pd-buttons">'.$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-rating">'.$pdRating.'</div>';
|
||||||
|
echo '<div class="pd-tags">'.$pdTags.'</div>';
|
||||||
|
echo '<div class="pd-video">'.$pdVideo.'</div>';
|
||||||
|
echo '<div class="pd-cb"></div>';
|
||||||
|
echo '</div>';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/*$fileLayout = '<div class="pd-filebox">
|
||||||
|
{pdimage}
|
||||||
|
{pdfile}
|
||||||
|
{pdfilesize}
|
||||||
|
{pdversion}
|
||||||
|
{pdlicense}
|
||||||
|
{pdauthor}
|
||||||
|
{pdauthoremail}
|
||||||
|
{pdfiledate}
|
||||||
|
{pddownloads}
|
||||||
|
{pddescription}
|
||||||
|
{pdfeatures}
|
||||||
|
{pdchangelog}
|
||||||
|
{pdnotes}
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-report">{pdreportlink}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
|
||||||
|
$fileLayout = PhocaDownloadSettings::getLayoutText('file');
|
||||||
|
$fileLayoutParams = PhocaDownloadSettings::getLayoutParams('file');
|
||||||
|
|
||||||
|
$replace = array($pdTitle, $pdImage, $pdFile, $pdFileSize, $pdVersion, $pdLicense, $pdAuthor, $pdAuthorEmail, $pdFileDate, $pdDownloads, $pdDescription, $pdFeatures, $pdChangelog, $pdNotes, $pdMirrorLink1, $pdMirrorLink2, $pdReportLink, $pdRating, $pdTags, $pdVideo);
|
||||||
|
$output = str_replace($fileLayoutParams['search'], $replace, $fileLayout);
|
||||||
|
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
$o = '<div class="pd-cb"> </div>';
|
||||||
|
|
||||||
|
if ((int)$v->confirm_license > 0) {
|
||||||
|
$o .= '<h4 class="pdfv-confirm-lic-text">'.JText::_('COM_PHOCADOWNLOAD_LICENSE_AGREEMENT').'</h4>';
|
||||||
|
$o .= '<div id="phoca-dl-license" style="height:'.(int)$this->t['licenseboxheight'].'px">'.$v->licensetext.'</div>';
|
||||||
|
|
||||||
|
// External link
|
||||||
|
if ($v->link_external != '' && $v->directlink == 1) {
|
||||||
|
$o .= '<form action="" name="phocaDownloadForm" id="phocadownloadform" target="'.$this->t['download_external_link'].'">';
|
||||||
|
$o .= '<input type="checkbox" name="license_agree" onclick="enableDownloadPD()" /> <span>'.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').'</span> ';
|
||||||
|
$o .= '<input class="btn" 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" 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" 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" 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.DS.'components'.DS.'com_jcomments'.DS.'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 $o;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
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 of box
|
||||||
|
} else {
|
||||||
|
echo '<div> </div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo '</div></div><div class="pd-cb"> </div>'. $this->t['pw'];
|
||||||
|
?>
|
||||||
@ -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>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,223 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
jimport( 'joomla.filesystem.file' );
|
||||||
|
|
||||||
|
class PhocaDownloadViewDownload extends JViewLegacy
|
||||||
|
{
|
||||||
|
protected $file;
|
||||||
|
protected $category;
|
||||||
|
protected $t;
|
||||||
|
|
||||||
|
function display($tpl = null){
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->t['p'] = $app->getParams();
|
||||||
|
$this->t['user'] = JFactory::getUser();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$model = $this->getModel();
|
||||||
|
$document = JFactory::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 );
|
||||||
|
|
||||||
|
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 = (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
|
||||||
|
$token = JSession::getFormToken();
|
||||||
|
if (!JRequest::getInt( $token, 0, 'get' )) {
|
||||||
|
//JError::raiseError(403, 'Request Forbidden');
|
||||||
|
$app->redirect(JRoute::_('index.php', false), JText::_('COM_PHOCADOWNLOAD_INVALID_TOKEN'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check License Agreement
|
||||||
|
/*if (empty($licenseAgree)) {
|
||||||
|
$app->redirect(JRoute::_($currentLink, false), JText::_('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 ( '../', JURI::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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _prepareDocument( $file) {
|
||||||
|
|
||||||
|
$app = JFactory::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', JText::_('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->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0)) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
}
|
||||||
|
//$this->document->setTitle($title);
|
||||||
|
|
||||||
|
$this->document->setTitle($title);*/
|
||||||
|
|
||||||
|
$title = $this->t['p']->get('page_title', '');
|
||||||
|
$this->tmpl['display_file_name_title'] = 1;
|
||||||
|
if (empty($title)) {
|
||||||
|
$title = htmlspecialchars_decode($app->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 1) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
|
||||||
|
if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') {
|
||||||
|
$title = $title .' - ' . $file->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 2) {
|
||||||
|
|
||||||
|
if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') {
|
||||||
|
$title = $title .' - ' . $file->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('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->getCfg('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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
<view hidden="true" />
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
<?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();
|
||||||
|
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
|
||||||
|
class PhocaDownloadViewFeed extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
function display($tpl = null)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$userLevels = implode (',', $user->getAuthorisedViewLevels());
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$moduleId = $app->input->get('id', 0, 'int');
|
||||||
|
$table = &JTable::getInstance('module');
|
||||||
|
|
||||||
|
|
||||||
|
if ((int)$moduleId > 0) {
|
||||||
|
$db = JFactory::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()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$module = $db->loadObject();
|
||||||
|
if (isset($module->params) && $module->params != '') {
|
||||||
|
jimport( 'joomla.html.parameter' );
|
||||||
|
$paramsM = new JRegistry;
|
||||||
|
$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', JText::_('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) {
|
||||||
|
JArrayHelper::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 = JFactory::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 c.'.$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 JFeedItem();
|
||||||
|
|
||||||
|
$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 = JRoute::_($link);
|
||||||
|
|
||||||
|
|
||||||
|
// FILEDATE
|
||||||
|
$fileDate = '';
|
||||||
|
if ((int)$displayDateType > 0) {
|
||||||
|
if ($valueDoc->filename !='') {
|
||||||
|
$fileDate = PhocaDownloadFile::getFileTime($valueDoc->filename, $displayDateType, "Y-m-d H:M:S");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$fileDate = JHTML::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="http://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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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>
|
||||||
@ -0,0 +1,366 @@
|
|||||||
|
<?php
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
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="pdtop">'
|
||||||
|
.'<a title="'.$linkUpText.'" href="'. $linkUp.'" >'
|
||||||
|
.JHTML::_('image', $this->t['mediapath']->media_img_rel . 'up.png', JText::_('COM_PHOCADOWNLOAD_UP'))
|
||||||
|
.'</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '<div class="pd-file"><div class="pdtop"></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>';
|
||||||
|
|
||||||
|
|
||||||
|
// =====================================================================================
|
||||||
|
// 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)$directFv == 1) {
|
||||||
|
|
||||||
|
$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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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']);
|
||||||
|
|
||||||
|
//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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdDescription = '';
|
||||||
|
if ($l->isValueEditor($v->description)) {
|
||||||
|
$pdDescription .= '<div class="pd-fdesc">'.$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';
|
||||||
|
} else {
|
||||||
|
$classMirror = 'pd-mirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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';
|
||||||
|
} else {
|
||||||
|
$classMirror = 'pd-mirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
if ($l->displayTags($v->id) != '') {
|
||||||
|
$pdTags .= $l->displayTags($v->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
//Convert
|
||||||
|
// ---------------------------------------------------
|
||||||
|
if ($this->t['display_specific_layout'] == 0) {
|
||||||
|
echo '<div class="pd-filebox">';
|
||||||
|
//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 ($this->t['display_mirror_links'] == 5 || $this->t['display_mirror_links'] == 6) {
|
||||||
|
echo '<div class="pd-buttons">'.$pdMirrorLink2.'</div>';
|
||||||
|
echo '<div class="pd-buttons">'.$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-rating">'.$pdRating.'</div>';
|
||||||
|
echo '<div class="pd-tags">'.$pdTags.'</div>';
|
||||||
|
echo '<div class="pd-video">'.$pdVideo.'</div>';
|
||||||
|
echo '<div class="pd-cb"></div>';
|
||||||
|
echo '</div>';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/*$fileLayout = '<div class="pd-filebox">
|
||||||
|
{pdimage}
|
||||||
|
{pdfile}
|
||||||
|
{pdfilesize}
|
||||||
|
{pdversion}
|
||||||
|
{pdlicense}
|
||||||
|
{pdauthor}
|
||||||
|
{pdauthoremail}
|
||||||
|
{pdfiledate}
|
||||||
|
{pddownloads}
|
||||||
|
{pddescription}
|
||||||
|
{pdfeatures}
|
||||||
|
{pdchangelog}
|
||||||
|
{pdnotes}
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-report">{pdreportlink}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>';*/
|
||||||
|
|
||||||
|
|
||||||
|
$fileLayout = PhocaDownloadSettings::getLayoutText('file');
|
||||||
|
$fileLayoutParams = PhocaDownloadSettings::getLayoutParams('file');
|
||||||
|
|
||||||
|
$replace = array($pdTitle, $pdImage, $pdFile, $pdFileSize, $pdVersion, $pdLicense, $pdAuthor, $pdAuthorEmail, $pdFileDate, $pdDownloads, $pdDescription, $pdFeatures, $pdChangelog, $pdNotes, $pdMirrorLink1, $pdMirrorLink2, $pdReportLink, $pdRating, $pdTags, $pdVideo);
|
||||||
|
$output = str_replace($fileLayoutParams['search'], $replace, $fileLayout);
|
||||||
|
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
$o = '<div class="pd-cb"> </div>';
|
||||||
|
|
||||||
|
if ((int)$v->confirm_license > 0) {
|
||||||
|
$o .= '<h4 class="pdfv-confirm-lic-text">'.JText::_('COM_PHOCADOWNLOAD_LICENSE_AGREEMENT').'</h4>';
|
||||||
|
$o .= '<div id="phoca-dl-license" style="height:'.(int)$this->t['licenseboxheight'].'px">'.$v->licensetext.'</div>';
|
||||||
|
|
||||||
|
// External link
|
||||||
|
if ($v->link_external != '' && $v->directlink == 1) {
|
||||||
|
$o .= '<form action="" name="phocaDownloadForm" id="phocadownloadform" target="'.$this->t['download_external_link'].'">';
|
||||||
|
$o .= '<input type="checkbox" name="license_agree" onclick="enableDownloadPD()" /> <span>'.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').'</span> ';
|
||||||
|
$o .= '<input class="btn" 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" 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" 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" 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.DS.'components'.DS.'com_jcomments'.DS.'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 $o;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
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 of box
|
||||||
|
} else {
|
||||||
|
echo '<div> </div>';
|
||||||
|
}
|
||||||
|
echo '</div></div><div class="pd-cb"> </div>'. $this->t['pw'];
|
||||||
|
?>
|
||||||
@ -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="inputbox"
|
||||||
|
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="radio" 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="radio" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
|
||||||
|
</field>
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
?><div id="phocadownload-comments"><?php
|
||||||
|
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$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>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,231 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
jimport( 'joomla.filesystem.file' );
|
||||||
|
|
||||||
|
class PhocaDownloadViewFile extends JViewLegacy
|
||||||
|
{
|
||||||
|
protected $file;
|
||||||
|
protected $category;
|
||||||
|
protected $t;
|
||||||
|
|
||||||
|
function display($tpl = null){
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->t['p'] = $app->getParams();
|
||||||
|
$this->t['user'] = JFactory::getUser();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$model = $this->getModel();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$fileId = $app->input->get('id', 0, 'int');
|
||||||
|
$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::renderAllCSS();
|
||||||
|
$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);
|
||||||
|
|
||||||
|
|
||||||
|
// 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 ) {
|
||||||
|
JHTML::_('behavior.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
|
||||||
|
$token = JSession::getFormToken();
|
||||||
|
if (!JRequest::getInt( $token, 0, 'post' )) {
|
||||||
|
//JError::raiseError(403, 'Request Forbidden');
|
||||||
|
$app->redirect(JRoute::_('index.php', false), JText::_('COM_PHOCADOWNLOAD_INVALID_TOKEN'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check License Agreement
|
||||||
|
if (empty($licenseAgree)) {
|
||||||
|
$app->redirect(JRoute::_($currentLink, false), JText::_('COM_PHOCADOWNLOAD_WARNING_AGREE_LICENSE_TERMS'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink);
|
||||||
|
PhocaDownloadDownload::download($fileData, $downloadId, $currentLink);
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
$imagePath = PhocaDownloadPath::getPathSet('icon');
|
||||||
|
$this->t['cssimgpath'] = str_replace ( '../', JURI::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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _prepareDocument($category, $file) {
|
||||||
|
|
||||||
|
$app = JFactory::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', JText::_('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->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0)) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
}
|
||||||
|
//$this->document->setTitle($title);
|
||||||
|
|
||||||
|
$this->document->setTitle($title);*/
|
||||||
|
|
||||||
|
$title = $this->t['p']->get('page_title', '');
|
||||||
|
$this->tmpl['display_file_name_title'] = 1;
|
||||||
|
if (empty($title)) {
|
||||||
|
$title = htmlspecialchars_decode($app->getCfg('sitename'));
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 1) {
|
||||||
|
$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
|
||||||
|
|
||||||
|
if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') {
|
||||||
|
$title = $title .' - ' . $file->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ($app->getCfg('sitename_pagetitles', 0) == 2) {
|
||||||
|
|
||||||
|
if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') {
|
||||||
|
$title = $title .' - ' . $file->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('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->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) {
|
||||||
|
$this->document->setMetaData('title', $this->t['p']->get('page_title', ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Breadcrumbs TODO (Add the whole tree)
|
||||||
|
$pathway = $app->getPathway();
|
||||||
|
if (isset($category->id)) {
|
||||||
|
if ($category->id > 0) {
|
||||||
|
$pathway->addItem($category->title, JRoute::_(PhocaDownloadRoute::getCategoryRoute($category->id, $category->alias)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($file->title)) {
|
||||||
|
$pathway->addItem($file->title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
JHTML::_('behavior.tooltip');
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
|
||||||
|
|
||||||
|
function insertLink() {
|
||||||
|
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.jInsertEditorText(tag, '<?php echo $this->t['ename']; ?>');
|
||||||
|
//window.parent.document.getElementById('sbox-window').close();
|
||||||
|
window.parent.SqueezeBox.close();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
alert("<?php echo JText::_( 'COM_PHOCADOWNLOAD_YOU_MUST_SELECT_CATEGORY', true ); ?>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="phocadownload-links">
|
||||||
|
<fieldset class="adminform">
|
||||||
|
<legend><?php echo JText::_( 'COM_PHOCADOWNLOAD_CATEGORY' ); ?></legend>
|
||||||
|
<form name="adminForm" id="adminForm">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right" >
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_CATEGORY' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php echo $this->lists['catid'];?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TITLE' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="title" name="title" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="target">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select name="target" id="target">
|
||||||
|
<option value="s" selected="selected"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_SELF' ); ?></option>
|
||||||
|
<option value="b"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_BLANK' ); ?></option>
|
||||||
|
<option value="t"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_TOP' ); ?></option>
|
||||||
|
<option value="p"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_PARENT' ); ?></option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
<div style="text-align:left;"><span class="icon-16-edb-back"><a style="text-decoration:underline" href="<?php echo $this->tmpl['backlink'];?>"><?php echo JText::_('COM_PHOCADOWNLOAD_BACK')?></a></span></div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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
|
||||||
|
*/
|
||||||
|
jimport('joomla.application.component.view');
|
||||||
|
class phocaDownloadViewphocaDownloadLinkCat extends JViewLegacy
|
||||||
|
{
|
||||||
|
function display($tpl = null) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
JHtml::_('behavior.tooltip');
|
||||||
|
JHtml::_('behavior.formvalidation');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
//Frontend Changes
|
||||||
|
$tUri = '';
|
||||||
|
if (!$app->isAdmin()) {
|
||||||
|
$tUri = JURI::base();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
|
||||||
|
|
||||||
|
$eName = $app->input->get('e_name');
|
||||||
|
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
|
||||||
|
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename'];
|
||||||
|
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// build list of categories
|
||||||
|
//$javascript = 'class="inputbox" size="1" onchange="submitform( );"';
|
||||||
|
$javascript = 'class="inputbox" size="1"';
|
||||||
|
$filter_catid = '';
|
||||||
|
|
||||||
|
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||||
|
. ' 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, JHTML::_('select.option', '0', '- '.JText::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -', 'value', 'text'));
|
||||||
|
$lists['catid'] = JHTML::_( 'select.genericlist', $tree, 'catid', $javascript , 'value', 'text', $filter_catid );
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
$this->assignRef('lists', $lists);
|
||||||
|
$this->assignRef('tmpl', $this->t);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
JHTML::_('behavior.tooltip');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertLink() {
|
||||||
|
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+"}";
|
||||||
|
|
||||||
|
window.parent.jInsertEditorText(tag, '<?php echo $this->t['ename']; ?>');
|
||||||
|
//window.parent.document.getElementById('sbox-window').close();
|
||||||
|
window.parent.SqueezeBox.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div id="phocadownload-links">
|
||||||
|
<fieldset class="adminform">
|
||||||
|
<legend><?php echo JText::_( 'COM_PHOCADOWNLOAD_CATEGORIES' ); ?></legend>
|
||||||
|
<form name="adminFormLink" id="adminFormLink">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
<tr>
|
||||||
|
<td class="key" align="right" width="20%">
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TITLE' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td width="80%">
|
||||||
|
<input type="text" id="title" name="title" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="target">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select name="target" id="target">
|
||||||
|
<option value="s" selected="selected"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_SELF' ); ?></option>
|
||||||
|
<option value="b"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_BLANK' ); ?></option>
|
||||||
|
<option value="t"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_TOP' ); ?></option>
|
||||||
|
<option value="p"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_PARENT' ); ?></option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
<div style="text-align:left;"><span class="icon-16-edb-back"><a style="text-decoration:underline" href="<?php echo $this->tmpl['backlink'];?>"><?php echo JText::_('COM_PHOCADOWNLOAD_BACK')?></a></span></div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view' );
|
||||||
|
|
||||||
|
class phocaDownloadViewphocaDownloadLinkCats extends JViewLegacy
|
||||||
|
{
|
||||||
|
function display($tpl = null) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
JHtml::_('behavior.tooltip');
|
||||||
|
JHtml::_('behavior.formvalidation');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
|
||||||
|
//Frontend Changes
|
||||||
|
$tUri = '';
|
||||||
|
if (!$app->isAdmin()) {
|
||||||
|
$tUri = JURI::base();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
|
||||||
|
|
||||||
|
$eName = $app->input->get('e_name');
|
||||||
|
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
|
||||||
|
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename'];
|
||||||
|
|
||||||
|
|
||||||
|
// Category Tree
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||||
|
. ' 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="inputbox"';
|
||||||
|
$attribs .= ' multiple="multiple"';
|
||||||
|
$ctrl .= '';
|
||||||
|
//$value = implode( '|', )
|
||||||
|
|
||||||
|
$categoriesOutput = JHTML::_('select.genericlist', $tree, $ctrl, $attribs, 'value', 'text', 0, 'hidecategories' );
|
||||||
|
|
||||||
|
$this->assignRef('categoriesoutput', $categoriesOutput);
|
||||||
|
$this->assignRef('tmpl', $this->t);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,398 @@
|
|||||||
|
<?php
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
//Ordering allowed ?
|
||||||
|
$ordering = ($this->lists['order'] == 'a.ordering');
|
||||||
|
|
||||||
|
JHTML::_('behavior.tooltip');
|
||||||
|
|
||||||
|
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';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
function insertLink() {
|
||||||
|
var title = document.getElementById("title").value;
|
||||||
|
if (title != '') {
|
||||||
|
title = "|text="+title;
|
||||||
|
}
|
||||||
|
<?php if ($this->t['type'] == 0) { ?>
|
||||||
|
var target = document.getElementById("target").value;
|
||||||
|
if (target != '') {
|
||||||
|
target = "|target="+target;
|
||||||
|
}
|
||||||
|
<?php } else if ($this->t['type'] == 1 || $this->t['type'] == 2) { ?>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
<?php } else if ($this->t['type'] == 3) { ?>
|
||||||
|
var previewwidth = document.getElementById("previewwidth").value;
|
||||||
|
if (previewwidth != '') {
|
||||||
|
previewwidth = "|previewwidth="+previewwidth;
|
||||||
|
}
|
||||||
|
var previewheight = document.getElementById("previewheight").value;
|
||||||
|
if (previewheight != '') {
|
||||||
|
previewheight = "|previewheight="+previewheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php } else if ($this->t['type'] == 4) { ?>
|
||||||
|
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 = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
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) {
|
||||||
|
<?php if ($this->t['type'] == 0) { ?>
|
||||||
|
var tag = "{phocadownload view=<?php echo $view ?>"+fileIdOutput+title+target+"}";
|
||||||
|
<?php } else if ($this->t['type'] == 1) { ?>
|
||||||
|
var tag = "{phocadownload view=<?php echo $view ?>"+fileIdOutput+title+playerwidth+playerheight+playerheightmp3+"}";
|
||||||
|
<?php } else if ($this->t['type'] == 2) { ?>
|
||||||
|
var tag = "{phocadownload view=<?php echo $view ?>"+fileIdOutput+title+playerwidth+playerheight+playerheightmp3+"}";
|
||||||
|
<?php } else if ($this->t['type'] == 3) { ?>
|
||||||
|
var tag = "{phocadownload view=<?php echo $view ?>"+fileIdOutput+title+previewwidth+previewheight+"}";
|
||||||
|
<?php } else if ($this->t['type'] == 4) { ?>
|
||||||
|
var tag = "{phocadownload view=<?php echo $view ?>"+fileIdOutput+limit+"}";
|
||||||
|
<?php } ?>
|
||||||
|
window.parent.jInsertEditorText(tag, '<?php echo $this->t['ename']; ?>');
|
||||||
|
//window.parent.document.getElementById('sbox-window').close();
|
||||||
|
window.parent.SqueezeBox.close();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
<?php if ($this->t['type'] == 4) { ?>
|
||||||
|
|
||||||
|
if (categoryIdOutput != '' && parseInt(categoryid) > 0) {
|
||||||
|
var tag = "{phocadownload view=<?php echo $view ?>"+categoryIdOutput+limit+"}";
|
||||||
|
window.parent.jInsertEditorText(tag, '<?php echo $this->t['ename']; ?>');
|
||||||
|
window.parent.SqueezeBox.close();
|
||||||
|
} else {
|
||||||
|
alert("<?php echo JText::_( 'COM_PHOCADOWNLOAD_YOU_MUST_SELECT_CATEGORY', true ); ?>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
<?php } else { ?>
|
||||||
|
alert("<?php echo JText::_( 'COM_PHOCADOWNLOAD_YOU_MUST_SELECT_FILE', true ); ?>");
|
||||||
|
return false;
|
||||||
|
<?php } ?>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<div id="phocadownload-links">
|
||||||
|
<fieldset class="adminform">
|
||||||
|
|
||||||
|
<legend><?php echo JText::_( 'COM_PHOCADOWNLOAD_FILE' ); ?></legend>
|
||||||
|
<form action="<?php echo htmlspecialchars($this->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 JText::_( 'COM_PHOCADOWNLOAD_FILTER' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td width="80%">
|
||||||
|
<div class="input-append"><input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" /> <button class="btn" onclick="this.form.submit();"><?php echo JText::_('COM_PHOCADOWNLOAD_FILTER'); ?></button> <button class="btn" onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_('COM_PHOCADOWNLOAD_RESET'); ?></button></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="key" align="right" nowrap="nowrap">
|
||||||
|
<label for="title" nowrap="nowrap"><?php echo JText::_( 'COM_PHOCADOWNLOAD_CATEGORY' ); ?></label>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $this->lists['catid']; ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($this->t['type'] != 4) { ?>
|
||||||
|
<div id="editcell">
|
||||||
|
<table class="adminlist">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="5%"><?php echo JText::_( 'COM_PHOCADOWNLOAD_NUM' ); ?></th>
|
||||||
|
<th width="5%"></th>
|
||||||
|
<th class="title" width="60%"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_TITLE', 'a.title', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||||
|
</th>
|
||||||
|
<th width="20%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_FILENAME', 'a.filename', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||||
|
</th>
|
||||||
|
<th width="10%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_ID', 'a.id', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="12"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$k = 0;
|
||||||
|
for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
|
||||||
|
$row = &$this->items[$i];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr class="<?php echo "row$k"; ?>">
|
||||||
|
<td><?php echo $this->pagination->getRowOffset( $i ); ?></td>
|
||||||
|
<td><input type="radio" name="fileid" value="<?php echo $row->id ?>" /></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->lists['order']; ?>" />
|
||||||
|
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||||
|
<input type="hidden" name="e_name" value="<?php echo $this->t['ename']?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if ($this->t['type'] == 0) {
|
||||||
|
?>
|
||||||
|
<form name="adminFormLink" id="adminFormLink">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TITLE' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="title" name="title" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="target">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select name="target" id="target">
|
||||||
|
<option value="s" selected="selected"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_SELF' ); ?></option>
|
||||||
|
<option value="b"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_BLANK' ); ?></option>
|
||||||
|
<option value="t"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_TOP' ); ?></option>
|
||||||
|
<option value="p"><?php echo JText::_( 'COM_PHOCADOWNLOAD_TARGET_PARENT' ); ?></option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else if ($this->t['type'] == 1 || $this->t['type'] == 2){
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form name="adminFormLink" id="adminFormLink">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
|
||||||
|
<?php if ($this->t['type'] == 1) { ?>
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TITLE' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="title" name="title" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } else { ?>
|
||||||
|
<input type="hidden" id="title" name="title" />
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="playerwidth">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_PLAYER_WIDTH' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="playerwidth" name="playerwidth" value="328" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="playerheight">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_PLAYER_HEIGHT' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="playerheight" name="playerheight" value="200" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="playerheightmp3">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_PLAYER_HEIGHT_MP3' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="playerheightmp3" name="playerheightmp3" value="30" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php if ($this->t['type'] == 1) { ?>
|
||||||
|
<tr><td colspan="2"><?php echo JText::_('COM_PHOCADOWNLOAD_WARNING_PLAYER_SIZE')?></td></tr>
|
||||||
|
<?php } ?>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else if ($this->t['type'] == 3){
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form name="adminFormLink" id="adminFormLink">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
|
||||||
|
<?php if ($this->t['type'] == 1) { ?>
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_TITLE' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="title" name="title" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } else { ?>
|
||||||
|
<input type="hidden" id="title" name="title" />
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="previewwidth">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_PREVIEW_WIDTH' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="previewwidth" name="previewwidth" value="640" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="previewheight">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_PREVIEW_HEIGHT' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="previewheight" name="previewheight" value="480" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else if ($this->t['type'] == 4){
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form name="adminFormLink" id="adminFormLink">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="key" align="right" nowrap="nowrap">
|
||||||
|
<label for="title" nowrap="nowrap"><?php echo JText::_( 'COM_PHOCADOWNLOAD_CATEGORY' ); ?></label>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $this->lists['catid']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right">
|
||||||
|
<label for="title">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_LIMIT' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="limit" name="limit" />
|
||||||
|
<input type="hidden" id="title" name="title" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</fieldset>
|
||||||
|
<div style="text-align:left;"><span class="icon-16-edb-back"><a style="text-decoration:underline" href="<?php echo $this->tmpl['backlink'];?>"><?php echo JText::_('COM_PHOCADOWNLOAD_BACK')?></a></span></div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view' );
|
||||||
|
|
||||||
|
class PhocaDownloadViewPhocaDownloadLinkFile extends JViewLegacy
|
||||||
|
{
|
||||||
|
var $_context = 'com_phocadownload.phocadownloadlinkfile';
|
||||||
|
|
||||||
|
function display($tpl = null) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
JHtml::_('behavior.tooltip');
|
||||||
|
JHtml::_('behavior.formvalidation');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
|
||||||
|
//Frontend Changes
|
||||||
|
$tUri = '';
|
||||||
|
if (!$app->isAdmin()) {
|
||||||
|
$tUri = JURI::base();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
|
||||||
|
|
||||||
|
$eName = $app->input->get('e_name');
|
||||||
|
$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&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename'];
|
||||||
|
|
||||||
|
|
||||||
|
$params = JComponentHelper::getParams('com_phocadownload') ;
|
||||||
|
|
||||||
|
//Filter
|
||||||
|
$context = 'com_phocadownload.phocadownload.list.';
|
||||||
|
//$sectionid = $app->input->get( 'sectionid', -1, '', 'int' );
|
||||||
|
//$redirect = $sectionid;
|
||||||
|
$option = JRequest::getCmd( 'option' );
|
||||||
|
|
||||||
|
$filter_state = $app->getUserStateFromRequest( $this->_context.'.filter_state', 'filter_state', '', '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 = JString::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="inputbox" 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'] = JHTML::_('grid.state', $filter_state );
|
||||||
|
|
||||||
|
// table ordering
|
||||||
|
$lists['order_Dir'] = $filter_order_Dir;
|
||||||
|
$lists['order'] = $filter_order;
|
||||||
|
|
||||||
|
// search filter
|
||||||
|
$lists['search']= $search;
|
||||||
|
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$uriS = $uri->toString();
|
||||||
|
$this->assignRef('user', $user);
|
||||||
|
$this->assignRef('lists', $lists);
|
||||||
|
$this->assignRef('tmpl', $this->t);
|
||||||
|
$this->assignRef('items', $items);
|
||||||
|
$this->assignRef('pagination', $pagination);
|
||||||
|
$this->assignRef('request_url', $uriS);
|
||||||
|
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
JHTML::_('behavior.tooltip');
|
||||||
|
|
||||||
|
echo '<div id="phocadownload-links">'
|
||||||
|
.'<fieldset class="adminform">'
|
||||||
|
.'<legend>'.JText::_( 'COM_PHOCADOWNLOAD_SELECT_TYPE' ).'</legend>'
|
||||||
|
.'<ul>'
|
||||||
|
.'<li class="icon-16-edb-categories"><a href="'.$this->t['linkcategories'].'">'.JText::_('COM_PHOCADOWNLOAD_LINK_TO_CATEGORIES').'</a></li>'
|
||||||
|
.'<li class="icon-16-edb-category"><a href="'.$this->t['linkcategory'].'">'.JText::_('COM_PHOCADOWNLOAD_LINK_TO_CATEGORY').'</a></li>'
|
||||||
|
.'<li class="icon-16-edb-file"><a href="'.$this->t['linkfile'].'&type=0">'.JText::_('COM_PHOCADOWNLOAD_LINK_TO_FILE').'</a></li>'
|
||||||
|
.'<li class="icon-16-edb-play"><a href="'.$this->t['linkfile'].'&type=1">'.JText::_('COM_PHOCADOWNLOAD_PLAY_FILE_LINK').'</a> <a href="'.$this->t['linkfile'].'&type=2">'.JText::_('COM_PHOCADOWNLOAD_PLAY_FILE_DIRECT').'</a></li>'
|
||||||
|
.'<li class="icon-16-edb-preview"><a href="'.$this->t['linkfile'].'&type=3">'.JText::_('COM_PHOCADOWNLOAD_PREVIEW_FILE_LINK').'</a></li>'
|
||||||
|
.'<li class="icon-16-edb-file"><a href="'.$this->t['linkfile'].'&type=4">'.JText::_('COM_PHOCADOWNLOAD_FILELIST').'</a></li>'
|
||||||
|
.'<li class="icon-16-edb-play"><a href="'.$this->t['linkytb'].'">'.JText::_('COM_PHOCADOWNLOAD_YOUTUBE_VIDEO').'</a></li>'
|
||||||
|
.'</ul>'
|
||||||
|
.'</div>'
|
||||||
|
.'</fieldset>'
|
||||||
|
.'</div>';
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view' );
|
||||||
|
|
||||||
|
class phocaDownloadViewphocaDownloadLinks extends JViewLegacy
|
||||||
|
{
|
||||||
|
function display($tpl = null) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
JHtml::_('behavior.tooltip');
|
||||||
|
JHtml::_('behavior.formvalidation');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
JHtml::_('behavior.tooltip');
|
||||||
|
JHtml::_('behavior.formvalidation');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
|
||||||
|
//Frontend Changes
|
||||||
|
$tUri = '';
|
||||||
|
if (!$app->isAdmin()) {
|
||||||
|
$tUri = JURI::base();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
|
||||||
|
|
||||||
|
$eName = $app->input->get('e_name');
|
||||||
|
$eName = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
|
||||||
|
|
||||||
|
|
||||||
|
$this->t['linkcategories'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkcats&tmpl=component&e_name='.$eName;
|
||||||
|
$this->t['linkcategory'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkcat&tmpl=component&e_name='.$eName;
|
||||||
|
$this->t['linkfile'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkfile&tmpl=component&e_name='.$eName;
|
||||||
|
$this->t['linkytb'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkytb&tmpl=component&e_name='.$eName;
|
||||||
|
|
||||||
|
$this->assignRef('tmpl', $this->t);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
JHTML::_('behavior.tooltip');
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function insertLink() {
|
||||||
|
|
||||||
|
var urlOutput;
|
||||||
|
var url = document.getElementById("url").value;
|
||||||
|
if (url != '' ) {
|
||||||
|
urlOutput = "|url="+url;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (urlOutput != '' && urlOutput) {
|
||||||
|
var tag = "{phocadownload view=youtube"+urlOutput+"}";
|
||||||
|
window.parent.jInsertEditorText(tag, '<?php echo $this->t['ename']; ?>');
|
||||||
|
//window.parent.document.getElementById('sbox-window').close();
|
||||||
|
window.parent.SqueezeBox.close();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
alert("<?php echo JText::_( 'COM_PHOCADOWNLOAD_WARNING_SET_YOUTUBE_URL', true ); ?>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div id="phocadownload-links">
|
||||||
|
<fieldset class="adminform">
|
||||||
|
<legend><?php echo JText::_( 'COM_PHOCADOWNLOAD_YOUTUBE_VIDEO' ); ?></legend>
|
||||||
|
<form name="adminFormLink" id="adminFormLink">
|
||||||
|
<table class="admintable" width="100%">
|
||||||
|
|
||||||
|
|
||||||
|
<tr >
|
||||||
|
<td class="key" align="right" >
|
||||||
|
<label for="url">
|
||||||
|
<?php echo JText::_( 'COM_PHOCADOWNLOAD_YOUTUBE_URL' ); ?>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="url" name="url" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td align="right"><button class="btn btn-primary plg-button-insert " onclick="insertLink();return false;"><span class="icon-ok"></span> <?php echo JText::_( 'COM_PHOCADOWNLOAD_INSERT_CODE' ); ?></button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
<div style="text-align:left;"><span class="icon-16-edb-back"><a style="text-decoration:underline" href="<?php echo $this->tmpl['backlink'];?>"><?php echo JText::_('COM_PHOCADOWNLOAD_BACK')?></a></span></div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view' );
|
||||||
|
|
||||||
|
class phocaDownloadViewphocaDownloadLinkYtb extends JViewLegacy
|
||||||
|
{
|
||||||
|
function display($tpl = null) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
JHtml::_('behavior.tooltip');
|
||||||
|
JHtml::_('behavior.formvalidation');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
//Frontend Changes
|
||||||
|
$tUri = '';
|
||||||
|
if (!$app->isAdmin()) {
|
||||||
|
$tUri = JURI::base();
|
||||||
|
|
||||||
|
}
|
||||||
|
JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' );
|
||||||
|
|
||||||
|
$eName = $app->input->get('e_name');
|
||||||
|
$this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
|
||||||
|
$this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename'];
|
||||||
|
|
||||||
|
$this->assignRef('tmpl', $this->t);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
<view hidden="true" />
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
// no direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
// 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->file[0])) {
|
||||||
|
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->file[0]->cataccessuserid, $this->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') {
|
||||||
|
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="video/mp4">';
|
||||||
|
echo JText::_('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 JText::_('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 JText::_('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 JText::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
|
||||||
|
echo '</video>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//Flow Player
|
||||||
|
$versionFLP = '3.2.2';
|
||||||
|
$versionFLPJS = '3.2.2';
|
||||||
|
$document = JFactory::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 JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
|
||||||
|
class PhocaDownloadViewPlay extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
function display($tpl = null){
|
||||||
|
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$this->t = array();
|
||||||
|
$this->t['user'] = JFactory::getUser();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$model = $this->getModel();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$fileId = $app->input->get('id', 0, 'int');
|
||||||
|
$file = $model->getFile($fileId);
|
||||||
|
|
||||||
|
$fileExt = '';
|
||||||
|
|
||||||
|
$filePath = PhocaDownloadPath::getPathSet('fileplay');
|
||||||
|
$filePath = str_replace ( '../', JURI::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'] = JURI::base().'components/com_phocadownload/assets/flowplayer/';
|
||||||
|
$this->t['playerwidth'] = $params->get( 'player_width', 328 );
|
||||||
|
$this->t['playerheight'] = $params->get( 'player_height', 200 );
|
||||||
|
$this->t['html5_play'] = $params->get( 'html5_play', 0 );
|
||||||
|
} else {
|
||||||
|
echo JText::_('COM_PHOCADOWNLOAD_ERROR_NO_CORRECT_FILE_TO_PLAY_FOUND');exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo JText::_('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->assignRef('file', $file);
|
||||||
|
$this->assignRef('tmpl', $this->t);
|
||||||
|
$this->assignRef('params', $params);
|
||||||
|
$uriT = $uri->toString();
|
||||||
|
$this->assignRef('request_url', $uriT);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
<view hidden="true" />
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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();
|
||||||
|
jimport( 'joomla.application.component.view');
|
||||||
|
|
||||||
|
class PhocaDownloadViewRatingFileA extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
function display($tpl = null){
|
||||||
|
|
||||||
|
if (!JRequest::checkToken('request')) {
|
||||||
|
$response = array(
|
||||||
|
'status' => '0',
|
||||||
|
'error' => JText::_('JINVALID_TOKEN')
|
||||||
|
);
|
||||||
|
echo json_encode($response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$app = JFactory::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 = JComponentHelper::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 = JFactory::getUser();
|
||||||
|
//$view = $app->input->get( 'view', '', 'get', '', JREQUEST_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 = JText::_('COM_PHOCADOWNLOAD_ERROR_WRONG_RATING') ;
|
||||||
|
$response = array(
|
||||||
|
'status' => '0',
|
||||||
|
'error' => $msg);
|
||||||
|
echo json_encode($response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$post['fileid'] < 1) {
|
||||||
|
$msg = JText::_('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 = JText::_('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 = JText::_('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 = JText::_('COM_PHOCADOWNLOAD_ERROR_RATING_FILE');
|
||||||
|
$response = array(
|
||||||
|
'status' => '0',
|
||||||
|
'error' => $msg);
|
||||||
|
echo json_encode($response);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_RATING_FILE');
|
||||||
|
$response = array(
|
||||||
|
'status' => '1',
|
||||||
|
'error' => '',
|
||||||
|
'message' => $msg);
|
||||||
|
echo json_encode($response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION');
|
||||||
|
$response = array(
|
||||||
|
'status' => '0',
|
||||||
|
'error' => $msg);
|
||||||
|
echo json_encode($response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION');
|
||||||
|
$response = array(
|
||||||
|
'status' => '0',
|
||||||
|
'error' => $msg);
|
||||||
|
echo json_encode($response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -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>
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
$heading = '';
|
||||||
|
if ($this->t['p']->get( 'page_heading' ) != '') {
|
||||||
|
$heading .= $this->t['p']->get( 'page_heading' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->t['showpageheading'] != 0) {
|
||||||
|
if ( $heading != '') {
|
||||||
|
echo '<h1>'. $this->escape($heading) . '</h1>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tab = 0;
|
||||||
|
switch ($this->t['tab']) {
|
||||||
|
case 'up':
|
||||||
|
$tab = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'cc':
|
||||||
|
default:
|
||||||
|
$tab = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<div> </div>';
|
||||||
|
|
||||||
|
if ($this->t['displaytabs'] > 0) {
|
||||||
|
echo '<div id="phocadownload-pane">';
|
||||||
|
//$pane =& J Pane::getInstance('Tabs', array('startOffset'=> $this->t['tab']));
|
||||||
|
//echo $pane->startPane( 'pane' );
|
||||||
|
echo JHtml::_('tabs.start', 'config-tabs-com_phocadownload-user', array('useCookie'=>1, 'startOffset'=> $this->t['tab']));
|
||||||
|
|
||||||
|
//echo $pane->startPanel( JHTML::_( 'image .site', $this->t['pi'].'icon-document-16.png','', '', '', '', '') . ' '.JText::_('COM_PHOCADOWNLOAD_UPLOAD'), 'files' );
|
||||||
|
echo JHtml::_('tabs.panel', JHtml::_( 'image', $this->t['pi'].'icon-document-16.png', '') . ' '.JText::_('COM_PHOCADOWNLOAD_UPLOAD'), 'files' );
|
||||||
|
echo $this->loadTemplate('files');
|
||||||
|
//echo $pane->endPanel();
|
||||||
|
|
||||||
|
//echo $pane->endPane();
|
||||||
|
echo JHtml::_('tabs.end');
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
echo $this->t['pw'];
|
||||||
|
?>
|
||||||
@ -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>
|
||||||
@ -0,0 +1,332 @@
|
|||||||
|
<?php 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"><div style="font-size:1px;height:1px;margin:0px;padding:0px;"> </div>';
|
||||||
|
|
||||||
|
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'));
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4><?php echo JText::_( 'COM_PHOCADOWNLOAD_UPLOADED_FILES' ); ?></h4>
|
||||||
|
<form action="<?php echo htmlspecialchars($this->t['action']);?>" method="post" name="phocadownloadfilesform" id="adminForm">
|
||||||
|
|
||||||
|
<div class="filter-search btn-group pull-left">
|
||||||
|
<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->listsfiles['search'];?>" title="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="btn-group pull-left hidden-phone">
|
||||||
|
<button class="btn tip hasTooltip" type="submit" onclick="this.form.submit();" title="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>"><i class="icon-search"></i></button>
|
||||||
|
<button class="btn tip hasTooltip" type="button" onclick="document.getElementById('pdsearch').value='';document.phocadownloadfilesform.submit();" title="<?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?>"><i class="icon-remove"></i></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="float:right">
|
||||||
|
<?php echo $this->listsfiles['catid'] ?>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix ph-cb"></div>
|
||||||
|
|
||||||
|
<table class="adminlist">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="title" width="50%"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_TITLE', 'a.title', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image'); ?></th>
|
||||||
|
<th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_PUBLISHED', 'a.published', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
|
||||||
|
<th width="3%" nowrap="nowrap"><?php echo JText::_('COM_PHOCADOWNLOAD_DELETE'); ?></th>
|
||||||
|
<th width="3%" nowrap="nowrap"><?php echo JText::_('COM_PHOCADOWNLOAD_ACTIVE'); ?></th>
|
||||||
|
<th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_APPROVED', 'a.approved', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
|
||||||
|
|
||||||
|
<th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_DATE_UPLOAD', 'a.date', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
|
||||||
|
|
||||||
|
|
||||||
|
<th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_CATEGORY', 'a.catid', $this->listsfiles['order_Dir'], $this->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 echo $row->title; ?></td>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Publish Unpublish
|
||||||
|
echo '<td align="center">';
|
||||||
|
if ($row->published == 1) {
|
||||||
|
if ($rightDisplayDelete) {
|
||||||
|
echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'unpublish\', '.(int)$row->id.');" >';
|
||||||
|
echo JHTML::_('image', $this->t['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED'));
|
||||||
|
echo '</a>';
|
||||||
|
} else {
|
||||||
|
echo JHTML::_('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 JHTML::_('image', $this->t['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
|
||||||
|
echo '</a>';
|
||||||
|
} else {
|
||||||
|
echo JHTML::_('image', $this->t['pi'].'icon-unpublish-g.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
echo '<td align="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 JHTML::_('image', $this->t['pi'].'icon-trash.png', JText::_('COM_PHOCADOWNLOAD_DELETE'));
|
||||||
|
echo '</a>';
|
||||||
|
} else {
|
||||||
|
echo JHTML::_('image', $this->t['pi'].'icon-trash-g.png', JText::_('COM_PHOCADOWNLOAD_DELETE'));
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
echo '<td align="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 .= JText::_( 'COM_PHOCADOWNLOAD_START') . ': '.JText::_( 'COM_PHOCADOWNLOAD_ALWAYS' );
|
||||||
|
} else {
|
||||||
|
$times .= 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 .= "<br />". JText::_( 'COM_PHOCADOWNLOAD_FINISH'). ': '. JText::_('COM_PHOCADOWNLOAD_NO_EXPIRY' );
|
||||||
|
} else {
|
||||||
|
$times .= "<br />". 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 align="center">';
|
||||||
|
if ($row->approved == 1) {
|
||||||
|
echo JHTML::_('image', $this->t['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_APPROVED'));
|
||||||
|
} else {
|
||||||
|
echo JHTML::_('image', $this->t['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_NOT_APPROVED'));
|
||||||
|
}
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
echo '<td align="center">'. $row->date .'</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<td align="center">'. $row->categorytitle .'</td>'
|
||||||
|
//echo '<td align="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 (count($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') .' '
|
||||||
|
.$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 JHTML::_( '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->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' ).': '.$this->t['uploadmaxsizeread'].']';
|
||||||
|
?></h4>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($this->t['errorcatid'] != '') {
|
||||||
|
echo '<div class="alert alert-error">'
|
||||||
|
.'<button type="button" class="close" data-dismiss="alert">×</button>' . $this->t['errorcatid'] . '</div>';
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<form onsubmit="return OnUploadSubmitFile();" action="<?php echo $this->t['actionamp'] ?>task=upload&<?php echo $this->session->getName().'='.$this->session->getId(); ?>&<?php echo JSession::getFormToken();?>=1" name="phocadownloaduploadform" id="phocadownload-upload-form" method="post" enctype="multipart/form-data">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php echo JText::_('COM_PHOCADOWNLOAD_FILENAME');?>:</strong></td><td>
|
||||||
|
<input type="file" id="file-upload" name="Filedata" />
|
||||||
|
<button class="btn btn-primary" id="file-upload-submit"><i class="icon-upload icon-white"></i><?php echo JText::_('COM_PHOCADOWNLOAD_START_UPLOAD')?></button>
|
||||||
|
<span id="upload-clear"></span></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($this->t['errorfile'] != '') {
|
||||||
|
echo '<tr><td></td><td><div class="alert alert-error">'
|
||||||
|
.'<button type="button" class="close" data-dismiss="alert">×</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->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();" cols="30" rows="10" class="comment-input"><?php echo $this->formdata->description ?></textarea></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </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->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->formdata->email ?>" maxlength="255" class="comment-input" /></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($this->t['erroremail'] != '') {
|
||||||
|
echo '<tr><td></td><td><div class="alert alert-error">'
|
||||||
|
.'<button type="button" class="close" data-dismiss="alert">×</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->formdata->website ?>" maxlength="255" class="comment-input" /></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($this->t['errorwebsite'] != '') {
|
||||||
|
echo '<tr><td></td><td><div class="alert alert-error">'
|
||||||
|
.'<button type="button" class="close" data-dismiss="alert">×</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->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->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->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"><center><?php echo JHTML::_('image', $this->t['pi'].'icon-loading.gif', '') . JText::_('COM_PHOCADOWNLOAD_LOADING'); ?></center></div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,312 @@
|
|||||||
|
<?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();
|
||||||
|
jimport( 'joomla.client.helper' );
|
||||||
|
jimport( 'joomla.application.component.view' );
|
||||||
|
jimport( 'joomla.html.pane' );
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadViewUser extends JViewLegacy
|
||||||
|
{
|
||||||
|
protected $_context_files = 'com_phocadownload.phocadownloaduserfiles';
|
||||||
|
protected $t;
|
||||||
|
function display($tpl = null) {
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$menus = $app->getMenu();
|
||||||
|
$menu = $menus->getActive();
|
||||||
|
$this->t['p'] = $app->getParams();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::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->redirect(JRoute::_($this->t['pl'], false), JText::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhocaDownloadRenderFront::renderAllCSS();
|
||||||
|
|
||||||
|
|
||||||
|
// = = = = = = = = = = =
|
||||||
|
// PANE
|
||||||
|
// = = = = = = = = = = =
|
||||||
|
// - - - - - - - - - -
|
||||||
|
// ALL TABS
|
||||||
|
// - - - - - - - - - -
|
||||||
|
// UCP is disabled (security reasons)
|
||||||
|
if ((int)$this->t['p']->get( 'enable_user_cp', 0 ) == 0) {
|
||||||
|
$app->redirect(JURI::base(false), JText::_("COM_PHOCADOWNLOAD_USER_UPLOAD_DISABLED"));
|
||||||
|
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['parentid'] = $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 = !JClientHelper::hasCredentials('ftp');// Set FTP form
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$this->assignRef('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 JObject();
|
||||||
|
$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'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY');
|
||||||
|
$returnForm = 1;
|
||||||
|
}
|
||||||
|
jimport('joomla.mail.helper');
|
||||||
|
if ($post['email'] != '' && !JMailHelper::isEmailAddress($post['email']) ) {
|
||||||
|
$this->t['erroremail'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_EMAIL_ADDRESS');
|
||||||
|
$returnForm = 1;
|
||||||
|
}
|
||||||
|
if ($post['website'] != '' && !PhocaDownloadUtils::isURLAddress($post['website']) ) {
|
||||||
|
$this->t['errorwebsite'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_WEBSITE');
|
||||||
|
$returnForm = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload
|
||||||
|
$errUploadMsg = '';
|
||||||
|
$redirectUrl = '';
|
||||||
|
$fileArray = JRequest::getVar('Filedata', '', 'files', 'array');
|
||||||
|
|
||||||
|
if(empty($fileArray) || (isset($fileArray['name']) && $fileArray['name'] == '')) {
|
||||||
|
$this->t['errorfile'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ADD_FILE');
|
||||||
|
$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->redirect(JRoute::_($link, false), JText::_("COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOADED"));
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$this->t['errorfile'] = JText::_('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_state_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_state','filter_state', '','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 = JString::strtolower( $search_files );
|
||||||
|
|
||||||
|
// build list of categories
|
||||||
|
$javascript = 'class="inputbox" 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 parentid' .
|
||||||
|
' 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[] = JHTML::_('select.option', 'P', JText::_( 'Published' ) );
|
||||||
|
$state_files[] = JHTML::_('select.option', 'U', JText::_( 'Unpublished') );
|
||||||
|
$lists_image['state'] = JHTML::_('select.genericlist', $state_files, 'filter_state', 'class="inputbox" size="1" onchange="document.phocadownloadfilesform.submit();"', 'value', 'text', $filter_state );*/
|
||||||
|
|
||||||
|
//$lists_files['sectionid'] = PhocaDownloadCategory::filterSection($query, $filter_sectionid_files, TRUE);
|
||||||
|
|
||||||
|
// state filter
|
||||||
|
$lists_files['state'] = JHTML::_('grid.state', $filter_state_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 = '&';
|
||||||
|
} 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->assignRef( 'formdata', $formData);
|
||||||
|
$this->assignRef( 'tmpl', $this->t);
|
||||||
|
$this->assignRef( 'params', $this->t['p']);
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$this->assignRef('session', $session);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user