Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
astridx committed Jan 24, 2022
1 parent da9b602 commit b5cfc44
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 108 deletions.
18 changes: 18 additions & 0 deletions aggpxtrack-update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,22 @@
<maintainerurl>https://astrid-guenther.de</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>pkg_aggpxtrack</name>
<description>pkg_aggpxtrack</description>
<element>pkg_aggpxtrack</element>
<type>package</type>
<client>site</client>
<version>3.0.2</version>
<infourl title="aggpxtrack">https://github.com/astridx/pkg_aggpxtrack/blob/v3.0.2/README.md</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/astridx/pkg_aggpxtrack/releases/download/v3.0.2/pkg-aggpxtrack-3.0.2.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Astrid Günther</maintainer>
<maintainerurl>https://astrid-guenther.de</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
</updates>
20 changes: 20 additions & 0 deletions aggpxtrack-update4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,24 @@
<sha256></sha256>
<sha384></sha384>
</update>
<update>
<name>pkg_aggpxtrack</name>
<description>pkg_aggpxtrack</description>
<element>pkg_aggpxtrack</element>
<type>package</type>
<client>site</client>
<version>4.0.3</version>
<infourl title="aggpxtrack">https://github.com/astridx/pkg_aggpxtrack/blob/v4.0.3/README.md</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/astridx/pkg_aggpxtrack/releases/download/v4.0.3/pkg-aggpxtrack-4.0.3.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Astrid Günther</maintainer>
<maintainerurl>https://astrid-guenther.de</maintainerurl>
<targetplatform name="joomla" version="4.*"/>
<sha256></sha256>
<sha384></sha384>
</update>
</updates>
18 changes: 18 additions & 0 deletions changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<changelogs>
<changelog>
<element>pkg_aggpxtrack</element>
<type>package</type>
<version>4.0.0</version>
<note>
<item>Initial Version</item>
</note>
</changelog>
<changelog>
<element>pkg_aggpxtrack</element>
<type>package</type>
<version>4.0.3</version>
<note>
<item>Add Geoportal France and delete Openstreetmap black and white map provider</item>
</note>
</changelog>
</changelogs>
2 changes: 1 addition & 1 deletion dist/current
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
define('COM_MEDIA_BASE', JPATH_ROOT . '/' . $params->get($path, 'images'));
define('COM_MEDIA_BASEURL', JUri::root() . $params->get($path, 'images'));

$controller = JControllerLegacy::getInstance('Aggpxtrack', array('base_path' => JPATH_COMPONENT_ADMINISTRATOR));
$controller = JControllerLegacy::getInstance('Aggpxtrack', ['base_path' => JPATH_COMPONENT_ADMINISTRATOR]);
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.5" type="component" method="upgrade">
<name>com_aggpxtrack</name>
<author>Astrid Günther</author>
<creationDate>2021-05-18</creationDate>
<copyright>(C) 2021 Astrid Günther. All rights reserved.</copyright>
<creationDate>2022-01-24</creationDate>
<copyright>(C) 2022 Astrid Günther. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>info@astrid-guenther.de</authorEmail>
<authorUrl>www.astrid-guenther.de</authorUrl>
<version>3.0.1</version>
<version>3.0.2</version>
<description>COM_AGGPXTRACK_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AggpxtrackController extends JControllerLegacy
*
* @since 1.5
*/
public function display($cacheable = false, $urlparams = array())
public function display($cacheable = false, $urlparams = [])
{
return parent::display();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,19 @@ public function upload()
$this->folder = $this->input->get('folder', '', 'path');

// Don't redirect to an external URL.
if (!JUri::isInternal($return))
{
if (!JUri::isInternal($return)) {
$return = '';
}

// Set the redirect
if ($return)
{
if ($return) {
$this->setRedirect($return . '&folder=' . $this->folder);
}
else
{
} else {
$this->setRedirect('index.php?option=com_aggpxtrack&folder=' . $this->folder);
}

// Authorize the user
if (!$this->authoriseUser('create'))
{
if (!$this->authoriseUser('create')) {
return false;
}

Expand All @@ -81,8 +76,7 @@ public function upload()

// Check for the total size of post back data.
if (($postMaxSize > 0 && $contentLength > $postMaxSize)
|| ($memoryLimit != -1 && $contentLength > $memoryLimit))
{
|| ($memoryLimit != -1 && $contentLength > $memoryLimit)) {
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_WARNUPLOADTOOLARGE'), 'warning');

return false;
Expand All @@ -92,32 +86,28 @@ public function upload()
$uploadMaxFileSize = $mediaHelper->toBytes(ini_get('upload_max_filesize'));

// Perform basic checks on file info before attempting anything
foreach ($files as &$file)
{
foreach ($files as &$file) {
$file['name'] = JFile::makeSafe($file['name']);
$file['name'] = str_replace(' ', '-', $file['name']);
$file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $this->folder, $file['name'])));
$file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, [COM_MEDIA_BASE, $this->folder, $file['name']]));

if (($file['error'] == 1)
|| ($uploadMaxSize > 0 && $file['size'] > $uploadMaxSize)
|| ($uploadMaxFileSize > 0 && $file['size'] > $uploadMaxFileSize))
{
|| ($uploadMaxFileSize > 0 && $file['size'] > $uploadMaxFileSize)) {
// File size exceed either 'upload_max_filesize' or 'upload_maxsize'.
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_WARNFILETOOLARGE'), 'warning');

return false;
}

if (JFile::exists($file['filepath']))
{
if (JFile::exists($file['filepath'])) {
// A file with this name already exists
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_FILE_EXISTS'), 'warning');

return false;
}

if (!isset($file['name']))
{
if (!isset($file['name'])) {
// No filename (after the name was cleaned by JFile::makeSafe)
$this->setRedirect('index.php', JText::_('COM_AGGPXTRACK_INVALID_REQUEST'), 'error');

Expand All @@ -130,24 +120,21 @@ public function upload()
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();

foreach ($files as &$file)
{
foreach ($files as &$file) {
// The request is valid
$ext = 'com_media';

if (!$mediaHelper->canUpload($file, $ext))
{
if (!$mediaHelper->canUpload($file, $ext)) {
// The file can't be uploaded

return false;
}

// Trigger the onContentBeforeSave event.
$object_file = new JObject($file);
$result = $dispatcher->trigger('onContentBeforeSave', array('com_aggpxtrack.file', &$object_file, true));
$result = $dispatcher->trigger('onContentBeforeSave', ['com_aggpxtrack.file', &$object_file, true]);

if (in_array(false, $result, true))
{
if (in_array(false, $result, true)) {
// There are some errors in the plugins
$app->enqueueMessage(
JText::plural('COM_AGGPXTRACK_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors)),
Expand All @@ -157,16 +144,15 @@ public function upload()
return false;
}

if (!JFile::upload($object_file->tmp_name, $object_file->filepath))
{
if (!JFile::upload($object_file->tmp_name, $object_file->filepath)) {
// Error in upload
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_UNABLE_TO_UPLOAD_FILE'), 'warning');

return false;
}

// Trigger the onContentAfterSave event.
$dispatcher->trigger('onContentAfterSave', array('com_aggpxtrack.file', &$object_file, true));
$dispatcher->trigger('onContentAfterSave', ['com_aggpxtrack.file', &$object_file, true]);
$this->setMessage(JText::sprintf('COM_AGGPXTRACK_UPLOAD_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}

Expand All @@ -184,8 +170,7 @@ public function upload()
*/
protected function authoriseUser($action)
{
if (!JFactory::getUser()->authorise('core.' . strtolower($action), 'com_aggpxtrack'))
{
if (!JFactory::getUser()->authorise('core.' . strtolower($action), 'com_aggpxtrack')) {
// User is not authorised
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_' . strtoupper($action) . '_NOT_PERMITTED'), 'warning');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public function getState($property = null, $default = null)
{
static $set;

if (!$set)
{
if (!$set) {
$input = JFactory::getApplication()->input;
$folder = $input->get('folder', '', 'path');
$this->setState('folder', $folder);
Expand Down Expand Up @@ -89,8 +88,7 @@ public function getList()
static $list;

// Only process the list once per request
if (is_array($list))
{
if (is_array($list)) {
return $list;
}

Expand All @@ -100,26 +98,22 @@ public function getList()
$basePath = COM_MEDIA_BASE . ((strlen($current) > 0) ? '/' . $current : '');
$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE . '/');

$images = array ();
$folders = array ();
$images = [];
$folders = [];

$fileList = false;
$folderList = false;

if (file_exists($basePath))
{
if (file_exists($basePath)) {
// Get the list of files and folders from the given folder
$fileList = array_reverse(JFolder::files($basePath));
$folderList = JFolder::folders($basePath);
}

// Iterate over the files if they exist
if ($fileList !== false)
{
foreach ($fileList as $file)
{
if (is_file($basePath . '/' . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html')
{
if ($fileList !== false) {
foreach ($fileList as $file) {
if (is_file($basePath . '/' . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
$tmp = new JObject;
$tmp->name = $file;
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $file));
Expand All @@ -129,19 +123,16 @@ public function getList()

$file_extension = strtolower(JFile::getExt($file));

if ($file_extension == 'gpx')
{
if ($file_extension == 'gpx') {
$images[] = $tmp;
}
}
}
}

// Iterate over the folders if they exist
if ($folderList !== false)
{
foreach ($folderList as $folder)
{
if ($folderList !== false) {
foreach ($folderList as $folder) {
$tmp = new JObject;
$tmp->name = basename($folder);
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $folder));
Expand All @@ -156,16 +147,15 @@ public function getList()
}

// Sortiert nach Datum
$date = array();
$date = [];

foreach ($images as $key => $row)
{
foreach ($images as $key => $row) {
$date[$key] = $row->date;
}

array_multisort($date, SORT_DESC, $images);

$list = array('folders' => $folders, 'images' => $images);
$list = ['folders' => $folders, 'images' => $images];

return $list;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ public function copyFiles()
// Now we read all png files and put them in an array.
$gpx_files = JFolder::files($pathsearch, '.gpx');

foreach ($gpx_files as $file)
{
if (!file_exists($path . $file))
{
foreach ($gpx_files as $file) {
if (!file_exists($path . $file)) {
JFile::copy($pathsearch . $file, $path . $file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ public function display($tpl = null)
{
$url = JUri::base() . $url;
header('Location: ' . $url . 'index.php?option=com_config');

}
}
Loading

0 comments on commit b5cfc44

Please sign in to comment.