Skip to content

Commit

Permalink
3.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
PhocaCz committed Mar 6, 2015
1 parent 3ef7913 commit e80d096
Show file tree
Hide file tree
Showing 648 changed files with 32,382 additions and 0 deletions.
12 changes: 12 additions & 0 deletions access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_phocadownload">
<section name="component">
<action name="core.admin" title="JAction_Admin" description="JAction_Admin_Component_Desc" />
<action name="core.manage" title="JAction_Manage" description="JAction_Manage_Component_Desc" />
<action name="core.create" title="JAction_Create" description="JAction_Create_Component_Desc" />
<action name="core.delete" title="JAction_Delete" description="JAction_Delete_Component_Desc" />
<action name="core.edit" title="JAction_Edit" description="JAction_Edit_Component_Desc" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JAction_EditState_Component_Desc" />
</section>

</access>
534 changes: 534 additions & 0 deletions config.xml

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?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.controller');
$app = JFactory::getApplication();
$option = $app->input->get('option');

$l['cp'] = array('COM_PHOCADOWNLOAD_CONTROL_PANEL', '');
$l['f'] = array('COM_PHOCADOWNLOAD_FILES', 'phocadownloadfiles');
$l['c'] = array('COM_PHOCADOWNLOAD_CATEGORIES', 'phocadownloadcats');
$l['l'] = array('COM_PHOCADOWNLOAD_LICENSES', 'phocadownloadlics');
$l['st'] = array('COM_PHOCADOWNLOAD_STATISTICS', 'phocadownloadstat');
$l['d'] = array('COM_PHOCADOWNLOAD_DOWNLOADS', 'phocadownloaddownloads');
$l['u'] = array('COM_PHOCADOWNLOAD_UPLOADS', 'phocadownloaduploads');
$l['fr'] = array('COM_PHOCADOWNLOAD_FILE_RATING', 'phocadownloadrafile');
$l['t'] = array('COM_PHOCADOWNLOAD_TAGS', 'phocadownloadtags');
$l['ly'] = array('COM_PHOCADOWNLOAD_LAYOUT', 'phocadownloadlayouts');
$l['sty'] = array('COM_PHOCADOWNLOAD_STYLES', 'phocadownloadstyles');
$l['log'] = array('COM_PHOCADOWNLOAD_LOGGING', 'phocadownloadlogs');
$l['in'] = array('COM_PHOCADOWNLOAD_INFO', 'phocadownloadinfo');

// Submenu view
//$view = JRequest::getVar( 'view', '', '', 'string', JREQUEST_ALLOWRAW );
//$layout = JRequest::getVar( 'layout', '', '', 'string', JREQUEST_ALLOWRAW );
$view = JFactory::getApplication()->input->get('view');
$layout = JFactory::getApplication()->input->get('layout');

if ($layout == 'edit') {
} else {
foreach ($l as $k => $v) {

if ($v[1] == '') {
$link = 'index.php?option='.$option;
} else {
$link = 'index.php?option='.$option.'&view=';
}

if ($view == $v[1]) {
JHtmlSidebar::addEntry(JText::_($v[0]), $link.$v[1], true );
} else {
JHtmlSidebar::addEntry(JText::_($v[0]), $link.$v[1]);
}
}
}

class PhocadownloadCpController extends JControllerLegacy {
function display($cachable = false, $urlparams = array()) {
parent::display($cachable , $urlparams);
}
}
?>
1 change: 1 addition & 0 deletions controllers/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
56 changes: 56 additions & 0 deletions controllers/phocadownloadcat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?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.controllerform');

class PhocaDownloadCpControllerPhocaDownloadcat extends JControllerForm
{
protected $option = 'com_phocadownload';

function __construct($config=array()) {
parent::__construct($config);
}

protected function allowAdd($data = array()) {
$user = JFactory::getUser();
$allow = null;
$allow = $user->authorise('core.create', 'com_phocadownload');
if ($allow === null) {
return parent::allowAdd($data);
} else {
return $allow;
}
}

protected function allowEdit($data = array(), $key = 'id') {
$user = JFactory::getUser();
$allow = null;
$allow = $user->authorise('core.edit', 'com_phocadownload');
if ($allow === null) {
return parent::allowEdit($data, $key);
} else {
return $allow;
}
}

public function batch($model = null) {
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Set the model
$model = $this->getModel('phocadownloadcat', '', array());

// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_phocadownload&view=phocadownloadcats'.$this->getRedirectToListAppend(), false));

return parent::batch($model);
}
}
?>
42 changes: 42 additions & 0 deletions controllers/phocadownloadcats.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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.controlleradmin');

class PhocaDownloadCpControllerPhocaDownloadcats extends JControllerAdmin
{
protected $option = 'com_phocadownload';

public function __construct($config = array())
{
parent::__construct($config);


}

public function &getModel($name = 'PhocaDownloadcat', $prefix = 'PhocaDownloadCpModel')
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}

public function saveOrderAjax() {
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
$order = $this->input->post->get('order', array(), 'array');
JArrayHelper::toInteger($pks);
JArrayHelper::toInteger($order);
$model = $this->getModel();
$return = $model->saveorder($pks, $order);
if ($return) { echo "1";}
JFactory::getApplication()->close();
}

}
?>
46 changes: 46 additions & 0 deletions controllers/phocadownloaddownloads.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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.controllerform');

class PhocaDownloadCpControllerPhocaDownloadDownloads extends JControllerForm
{
protected $option = 'com_phocadownload';

public function &getModel($name = 'PhocaDownloadDownloads', $prefix = 'PhocaDownloadCpModel')
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}

function cancel($key = NULL) {
$model = $this->getModel( 'phocadownload' );
$this->setRedirect( 'index.php?option=com_phocadownload&view=phocadownloaddownloads' );
}

function reset() {

$post = JRequest::get('post');
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$idFile = JRequest::getVar( 'idfile', 0, 'post', 'int' );

$model = $this->getModel( 'phocadownloaddownloads' );

if ($model->reset($cid)) {
$msg = JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_RESET_USER_STAT' );
} else {
$msg = JText::_( 'COM_PHOCADOWNLOAD_ERROR_RESET_USER_STAT' );
}

$link = 'index.php?option=com_phocadownload&view=phocadownloaddownloads&id='.(int)$idFile;
$this->setRedirect($link, $msg);
}
}
?>
79 changes: 79 additions & 0 deletions controllers/phocadownloadfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?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.controllerform');

class PhocaDownloadCpControllerPhocaDownloadFile extends JControllerForm
{
protected $option = 'com_phocadownload';

function __construct($config=array()) {

parent::__construct($config);

$task = JRequest::getVar('task');
if ((string)$task == 'addtext') {
JRequest::setVar('task','add');
JRequest::setVar('layout','edit_text');
}
}

protected function allowAdd($data = array()) {
$user = JFactory::getUser();
$allow = null;
$allow = $user->authorise('core.create', 'com_phocadownload');
if ($allow === null) {
return parent::allowAdd($data);
} else {
return $allow;
}
}

protected function allowEdit($data = array(), $key = 'id') {
$user = JFactory::getUser();
$allow = null;
$allow = $user->authorise('core.edit', 'com_phocadownload');
if ($allow === null) {
return parent::allowEdit($data, $key);
} else {
return $allow;
}
}

public function batch($model = null) {
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Set the model
$model = $this->getModel('phocadownloadfile', '', array());

// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_phocadownload&view=phocadownloadfiles'.$this->getRedirectToListAppend(), false));

return parent::batch($model);
}

/*
function copyquick() {
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$model = $this->getModel( 'phocadownloadfile' );
if ($model->copyQuick($cid)) {
$msg = JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_COPY_FILE' );
} else {
$msg = JText::_( 'COM_PHOCADOWNLOAD_ERROR_COPY_FILE' );
}
$link = 'index.php?option=com_phocadownload&view=phocadownloadfiles';
$this->setRedirect($link, $msg);
}*/

}
?>
81 changes: 81 additions & 0 deletions controllers/phocadownloadfiles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?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.controlleradmin');

class PhocaDownloadCpControllerPhocaDownloadFiles extends JControllerAdmin
{
protected $option = 'com_phocadownload';

public function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('disapprove', 'approve');

}

public function &getModel($name = 'PhocaDownloadFile', $prefix = 'PhocaDownloadCpModel')
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}


function approve()
{
// Check for request forgeries
JRequest::checkToken() or die(JText::_('JINVALID_TOKEN'));

// Get items to publish from the request.
$cid = JRequest::getVar('cid', array(), '', 'array');
$data = array('approve' => 1, 'disapprove' => 0);
$task = $this->getTask();
$value = JArrayHelper::getValue($data, $task, 0, 'int');

if (empty($cid)) {
JError::raiseWarning(500, JText::_($this->text_prefix.'_NO_ITEM_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();

// Make sure the item ids are integers
JArrayHelper::toInteger($cid);

// Publish the items.

if (!$model->approve($cid, $value)) {
JError::raiseWarning(500, $model->getError());
} else {
if ($value == 1) {
$ntext = $this->text_prefix.'_N_ITEMS_APPROVED';
} else if ($value == 0) {
$ntext = $this->text_prefix.'_N_ITEMS_DISAPPROVED';
}
$this->setMessage(JText::plural($ntext, count($cid)));
}
}

$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
}

public function saveOrderAjax() {
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
$order = $this->input->post->get('order', array(), 'array');
JArrayHelper::toInteger($pks);
JArrayHelper::toInteger($order);
$model = $this->getModel();
$return = $model->saveorder($pks, $order);
if ($return) { echo "1";}
JFactory::getApplication()->close();
}

}
?>
Loading

0 comments on commit e80d096

Please sign in to comment.