Skip to content

Commit

Permalink
5.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
PhocaCz committed Sep 3, 2024
1 parent 13b821f commit df77a8d
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Phoca Download is download manager for Joomla! CMS. It includes component, modul

## Version (Joomla! 5.x)

5.0.5
5.0.7



Expand Down
5 changes: 5 additions & 0 deletions admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@
<option value="0">COM_PHOCADOWNLOAD_NO</option>
</field>

<field name="frontend_run_events" type="list" default="0" label="COM_PHOCADOWNLOAD_RUN_EVENTS_FRONTEND_LABEL" description="COM_PHOCADOWNLOAD_RUN_EVENTS_FRONTEND_DESC">
<option value="0">COM_PHOCADOWNLOAD_NO</option>
<option value="1">COM_PHOCADOWNLOAD_YES</option>
</field>

</fieldset>

<fieldset name="general" label="COM_PHOCADOWNLOAD_CONFIG_HEAD_GENERAL_LABEL">
Expand Down
3 changes: 3 additions & 0 deletions admin/language/en-GB/en-GB.com_phocadownload.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
; @test utf-8 ä, ö, ü
;

;[5.0.4]
COM_PHOCADOWNLOAD_RUN_EVENTS_FRONTEND_LABEL="Run Events During Frontend Upload"
COM_PHOCADOWNLOAD_RUN_EVENTS_FRONTEND_DESC="Enable or disable event listening during frontend upload. For example, if you want to index files uploaded in the frontend in Smart search. (Befor Save or After Save events)"
;[5.0.3]
COM_PHOCADOWNLOAD_WARNING_FILE_EXISTS_IN_SYSTEM="This file is assigned to Phoca Download entry in the system. First delete the entry with this file, then you will be able to delete this file from the server."
COM_PHOCADOWNLOAD_ERROR_WHILE_DELETING_FILE="Error while deleting file"
Expand Down
2 changes: 1 addition & 1 deletion checksum.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"com_phocadownload_v5.0.0Beta.zip":{"key":"com_phocadownload_v5.0.0Beta.zip","extname":"com_phocadownload","version":"5.0.0Beta","checksum":"60224eaec714795c831ccf2145be6272561bf62cb831a5f28ce2b738d894e3d9d24c2e3805e2d769e36d50cdb21ead28572a76f80de58271a2ad31cd9915c43d"},"com_phocadownload_v4.0.7.zip":{"key":"com_phocadownload_v4.0.7.zip","extname":"com_phocadownload","version":"4.0.7","checksum":"85092b0c0de78f23abb348f1083bd6de10e46f0cecfa50aa984fd84a67a9a2255cd6fcc30467b75a3ea545d81959520a9d11d86299c5f0a306ace8821d8c8e50"},"com_phocadownload_v5.0.0Beta2.zip":{"key":"com_phocadownload_v5.0.0Beta2.zip","extname":"com_phocadownload","version":"5.0.0Beta2","checksum":"833044110c7d55ca3fb245611868ba985c5ff4eae8b06355be4aef08072f9a76a3f8ff14af5c7fdbbebcb201dd7ddb48df6b54714f805393ff2bf8b629c560cd"},"com_phocadownload_v4.0.8.zip":{"key":"com_phocadownload_v4.0.8.zip","extname":"com_phocadownload","version":"4.0.8","checksum":"64fef93f6b61078f5c0e6596c02d6f30d0164a9eb849b112663619c53953ccb424977a00bbfb80e1648370e52c39640902f462ce214c24337d1c8a1cd73f8e56"},"com_phocadownload_v5.0.0Beta3.zip":{"key":"com_phocadownload_v5.0.0Beta3.zip","extname":"com_phocadownload","version":"5.0.0Beta3","checksum":"7dc10421dac2b7d282ca7bbca8bf84f6edf8c181969658b854e921205b434bf13c7b100c6b95146107134d2c3c3c7b7699d6514c36122a403e134ce7b8bfe1d9"},"com_phocadownload_v4.0.9.zip":{"key":"com_phocadownload_v4.0.9.zip","extname":"com_phocadownload","version":"4.0.9","checksum":"505a376b9508fcde09202ef2541d3a01da2cc596de9a0464f0acf5f35fe8fa00fc3348ccfffa03f56e5ba17f9bb5c7e91661816d5a1a4fdd58403a8dce4d2d49"},"com_phocadownload_v5.0.0Beta4.zip":{"key":"com_phocadownload_v5.0.0Beta4.zip","extname":"com_phocadownload","version":"5.0.0Beta4","checksum":"47b180bd30190f062658f5db7cabe7e4d6cda9a087ae154c91a109b14c4edfd9699c9dc40265725f0f466cc014e7590625a1f36807faf395befe06e361c3daab"},"com_phocadownload_v5.0.0Beta5.zip":{"key":"com_phocadownload_v5.0.0Beta5.zip","extname":"com_phocadownload","version":"5.0.0Beta5","checksum":"f64596ead1ef5edeca9360fd30d0ad005b008d7c12b059aeeef63e0e85c98303ca37ea090137e17442a4bb426d52c554aac391396ce03607cf027c4d0bf61cd8"},"com_phocadownload_v5.0.0Beta6.zip":{"key":"com_phocadownload_v5.0.0Beta6.zip","extname":"com_phocadownload","version":"5.0.0Beta6","checksum":"613bff446c16ddb3348a087f7ca34dd9f9d6280200b5a6a839f05375d14d115d6ee7b30486bea9d0938d19d6252503cd1767e504f0f4688d24d9114b7675e3b7"},"com_phocadownload_v4.0.10Beta.zip":{"key":"com_phocadownload_v4.0.10Beta.zip","extname":"com_phocadownload","version":"4.0.10Beta","checksum":"1049b5b2b9cd00d5ac5fa9ff1d00380c2fec8abdd33100205023c0c8d05746c157b140351f5f28ca2ad2a58a585a86384335388cea94d09dc58fe9f5aeca3e19"},"com_phocadownload_v5.0.0Beta7.zip":{"key":"com_phocadownload_v5.0.0Beta7.zip","extname":"com_phocadownload","version":"5.0.0Beta7","checksum":"bb7c0a28286b520d3d6896065d64dab11a2fecdd45050b1bb50b6867614bccab08f73cf5dba6c91228b36d0c5abaa11fbe8f23cbebad3c22661e38d00553e40c"},"com_phocadownload_v5.0.0.zip":{"key":"com_phocadownload_v5.0.0.zip","extname":"com_phocadownload","version":"5.0.0","checksum":"7495f79d9bb0711aa03f1f48ad835472451b2829070a94ed0b844df924ca26573c9d8bca34e9cdc9703168ac1f0b93b8a0529f814ecc4f8eb4c1f5de67b4553d"},"com_phocadownload_v5.0.1.zip":{"key":"com_phocadownload_v5.0.1.zip","extname":"com_phocadownload","version":"5.0.1","checksum":"db3921291c66ae5a2969eda7ec5cdb31c4453953928581282614efec15b30b7f55343bbb2163d34778279264e68f31b9946fc300522ca0dec58477ff000dcc7c"},"com_phocadownload_v5.0.2.zip":{"key":"com_phocadownload_v5.0.2.zip","extname":"com_phocadownload","version":"5.0.2","checksum":"ff00e0114a1f2fa83f0f3699bb2e23bee2011d9fb38aa690f20b0d6e07bb0cf7def82e33ea6ac3038bee635befad0cf7cdf80d20d6f2a6de41e20a693869e95a"},"com_phocadownload_v5.0.3.zip":{"key":"com_phocadownload_v5.0.3.zip","extname":"com_phocadownload","version":"5.0.3","checksum":"8d9af7089d335c0caba5c3ff99f146908c893af8d91bdceb5a0f2583bb946cb222e66de89a6cc7bb35ae27adccbfadff180a3bfb7ca11841294fe13901070554"},"com_phocadownload_v5.0.4.zip":{"key":"com_phocadownload_v5.0.4.zip","extname":"com_phocadownload","version":"5.0.4","checksum":"1a1f97f53d8aa4f3d11bebd43ff407555976eee52f4ef08c9232fc00d73aac3d1356b5ae721b7d283c5956e4c102eeae0d0eb22f926d8f7491d9c8cd61cce4a0"},"com_phocadownload_v5.0.5.zip":{"key":"com_phocadownload_v5.0.5.zip","extname":"com_phocadownload","version":"5.0.5","checksum":"7f0043b927f250b53a3c9049ffe92d1199f0ea05bfeb922949c0aae8fe98eb0c9d910152b93f03f4ba483365a258ff48e830d1ccd68ef721cebb5a684abca0eb"}}
{"com_phocadownload_v5.0.0Beta.zip":{"key":"com_phocadownload_v5.0.0Beta.zip","extname":"com_phocadownload","version":"5.0.0Beta","checksum":"60224eaec714795c831ccf2145be6272561bf62cb831a5f28ce2b738d894e3d9d24c2e3805e2d769e36d50cdb21ead28572a76f80de58271a2ad31cd9915c43d"},"com_phocadownload_v4.0.7.zip":{"key":"com_phocadownload_v4.0.7.zip","extname":"com_phocadownload","version":"4.0.7","checksum":"85092b0c0de78f23abb348f1083bd6de10e46f0cecfa50aa984fd84a67a9a2255cd6fcc30467b75a3ea545d81959520a9d11d86299c5f0a306ace8821d8c8e50"},"com_phocadownload_v5.0.0Beta2.zip":{"key":"com_phocadownload_v5.0.0Beta2.zip","extname":"com_phocadownload","version":"5.0.0Beta2","checksum":"833044110c7d55ca3fb245611868ba985c5ff4eae8b06355be4aef08072f9a76a3f8ff14af5c7fdbbebcb201dd7ddb48df6b54714f805393ff2bf8b629c560cd"},"com_phocadownload_v4.0.8.zip":{"key":"com_phocadownload_v4.0.8.zip","extname":"com_phocadownload","version":"4.0.8","checksum":"64fef93f6b61078f5c0e6596c02d6f30d0164a9eb849b112663619c53953ccb424977a00bbfb80e1648370e52c39640902f462ce214c24337d1c8a1cd73f8e56"},"com_phocadownload_v5.0.0Beta3.zip":{"key":"com_phocadownload_v5.0.0Beta3.zip","extname":"com_phocadownload","version":"5.0.0Beta3","checksum":"7dc10421dac2b7d282ca7bbca8bf84f6edf8c181969658b854e921205b434bf13c7b100c6b95146107134d2c3c3c7b7699d6514c36122a403e134ce7b8bfe1d9"},"com_phocadownload_v4.0.9.zip":{"key":"com_phocadownload_v4.0.9.zip","extname":"com_phocadownload","version":"4.0.9","checksum":"505a376b9508fcde09202ef2541d3a01da2cc596de9a0464f0acf5f35fe8fa00fc3348ccfffa03f56e5ba17f9bb5c7e91661816d5a1a4fdd58403a8dce4d2d49"},"com_phocadownload_v5.0.0Beta4.zip":{"key":"com_phocadownload_v5.0.0Beta4.zip","extname":"com_phocadownload","version":"5.0.0Beta4","checksum":"47b180bd30190f062658f5db7cabe7e4d6cda9a087ae154c91a109b14c4edfd9699c9dc40265725f0f466cc014e7590625a1f36807faf395befe06e361c3daab"},"com_phocadownload_v5.0.0Beta5.zip":{"key":"com_phocadownload_v5.0.0Beta5.zip","extname":"com_phocadownload","version":"5.0.0Beta5","checksum":"f64596ead1ef5edeca9360fd30d0ad005b008d7c12b059aeeef63e0e85c98303ca37ea090137e17442a4bb426d52c554aac391396ce03607cf027c4d0bf61cd8"},"com_phocadownload_v5.0.0Beta6.zip":{"key":"com_phocadownload_v5.0.0Beta6.zip","extname":"com_phocadownload","version":"5.0.0Beta6","checksum":"613bff446c16ddb3348a087f7ca34dd9f9d6280200b5a6a839f05375d14d115d6ee7b30486bea9d0938d19d6252503cd1767e504f0f4688d24d9114b7675e3b7"},"com_phocadownload_v4.0.10Beta.zip":{"key":"com_phocadownload_v4.0.10Beta.zip","extname":"com_phocadownload","version":"4.0.10Beta","checksum":"1049b5b2b9cd00d5ac5fa9ff1d00380c2fec8abdd33100205023c0c8d05746c157b140351f5f28ca2ad2a58a585a86384335388cea94d09dc58fe9f5aeca3e19"},"com_phocadownload_v5.0.0Beta7.zip":{"key":"com_phocadownload_v5.0.0Beta7.zip","extname":"com_phocadownload","version":"5.0.0Beta7","checksum":"bb7c0a28286b520d3d6896065d64dab11a2fecdd45050b1bb50b6867614bccab08f73cf5dba6c91228b36d0c5abaa11fbe8f23cbebad3c22661e38d00553e40c"},"com_phocadownload_v5.0.0.zip":{"key":"com_phocadownload_v5.0.0.zip","extname":"com_phocadownload","version":"5.0.0","checksum":"7495f79d9bb0711aa03f1f48ad835472451b2829070a94ed0b844df924ca26573c9d8bca34e9cdc9703168ac1f0b93b8a0529f814ecc4f8eb4c1f5de67b4553d"},"com_phocadownload_v5.0.1.zip":{"key":"com_phocadownload_v5.0.1.zip","extname":"com_phocadownload","version":"5.0.1","checksum":"db3921291c66ae5a2969eda7ec5cdb31c4453953928581282614efec15b30b7f55343bbb2163d34778279264e68f31b9946fc300522ca0dec58477ff000dcc7c"},"com_phocadownload_v5.0.2.zip":{"key":"com_phocadownload_v5.0.2.zip","extname":"com_phocadownload","version":"5.0.2","checksum":"ff00e0114a1f2fa83f0f3699bb2e23bee2011d9fb38aa690f20b0d6e07bb0cf7def82e33ea6ac3038bee635befad0cf7cdf80d20d6f2a6de41e20a693869e95a"},"com_phocadownload_v5.0.3.zip":{"key":"com_phocadownload_v5.0.3.zip","extname":"com_phocadownload","version":"5.0.3","checksum":"8d9af7089d335c0caba5c3ff99f146908c893af8d91bdceb5a0f2583bb946cb222e66de89a6cc7bb35ae27adccbfadff180a3bfb7ca11841294fe13901070554"},"com_phocadownload_v5.0.4.zip":{"key":"com_phocadownload_v5.0.4.zip","extname":"com_phocadownload","version":"5.0.4","checksum":"1a1f97f53d8aa4f3d11bebd43ff407555976eee52f4ef08c9232fc00d73aac3d1356b5ae721b7d283c5956e4c102eeae0d0eb22f926d8f7491d9c8cd61cce4a0"},"com_phocadownload_v5.0.5.zip":{"key":"com_phocadownload_v5.0.5.zip","extname":"com_phocadownload","version":"5.0.5","checksum":"7f0043b927f250b53a3c9049ffe92d1199f0ea05bfeb922949c0aae8fe98eb0c9d910152b93f03f4ba483365a258ff48e830d1ccd68ef721cebb5a684abca0eb"},"com_phocadownload_v5.0.6.zip":{"key":"com_phocadownload_v5.0.6.zip","extname":"com_phocadownload","version":"5.0.6","checksum":"f0b9d724528d10afe78a87da262783e7f6db96c5a52efb6795281d05890db23542c8160d47d6454e9de0efe5c2fb0f5222e2e4dca02f09b772d54076e87d6aa2"},"com_phocadownload_v5.0.7.zip":{"key":"com_phocadownload_v5.0.7.zip","extname":"com_phocadownload","version":"5.0.7","checksum":"54ca359984d05b34f48f3732e305db8c82f5c52ab2b3e0491ea15d78d40ee806f1356485bb196d0421862284c57dea161162368886d900ef59afb98682f87385"}}
8 changes: 4 additions & 4 deletions manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<description><![CDATA[ Phoca Download is download manager for Joomla! CMS. It includes component, modules and plugins and allows displaying files on website which can be downloaded (previewed, played) by website visitors. ]]></description>
<element>com_phocadownload</element>
<type>component</type>
<version>5.0.5</version>
<infourl title="Phoca Download 5.0.5">http://www.phoca.cz/version/index.php?phocadownload=5.0.5</infourl>
<version>5.0.7</version>
<infourl title="Phoca Download 5.0.7">http://www.phoca.cz/version/index.php?phocadownload=5.0.7</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/PhocaCz/PhocaDownload/releases/download/5.0.5/com_phocadownload_v5.0.5.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/PhocaCz/PhocaDownload/releases/download/5.0.7/com_phocadownload_v5.0.7.zip</downloadurl>
</downloads>
<sha512>7f0043b927f250b53a3c9049ffe92d1199f0ea05bfeb922949c0aae8fe98eb0c9d910152b93f03f4ba483365a258ff48e830d1ccd68ef721cebb5a684abca0eb</sha512>
<sha512>54ca359984d05b34f48f3732e305db8c82f5c52ab2b3e0491ea15d78d40ee806f1356485bb196d0421862284c57dea161162368886d900ef59afb98682f87385</sha512>
<tags>
<tag>stable</tag>
</tags>
Expand Down
Binary file modified phocadownload-release-news.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion phocadownload-release-news.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified phocadownload-release.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion phocadownload-release.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions phocadownload.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension type="component" method="upgrade" version="5.0">
<name>com_phocadownload</name>
<author>Jan Pavelka (www.phoca.cz)</author>
<creationDate>05/08/2024</creationDate>
<creationDate>18/08/2024</creationDate>
<authorEmail></authorEmail>
<authorUrl>https://www.phoca.cz</authorUrl>
<copyright>Jan Pavelka</copyright>
<license>GNU/GPL</license>
<version>5.0.5</version>
<version>5.0.7</version>
<description>COM_PHOCADOWNLOAD_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>
<projectName>PhocaDownload</projectName>
Expand Down
65 changes: 65 additions & 0 deletions site/models/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/

defined('_JEXEC') or die();

use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Client\ClientHelper;
use Joomla\CMS\Component\ComponentHelper;
Expand All @@ -31,10 +34,20 @@ class PhocaDownloadModelUser extends BaseDatabaseModel
var $_pagination_files = null;
var $_context_files = 'com_phocadownload.phocadownloaduserfiles';

protected $event_before_save = null;
protected $event_after_save = null;


function __construct() {
parent::__construct();

//if (isset($config['event_before_save'])) {
// $this->event_before_save = $config['event_before_save'];
//} elseif (empty($this->event_before_save)) {
$this->event_before_save = 'onContentBeforeSave';
//}
$this->event_after_save = 'onContentAfterSave';

$app = Factory::getApplication();
// SubCategory
$limit_files = $app->getUserStateFromRequest( $this->_context_files.'.list.limit', 'limit', 20, 'int' );
Expand Down Expand Up @@ -415,9 +428,11 @@ function singleFileUpload(&$errUploadMsg, $file, $post) {
function _save($data, $filename, &$errSaveMsg, $fileExists = 0) {

$user = Factory::getUser();
$app = Factory::getApplication();

$paramsC = ComponentHelper::getParams('com_phocadownload') ;
$default_access = $paramsC->get( 'default_access', 1 );
$frontend_run_events = $paramsC->get( 'frontend_run_events', 0 );
$fileId = false;
if ($fileExists == 1) {
// We not only owerwrite the file but we must update it
Expand All @@ -441,8 +456,10 @@ function _save($data, $filename, &$errSaveMsg, $fileExists = 0) {

$row = $this->getTable('phocadownload');

$isNew = true;
if (isset($fileId->id) && (int)$fileId->id > 0) {
$data['id'] = (int)$fileId->id;
$isNew = false;
}


Expand Down Expand Up @@ -504,13 +521,61 @@ function _save($data, $filename, &$errSaveMsg, $fileExists = 0) {
return false;
}

/*
PluginHelper::importPlugin($this->events_map['save']);
$result = $app->triggerEvent($this->event_before_save, array($this->option.'.'.$this->name, $row, $isNew, $data));
if (\in_array(false, $result, true)) {
$this->setError($row->getError());
return false;
}
// Store the data.
/*if (!$table->store()) {
throw new Exception($table->getError(), 500);
return false;
}*/

// Trigger the before save event.
if ($frontend_run_events == 1) {
PluginHelper::importPlugin('content');
$context = $this->option . '.' . 'file';// com_phocadownload.file
$table = $row;
$dispatcher = $this->getDispatcher();

// Before Save
$beforeSaveEvent = new Joomla\CMS\Event\Model\BeforeSaveEvent($this->event_before_save, [
'context' => $context,
'subject' => $table,
'isNew' => $isNew,
'data' => $data,
]);
$result = $dispatcher->dispatch($this->event_before_save, $beforeSaveEvent)->getArgument('result', []);
//$result = $app->triggerEvent($this->event_before_save, array($context, $row, $isNew, $data));


/*if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}*/
}

// Store the Phoca gallery table to the database
if (!$row->store()) {
//throw new Exception($this->_db->getError());
$this->setError($row->getError());
return false;
}

if ($frontend_run_events == 1) {
// After Save
$afterSaveEvent = new Joomla\CMS\Event\Model\AfterSaveEvent($this->event_after_save, [
'context' => $context,
'subject' => $table,
'isNew' => $isNew,
'data' => $data,
]);
$result = $dispatcher->dispatch($this->event_after_save, $afterSaveEvent)->getArgument('result', []);
}
PhocaDownloadLog::log($row->id, 2);

return true;
Expand Down
10 changes: 9 additions & 1 deletion site/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ public function __construct($app = null, $menu = null) {
//$play->setKey('id')->setParent($category, 'catid');//->setNestable();
//$this->registerView($play);

$views = array('play', 'download', 'user');
$views = array('play', 'user');
foreach ($views as $k => $v) {
$item = new RouterViewConfiguration($v);
$item->setName($v)->setParent($file, 'id')->setParent($category, 'catid');
$this->registerView($item);
}

$views = array('download');
foreach ($views as $k => $v) {
$item = new RouterViewConfiguration($v);
//$item->setName($v)->setParent($file, 'id')->setParent($category, 'catid');
$item->setName($v)->setParent($file, 'id')->setParent($categories, 'parent_id');
$this->registerView($item);
}

$feed = new RouterViewConfiguration('feed');
$feed->setName('feed')->setKey('id')->setParent($categories, 'parent_id');
$this->registerView($feed);
Expand Down

0 comments on commit df77a8d

Please sign in to comment.