diff --git a/README.MD b/README.MD index 3790fb2..24666d4 100755 --- a/README.MD +++ b/README.MD @@ -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 diff --git a/admin/config.xml b/admin/config.xml index 779db2d..8f9690e 100755 --- a/admin/config.xml +++ b/admin/config.xml @@ -550,6 +550,11 @@ + + + + +
diff --git a/admin/language/en-GB/en-GB.com_phocadownload.ini b/admin/language/en-GB/en-GB.com_phocadownload.ini index 188cd59..02456e4 100755 --- a/admin/language/en-GB/en-GB.com_phocadownload.ini +++ b/admin/language/en-GB/en-GB.com_phocadownload.ini @@ -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" diff --git a/checksum.json b/checksum.json index b1337a8..c72a325 100644 --- a/checksum.json +++ b/checksum.json @@ -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"}} \ No newline at end of file +{"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"}} \ No newline at end of file diff --git a/manifest.xml b/manifest.xml index e4da49b..fc3f004 100755 --- a/manifest.xml +++ b/manifest.xml @@ -44,12 +44,12 @@ com_phocadownload component - 5.0.5 - http://www.phoca.cz/version/index.php?phocadownload=5.0.5 + 5.0.7 + http://www.phoca.cz/version/index.php?phocadownload=5.0.7 - https://github.com/PhocaCz/PhocaDownload/releases/download/5.0.5/com_phocadownload_v5.0.5.zip + https://github.com/PhocaCz/PhocaDownload/releases/download/5.0.7/com_phocadownload_v5.0.7.zip - 7f0043b927f250b53a3c9049ffe92d1199f0ea05bfeb922949c0aae8fe98eb0c9d910152b93f03f4ba483365a258ff48e830d1ccd68ef721cebb5a684abca0eb + 54ca359984d05b34f48f3732e305db8c82f5c52ab2b3e0491ea15d78d40ee806f1356485bb196d0421862284c57dea161162368886d900ef59afb98682f87385 stable diff --git a/phocadownload-release-news.png b/phocadownload-release-news.png index 0471a02..232d003 100644 Binary files a/phocadownload-release-news.png and b/phocadownload-release-news.png differ diff --git a/phocadownload-release-news.svg b/phocadownload-release-news.svg index 219f48f..344c759 100644 --- a/phocadownload-release-news.svg +++ b/phocadownload-release-news.svg @@ -21,7 +21,7 @@ WWW.PHOCA.CZ/NEWS - Phoca Downloadversion 5.0.5 + Phoca Downloadversion 5.0.7 has been released diff --git a/phocadownload-release.png b/phocadownload-release.png index a30d365..0819979 100755 Binary files a/phocadownload-release.png and b/phocadownload-release.png differ diff --git a/phocadownload-release.svg b/phocadownload-release.svg index aa79c9a..ebb284c 100644 --- a/phocadownload-release.svg +++ b/phocadownload-release.svg @@ -132,7 +132,7 @@ x="255.99997" y="242.20009" id="tspan1992" - style="font-size:34.6667px;text-align:center;text-anchor:middle">version 5.0.5 + style="font-size:34.6667px;text-align:center;text-anchor:middle">version 5.0.7 com_phocadownload Jan Pavelka (www.phoca.cz) - 05/08/2024 + 18/08/2024 https://www.phoca.cz Jan Pavelka GNU/GPL - 5.0.5 + 5.0.7 COM_PHOCADOWNLOAD_XML_DESCRIPTION script.php PhocaDownload diff --git a/site/models/user.php b/site/models/user.php index 3906612..6d82ce8 100755 --- a/site/models/user.php +++ b/site/models/user.php @@ -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; @@ -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' ); @@ -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 @@ -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; } @@ -504,6 +521,44 @@ 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()); @@ -511,6 +566,16 @@ function _save($data, $filename, &$errSaveMsg, $fileExists = 0) { 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; diff --git a/site/router.php b/site/router.php index 7aac331..b554b03 100755 --- a/site/router.php +++ b/site/router.php @@ -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);