From 57e79d442c70a367465bdfad116afd01233c540b Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Thu, 18 Apr 2024 12:48:03 +0200 Subject: [PATCH] Remove Ioncube and License stuff --- .../EnvironmentConfig/Bootstrap.php | 10 +- .../EnvironmentConfig/EnvironmentConfig.php | 127 +---- .../EnvironmentConfigProvider.php | 10 +- classes/Core/ErrorHandler/ErrorHandler.php | 96 ---- classes/Core/ErrorHandler/ErrorPageData.php | 9 - phpwf/class.player.php | 102 +--- phpwf/plugins/class.acl.php | 45 +- www/eproosystem.php | 103 +--- www/lib/class.erpapi.php | 466 +----------------- www/lib/dokumente/class.briefpapier.php | 5 +- www/pages/appstore.php | 139 +----- www/pages/benutzer.php | 32 -- www/pages/dataprotection.php | 18 +- www/pages/einstellungen.php | 2 +- www/pages/learningdashboard.php | 12 +- www/pages/onlineshops.php | 3 - www/pages/supportapp.php | 51 -- www/pages/systemhealth.php | 1 - www/pages/systemlog.php | 19 - www/pages/welcome.php | 146 ------ www/pages/zahlungsweisen.php | 52 +- www/setup/setup.conf.php | 19 - www/themes/new/templates/tooltipinline.tpl | 8 - www/widgets/widget.shopexport.php | 11 - 24 files changed, 65 insertions(+), 1421 deletions(-) diff --git a/classes/Components/EnvironmentConfig/Bootstrap.php b/classes/Components/EnvironmentConfig/Bootstrap.php index 50f56342..18262ca2 100644 --- a/classes/Components/EnvironmentConfig/Bootstrap.php +++ b/classes/Components/EnvironmentConfig/Bootstrap.php @@ -44,14 +44,6 @@ class Bootstrap /** @var LegacyApplication $app */ $app = $container->get('LegacyApplication'); - if (!class_exists('License')) { - $test = dirname(__DIR__, 3) . '/phpwf/plugins/class.license.php'; - $file = new SplFileInfo($test); - if ($file->isFile()) { - include $test; - } - } - - return new EnvironmentConfigProvider(new License(), $app->Conf); + return new EnvironmentConfigProvider($app->Conf); } } diff --git a/classes/Components/EnvironmentConfig/EnvironmentConfig.php b/classes/Components/EnvironmentConfig/EnvironmentConfig.php index 3c6c50da..1ca73d67 100644 --- a/classes/Components/EnvironmentConfig/EnvironmentConfig.php +++ b/classes/Components/EnvironmentConfig/EnvironmentConfig.php @@ -34,11 +34,6 @@ final class EnvironmentConfig */ private $userdataDirectoryPath; - /** - * @var array|null $ioncubeSystemInformation - */ - private $ioncubeSystemInformation; - /** * @param string $databaseHost * @param string $databaseName @@ -46,7 +41,6 @@ final class EnvironmentConfig * @param string $databasePassword * @param int $databasePort * @param string $userdataDirectoryPath - * @param array $ioncubeSystemInformation */ public function __construct( string $databaseHost, @@ -54,8 +48,7 @@ final class EnvironmentConfig string $databaseUser, string $databasePassword, int $databasePort, - string $userdataDirectoryPath, - ?array $ioncubeSystemInformation + string $userdataDirectoryPath ) { $this->databaseHost = $databaseHost; $this->databaseName = $databaseName; @@ -63,7 +56,6 @@ final class EnvironmentConfig $this->databasePassword = $databasePassword; $this->databasePort = $databasePort; $this->userdataDirectoryPath = $userdataDirectoryPath; - $this->ioncubeSystemInformation = $ioncubeSystemInformation; } /** @@ -113,121 +105,4 @@ final class EnvironmentConfig { return $this->userdataDirectoryPath; } - - /** - * @return ?array - */ - public function getIoncubeSystemInformation(): ?array - { - return $this->ioncubeSystemInformation; - } - - /** - * @return bool - */ - public function isSystemHostedOnCloud(): bool - { - return !empty($this->ioncubeSystemInformation['iscloud']['value']); - } - - /** - * @return bool - */ - public function isSystemFlaggedAsDevelopmentVersion(): bool - { - return !empty($this->ioncubeSystemInformation['isdevelopmentversion']['value']); - } - - /** - * @return bool - */ - public function isSystemFlaggedAsTestVersion(): bool - { - return !empty($this->ioncubeSystemInformation['testlizenz']['value']); - } - - /** - * @return int - */ - public function getMaxUser(): int - { - if (!isset($this->ioncubeSystemInformation['maxuser']['value'])) { - return 0; - } - - return (int)$this->ioncubeSystemInformation['maxuser']['value']; - } - - /** - * @return int - */ - public function getMaxLightUser(): int - { - if (!isset($this->ioncubeSystemInformation['maxlightuser']['value'])) { - return 0; - } - - return (int)$this->ioncubeSystemInformation['maxlightuser']['value']; - } - - /** - * @return int|null - */ - public function getExpirationTimeStamp(): ?int - { - if (!isset($this->ioncubeSystemInformation['expdate']['value'])) { - return 0; - } - - return (int)$this->ioncubeSystemInformation['expdate']['value']; - } - - /** - * @param string $name - * - * @return string|null - */ - public function getValueOfSpecificIoncubeSystemInformation(string $name): ?string - { - if ($this->ioncubeSystemInformation === null) { - return null; - } - - if (array_key_exists($name, $this->ioncubeSystemInformation)) { - return $this->ioncubeSystemInformation[$name]['value']; - } - - return null; - } - - /** - * @return array - */ - public function getSystemFallbackEmailAddresses(): array - { - $emailAddresses = []; - $mailAddressSelfBuyCustomer = (string)$this->getValueOfSpecificIoncubeSystemInformation('buyemail'); - if ($mailAddressSelfBuyCustomer !== '') { - $emailAddresses[] = $mailAddressSelfBuyCustomer; - } - - $mailAddressCustomerLicence = (string)$this->getValueOfSpecificIoncubeSystemInformation('emaillicence'); - if ($mailAddressCustomerLicence !== '' - && strpos($mailAddressCustomerLicence, '@') !== false - && strpos($mailAddressCustomerLicence, '@xentral.com') === false - && strpos($mailAddressCustomerLicence, '@xentral.biz') === false) { - $emailAddresses[] = $mailAddressCustomerLicence; - } - - //in old licences email-address of customer can be insert in name instead email - $nameCustomerLicence = (string)$this->getValueOfSpecificIoncubeSystemInformation('namelicence'); - if ($nameCustomerLicence !== '' - && strpos($nameCustomerLicence, '@') !== false - && strpos($nameCustomerLicence, '@xentral.com') === false - && strpos($nameCustomerLicence, '@xentral.biz') === false) { - $emailAddresses[] = $nameCustomerLicence; - } - - return $emailAddresses; - } } diff --git a/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php b/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php index 81b9a035..50164a58 100644 --- a/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php +++ b/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php @@ -7,19 +7,14 @@ use License; final class EnvironmentConfigProvider { - /** @var License $license */ - private $license; - /** @var Config $config */ private $config; /** - * @param License $license * @param Config $config */ - public function __construct(License $license, Config $config) + public function __construct(Config $config) { - $this->license = $license; $this->config = $config; } @@ -30,8 +25,7 @@ final class EnvironmentConfigProvider { $environmentConfig = new EnvironmentConfig( $this->config->WFdbhost, $this->config->WFdbname, $this->config->WFdbuser, - $this->config->WFdbpass, $this->config->WFdbport, $this->config->WFuserdata, - (array)$this->license->getProperties() + $this->config->WFdbpass, $this->config->WFdbport, $this->config->WFuserdata ); return $environmentConfig; diff --git a/classes/Core/ErrorHandler/ErrorHandler.php b/classes/Core/ErrorHandler/ErrorHandler.php index a871bf58..4c4ef3ee 100644 --- a/classes/Core/ErrorHandler/ErrorHandler.php +++ b/classes/Core/ErrorHandler/ErrorHandler.php @@ -84,10 +84,6 @@ final class ErrorHandler public function handleException($exception) { $title = null; - if ($this->isIoncubeError($exception)) { - $title = $this->handleIoncubeError($exception); - } - $data = new ErrorPageData($exception, $title); $renderer = new ErrorPageRenderer($data); header('HTTP/1.1 500 Internal Server Error'); @@ -125,96 +121,4 @@ final class ErrorHandler { return in_array((int)$type, self::THROWABLE_ERROR_TYPES, true); } - - /** - * @param Throwable $exception - * - * @return bool - */ - private function isIoncubeError($exception) - { - if ((int)$exception->getCode() !== E_CORE_ERROR) { - return false; - } - if (strpos($exception->getMessage(), 'requires a license file.') !== false) { - return true; - } - if (strpos($exception->getMessage(), 'ionCube Encoder') !== false) { - return true; - } - - return false; - } - - /** - * @param Throwable $exception - * - * @return string|null - */ - private function handleIoncubeError($exception) - { - $file = $this->extractFileFromIoncubeError($exception); - if (empty($file)) { - return null; - } - - if (!$this->isDeleteableFile($file)) { - return null; - } - - @unlink($file); - if(is_file($file)) { - return sprintf('Es wurde eine alte Systemdatei gefunden die nicht manuell gelöscht werden konnte. - Bitte löschen Sie die Datei %s', $file); - } - return 'Es wurde eine alte Systemdatei gefunden und automatisch gelöscht. - Bitte führen Sie das Update nochmal durch dann sollte diese Meldung nicht mehr erscheinen.'; - } - - /** - * @param string $file - * - * @return bool - */ - private function isDeleteableFile(string $file) - { - if (!is_file($file)) { - return false; - } - $dir = dirname($file); - foreach (self::DELETE_FILE_FOLDERS as $folder) { - if (substr($dir, -strlen($folder)) === $folder) { - return true; - } - } - - return false; - } - - /** - * @example "
The encoded file /var/www/xentral/www/pages/adresse.php requires a license file.
" - * "The license file /var/www/xentral/key.php is corrupt." - * - * @param Throwable $exception - * - * @return string|null - */ - private function extractFileFromIoncubeError($exception) - { - $message = strip_tags($exception->getMessage()); - $theFilePos = stripos($message, 'The File '); - if ($theFilePos === false) { - $theFilePos = strpos($message, 'The encoded file'); - if ($theFilePos === false) { - return null; - } - $theFilePos += 16; - } else { - $theFilePos += 9; - } - $file = trim(substr($message, $theFilePos)); - $file = explode(' ', $file); - - return reset($file); - } } diff --git a/classes/Core/ErrorHandler/ErrorPageData.php b/classes/Core/ErrorHandler/ErrorPageData.php index 469d65df..52a159c1 100644 --- a/classes/Core/ErrorHandler/ErrorPageData.php +++ b/classes/Core/ErrorHandler/ErrorPageData.php @@ -323,15 +323,6 @@ final class ErrorPageData implements JsonSerializable 'ldap' => function () { return function_exists('ldap_connect'); }, - 'ioncube' => function () { - if (!function_exists('ioncube_loader_version')) { - return false; - } - - $ioncubeMajorVersion = (int)@ioncube_loader_version(); - - return $ioncubeMajorVersion >= 5; - }, ]; } diff --git a/phpwf/class.player.php b/phpwf/class.player.php index 4dd5bffd..8c72cfd0 100644 --- a/phpwf/class.player.php +++ b/phpwf/class.player.php @@ -2,7 +2,7 @@ /* * SPDX-FileCopyrightText: 2019 Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg - * SPDX-FileCopyrightText: 2023 Andreas Palm + * SPDX-FileCopyrightText: 2023-2024 Andreas Palm * * SPDX-License-Identifier: LicenseRef-EGPL-3.1 */ @@ -104,105 +104,7 @@ class Player { $module = 'welcome'; $action = 'main'; } - - - if($this->app->erp->isIoncube() && method_exists($this->app->erp, 'IoncubeProperty') - && WithGUI() && !(($module=='welcome' && $action=='upgrade') || $module=='' || ($module=='welcome' && $action=='start'))) - { - if(method_exists('erpAPI','Ioncube_getMaxUser')) - { - $maxuser = erpAPI::Ioncube_getMaxUser(); - }elseif(method_exists($this->app->erp, 'IoncubegetMaxUser')) - { - $maxuser = $this->app->erp->IoncubegetMaxUser(); - }else{ - $maxuser = 0; - } - if(method_exists('erpAPI','Ioncube_getMaxLightusers')) - { - $maxlightuser = erpAPI::Ioncube_getMaxLightusers(); - }else{ - $maxlightuser = 0; - } - if($maxuser) - { - $anzuser2 = 0; - if($maxlightuser > 0) { - $anzuser2 = (int)$this->app->DB->Select("SELECT count(DISTINCT u.id) FROM `user` u WHERE activ = 1 AND type = 'lightuser' "); - $anzuser = (int)$this->app->DB->Select("SELECT count(id) FROM `user` WHERE activ = 1 AND not isnull(hwtoken) AND hwtoken <> 4") - $anzuser2; - $anzuserzeiterfassung = (int)$this->app->DB->Select("SELECT count(*) from user where activ = 1 AND hwtoken = 4 AND type != 'lightuser'"); - }else{ - $anzuser = $this->app->DB->Select("SELECT count(*) from user where activ = 1 AND hwtoken <> 4 "); - $anzuserzeiterfassung = (int)$this->app->DB->Select("SELECT count(*) from user where activ = 1 AND hwtoken = 4"); - } - - $maxmitarbeiterzeiterfassung = $this->app->erp->ModulVorhanden('mitarbeiterzeiterfassung')?$maxuser:0; - if($anzuser > $maxuser - || ( - ($anzuser + $anzuserzeiterfassung + $anzuser2) > - $maxmitarbeiterzeiterfassung + $maxuser + $maxlightuser - ) - || (($anzuser + $anzuserzeiterfassung) > $maxmitarbeiterzeiterfassung + $maxuser) - ) { - if(!(($module == 'welcome' && - ($action=='info' || $action == 'start' || $action == 'logout' || $action == '' || $action == 'main')) || - ($module == 'einstellungen' && ($action == 'list' || $action == '')) || - $module == 'benutzer' - )) - { - if($this->app->erp->RechteVorhanden('benutzer','list')) - { - $module = 'benutzer'; - $action = 'list'; - - if($maxlightuser > 0){ - $error = 'Es existieren mehr aktive Benutzer als Ihre Lizenz erlaubt: Benutzer ' . ($anzuser + $anzuser2) . ($maxlightuser > 0 ? ' (davon ' . $anzuser2 . ' Light-User)' : '') . ' von ' . ($maxuser + $maxlightuser) . ($maxlightuser > 0 ? ' (' . $maxlightuser . ' Light-User)' : ''); - }else{ - $error = 'Es existieren mehr aktive Benutzer als Ihre Lizenz erlaubt: Benutzer ' . ($anzuser + $anzuser2) . ($maxlightuser > 0 ? ' (davon ' . $anzuser2 . ' Zeiterfassungs-User)' : '') . ' von ' . ($maxuser + $anzuser2) . ($anzuser2 > 0 ? ' (' . $anzuser2 . ' Zeiterfassungs-User)' : ''); - } - $error = '
'.$error.'
'; - $this->app->Tpl->Add('MESSAGE', $error); - $this->app->Secure->GET['msg'] = $this->app->erp->base64_url_encode($error); - }else{ - $module = 'welcome'; - $action = 'info'; - } - $this->app->Secure->GET['module'] = $module; - $this->app->Secure->GET['action'] = $action; - } - } - } - if(method_exists('erpAPI','Ioncube_Property')) - { - $deaktivateonexp = erpAPI::Ioncube_Property('deaktivateonexp'); - }else{ - $deaktivateonexp = $this->app->erp->IoncubeProperty('deaktivateonexp'); - } - if($deaktivateonexp) - { - if(method_exists('erpAPI','Ioncube_HasExpired')) - { - $IoncubeHasExpired = erpAPI::Ioncube_HasExpired(); - }elseif(method_exists($this->app->erp, 'IoncubeHasExpired')) - { - $IoncubeHasExpired = $this->app->erp->IoncubeHasExpired(); - }else{ - $IoncubeHasExpired = false; - } - }else{ - $IoncubeHasExpired = false; - } - if($deaktivateonexp && $IoncubeHasExpired - && !(($module == 'welcome' && $action='logout') || ($module == 'welcome' && $action='start') || ($module == 'welcome' && $action='main')) - ) - { - $module = 'welcome'; - $action = 'info'; - $this->app->Secure->GET['module'] = $module; - $this->app->Secure->GET['action'] = $action; - } - } - } + } if($action!="list" && $action!="css" && $action!="logo" && $action!="poll" && $module!="ajax" && $module!="protokoll" && $action!="thumbnail"){ $this->app->erp->Protokoll(); diff --git a/phpwf/plugins/class.acl.php b/phpwf/plugins/class.acl.php index 59315a18..8d50028e 100644 --- a/phpwf/plugins/class.acl.php +++ b/phpwf/plugins/class.acl.php @@ -295,8 +295,6 @@ class Acl /** @var EnvironmentConfig $environmentConfig */ $environmentConfig = $this->app->Container->get('EnvironmentConfig'); - $mailAddresses = array_merge($mailAddresses, $environmentConfig->getSystemFallbackEmailAddresses()); - return array_unique($mailAddresses); } @@ -438,37 +436,24 @@ class Acl if(!empty($serverLocation)) { $server = rtrim($serverLocation,'/') . '?module=welcome&action=passwortvergessen&code=' . $code; } - foreach(['default', 'fallback'] as $sentSetting) { - if($sentSetting === 'fallback') { - $db = $this->app->Conf->WFdbname; - if( - empty(erpAPI::Ioncube_Property('cloudemail')) - || $this->app->erp->firmendaten[$db]['email'] === erpAPI::Ioncube_Property('cloudemail') - ) { - break; - } - $this->app->erp->firmendaten[$db]['mailanstellesmtp'] = 1; - $this->app->erp->firmendaten[$db]['email'] = erpAPI::Ioncube_Property('cloudemail'); + foreach ($emailAddresses as $email) { + $recipientMailAddress = $email; + $recipientName = $name; + if(empty($recipientMailAddress) || empty($recipientName)) { + continue; } - foreach ($emailAddresses as $email) { - $recipientMailAddress = $email; - $recipientName = $name; - if(empty($recipientMailAddress) || empty($recipientName)) { - continue; - } - $mailContent = str_replace(['{NAME}', '{ANREDE}', '{URL}'], [$recipientName, $anrede, $server], $mailContent); + $mailContent = str_replace(['{NAME}', '{ANREDE}', '{URL}'], [$recipientName, $anrede, $server], $mailContent); - if(!$this->app->erp->isHTML($mailContent)){ - $mailContent = str_replace("\r\n", '
', $mailContent); - } - $mailSuccessfullySent = $this->app->erp->MailSend( - $this->app->erp->GetFirmaMail(), $this->app->erp->GetFirmaAbsender(), - $recipientMailAddress, $recipientName, $mailSubject, $mailContent, '', 0, true, '', '', true - ); - if($mailSuccessfullySent){ - break 2; - } + if(!$this->app->erp->isHTML($mailContent)){ + $mailContent = str_replace("\r\n", '
', $mailContent); + } + $mailSuccessfullySent = $this->app->erp->MailSend( + $this->app->erp->GetFirmaMail(), $this->app->erp->GetFirmaAbsender(), + $recipientMailAddress, $recipientName, $mailSubject, $mailContent, '', 0, true, '', '', true + ); + if($mailSuccessfullySent){ + break; } } } diff --git a/www/eproosystem.php b/www/eproosystem.php index 560f7a59..985ff0b6 100644 --- a/www/eproosystem.php +++ b/www/eproosystem.php @@ -323,32 +323,10 @@ class erpooSystem extends Application } } - $isTestlizenz = !empty(erpAPI::Ioncube_Property('testlizenz')); - $isCloud = erpAPI::Ioncube_Property('iscloud'); - $isDemo = $isTestlizenz && $isCloud; $activateDoubleClick = false; /** @var Dataprotection $dataProtectionModule */ $dataProtectionModule = $this->loadModule('dataprotection'); - if($isCloud - && $dataProtectionModule !== null - && $dataProtectionModule->isGoogleAnalyticsActive() - ){ - $activateDoubleClick = true; - $this->Tpl->Add( - 'SCRIPTJAVASCRIPT', - ' - - '); - - $this->Tpl->Add('ADDITIONALCSPHEADER', ' www.googletagmanager.com www.google-analytics.com ssl.google-analytics.com stats.g.doubleclick.net '); - } if($dataProtectionModule !== null && $dataProtectionModule->isHubspotActive()) { $activateDoubleClick = true; $this->Tpl->Add( @@ -468,13 +446,6 @@ class erpooSystem extends Application ];*/ - if(!empty(erpAPI::Ioncube_Property('testlizenz')) && $this->User->GetType() === 'admin'){ - $possibleUserItems['Starte hier!'] = [ - 'link' => 'index.php?module=learningdashboard&action=list', - 'type' => 'cta' - ]; - } - $userItems = '