Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
diddipoeler committed Nov 1, 2023
1 parent d589aa3 commit 0d889cc
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 131 deletions.
2 changes: 1 addition & 1 deletion admin/libraries/sportsmanagement/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ protected function addToolbar()
$cfg_help_server = ComponentHelper::getParams($this->option)->get('cfg_help_server', '');
$layout = $this->jinput->get('layout');
$view = ucfirst(strtolower($this->view));
$layout = ucfirst(strtolower($layout ?? '')); //remove strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
$layout = ucfirst(strtolower($layout)); //remove strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

if ($canDo->get('core.admin'))
{
Expand Down
109 changes: 40 additions & 69 deletions admin/models/githubinstall.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
*
* SportsManagement ein Programm zur Verwaltung für alle Sportarten
*
* @version 1.0.05
* @package Sportsmanagement
* @subpackage models
Expand All @@ -14,7 +12,6 @@

defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Http\HttpFactory;

use Joomla\CMS\Language\Text;
use Joomla\Archive\Archive;
use Joomla\CMS\Filesystem\Folder;
Expand All @@ -24,7 +21,7 @@
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerHelper;

if (version_compare(JSM_JVERSION, '3', 'eq'))
if (version_compare(JVERSION, '3.0.0', 'ge'))
{
jimport('joomla.filesystem.archive');
}
Expand Down Expand Up @@ -80,12 +77,31 @@ function CopyGithubLink($link)

$my_text = '';

if (version_compare(JSM_JVERSION, '3', 'eq'))
if (version_compare(JVERSION, '4.0.0', 'ge'))
{
/** Download the package at the URL given. */
$p_file = InstallerHelper::downloadPackage($link);
/** Was the package downloaded? */
if (!$p_file)
{
$my_text = '<span style="color:' . $this->storeFailedColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte nicht kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'), 'error');

return false;
}
else
{
$my_text = '<span style="color:' . $this->storeSuccessColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
}

}
elseif (version_compare(JVERSION, '3.0.0', 'ge'))
{
/**
*
* Get the handler to download the package
*/
/** Get the handler to download the package */
try
{
$http = HttpFactory::getHttp(null, array('curl', 'stream'));
Expand All @@ -97,10 +113,7 @@ function CopyGithubLink($link)
return false;
}

/**
*
* Download the package
*/
/** Download the package */
try
{
$result = $http->get($link);
Expand All @@ -124,10 +137,7 @@ function CopyGithubLink($link)

try
{
/**
*
* Write the file to disk
*/
/** Write the file to disk */
File::write($filepath, $result->body);
}
catch (RuntimeException $e)
Expand All @@ -138,102 +148,63 @@ function CopyGithubLink($link)
return false;
}
}
elseif (version_compare(JSM_JVERSION, '4', 'eq'))
{
/**
*
* Download the package at the URL given.
*/
$p_file = InstallerHelper::downloadPackage($link);
/**
*
* Was the package downloaded?
*/
if (!$p_file)
{
$my_text = '<span style="color:' . $this->storeFailedColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte nicht kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'), 'error');

return false;
}
else
{
$my_text = '<span style="color:' . $this->storeSuccessColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
}
}

$this->_success_text['Komponente:'] = $my_text;

$extractdir = JPATH_SITE . DIRECTORY_SEPARATOR . 'tmp';

// $dest = JPATH_SITE.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.$file['name'];

if (version_compare(JSM_JVERSION, '3', 'eq'))
if (version_compare(JVERSION, '4.0.0', 'ge'))
{
$dest = JPATH_SITE . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $file['name'];
$dest = JPATH_SITE . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'sportsmanagement-' . $file['name'];
$archive = new Archive;

try
{
$result = JArchive::extract($dest, $extractdir);
$result = $archive->extract($dest, $extractdir);
}
catch (Exception $e)
{
$this->jsmapp->enqueueMessage(__METHOD__ . ' ' . __LINE__ . Text::_($e->getMessage()), 'Error');
$result = false;
}

}
elseif (version_compare(JSM_JVERSION, '4', 'eq'))
elseif (version_compare(JVERSION, '3.0.0', 'ge'))
{
$dest = JPATH_SITE . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'sportsmanagement-' . $file['name'];
$archive = new Archive;
$dest = JPATH_SITE . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $file['name'];

try
{
$result = $archive->extract($dest, $extractdir);
$result = JArchive::extract($dest, $extractdir);
}
catch (Exception $e)
{
$this->jsmapp->enqueueMessage(__METHOD__ . ' ' . __LINE__ . Text::_($e->getMessage()), 'Error');
$result = false;
}

}

/**
*
* Get an installer instance
*/

/** Get an installer instance */
$installer = Installer::getInstance();

/**
*
* Get the path to the package to install
*/

/** Get the path to the package to install */
$p_dir = JPATH_SITE . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'sportsmanagement-' . str_replace(".zip", "", $file['name']) . DIRECTORY_SEPARATOR;

// $p_dir_modules = JPATH_SITE.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'sportsmanagement-master'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR;
$p_dir_modules = JPATH_SITE . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR;

/**
*
* Detect the package type
*/
/** Detect the package type */
$type = InstallerHelper::detectType($p_dir);

$package['packagefile'] = null;
$package['extractdir'] = null;
$package['dir'] = $p_dir;
$package['type'] = $type;

/**
*
* Install the package
*/
/** Install the package */

if (!$installer->install($package['dir']))
{
Expand Down
25 changes: 13 additions & 12 deletions admin/models/jlextcountry.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
*
* SportsManagement ein Programm zur Verwaltung für Sportarten
*
* @version 1.0.05
* @package Sportsmanagement
* @subpackage models
Expand All @@ -11,17 +9,15 @@
* @copyright Copyright: © 2013-2023 Fussball in Europa http://fussballineuropa.de/ All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\Archive\Archive;

jimport('joomla.filesystem.folder');
if (version_compare(JSM_JVERSION, '3', 'eq'))
if (version_compare(JVERSION, '3.0.0', 'ge'))
{
jimport('joomla.filesystem.archive');
}
Expand Down Expand Up @@ -74,31 +70,36 @@ function importplz()
{
$app->enqueueMessage(Text::_('COM_SPORTSMANAGEMENT_ADMIN_COUNTRY_COPY_PLZ_SUCCESS'), 'Notice');

if (version_compare(JSM_JVERSION, '3', 'eq'))
if (version_compare(JVERSION, '4.0.0', 'ge'))
{
$archive = new Archive;

try
{
$result = JArchive::extract($filepath, $base_Dir);
$result = $archive->extract($filepath, $base_Dir);
}
catch (Exception $e)
{
$this->jsmapp->enqueueMessage(__METHOD__ . ' ' . __LINE__ . Text::_($e->getMessage()), 'Error');
$result = false;
}


}
elseif (version_compare(JSM_JVERSION, '4', 'eq'))
elseif (version_compare(JVERSION, '3.0.0', 'ge'))
{
$archive = new Archive;

try
try
{
$result = $archive->extract($filepath, $base_Dir);
$result = JArchive::extract($filepath, $base_Dir);
}
catch (Exception $e)
{
$this->jsmapp->enqueueMessage(__METHOD__ . ' ' . __LINE__ . Text::_($e->getMessage()), 'Error');
$result = false;
}



}

if ($result)
Expand Down
2 changes: 1 addition & 1 deletion admin/models/joomleagueimports.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ function importjoomleaguenew($importstep = 0, $sports_type_id = 0)
* zuerst noch überprüfen, ob der user
* überhaupt den zugriff auf die datenbank hat.
*/
if (version_compare(JSM_JVERSION, '4', 'eq'))
if (version_compare(JVERSION, '4.0.0', 'ge'))
{
//$jl_access = JDatabaseDriver::getInstance($option);
$db = JDatabaseDriver::getInstance($option);
Expand Down
69 changes: 36 additions & 33 deletions admin/models/jsmgcalendars.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
include_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . JSM_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'sportsmanagement.php';
}

// If( version_compare(JSM_JVERSION,'3','eq') )
// {
// jimport('joomla.filesystem.archive');
// }

Table::addIncludePath(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . JSM_PATH . DIRECTORY_SEPARATOR . 'tables');

/**
Expand Down Expand Up @@ -81,9 +76,42 @@ function check_google_api()
$filename = $file['name'];
$filepath = $base_Dir . $filename;

if (version_compare(JSM_JVERSION, '3', 'eq'))
if (version_compare(JVERSION, '4.0.0', 'ge'))
{



/**
*
* Download the package at the URL given.
*/
$p_file = InstallerHelper::downloadPackage($link);
/**
*
* Was the package downloaded?
*/
if (!$p_file)
{
$my_text = '<span style="color:' . $this->storeFailedColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte nicht kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'), 'error');

return false;
}
else
{
$my_text = '<span style="color:' . $this->storeSuccessColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
}


}
elseif (version_compare(JVERSION, '4.0.0', 'ge'))
{

/**
*
* Get the handler to download the package
*/
Expand Down Expand Up @@ -137,33 +165,8 @@ function check_google_api()

return false;
}
}
elseif (version_compare(JSM_JVERSION, '4', 'eq'))
{
/**
*
* Download the package at the URL given.
*/
$p_file = InstallerHelper::downloadPackage($link);
/**
*
* Was the package downloaded?
*/
if (!$p_file)
{
$my_text = '<span style="color:' . $this->storeFailedColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte nicht kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'), 'error');

return false;
}
else
{
$my_text = '<span style="color:' . $this->storeSuccessColor . '">';
$my_text .= Text::sprintf('Die ZIP-Datei der Komponente [ %1$s ] konnte kopiert werden!', "</span><strong>" . $p_file . "</strong>");
$my_text .= '<br />';
}


}

/**
Expand Down
2 changes: 1 addition & 1 deletion admin/views/club/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function init()
//$this->document->addScript('https://maps.googleapis.com/maps/api/js?libraries=places&language=de');
//$this->document->addScript(Uri::base() . 'components/' . $this->option . '/assets/js/geocomplete.js');

if (version_compare(JSM_JVERSION, '4', 'eq'))
if (version_compare(JVERSION, '4.0.0', 'ge'))
{
$this->document->addScript(Uri::base() . 'components/' . $this->option . '/assets/js/editgeocode.js');
}
Expand Down
Loading

0 comments on commit 0d889cc

Please sign in to comment.