Component Builder (v.3.1.27)
+ Component Builder (v.3.1.28)
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml
index 815317423..0130d0525 100644
--- a/componentbuilder_update_server.xml
+++ b/componentbuilder_update_server.xml
@@ -1217,4 +1217,22 @@
https://dev.vdm.io
+
+ Component Builder
+ Builds Complex Joomla Components
+ pkg_component_builder
+ package
+ site
+ 3.1.28
+ https://dev.vdm.io
+
+ https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.28.zip
+
+
+ stable
+
+ Llewellyn van der Merwe
+ https://dev.vdm.io
+
+
\ No newline at end of file
diff --git a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Abstraction/Api.php b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Abstraction/Api.php
index 7d57da4f5..ecd5787c0 100644
--- a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Abstraction/Api.php
+++ b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Abstraction/Api.php
@@ -48,6 +48,22 @@ abstract class Api
*/
protected Response $response;
+ /**
+ * The Url string
+ *
+ * @var string|null
+ * @since 3.2.0
+ */
+ protected ?string $url = null;
+
+ /**
+ * The token string
+ *
+ * @var string|null
+ * @since 3.2.0
+ */
+ protected ?string $token = null;
+
/**
* Constructor.
*
@@ -67,14 +83,31 @@ abstract class Api
/**
* Load/Reload API.
*
- * @param string|null $url The url.
- * @param token|null $token The token.
+ * @param string|null $url The url.
+ * @param token|null $token The token.
+ * @param bool $backup The backup swapping switch.
*
* @return void
* @since 3.2.0
**/
- public function load_(?string $url = null, ?string $token = null)
+ public function load_(?string $url = null, ?string $token = null, bool $backup = true): void
{
+ // we keep the old values
+ // so we can reset after our call
+ // for the rest of the container
+ if ($backup)
+ {
+ if ($url !== null)
+ {
+ $this->url = $this->uri->getUrl();
+ }
+
+ if ($token !== null)
+ {
+ $this->token = $this->http->getToken();
+ }
+ }
+
if ($url !== null)
{
$this->uri->setUrl($url);
@@ -86,6 +119,27 @@ abstract class Api
}
}
+ /**
+ * Reset to previous toke, url it set
+ *
+ * @return void
+ * @since 3.2.0
+ **/
+ public function reset_(): void
+ {
+ if ($this->url !== null)
+ {
+ $this->uri->setUrl($this->url);
+ $this->url = null;
+ }
+
+ if ($this->token !== null)
+ {
+ $this->http->setToken($this->token);
+ $this->token = null;
+ }
+ }
+
/**
* Get the API url
*
diff --git a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php
index 763308e69..6c5b3c6e4 100644
--- a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php
+++ b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php
@@ -23,6 +23,14 @@ use Joomla\Registry\Registry;
*/
final class Http extends JoomlaHttp
{
+ /**
+ * The token
+ *
+ * @var string
+ * @since 3.2.0
+ */
+ protected string $_token_; // to avoid collusions (but allow swapping)
+
/**
* Constructor.
*
@@ -45,6 +53,7 @@ final class Http extends JoomlaHttp
if (is_string($token))
{
$config['headers']['Authorization'] = 'token ' . $token;
+ $this->_token_ = $token;
}
$options = new Registry($config);
@@ -60,7 +69,7 @@ final class Http extends JoomlaHttp
*
* @since 3.2.0
**/
- public function setToken(string $token)
+ public function setToken(string $token): void
{
// get the current headers
$headers = (array) $this->getOption('headers', [
@@ -70,8 +79,20 @@ final class Http extends JoomlaHttp
// add the token
$headers['Authorization'] = 'token ' . $token;
+ $this->_token_ = $token;
$this->setOption('headers', $headers);
+ }
+
+ /**
+ * Get the Token.
+ *
+ * @return string|null
+ * @since 3.2.0
+ **/
+ public function getToken(): ?string
+ {
+ return $this->_token_ ?? null;
}
}
diff --git a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Uri.php b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Uri.php
index 8755b7b7b..daa3add1e 100644
--- a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Uri.php
+++ b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Uri.php
@@ -110,6 +110,17 @@ final class Uri
$this->url = $url;
}
+ /**
+ * Get the URL of the API
+ *
+ * @return string|null
+ * @since 3.2.0
+ **/
+ public function getUrl(): ?string
+ {
+ return $this->url ?? null;
+ }
+
/**
* Set the endpoint of the API
*
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Server/Sftp.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Server/Sftp.php
index d27246049..27772b8cd 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Server/Sftp.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Server/Sftp.php
@@ -12,6 +12,9 @@
namespace VDM\Joomla\Componentbuilder\Server;
+use Joomla\CMS\Factory;
+use Joomla\CMS\Language\Text;
+use Joomla\CMS\Application\CMSApplication;
use phpseclib3\Net\SFTP as SftpClient;
use VDM\Joomla\Componentbuilder\Crypt\KeyLoader;
use VDM\Joomla\Utilities\StringHelper;
@@ -51,16 +54,26 @@ class Sftp implements Serverinterface
**/
protected ?object $details = null;
+ /**
+ * Application object.
+ *
+ * @var CMSApplication
+ * @since 3.2.0
+ **/
+ protected CMSApplication $app;
+
/**
* Constructor
*
* @param KeyLoader $key The key loader object.
+ * @param CMSApplication|null $app The app object.
*
* @since 3.2.0
*/
- public function __construct(KeyLoader $key)
+ public function __construct(KeyLoader $key, ?CMSApplication $app = null)
{
$this->key = $key;
+ $this->app = $app ?: Factory::getApplication();
}
/**
@@ -106,10 +119,21 @@ class Sftp implements Serverinterface
StringHelper::check($this->details->path) &&
$this->details->path !== '/')
{
- $path = '/' . trim((string) $this->details->path, '/');
+ $path = trim((string) $this->details->path);
+ $path = '/' . trim($path, '/') . '/';
}
- return $this->client->put($path . '/' . $fileName, $data);
+ try
+ {
+ return $this->client->put($path . trim($fileName), $data);
+ }
+ catch(\Exception $e)
+ {
+ $this->app->enqueueMessage(
+ Text::sprintf('COM_COMPONENTBUILDER_MOVING_OF_THE_S_FAILED', $fileName) . ': ' . $e->getMessage(),
+ 'Error'
+ );
+ }
}
return false;
@@ -147,24 +171,23 @@ class Sftp implements Serverinterface
isset($this->details->username) && StringHelper::check($this->details->username))
{
// insure the port is set
- $port = (isset($this->details->port) && is_numeric($this->details->port) && $this->details->port > 0)
- ? (int) $this->details->port : 22;
+ $port = (int)($this->details->port ?? 22);
// open the connection
$sftp = new SftpClient($this->details->host, $port);
// set the passphrase if it exist
- $passphrase = $this->details->secret ?? null;
+ $passphrase = (isset($this->details->secret) && StringHelper::check(trim($this->details->secret))) ? trim($this->details->secret) : false;
// set the password if it exist
- $password = $this->details->password ?? null;
+ $password = (isset($this->details->password) && StringHelper::check(trim($this->details->password))) ? trim($this->details->password) : false;
// now login based on authentication type
$key = null;
switch($this->details->authentication)
{
case 1: // password
- $key = $this->details->password ?? null;
+ $key = $password ?? null;
$password = null;
break;
case 2: // private key file
@@ -172,28 +195,77 @@ class Sftp implements Serverinterface
if (isset($this->details->private) && StringHelper::check($this->details->private) &&
($private_key = FileHelper::getContent($this->details->private, null)) !== null)
{
- $key = $this->key::load($private_key, $passphrase);
+ try
+ {
+ $key = $this->key::load(trim($private_key), $passphrase);
+ }
+ catch(\Exception $e)
+ {
+ $this->app->enqueueMessage(
+ Text::_('COM_COMPONENTBUILDER_LOADING_THE_PRIVATE_KEY_FILE_FAILED') . ': ' . $e->getMessage(),
+ 'Error'
+ );
+ $key = null;
+ }
}
break;
case 4: // private key field
case 5: // both password and private key field
if (isset($this->details->private_key) && StringHelper::check($this->details->private_key))
{
- $key = $this->key::load($this->details->private_key, $passphrase);
+ try
+ {
+ $key = $this->key::load(trim($this->details->private_key), $passphrase);
+ }
+ catch(\Exception $e)
+ {
+ $this->app->enqueueMessage(
+ Text::_('COM_COMPONENTBUILDER_LOADING_THE_PRIVATE_KEY_TEXT_FAILED') . ': ' . $e->getMessage(),
+ 'Error'
+ );
+ $key = null;
+ }
}
break;
}
+ // remove any null bites from the username
+ $this->details->username = trim($this->details->username);
+
// login
- if ((!empty($key) && !empty($password) && $sftp->login($this->details->username, $key, $password)) ||
- (!empty($key) && $sftp->login($this->details->username, $key)))
+ if (!empty($key) && !empty($password))
{
- return $sftp;
+ try
+ {
+ $sftp->login($this->details->username, $key, $password);
+ return $sftp;
+ }
+ catch(\Exception $e)
+ {
+ $this->app->enqueueMessage(
+ Text::_('COM_COMPONENTBUILDER_LOGIN_FAILED') . ': ' . $e->getMessage(),
+ 'Error'
+ );
+ }
+ }
+ elseif (!empty($key))
+ {
+ try
+ {
+ $sftp->login($this->details->username, $key);
+ return $sftp;
+ }
+ catch(\Exception $e)
+ {
+ $this->app->enqueueMessage(
+ Text::_('COM_COMPONENTBUILDER_LOGIN_FAILED') . ': ' . $e->getMessage(),
+ 'Error'
+ );
+ }
}
}
return null;
- }
-
+ }
}
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php
index ef1229553..0210aa25a 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Table.php
@@ -67,51 +67,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
- 'php_helper_both' => [
- 'name' => 'php_helper_both',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_LABEL',
- 'type' => 'editor',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'base64',
- 'tab_name' => 'Libs & Helpers',
- ],
- 'created' => [
- 'name' => 'created',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_LABEL',
- 'type' => 'calendar',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'publishing',
- ],
- 'crowdin_project_identifier' => [
- 'name' => 'crowdin_project_identifier',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_LABEL',
- 'type' => 'text',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Dynamic Integration',
- ],
- 'php_method_uninstall' => [
- 'name' => 'php_method_uninstall',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL',
- 'type' => 'editor',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'base64',
- 'tab_name' => 'Dash & Install',
- ],
- 'php_preflight_install' => [
- 'name' => 'php_preflight_install',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL',
- 'type' => 'editor',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'base64',
- 'tab_name' => 'Dash & Install',
- ],
'css_admin' => [
'name' => 'css_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_ADMIN_LABEL',
@@ -121,33 +76,6 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
- 'mvc_versiondate' => [
- 'name' => 'mvc_versiondate',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MVC_VERSIONDATE_LABEL',
- 'type' => 'list',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
- ],
- 'remove_line_breaks' => [
- 'name' => 'remove_line_breaks',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL',
- 'type' => 'radio',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
- ],
- 'add_placeholders' => [
- 'name' => 'add_placeholders',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PLACEHOLDERS_LABEL',
- 'type' => 'radio',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
- ],
'php_admin_event' => [
'name' => 'php_admin_event',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_LABEL',
@@ -166,18 +94,18 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
- 'description' => [
- 'name' => 'description',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL',
- 'type' => 'textarea',
+ 'crowdin_username' => [
+ 'name' => 'crowdin_username',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_USERNAME_LABEL',
+ 'type' => 'text',
'title' => false,
'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
+ 'store' => 'basic_encryption',
+ 'tab_name' => 'Dynamic Integration',
],
- 'author' => [
- 'name' => 'author',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL',
+ 'component_version' => [
+ 'name' => 'component_version',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
@@ -193,10 +121,19 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
- 'email' => [
- 'name' => 'email',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_LABEL',
- 'type' => 'text',
+ 'remove_line_breaks' => [
+ 'name' => 'remove_line_breaks',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL',
+ 'type' => 'radio',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
+ 'description' => [
+ 'name' => 'description',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL',
+ 'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@@ -211,6 +148,96 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'MySQL',
],
+ 'debug_linenr' => [
+ 'name' => 'debug_linenr',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL',
+ 'type' => 'radio',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
+ 'mvc_versiondate' => [
+ 'name' => 'mvc_versiondate',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MVC_VERSIONDATE_LABEL',
+ 'type' => 'list',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
+ 'php_preflight_install' => [
+ 'name' => 'php_preflight_install',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL',
+ 'type' => 'editor',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => 'base64',
+ 'tab_name' => 'Dash & Install',
+ ],
+ 'backup_folder_path' => [
+ 'name' => 'backup_folder_path',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_LABEL',
+ 'type' => 'text',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Dynamic Integration',
+ ],
+ 'php_method_uninstall' => [
+ 'name' => 'php_method_uninstall',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL',
+ 'type' => 'editor',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => 'base64',
+ 'tab_name' => 'Dash & Install',
+ ],
+ 'add_placeholders' => [
+ 'name' => 'add_placeholders',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PLACEHOLDERS_LABEL',
+ 'type' => 'radio',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
+ 'author' => [
+ 'name' => 'author',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL',
+ 'type' => 'text',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
+ 'add_sales_server' => [
+ 'name' => 'add_sales_server',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SALES_SERVER_LABEL',
+ 'type' => 'radio',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Dynamic Integration',
+ ],
+ 'email' => [
+ 'name' => 'email',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_LABEL',
+ 'type' => 'text',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
+ 'translation_tool' => [
+ 'name' => 'translation_tool',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TRANSLATION_TOOL_LABEL',
+ 'type' => 'list',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Dynamic Integration',
+ ],
'website' => [
'name' => 'website',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_LABEL',
@@ -220,14 +247,14 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
- 'debug_linenr' => [
- 'name' => 'debug_linenr',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL',
- 'type' => 'radio',
+ 'buildcompsql' => [
+ 'name' => 'buildcompsql',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL',
+ 'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
+ 'store' => 'base64',
+ 'tab_name' => 'Dynamic Build (beta)',
],
'add_license' => [
'name' => 'add_license',
@@ -238,6 +265,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
+ 'php_helper_admin' => [
+ 'name' => 'php_helper_admin',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_ADMIN_LABEL',
+ 'type' => 'editor',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => 'base64',
+ 'tab_name' => 'Libs & Helpers',
+ ],
'license_type' => [
'name' => 'license_type',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_LABEL',
@@ -247,18 +283,18 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
- 'add_email_helper' => [
- 'name' => 'add_email_helper',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL',
- 'type' => 'radio',
+ 'php_helper_site' => [
+ 'name' => 'php_helper_site',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL',
+ 'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
- 'store' => NULL,
+ 'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
- 'php_helper_admin' => [
- 'name' => 'php_helper_admin',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_ADMIN_LABEL',
+ 'javascript' => [
+ 'name' => 'javascript',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
@@ -274,9 +310,9 @@ class Table extends BaseTable implements Tableinterface
'store' => 'basic_encryption',
'tab_name' => 'Details',
],
- 'php_helper_site' => [
- 'name' => 'php_helper_site',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL',
+ 'css_site' => [
+ 'name' => 'css_site',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
@@ -292,15 +328,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
- 'javascript' => [
- 'name' => 'javascript',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL',
- 'type' => 'editor',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'base64',
- 'tab_name' => 'Libs & Helpers',
- ],
'whmcs_buy_link' => [
'name' => 'whmcs_buy_link',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_BUY_LINK_LABEL',
@@ -310,33 +337,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
- 'css_site' => [
- 'name' => 'css_site',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL',
- 'type' => 'editor',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'base64',
- 'tab_name' => 'Libs & Helpers',
- ],
- 'license' => [
- 'name' => 'license',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_LABEL',
- 'type' => 'textarea',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
- ],
- 'bom' => [
- 'name' => 'bom',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOM_LABEL',
- 'type' => 'filelist',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
- ],
'php_preflight_update' => [
'name' => 'php_preflight_update',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL',
@@ -346,10 +346,10 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
- 'image' => [
- 'name' => 'image',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL',
- 'type' => 'media',
+ 'license' => [
+ 'name' => 'license',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_LABEL',
+ 'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@@ -364,10 +364,10 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
- 'copyright' => [
- 'name' => 'copyright',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COPYRIGHT_LABEL',
- 'type' => 'textarea',
+ 'bom' => [
+ 'name' => 'bom',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOM_LABEL',
+ 'type' => 'filelist',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@@ -382,6 +382,15 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'MySQL',
],
+ 'image' => [
+ 'name' => 'image',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL',
+ 'type' => 'media',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Details',
+ ],
'addreadme' => [
'name' => 'addreadme',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDREADME_LABEL',
@@ -391,14 +400,14 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Readme',
],
- 'add_sales_server' => [
- 'name' => 'add_sales_server',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SALES_SERVER_LABEL',
- 'type' => 'radio',
+ 'copyright' => [
+ 'name' => 'copyright',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COPYRIGHT_LABEL',
+ 'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
- 'tab_name' => 'Dynamic Integration',
+ 'tab_name' => 'Details',
],
'update_server_url' => [
'name' => 'update_server_url',
@@ -409,15 +418,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
- 'component_version' => [
- 'name' => 'component_version',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL',
- 'type' => 'text',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Details',
- ],
'add_powers' => [
'name' => 'add_powers',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_POWERS_LABEL',
@@ -427,41 +427,32 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
- 'translation_tool' => [
- 'name' => 'translation_tool',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TRANSLATION_TOOL_LABEL',
- 'type' => 'list',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => NULL,
- 'tab_name' => 'Dynamic Integration',
- ],
- 'crowdin_username' => [
- 'name' => 'crowdin_username',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_USERNAME_LABEL',
- 'type' => 'text',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'basic_encryption',
- 'tab_name' => 'Dynamic Integration',
- ],
- 'buildcompsql' => [
- 'name' => 'buildcompsql',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL',
- 'type' => 'textarea',
- 'title' => false,
- 'list' => 'joomla_components',
- 'store' => 'base64',
- 'tab_name' => 'Dynamic Build (beta)',
- ],
- 'add_php_helper_both' => [
- 'name' => 'add_php_helper_both',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_BOTH_LABEL',
+ 'add_backup_folder_path' => [
+ 'name' => 'add_backup_folder_path',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BACKUP_FOLDER_PATH_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
- 'tab_name' => 'Libs & Helpers',
+ 'tab_name' => 'Dynamic Integration',
+ ],
+ 'crowdin_project_identifier' => [
+ 'name' => 'crowdin_project_identifier',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_LABEL',
+ 'type' => 'text',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Dynamic Integration',
+ ],
+ 'created' => [
+ 'name' => 'created',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_LABEL',
+ 'type' => 'calendar',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'publishing',
],
'add_php_helper_admin' => [
'name' => 'add_php_helper_admin',
@@ -742,6 +733,42 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
+ 'add_git_folder_path' => [
+ 'name' => 'add_git_folder_path',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_GIT_FOLDER_PATH_LABEL',
+ 'type' => 'radio',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Dynamic Integration',
+ ],
+ 'git_folder_path' => [
+ 'name' => 'git_folder_path',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GIT_FOLDER_PATH_LABEL',
+ 'type' => 'text',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Dynamic Integration',
+ ],
+ 'creatuserhelper' => [
+ 'name' => 'creatuserhelper',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATUSERHELPER_LABEL',
+ 'type' => 'radio',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Libs & Helpers',
+ ],
+ 'adduikit' => [
+ 'name' => 'adduikit',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL',
+ 'type' => 'list',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Libs & Helpers',
+ ],
'crowdin_project_api_key' => [
'name' => 'crowdin_project_api_key',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_API_KEY_LABEL',
@@ -751,6 +778,15 @@ class Table extends BaseTable implements Tableinterface
'store' => 'basic_encryption',
'tab_name' => 'Dynamic Integration',
],
+ 'addfootable' => [
+ 'name' => 'addfootable',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDFOOTABLE_LABEL',
+ 'type' => 'list',
+ 'title' => false,
+ 'list' => 'joomla_components',
+ 'store' => NULL,
+ 'tab_name' => 'Libs & Helpers',
+ ],
'crowdin_account_api_key' => [
'name' => 'crowdin_account_api_key',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_ACCOUNT_API_KEY_LABEL',
@@ -760,9 +796,9 @@ class Table extends BaseTable implements Tableinterface
'store' => 'basic_encryption',
'tab_name' => 'Dynamic Integration',
],
- 'creatuserhelper' => [
- 'name' => 'creatuserhelper',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATUSERHELPER_LABEL',
+ 'add_email_helper' => [
+ 'name' => 'add_email_helper',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
@@ -778,10 +814,10 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Build (beta)',
],
- 'adduikit' => [
- 'name' => 'adduikit',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL',
- 'type' => 'list',
+ 'add_php_helper_both' => [
+ 'name' => 'add_php_helper_both',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_BOTH_LABEL',
+ 'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@@ -796,13 +832,13 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'publishing',
],
- 'addfootable' => [
- 'name' => 'addfootable',
- 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDFOOTABLE_LABEL',
- 'type' => 'list',
+ 'php_helper_both' => [
+ 'name' => 'php_helper_both',
+ 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_LABEL',
+ 'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
- 'store' => NULL,
+ 'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
'modified' => [
diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php
index bd6f1a207..3c1554d4b 100644
--- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php
+++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php
@@ -65,7 +65,7 @@ abstract class TypeHelper
$string = StringHelper::transliterate($string);
// remove all and keep only characters and numbers and point (TODO just one point)
- $string = trim(preg_replace("/[^A-Za-z0-9\.]/", '', (string) $string));
+ $string = trim(preg_replace("/[^A-Za-z0-9_\.]/", '', (string) $string));
// best is to return lower (for all string equality in compiler)
return strtolower($string);
diff --git a/libraries/phpseclib3/vendor/composer/installed.json b/libraries/phpseclib3/vendor/composer/installed.json
index 23601e2a9..e1f5d8705 100644
--- a/libraries/phpseclib3/vendor/composer/installed.json
+++ b/libraries/phpseclib3/vendor/composer/installed.json
@@ -125,17 +125,17 @@
},
{
"name": "phpseclib/phpseclib",
- "version": "3.0.18",
- "version_normalized": "3.0.18.0",
+ "version": "3.0.33",
+ "version_normalized": "3.0.33.0",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "f28693d38ba21bb0d9f0c411ee5dae2b178201da"
+ "reference": "33fa69b2514a61138dd48e7a49f99445711e0ad0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/f28693d38ba21bb0d9f0c411ee5dae2b178201da",
- "reference": "f28693d38ba21bb0d9f0c411ee5dae2b178201da",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/33fa69b2514a61138dd48e7a49f99445711e0ad0",
+ "reference": "33fa69b2514a61138dd48e7a49f99445711e0ad0",
"shasum": ""
},
"require": {
@@ -153,7 +153,7 @@
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
- "time": "2022-12-17T18:26:50+00:00",
+ "time": "2023-10-21T14:00:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -218,7 +218,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
- "source": "https://github.com/phpseclib/phpseclib/tree/3.0.18"
+ "source": "https://github.com/phpseclib/phpseclib/tree/3.0.33"
},
"funding": [
{
diff --git a/libraries/phpseclib3/vendor/composer/installed.php b/libraries/phpseclib3/vendor/composer/installed.php
index db92cdf2b..a9ca29ef5 100644
--- a/libraries/phpseclib3/vendor/composer/installed.php
+++ b/libraries/phpseclib3/vendor/composer/installed.php
@@ -38,12 +38,12 @@
'dev_requirement' => false,
),
'phpseclib/phpseclib' => array(
- 'pretty_version' => '3.0.18',
- 'version' => '3.0.18.0',
+ 'pretty_version' => '3.0.33',
+ 'version' => '3.0.33.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpseclib/phpseclib',
'aliases' => array(),
- 'reference' => 'f28693d38ba21bb0d9f0c411ee5dae2b178201da',
+ 'reference' => '33fa69b2514a61138dd48e7a49f99445711e0ad0',
'dev_requirement' => false,
),
),
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/BACKERS.md b/libraries/phpseclib3/vendor/phpseclib/phpseclib/BACKERS.md
index f942f48f4..4ee6a4f9b 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/BACKERS.md
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/BACKERS.md
@@ -11,4 +11,6 @@ phpseclib ongoing development is made possible by [Tidelift](https://tidelift.co
- [Setasign](https://www.setasign.com/)
- [Charles Severance](https://github.com/csev)
- [Rachel Fish](https://github.com/itsrachelfish)
-- Tharyrok
\ No newline at end of file
+- Tharyrok
+- [cjhaas](https://github.com/cjhaas)
+- [istiak-tridip](https://github.com/istiak-tridip)
\ No newline at end of file
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/README.md b/libraries/phpseclib3/vendor/phpseclib/phpseclib/README.md
index 64c06ba28..bbb1e9f06 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/README.md
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/README.md
@@ -51,8 +51,7 @@ SSH-2, SFTP, X.509, an arbitrary-precision integer arithmetic library, Ed25519 /
* PHP4 compatible
* Composer compatible (PSR-0 autoloading)
* Install using Composer: `composer require phpseclib/phpseclib:~1.0`
-* Install using PEAR: See [phpseclib PEAR Channel Documentation](http://phpseclib.sourceforge.net/pear.htm)
-* [Download 1.0.20 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.20.zip/download)
+* [Download 1.0.21 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.21.zip/download)
## Security contact information
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
index c58379969..122507089 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
@@ -402,7 +402,7 @@ class Blowfish extends BlockCipher
// quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1
// "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider"
// in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not
- if (version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
+ if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
return false;
}
$this->cipher_name_openssl_ecb = 'bf-ecb';
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php
index a261dfc43..256c86906 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php
@@ -130,12 +130,17 @@ abstract class AsymmetricKey
*
* @param string $key
* @param string $password optional
- * @return AsymmetricKey
+ * @return \phpseclib3\Crypt\Common\PublicKey|\phpseclib3\Crypt\Common\PrivateKey
*/
public static function load($key, $password = false)
{
self::initialize_static_variables();
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('load() should not be called from final classes (' . static::class . ')');
+ }
+
$components = false;
foreach (self::$plugins[static::ALGORITHM]['Keys'] as $format) {
if (isset(self::$invisiblePlugins[static::ALGORITHM]) && in_array($format, self::$invisiblePlugins[static::ALGORITHM])) {
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php
index 9f540049c..4638a5393 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php
@@ -315,6 +315,13 @@ abstract class PKCS8 extends PKCS
*/
protected static function load($key, $password = '')
{
+ if (!Strings::is_stringable($key)) {
+ throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
+ }
+
+ $isPublic = strpos($key, 'PUBLIC') !== false;
+ $isPrivate = strpos($key, 'PRIVATE') !== false;
+
$decoded = self::preParse($key);
$meta = [];
@@ -445,6 +452,10 @@ abstract class PKCS8 extends PKCS
$private = ASN1::asn1map($decoded[0], Maps\OneAsymmetricKey::MAP);
if (is_array($private)) {
+ if ($isPublic) {
+ throw new \UnexpectedValueException('Human readable string claims public key but DER encoded string claims private key');
+ }
+
if (isset($private['privateKeyAlgorithm']['parameters']) && !$private['privateKeyAlgorithm']['parameters'] instanceof ASN1\Element && isset($decoded[0]['content'][1]['content'][1])) {
$temp = $decoded[0]['content'][1]['content'][1];
$private['privateKeyAlgorithm']['parameters'] = new ASN1\Element(substr($key, $temp['start'], $temp['length']));
@@ -474,6 +485,10 @@ abstract class PKCS8 extends PKCS
$public = ASN1::asn1map($decoded[0], Maps\PublicKeyInfo::MAP);
if (is_array($public)) {
+ if ($isPrivate) {
+ throw new \UnexpectedValueException('Human readable string claims private key but DER encoded string claims public key');
+ }
+
if ($public['publicKey'][0] != "\0") {
throw new \UnexpectedValueException('The first byte of the public key should be null - not ' . bin2hex($public['publicKey'][0]));
}
@@ -650,10 +665,6 @@ abstract class PKCS8 extends PKCS
{
self::initialize_static_variables();
- if (!Strings::is_stringable($key)) {
- throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
- }
-
if (self::$format != self::MODE_DER) {
$decoded = ASN1::extractBER($key);
if ($decoded !== false) {
@@ -679,6 +690,10 @@ abstract class PKCS8 extends PKCS
*/
public static function extractEncryptionAlgorithm($key)
{
+ if (!Strings::is_stringable($key)) {
+ throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
+ }
+
$decoded = self::preParse($key);
$r = ASN1::asn1map($decoded[0], ASN1\Maps\EncryptedPrivateKeyInfo::MAP);
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php
index 30261db8b..00bfdd45c 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php
@@ -668,11 +668,11 @@ abstract class SymmetricKey
switch (true) {
// PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster
case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
- case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
+ case !(is_string(php_uname('m')) && (php_uname('m') & "\xDF\xDF\xDF") == 'ARM'):
case defined('PHP_INT_SIZE') && PHP_INT_SIZE == 8:
self::$use_reg_intval = true;
break;
- case (php_uname('m') & "\xDF\xDF\xDF") == 'ARM':
+ case is_string(php_uname('m')) && (php_uname('m') & "\xDF\xDF\xDF") == 'ARM':
switch (true) {
/* PHP 7.0.0 introduced a bug that affected 32-bit ARM processors:
@@ -917,7 +917,7 @@ abstract class SymmetricKey
* @see Crypt/Hash.php
* @param string $password
* @param string $method
- * @param string[] ...$func_args
+ * @param int|string ...$func_args
* @throws \LengthException if pbkdf1 is being used and the derived key length exceeds the hash length
* @throws \RuntimeException if bcrypt is being used and a salt isn't provided
* @return bool
@@ -2589,12 +2589,8 @@ abstract class SymmetricKey
$length = ord($text[strlen($text) - 1]);
- if (!$length) {
- // temp fix for FOFEncryptAes conversions
- // Added by Llewellyn van der Merwe
- return rtrim($text);
- } elseif ($length > $this->block_size) {
- throw new BadDecryptionException("The ciphertext has an invalid padding length ($length) compared to the block size ({$this->block_size})");
+ if (!$length || $length > $this->block_size) {
+ throw new BadDecryptionException("The ciphertext has an invalid padding length ($length) compared to the block size ({$this->block_size})");
}
return substr($text, 0, -$length);
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
index c0f1d7f92..3b0383000 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
@@ -597,7 +597,7 @@ class DES extends BlockCipher
// quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1
// "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider"
// in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not
- if (version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
+ if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
return false;
}
$this->cipher_name_openssl_ecb = 'des-ecb';
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH.php
index 876cdbf89..e1deaf086 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH.php
@@ -81,6 +81,11 @@ abstract class DH extends AsymmetricKey
*/
public static function createParameters(...$args)
{
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('createParameters() should not be called from final classes (' . static::class . ')');
+ }
+
$params = new Parameters();
if (count($args) == 2 && $args[0] instanceof BigInteger && $args[1] instanceof BigInteger) {
//if (!$args[0]->isPrime()) {
@@ -242,6 +247,11 @@ abstract class DH extends AsymmetricKey
*/
public static function createKey(Parameters $params, $length = 0)
{
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')');
+ }
+
$one = new BigInteger(1);
if ($length) {
$max = $one->bitwise_leftShift($length);
@@ -387,9 +397,9 @@ abstract class DH extends AsymmetricKey
*/
public function getParameters()
{
- $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters');
+ $type = DH::validatePlugin('Keys', 'PKCS1', 'saveParameters');
$key = $type::saveParameters($this->prime, $this->base);
- return self::load($key, 'PKCS1');
+ return DH::load($key, 'PKCS1');
}
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php
index dc5375f28..c330a3c76 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php
@@ -19,7 +19,6 @@
namespace phpseclib3\Crypt\DH\Formats\Keys;
-use phpseclib3\Common\Functions\Strings;
use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor;
use phpseclib3\File\ASN1;
use phpseclib3\File\ASN1\Maps;
@@ -62,23 +61,10 @@ abstract class PKCS8 extends Progenitor
*/
public static function load($key, $password = '')
{
- if (!Strings::is_stringable($key)) {
- throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
- }
-
- $isPublic = strpos($key, 'PUBLIC') !== false;
-
$key = parent::load($key, $password);
$type = isset($key['privateKey']) ? 'privateKey' : 'publicKey';
- switch (true) {
- case !$isPublic && $type == 'publicKey':
- throw new \UnexpectedValueException('Human readable string claims non-public key but DER encoded string claims public key');
- case $isPublic && $type == 'privateKey':
- throw new \UnexpectedValueException('Human readable string claims public key but DER encoded string claims private key');
- }
-
$decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element);
if (empty($decoded)) {
throw new \RuntimeException('Unable to decode BER of parameters');
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php
index e4c155767..c0ded84cd 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php
@@ -18,7 +18,7 @@ use phpseclib3\Crypt\DH;
*
* @author Jim Wigginton
*/
-class Parameters extends DH
+final class Parameters extends DH
{
/**
* Returns the parameters
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php
index fe03452ca..737781f87 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php
@@ -19,7 +19,7 @@ use phpseclib3\Crypt\DH;
*
* @author Jim Wigginton
*/
-class PrivateKey extends DH
+final class PrivateKey extends DH
{
use Common\Traits\PasswordProtected;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php
index 3536360cb..87726a5a3 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php
@@ -19,7 +19,7 @@ use phpseclib3\Crypt\DH;
*
* @author Jim Wigginton
*/
-class PublicKey extends DH
+final class PublicKey extends DH
{
use Common\Traits\Fingerprint;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA.php
index 1d2658605..0123c66c5 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA.php
@@ -105,6 +105,11 @@ abstract class DSA extends AsymmetricKey
{
self::initialize_static_variables();
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('createParameters() should not be called from final classes (' . static::class . ')');
+ }
+
if (!isset(self::$engines['PHP'])) {
self::useBestEngine();
}
@@ -180,6 +185,11 @@ abstract class DSA extends AsymmetricKey
{
self::initialize_static_variables();
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')');
+ }
+
if (!isset(self::$engines['PHP'])) {
self::useBestEngine();
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php
index a5858b7e5..004881e8c 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php
@@ -23,7 +23,6 @@
namespace phpseclib3\Crypt\DSA\Formats\Keys;
-use phpseclib3\Common\Functions\Strings;
use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor;
use phpseclib3\File\ASN1;
use phpseclib3\File\ASN1\Maps;
@@ -66,23 +65,10 @@ abstract class PKCS8 extends Progenitor
*/
public static function load($key, $password = '')
{
- if (!Strings::is_stringable($key)) {
- throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
- }
-
- $isPublic = strpos($key, 'PUBLIC') !== false;
-
$key = parent::load($key, $password);
$type = isset($key['privateKey']) ? 'privateKey' : 'publicKey';
- switch (true) {
- case !$isPublic && $type == 'publicKey':
- throw new \UnexpectedValueException('Human readable string claims non-public key but DER encoded string claims public key');
- case $isPublic && $type == 'privateKey':
- throw new \UnexpectedValueException('Human readable string claims public key but DER encoded string claims private key');
- }
-
$decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element);
if (!$decoded) {
throw new \RuntimeException('Unable to decode BER of parameters');
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php
index 6bcb152d2..84d16ba68 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php
@@ -18,7 +18,7 @@ use phpseclib3\Crypt\DSA;
*
* @author Jim Wigginton
*/
-class Parameters extends DSA
+final class Parameters extends DSA
{
/**
* Returns the parameters
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php
index 7039941b9..74d3e69e3 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php
@@ -21,7 +21,7 @@ use phpseclib3\Math\BigInteger;
*
* @author Jim Wigginton
*/
-class PrivateKey extends DSA implements Common\PrivateKey
+final class PrivateKey extends DSA implements Common\PrivateKey
{
use Common\Traits\PasswordProtected;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php
index 7e00e24af..c14ffbdf5 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php
@@ -20,7 +20,7 @@ use phpseclib3\Crypt\DSA\Formats\Signature\ASN1 as ASN1Signature;
*
* @author Jim Wigginton
*/
-class PublicKey extends DSA implements Common\PublicKey
+final class PublicKey extends DSA implements Common\PublicKey
{
use Common\Traits\Fingerprint;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC.php
index e61f00929..10b38254a 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC.php
@@ -140,6 +140,11 @@ abstract class EC extends AsymmetricKey
{
self::initialize_static_variables();
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')');
+ }
+
if (!isset(self::$engines['PHP'])) {
self::useBestEngine();
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php
index a75162ed9..0ec7742fc 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php
@@ -23,7 +23,6 @@
namespace phpseclib3\Crypt\EC\Formats\Keys;
-use phpseclib3\Common\Functions\Strings;
use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor;
use phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve;
use phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve;
@@ -74,23 +73,10 @@ abstract class PKCS8 extends Progenitor
// one that's called
self::initialize_static_variables();
- if (!Strings::is_stringable($key)) {
- throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
- }
-
- $isPublic = strpos($key, 'PUBLIC') !== false;
-
$key = parent::load($key, $password);
$type = isset($key['privateKey']) ? 'privateKey' : 'publicKey';
- switch (true) {
- case !$isPublic && $type == 'publicKey':
- throw new \UnexpectedValueException('Human readable string claims non-public key but DER encoded string claims public key');
- case $isPublic && $type == 'privateKey':
- throw new \UnexpectedValueException('Human readable string claims public key but DER encoded string claims private key');
- }
-
switch ($key[$type . 'Algorithm']['algorithm']) {
case 'id-Ed25519':
case 'id-Ed448':
@@ -109,7 +95,7 @@ abstract class PKCS8 extends Progenitor
$components = [];
$components['curve'] = self::loadCurveByParam($params);
- if ($isPublic) {
+ if ($type == 'publicKey') {
$components['QA'] = self::extractPoint("\0" . $key['publicKey'], $components['curve']);
return $components;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php
index c9bf1beac..c0ed64a84 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php
@@ -18,7 +18,7 @@ use phpseclib3\Crypt\EC;
*
* @author Jim Wigginton
*/
-class Parameters extends EC
+final class Parameters extends EC
{
/**
* Returns the parameters
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php
index 8bf868629..462ea1a33 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php
@@ -29,7 +29,7 @@ use phpseclib3\Math\BigInteger;
*
* @author Jim Wigginton
*/
-class PrivateKey extends EC implements Common\PrivateKey
+final class PrivateKey extends EC implements Common\PrivateKey
{
use Common\Traits\PasswordProtected;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php
index 609d59609..4558ce34d 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php
@@ -28,7 +28,7 @@ use phpseclib3\Math\BigInteger;
*
* @author Jim Wigginton
*/
-class PublicKey extends EC implements Common\PublicKey
+final class PublicKey extends EC implements Common\PublicKey
{
use Common\Traits\Fingerprint;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
index baa5d2a1e..654c90642 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
@@ -275,7 +275,7 @@ class RC2 extends BlockCipher
// quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1
// "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider"
// in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not
- if (version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
+ if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
return false;
}
$this->cipher_name_openssl_ecb = 'rc2-ecb';
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php
index 11cfe510e..5f3bff2c0 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php
@@ -111,7 +111,7 @@ class RC4 extends StreamCipher
// quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1
// "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider"
// in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not
- if (version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
+ if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\d+\.\d+\.\d+) .*#', '$1', OPENSSL_VERSION_TEXT), '3.0.1', '>=')) {
return false;
}
$this->cipher_name_openssl = 'rc4-40';
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
index 207a9051b..135719979 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
@@ -304,6 +304,11 @@ abstract class RSA extends AsymmetricKey
{
self::initialize_static_variables();
+ $class = new \ReflectionClass(static::class);
+ if ($class->isFinal()) {
+ throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')');
+ }
+
$regSize = $bits >> 1; // divide by two to see how many bits P and Q would be
if ($regSize > self::$smallestPrime) {
$num_primes = floor($bits / self::$smallestPrime);
@@ -836,15 +841,15 @@ abstract class RSA extends AsymmetricKey
self::ENCRYPTION_PKCS1,
self::ENCRYPTION_NONE
];
- $numSelected = 0;
+ $encryptedCount = 0;
$selected = 0;
foreach ($masks as $mask) {
if ($padding & $mask) {
$selected = $mask;
- $numSelected++;
+ $encryptedCount++;
}
}
- if ($numSelected > 1) {
+ if ($encryptedCount > 1) {
throw new InconsistentSetupException('Multiple encryption padding modes have been selected; at most only one should be selected');
}
$encryptionPadding = $selected;
@@ -854,22 +859,26 @@ abstract class RSA extends AsymmetricKey
self::SIGNATURE_RELAXED_PKCS1,
self::SIGNATURE_PKCS1
];
- $numSelected = 0;
+ $signatureCount = 0;
$selected = 0;
foreach ($masks as $mask) {
if ($padding & $mask) {
$selected = $mask;
- $numSelected++;
+ $signatureCount++;
}
}
- if ($numSelected > 1) {
+ if ($signatureCount > 1) {
throw new InconsistentSetupException('Multiple signature padding modes have been selected; at most only one should be selected');
}
$signaturePadding = $selected;
$new = clone $this;
- $new->encryptionPadding = $encryptionPadding;
- $new->signaturePadding = $signaturePadding;
+ if ($encryptedCount) {
+ $new->encryptionPadding = $encryptionPadding;
+ }
+ if ($signatureCount) {
+ $new->signaturePadding = $signaturePadding;
+ }
return $new;
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php
index 7ff9a1992..1eaac6ef8 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php
@@ -25,7 +25,6 @@
namespace phpseclib3\Crypt\RSA\Formats\Keys;
-use phpseclib3\Common\Functions\Strings;
use phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor;
use phpseclib3\File\ASN1;
use phpseclib3\Math\BigInteger;
@@ -67,29 +66,13 @@ abstract class PKCS8 extends Progenitor
*/
public static function load($key, $password = '')
{
- if (!Strings::is_stringable($key)) {
- throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
- }
-
- if (strpos($key, 'PUBLIC') !== false) {
- $components = ['isPublicKey' => true];
- } elseif (strpos($key, 'PRIVATE') !== false) {
- $components = ['isPublicKey' => false];
- } else {
- $components = [];
- }
-
$key = parent::load($key, $password);
if (isset($key['privateKey'])) {
- if (!isset($components['isPublicKey'])) {
- $components['isPublicKey'] = false;
- }
+ $components['isPublicKey'] = false;
$type = 'private';
} else {
- if (!isset($components['isPublicKey'])) {
- $components['isPublicKey'] = true;
- }
+ $components['isPublicKey'] = true;
$type = 'public';
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php
index 84cede8e6..37dd09a45 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php
@@ -23,7 +23,7 @@ use phpseclib3\Math\BigInteger;
*
* @author Jim Wigginton
*/
-class PrivateKey extends RSA implements Common\PrivateKey
+final class PrivateKey extends RSA implements Common\PrivateKey
{
use Common\Traits\PasswordProtected;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php
index 89408792a..58939a9f6 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php
@@ -28,7 +28,7 @@ use phpseclib3\Math\BigInteger;
*
* @author Jim Wigginton
*/
-class PublicKey extends RSA implements Common\PublicKey
+final class PublicKey extends RSA implements Common\PublicKey
{
use Common\Traits\Fingerprint;
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
index cd8b76272..ff31f9c88 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
@@ -833,7 +833,6 @@ class Rijndael extends BlockCipher
// Generating encrypt code:
$init_encrypt .= '
- static $tables;
if (empty($tables)) {
$tables = &$this->getTables();
}
@@ -890,7 +889,6 @@ class Rijndael extends BlockCipher
// Generating decrypt code:
$init_decrypt .= '
- static $invtables;
if (empty($invtables)) {
$invtables = &$this->getInvTables();
}
@@ -947,7 +945,7 @@ class Rijndael extends BlockCipher
$this->inline_crypt = $this->createInlineCryptFunction(
[
- 'init_crypt' => '',
+ 'init_crypt' => 'static $tables; static $invtables;',
'init_encrypt' => $init_encrypt,
'init_decrypt' => $init_decrypt,
'encrypt_block' => $encrypt_block,
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php
index e21589c51..3096ff1a1 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php
@@ -21,7 +21,6 @@
namespace phpseclib3\File;
-use DateTime;
use phpseclib3\Common\Functions\Strings;
use phpseclib3\File\ASN1\Element;
use phpseclib3\Math\BigInteger;
@@ -205,7 +204,7 @@ abstract class ASN1
return null;
}
- return [self::decode_ber($encoded)];
+ return [$decoded];
}
/**
@@ -1403,7 +1402,7 @@ abstract class ASN1
return false;
}
break;
- case ($c & 0x80000000) != 0:
+ case ($c & (PHP_INT_SIZE == 8 ? 0x80000000 : (1 << 31))) != 0:
return false;
case $c >= 0x04000000:
$v .= chr(0x80 | ($c & 0x3F));
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/X509.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
index 7aa278f2a..5e2f073f4 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
@@ -164,7 +164,7 @@ class X509
*
* @var array
*/
- private $CAs;
+ private $CAs = [];
/**
* The currently loaded certificate
@@ -315,6 +315,10 @@ class X509
'id-at-uniqueIdentifier' => '2.5.4.45',
'id-at-role' => '2.5.4.72',
'id-at-postalAddress' => '2.5.4.16',
+ 'jurisdictionOfIncorporationCountryName' => '1.3.6.1.4.1.311.60.2.1.3',
+ 'jurisdictionOfIncorporationStateOrProvinceName' => '1.3.6.1.4.1.311.60.2.1.2',
+ 'jurisdictionLocalityName' => '1.3.6.1.4.1.311.60.2.1.1',
+ 'id-at-businessCategory' => '2.5.4.15',
//'id-domainComponent' => '0.9.2342.19200300.100.1.25',
//'pkcs-9' => '1.2.840.113549.1.9',
@@ -1038,7 +1042,8 @@ class X509
if ($names = $this->getExtension('id-ce-subjectAltName')) {
foreach ($names as $name) {
foreach ($name as $key => $value) {
- $value = str_replace(['.', '*'], ['\.', '[^.]*'], $value);
+ $value = preg_quote($value);
+ $value = str_replace('\*', '[^.]*', $value);
switch ($key) {
case 'dNSName':
/* From RFC2818 "HTTP over TLS":
@@ -1538,6 +1543,20 @@ class X509
private function translateDNProp($propName)
{
switch (strtolower($propName)) {
+ case 'jurisdictionofincorporationcountryname':
+ case 'jurisdictioncountryname':
+ case 'jurisdictionc':
+ return 'jurisdictionOfIncorporationCountryName';
+ case 'jurisdictionofincorporationstateorprovincename':
+ case 'jurisdictionstateorprovincename':
+ case 'jurisdictionst':
+ return 'jurisdictionOfIncorporationStateOrProvinceName';
+ case 'jurisdictionlocalityname':
+ case 'jurisdictionl':
+ return 'jurisdictionLocalityName';
+ case 'id-at-businesscategory':
+ case 'businesscategory':
+ return 'id-at-businessCategory';
case 'id-at-countryname':
case 'countryname':
case 'c':
@@ -2030,9 +2049,6 @@ class X509
if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
return false;
}
- if (empty($this->CAs)) {
- return $chain;
- }
while (true) {
$currentCert = $chain[count($chain) - 1];
for ($i = 0; $i < count($this->CAs); $i++) {
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
index b3ab84a80..3f4dc2ed7 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
@@ -29,6 +29,7 @@ namespace phpseclib3\Math;
use phpseclib3\Exception\BadConfigurationException;
use phpseclib3\Math\BigInteger\Engines\Engine;
+use UnexpectedValueException;
/**
* Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256
@@ -100,10 +101,6 @@ class BigInteger implements \JsonSerializable
/** @var class-string $fqmain */
self::$mainEngine = $fqmain;
- if (!in_array('Default', $modexps)) {
- $modexps[] = 'DefaultEngine';
- }
-
$found = false;
foreach ($modexps as $modexp) {
try {
@@ -140,18 +137,23 @@ class BigInteger implements \JsonSerializable
{
if (!isset(self::$mainEngine)) {
$engines = [
- ['GMP'],
+ ['GMP', ['DefaultEngine']],
['PHP64', ['OpenSSL']],
['BCMath', ['OpenSSL']],
- ['PHP32', ['OpenSSL']]
+ ['PHP32', ['OpenSSL']],
+ ['PHP64', ['DefaultEngine']],
+ ['PHP32', ['DefaultEngine']]
];
+
foreach ($engines as $engine) {
try {
- self::setEngine($engine[0], isset($engine[1]) ? $engine[1] : []);
- break;
+ self::setEngine($engine[0], $engine[1]);
+ return;
} catch (\Exception $e) {
}
}
+
+ throw new UnexpectedValueException('No valid BigInteger found. This is only possible when JIT is enabled on Windows and neither the GMP or BCMath extensions are available so either disable JIT or install GMP / BCMath');
}
}
@@ -437,6 +439,8 @@ class BigInteger implements \JsonSerializable
* JSON Serialize
*
* Will be called, automatically, when json_encode() is called on a BigInteger object.
+ *
+ * @return array{hex: string, precision?: int]
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php
index 05d031c51..abdf3b475 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php
@@ -166,7 +166,7 @@ abstract class Engine implements \JsonSerializable
$x = substr($x, 1);
}
- $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x);
+ $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#s', '$1', $x);
$is_negative = false;
if ($base < 0 && hexdec($x[0]) >= 8) {
@@ -187,7 +187,7 @@ abstract class Engine implements \JsonSerializable
// (?value = preg_replace('#(?value = preg_replace('#(?value) || $this->value == '-') {
$this->value = '0';
}
@@ -200,7 +200,7 @@ abstract class Engine implements \JsonSerializable
$x = substr($x, 1);
}
- $x = preg_replace('#^([01]*).*#', '$1', $x);
+ $x = preg_replace('#^([01]*).*#s', '$1', $x);
$temp = new static(Strings::bits2bin($x), 128 * $base); // ie. either -16 or +16
$this->value = $temp->value;
@@ -370,6 +370,8 @@ abstract class Engine implements \JsonSerializable
* JSON Serialize
*
* Will be called, automatically, when json_encode() is called on a BigInteger object.
+ *
+ * @return array{hex: string, precision?: int]
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
@@ -642,6 +644,11 @@ abstract class Engine implements \JsonSerializable
return $this->normalize($temp->powModInner($e, $n));
}
+ if ($this->compare($n) > 0) {
+ list(, $temp) = $this->divide($n);
+ return $temp->powModInner($e, $n);
+ }
+
return $this->powModInner($e, $n);
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php
index ab9bdc99b..4c30da564 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php
@@ -1326,4 +1326,18 @@ abstract class PHP extends Engine
return array_reverse($vals);
}
+
+ /**
+ * @return bool
+ */
+ protected static function testJITOnWindows()
+ {
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && function_exists('opcache_get_status') && !defined('PHPSECLIB_ALLOW_JIT')) {
+ $status = opcache_get_status();
+ if ($status && isset($status['jit']) && $status['jit']['enabled'] && $status['jit']['on']) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php
index 964cd170d..3a775e7db 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php
@@ -80,10 +80,10 @@ class PHP32 extends PHP
}
$step = count($vals) & 3;
if ($step) {
- $digit = floor($digit / pow(2, 2 * $step));
+ $digit = (int) floor($digit / pow(2, 2 * $step));
}
if ($step != 3) {
- $digit &= static::MAX_DIGIT;
+ $digit = (int) fmod($digit, static::BASE_FULL);
$i++;
}
$vals[] = $digit;
@@ -102,7 +102,7 @@ class PHP32 extends PHP
*/
public static function isValidEngine()
{
- return PHP_INT_SIZE >= 4;
+ return PHP_INT_SIZE >= 4 && !self::testJITOnWindows();
}
/**
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php
index ca11c08d4..70a2e173b 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php
@@ -103,7 +103,7 @@ class PHP64 extends PHP
*/
public static function isValidEngine()
{
- return PHP_INT_SIZE >= 8;
+ return PHP_INT_SIZE >= 8 && !self::testJITOnWindows();
}
/**
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php
index 4197ed37d..3c959e94f 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php
@@ -26,6 +26,8 @@ abstract class Integer implements \JsonSerializable
*
* PHP Serialize isn't supported because unserializing would require the factory be
* serialized as well and that just sounds like too much
+ *
+ * @return array{hex: string}
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField.php
index 17ff87a0f..1a0667f09 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField.php
@@ -44,9 +44,9 @@ class PrimeField extends FiniteField
*/
public function __construct(BigInteger $modulo)
{
- //if (!$modulo->isPrime()) {
- // throw new \UnexpectedValueException('PrimeField requires a prime number be passed to the constructor');
- //}
+ if (!$modulo->isPrime()) {
+ throw new \UnexpectedValueException('PrimeField requires a prime number be passed to the constructor');
+ }
$this->instanceID = self::$instanceCounter++;
Integer::setModulo($this->instanceID, $modulo);
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php
index 2d0c10caf..ddb04912d 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php
@@ -263,13 +263,13 @@ class Integer extends Base
$r = $this->value->powMod($temp, static::$modulo[$this->instanceID]);
while (!$t->equals($one)) {
- $i = clone $one;
-
- while (!$t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) {
- $i = $i->add($one);
+ for ($i == clone $one; $i->compare($m) < 0; $i = $i->add($one)) {
+ if ($t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) {
+ break;
+ }
}
- if ($i->compare($m) >= 0) {
+ if ($i->compare($m) == 0) {
return false;
}
$b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), static::$modulo[$this->instanceID]);
@@ -312,8 +312,11 @@ class Integer extends Base
*/
public function toBytes()
{
- $length = static::$modulo[$this->instanceID]->getLengthInBytes();
- return str_pad($this->value->toBytes(), $length, "\0", STR_PAD_LEFT);
+ if (isset(static::$modulo[$this->instanceID])) {
+ $length = static::$modulo[$this->instanceID]->getLengthInBytes();
+ return str_pad($this->value->toBytes(), $length, "\0", STR_PAD_LEFT);
+ }
+ return $this->value->toBytes();
}
/**
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
index 8d0e96c62..cdf0bec69 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
@@ -93,7 +93,7 @@ class SFTP extends SSH2
* @var array
* @access private
*/
- private $packet_types = [];
+ private static $packet_types = [];
/**
* Status Codes
@@ -102,19 +102,19 @@ class SFTP extends SSH2
* @var array
* @access private
*/
- private $status_codes = [];
+ private static $status_codes = [];
/** @var array */
- private $attributes;
+ private static $attributes;
/** @var array */
- private $open_flags;
+ private static $open_flags;
/** @var array */
- private $open_flags5;
+ private static $open_flags5;
/** @var array */
- private $file_types;
+ private static $file_types;
/**
* The Request ID
@@ -350,7 +350,9 @@ class SFTP extends SSH2
*
* Connects to an SFTP server
*
- * @param string $host
+ * $host can either be a string, representing the host, or a stream resource.
+ *
+ * @param mixed $host
* @param int $port
* @param int $timeout
*/
@@ -360,154 +362,156 @@ class SFTP extends SSH2
$this->max_sftp_packet = 1 << 15;
- $this->packet_types = [
- 1 => 'NET_SFTP_INIT',
- 2 => 'NET_SFTP_VERSION',
- 3 => 'NET_SFTP_OPEN',
- 4 => 'NET_SFTP_CLOSE',
- 5 => 'NET_SFTP_READ',
- 6 => 'NET_SFTP_WRITE',
- 7 => 'NET_SFTP_LSTAT',
- 9 => 'NET_SFTP_SETSTAT',
- 10 => 'NET_SFTP_FSETSTAT',
- 11 => 'NET_SFTP_OPENDIR',
- 12 => 'NET_SFTP_READDIR',
- 13 => 'NET_SFTP_REMOVE',
- 14 => 'NET_SFTP_MKDIR',
- 15 => 'NET_SFTP_RMDIR',
- 16 => 'NET_SFTP_REALPATH',
- 17 => 'NET_SFTP_STAT',
- 18 => 'NET_SFTP_RENAME',
- 19 => 'NET_SFTP_READLINK',
- 20 => 'NET_SFTP_SYMLINK',
- 21 => 'NET_SFTP_LINK',
+ if (empty(self::$packet_types)) {
+ self::$packet_types = [
+ 1 => 'NET_SFTP_INIT',
+ 2 => 'NET_SFTP_VERSION',
+ 3 => 'NET_SFTP_OPEN',
+ 4 => 'NET_SFTP_CLOSE',
+ 5 => 'NET_SFTP_READ',
+ 6 => 'NET_SFTP_WRITE',
+ 7 => 'NET_SFTP_LSTAT',
+ 9 => 'NET_SFTP_SETSTAT',
+ 10 => 'NET_SFTP_FSETSTAT',
+ 11 => 'NET_SFTP_OPENDIR',
+ 12 => 'NET_SFTP_READDIR',
+ 13 => 'NET_SFTP_REMOVE',
+ 14 => 'NET_SFTP_MKDIR',
+ 15 => 'NET_SFTP_RMDIR',
+ 16 => 'NET_SFTP_REALPATH',
+ 17 => 'NET_SFTP_STAT',
+ 18 => 'NET_SFTP_RENAME',
+ 19 => 'NET_SFTP_READLINK',
+ 20 => 'NET_SFTP_SYMLINK',
+ 21 => 'NET_SFTP_LINK',
- 101 => 'NET_SFTP_STATUS',
- 102 => 'NET_SFTP_HANDLE',
- 103 => 'NET_SFTP_DATA',
- 104 => 'NET_SFTP_NAME',
- 105 => 'NET_SFTP_ATTRS',
+ 101 => 'NET_SFTP_STATUS',
+ 102 => 'NET_SFTP_HANDLE',
+ 103 => 'NET_SFTP_DATA',
+ 104 => 'NET_SFTP_NAME',
+ 105 => 'NET_SFTP_ATTRS',
- 200 => 'NET_SFTP_EXTENDED'
- ];
- $this->status_codes = [
- 0 => 'NET_SFTP_STATUS_OK',
- 1 => 'NET_SFTP_STATUS_EOF',
- 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE',
- 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED',
- 4 => 'NET_SFTP_STATUS_FAILURE',
- 5 => 'NET_SFTP_STATUS_BAD_MESSAGE',
- 6 => 'NET_SFTP_STATUS_NO_CONNECTION',
- 7 => 'NET_SFTP_STATUS_CONNECTION_LOST',
- 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED',
- 9 => 'NET_SFTP_STATUS_INVALID_HANDLE',
- 10 => 'NET_SFTP_STATUS_NO_SUCH_PATH',
- 11 => 'NET_SFTP_STATUS_FILE_ALREADY_EXISTS',
- 12 => 'NET_SFTP_STATUS_WRITE_PROTECT',
- 13 => 'NET_SFTP_STATUS_NO_MEDIA',
- 14 => 'NET_SFTP_STATUS_NO_SPACE_ON_FILESYSTEM',
- 15 => 'NET_SFTP_STATUS_QUOTA_EXCEEDED',
- 16 => 'NET_SFTP_STATUS_UNKNOWN_PRINCIPAL',
- 17 => 'NET_SFTP_STATUS_LOCK_CONFLICT',
- 18 => 'NET_SFTP_STATUS_DIR_NOT_EMPTY',
- 19 => 'NET_SFTP_STATUS_NOT_A_DIRECTORY',
- 20 => 'NET_SFTP_STATUS_INVALID_FILENAME',
- 21 => 'NET_SFTP_STATUS_LINK_LOOP',
- 22 => 'NET_SFTP_STATUS_CANNOT_DELETE',
- 23 => 'NET_SFTP_STATUS_INVALID_PARAMETER',
- 24 => 'NET_SFTP_STATUS_FILE_IS_A_DIRECTORY',
- 25 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_CONFLICT',
- 26 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_REFUSED',
- 27 => 'NET_SFTP_STATUS_DELETE_PENDING',
- 28 => 'NET_SFTP_STATUS_FILE_CORRUPT',
- 29 => 'NET_SFTP_STATUS_OWNER_INVALID',
- 30 => 'NET_SFTP_STATUS_GROUP_INVALID',
- 31 => 'NET_SFTP_STATUS_NO_MATCHING_BYTE_RANGE_LOCK'
- ];
- // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1
- // the order, in this case, matters quite a lot - see \phpseclib3\Net\SFTP::_parseAttributes() to understand why
- $this->attributes = [
- 0x00000001 => 'NET_SFTP_ATTR_SIZE',
- 0x00000002 => 'NET_SFTP_ATTR_UIDGID', // defined in SFTPv3, removed in SFTPv4+
- 0x00000080 => 'NET_SFTP_ATTR_OWNERGROUP', // defined in SFTPv4+
- 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS',
- 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME',
- 0x00000010 => 'NET_SFTP_ATTR_CREATETIME', // SFTPv4+
- 0x00000020 => 'NET_SFTP_ATTR_MODIFYTIME',
- 0x00000040 => 'NET_SFTP_ATTR_ACL',
- 0x00000100 => 'NET_SFTP_ATTR_SUBSECOND_TIMES',
- 0x00000200 => 'NET_SFTP_ATTR_BITS', // SFTPv5+
- 0x00000400 => 'NET_SFTP_ATTR_ALLOCATION_SIZE', // SFTPv6+
- 0x00000800 => 'NET_SFTP_ATTR_TEXT_HINT',
- 0x00001000 => 'NET_SFTP_ATTR_MIME_TYPE',
- 0x00002000 => 'NET_SFTP_ATTR_LINK_COUNT',
- 0x00004000 => 'NET_SFTP_ATTR_UNTRANSLATED_NAME',
- 0x00008000 => 'NET_SFTP_ATTR_CTIME',
- // 0x80000000 will yield a floating point on 32-bit systems and converting floating points to integers
- // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in
- // two's compliment, consists of all 1 bits) by 31. on 64-bit systems this'll yield 0xFFFFFFFF80000000.
- // that's not a problem, however, and 'anded' and a 32-bit number, as all the leading 1 bits are ignored.
- (PHP_INT_SIZE == 4 ? -1 : 0xFFFFFFFF) => 'NET_SFTP_ATTR_EXTENDED'
- ];
- // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3
- // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name
- // the array for that $this->open5_flags and similarly alter the constant names.
- $this->open_flags = [
- 0x00000001 => 'NET_SFTP_OPEN_READ',
- 0x00000002 => 'NET_SFTP_OPEN_WRITE',
- 0x00000004 => 'NET_SFTP_OPEN_APPEND',
- 0x00000008 => 'NET_SFTP_OPEN_CREATE',
- 0x00000010 => 'NET_SFTP_OPEN_TRUNCATE',
- 0x00000020 => 'NET_SFTP_OPEN_EXCL',
- 0x00000040 => 'NET_SFTP_OPEN_TEXT' // defined in SFTPv4
- ];
- // SFTPv5+ changed the flags up:
- // https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-8.1.1.3
- $this->open_flags5 = [
- // when SSH_FXF_ACCESS_DISPOSITION is a 3 bit field that controls how the file is opened
- 0x00000000 => 'NET_SFTP_OPEN_CREATE_NEW',
- 0x00000001 => 'NET_SFTP_OPEN_CREATE_TRUNCATE',
- 0x00000002 => 'NET_SFTP_OPEN_OPEN_EXISTING',
- 0x00000003 => 'NET_SFTP_OPEN_OPEN_OR_CREATE',
- 0x00000004 => 'NET_SFTP_OPEN_TRUNCATE_EXISTING',
- // the rest of the flags are not supported
- 0x00000008 => 'NET_SFTP_OPEN_APPEND_DATA', // "the offset field of SS_FXP_WRITE requests is ignored"
- 0x00000010 => 'NET_SFTP_OPEN_APPEND_DATA_ATOMIC',
- 0x00000020 => 'NET_SFTP_OPEN_TEXT_MODE',
- 0x00000040 => 'NET_SFTP_OPEN_BLOCK_READ',
- 0x00000080 => 'NET_SFTP_OPEN_BLOCK_WRITE',
- 0x00000100 => 'NET_SFTP_OPEN_BLOCK_DELETE',
- 0x00000200 => 'NET_SFTP_OPEN_BLOCK_ADVISORY',
- 0x00000400 => 'NET_SFTP_OPEN_NOFOLLOW',
- 0x00000800 => 'NET_SFTP_OPEN_DELETE_ON_CLOSE',
- 0x00001000 => 'NET_SFTP_OPEN_ACCESS_AUDIT_ALARM_INFO',
- 0x00002000 => 'NET_SFTP_OPEN_ACCESS_BACKUP',
- 0x00004000 => 'NET_SFTP_OPEN_BACKUP_STREAM',
- 0x00008000 => 'NET_SFTP_OPEN_OVERRIDE_OWNER',
- ];
- // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2
- // see \phpseclib3\Net\SFTP::_parseLongname() for an explanation
- $this->file_types = [
- 1 => 'NET_SFTP_TYPE_REGULAR',
- 2 => 'NET_SFTP_TYPE_DIRECTORY',
- 3 => 'NET_SFTP_TYPE_SYMLINK',
- 4 => 'NET_SFTP_TYPE_SPECIAL',
- 5 => 'NET_SFTP_TYPE_UNKNOWN',
- // the following types were first defined for use in SFTPv5+
- // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#section-5.2
- 6 => 'NET_SFTP_TYPE_SOCKET',
- 7 => 'NET_SFTP_TYPE_CHAR_DEVICE',
- 8 => 'NET_SFTP_TYPE_BLOCK_DEVICE',
- 9 => 'NET_SFTP_TYPE_FIFO'
- ];
- $this->define_array(
- $this->packet_types,
- $this->status_codes,
- $this->attributes,
- $this->open_flags,
- $this->open_flags5,
- $this->file_types
- );
+ 200 => 'NET_SFTP_EXTENDED'
+ ];
+ self::$status_codes = [
+ 0 => 'NET_SFTP_STATUS_OK',
+ 1 => 'NET_SFTP_STATUS_EOF',
+ 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE',
+ 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED',
+ 4 => 'NET_SFTP_STATUS_FAILURE',
+ 5 => 'NET_SFTP_STATUS_BAD_MESSAGE',
+ 6 => 'NET_SFTP_STATUS_NO_CONNECTION',
+ 7 => 'NET_SFTP_STATUS_CONNECTION_LOST',
+ 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED',
+ 9 => 'NET_SFTP_STATUS_INVALID_HANDLE',
+ 10 => 'NET_SFTP_STATUS_NO_SUCH_PATH',
+ 11 => 'NET_SFTP_STATUS_FILE_ALREADY_EXISTS',
+ 12 => 'NET_SFTP_STATUS_WRITE_PROTECT',
+ 13 => 'NET_SFTP_STATUS_NO_MEDIA',
+ 14 => 'NET_SFTP_STATUS_NO_SPACE_ON_FILESYSTEM',
+ 15 => 'NET_SFTP_STATUS_QUOTA_EXCEEDED',
+ 16 => 'NET_SFTP_STATUS_UNKNOWN_PRINCIPAL',
+ 17 => 'NET_SFTP_STATUS_LOCK_CONFLICT',
+ 18 => 'NET_SFTP_STATUS_DIR_NOT_EMPTY',
+ 19 => 'NET_SFTP_STATUS_NOT_A_DIRECTORY',
+ 20 => 'NET_SFTP_STATUS_INVALID_FILENAME',
+ 21 => 'NET_SFTP_STATUS_LINK_LOOP',
+ 22 => 'NET_SFTP_STATUS_CANNOT_DELETE',
+ 23 => 'NET_SFTP_STATUS_INVALID_PARAMETER',
+ 24 => 'NET_SFTP_STATUS_FILE_IS_A_DIRECTORY',
+ 25 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_CONFLICT',
+ 26 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_REFUSED',
+ 27 => 'NET_SFTP_STATUS_DELETE_PENDING',
+ 28 => 'NET_SFTP_STATUS_FILE_CORRUPT',
+ 29 => 'NET_SFTP_STATUS_OWNER_INVALID',
+ 30 => 'NET_SFTP_STATUS_GROUP_INVALID',
+ 31 => 'NET_SFTP_STATUS_NO_MATCHING_BYTE_RANGE_LOCK'
+ ];
+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1
+ // the order, in this case, matters quite a lot - see \phpseclib3\Net\SFTP::_parseAttributes() to understand why
+ self::$attributes = [
+ 0x00000001 => 'NET_SFTP_ATTR_SIZE',
+ 0x00000002 => 'NET_SFTP_ATTR_UIDGID', // defined in SFTPv3, removed in SFTPv4+
+ 0x00000080 => 'NET_SFTP_ATTR_OWNERGROUP', // defined in SFTPv4+
+ 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS',
+ 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME',
+ 0x00000010 => 'NET_SFTP_ATTR_CREATETIME', // SFTPv4+
+ 0x00000020 => 'NET_SFTP_ATTR_MODIFYTIME',
+ 0x00000040 => 'NET_SFTP_ATTR_ACL',
+ 0x00000100 => 'NET_SFTP_ATTR_SUBSECOND_TIMES',
+ 0x00000200 => 'NET_SFTP_ATTR_BITS', // SFTPv5+
+ 0x00000400 => 'NET_SFTP_ATTR_ALLOCATION_SIZE', // SFTPv6+
+ 0x00000800 => 'NET_SFTP_ATTR_TEXT_HINT',
+ 0x00001000 => 'NET_SFTP_ATTR_MIME_TYPE',
+ 0x00002000 => 'NET_SFTP_ATTR_LINK_COUNT',
+ 0x00004000 => 'NET_SFTP_ATTR_UNTRANSLATED_NAME',
+ 0x00008000 => 'NET_SFTP_ATTR_CTIME',
+ // 0x80000000 will yield a floating point on 32-bit systems and converting floating points to integers
+ // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in
+ // two's compliment, consists of all 1 bits) by 31. on 64-bit systems this'll yield 0xFFFFFFFF80000000.
+ // that's not a problem, however, and 'anded' and a 32-bit number, as all the leading 1 bits are ignored.
+ (PHP_INT_SIZE == 4 ? (-1 << 31) : 0x80000000) => 'NET_SFTP_ATTR_EXTENDED'
+ ];
+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3
+ // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name
+ // the array for that $this->open5_flags and similarly alter the constant names.
+ self::$open_flags = [
+ 0x00000001 => 'NET_SFTP_OPEN_READ',
+ 0x00000002 => 'NET_SFTP_OPEN_WRITE',
+ 0x00000004 => 'NET_SFTP_OPEN_APPEND',
+ 0x00000008 => 'NET_SFTP_OPEN_CREATE',
+ 0x00000010 => 'NET_SFTP_OPEN_TRUNCATE',
+ 0x00000020 => 'NET_SFTP_OPEN_EXCL',
+ 0x00000040 => 'NET_SFTP_OPEN_TEXT' // defined in SFTPv4
+ ];
+ // SFTPv5+ changed the flags up:
+ // https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-8.1.1.3
+ self::$open_flags5 = [
+ // when SSH_FXF_ACCESS_DISPOSITION is a 3 bit field that controls how the file is opened
+ 0x00000000 => 'NET_SFTP_OPEN_CREATE_NEW',
+ 0x00000001 => 'NET_SFTP_OPEN_CREATE_TRUNCATE',
+ 0x00000002 => 'NET_SFTP_OPEN_OPEN_EXISTING',
+ 0x00000003 => 'NET_SFTP_OPEN_OPEN_OR_CREATE',
+ 0x00000004 => 'NET_SFTP_OPEN_TRUNCATE_EXISTING',
+ // the rest of the flags are not supported
+ 0x00000008 => 'NET_SFTP_OPEN_APPEND_DATA', // "the offset field of SS_FXP_WRITE requests is ignored"
+ 0x00000010 => 'NET_SFTP_OPEN_APPEND_DATA_ATOMIC',
+ 0x00000020 => 'NET_SFTP_OPEN_TEXT_MODE',
+ 0x00000040 => 'NET_SFTP_OPEN_BLOCK_READ',
+ 0x00000080 => 'NET_SFTP_OPEN_BLOCK_WRITE',
+ 0x00000100 => 'NET_SFTP_OPEN_BLOCK_DELETE',
+ 0x00000200 => 'NET_SFTP_OPEN_BLOCK_ADVISORY',
+ 0x00000400 => 'NET_SFTP_OPEN_NOFOLLOW',
+ 0x00000800 => 'NET_SFTP_OPEN_DELETE_ON_CLOSE',
+ 0x00001000 => 'NET_SFTP_OPEN_ACCESS_AUDIT_ALARM_INFO',
+ 0x00002000 => 'NET_SFTP_OPEN_ACCESS_BACKUP',
+ 0x00004000 => 'NET_SFTP_OPEN_BACKUP_STREAM',
+ 0x00008000 => 'NET_SFTP_OPEN_OVERRIDE_OWNER',
+ ];
+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2
+ // see \phpseclib3\Net\SFTP::_parseLongname() for an explanation
+ self::$file_types = [
+ 1 => 'NET_SFTP_TYPE_REGULAR',
+ 2 => 'NET_SFTP_TYPE_DIRECTORY',
+ 3 => 'NET_SFTP_TYPE_SYMLINK',
+ 4 => 'NET_SFTP_TYPE_SPECIAL',
+ 5 => 'NET_SFTP_TYPE_UNKNOWN',
+ // the following types were first defined for use in SFTPv5+
+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#section-5.2
+ 6 => 'NET_SFTP_TYPE_SOCKET',
+ 7 => 'NET_SFTP_TYPE_CHAR_DEVICE',
+ 8 => 'NET_SFTP_TYPE_BLOCK_DEVICE',
+ 9 => 'NET_SFTP_TYPE_FIFO'
+ ];
+ self::define_array(
+ self::$packet_types,
+ self::$status_codes,
+ self::$attributes,
+ self::$open_flags,
+ self::$open_flags5,
+ self::$file_types
+ );
+ }
if (!defined('NET_SFTP_QUEUE_SIZE')) {
define('NET_SFTP_QUEUE_SIZE', 32);
@@ -543,22 +547,7 @@ class SFTP extends SSH2
*/
private function partial_init_sftp_connection()
{
- $this->window_size_server_to_client[self::CHANNEL] = $this->window_size;
-
- $packet = Strings::packSSH2(
- 'CsN3',
- NET_SSH2_MSG_CHANNEL_OPEN,
- 'session',
- self::CHANNEL,
- $this->window_size,
- 0x4000
- );
-
- $this->send_binary_packet($packet);
-
- $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_OPEN;
-
- $response = $this->get_channel_packet(self::CHANNEL, true);
+ $response = $this->openChannel(self::CHANNEL, true);
if ($response === true && $this->isTimeout()) {
return false;
}
@@ -715,7 +704,7 @@ class SFTP extends SSH2
if (!$this->canonicalize_paths) {
throw $e;
}
- $this->$this->canonicalize_paths = false;
+ $this->canonicalize_paths = false;
$this->reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST);
}
@@ -815,7 +804,7 @@ class SFTP extends SSH2
list($status) = Strings::unpackSSH2('N', $response);
}
- $error = $this->status_codes[$status];
+ $error = self::$status_codes[$status];
if ($this->version > 2) {
list($message) = Strings::unpackSSH2('s', $response);
@@ -2138,7 +2127,7 @@ class SFTP extends SSH2
if ($start >= 0) {
$offset = $start;
- } elseif ($mode & self::RESUME) {
+ } elseif ($mode & (self::RESUME | self::RESUME_START)) {
// if NET_SFTP_OPEN_APPEND worked as it should _size() wouldn't need to be called
$size = $this->stat($remote_file)['size'];
$offset = $size !== false ? $size : 0;
@@ -2210,6 +2199,9 @@ class SFTP extends SSH2
if ($local_start >= 0) {
fseek($fp, $local_start);
$size -= $local_start;
+ } elseif ($mode & self::RESUME) {
+ fseek($fp, $offset);
+ $size -= $offset;
}
} elseif ($dataCallback) {
$size = 0;
@@ -2497,14 +2489,6 @@ class SFTP extends SSH2
}
}
- if ($length > 0 && $length <= $offset - $start) {
- if ($local_file === false) {
- $content = substr($content, 0, $length);
- } else {
- ftruncate($fp, $length + $res_offset);
- }
- }
-
if ($fclose_check) {
fclose($fp);
@@ -2840,15 +2824,37 @@ class SFTP extends SSH2
return $this->get_stat_cache_prop($path, 'gid');
}
+ /**
+ * Recursively go through rawlist() output to get the total filesize
+ *
+ * @return int
+ */
+ private static function recursiveFilesize(array $files)
+ {
+ $size = 0;
+ foreach ($files as $name => $file) {
+ if ($name == '.' || $name == '..') {
+ continue;
+ }
+ $size += is_array($file) ?
+ self::recursiveFilesize($file) :
+ $file->size;
+ }
+ return $size;
+ }
+
/**
* Gets file size
*
* @param string $path
+ * @param bool $recursive
* @return mixed
*/
- public function filesize($path)
+ public function filesize($path, $recursive = false)
{
- return $this->get_stat_cache_prop($path, 'size');
+ return !$recursive || $this->filetype($path) != 'dir' ?
+ $this->get_stat_cache_prop($path, 'size') :
+ self::recursiveFilesize($this->rawlist($path, true));
}
/**
@@ -3041,7 +3047,7 @@ class SFTP extends SSH2
list($flags) = Strings::unpackSSH2('N', $response);
}
- foreach ($this->attributes as $key => $value) {
+ foreach (self::$attributes as $key => $value) {
switch ($flags & $key) {
case NET_SFTP_ATTR_UIDGID:
if ($this->version > 3) {
@@ -3272,7 +3278,7 @@ class SFTP extends SSH2
$stop = microtime(true);
if (defined('NET_SFTP_LOGGING')) {
- $packet_type = '-> ' . $this->packet_types[$type] .
+ $packet_type = '-> ' . self::$packet_types[$type] .
' (' . round($stop - $start, 4) . 's)';
$this->append_log($packet_type, $data);
}
@@ -3376,7 +3382,7 @@ class SFTP extends SSH2
$packet = Strings::shift($this->packet_buffer, $length);
if (defined('NET_SFTP_LOGGING')) {
- $packet_type = '<- ' . $this->packet_types[$this->packet_type] .
+ $packet_type = '<- ' . self::$packet_types[$this->packet_type] .
' (' . round($stop - $start, 4) . 's)';
$this->append_log($packet_type, $packet);
}
@@ -3420,7 +3426,7 @@ class SFTP extends SSH2
*
* Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING')
*
- * @return array|string
+ * @return array|string|false
*/
public function getSFTPLog()
{
diff --git a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
index e0e063743..581b05966 100644
--- a/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
+++ b/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
@@ -553,7 +553,7 @@ class SSH2
* @var array
* @access private
*/
- private $message_numbers = [];
+ private static $message_numbers = [];
/**
* Disconnection Message 'reason codes' defined in RFC4253
@@ -562,7 +562,7 @@ class SSH2
* @var array
* @access private
*/
- private $disconnect_reasons = [];
+ private static $disconnect_reasons = [];
/**
* SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254
@@ -571,7 +571,7 @@ class SSH2
* @var array
* @access private
*/
- private $channel_open_failure_reasons = [];
+ private static $channel_open_failure_reasons = [];
/**
* Terminal Modes
@@ -581,7 +581,7 @@ class SSH2
* @var array
* @access private
*/
- private $terminal_modes = [];
+ private static $terminal_modes = [];
/**
* SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes
@@ -591,7 +591,7 @@ class SSH2
* @var array
* @access private
*/
- private $channel_extended_data_type_codes = [];
+ private static $channel_extended_data_type_codes = [];
/**
* Send Sequence Number
@@ -646,6 +646,14 @@ class SSH2
*/
protected $channel_status = [];
+ /**
+ * The identifier of the interactive channel which was opened most recently
+ *
+ * @see self::getInteractiveChannelId()
+ * @var int
+ */
+ private $channel_id_last_interactive = 0;
+
/**
* Packet Size
*
@@ -837,20 +845,6 @@ class SSH2
*/
private $request_pty = false;
- /**
- * Flag set while exec() is running when using enablePTY()
- *
- * @var bool
- */
- private $in_request_pty_exec = false;
-
- /**
- * Flag set after startSubsystem() is called
- *
- * @var bool
- */
- private $in_subsystem;
-
/**
* Contents of stdError
*
@@ -1093,6 +1087,21 @@ class SSH2
*/
private $smartMFA = true;
+ /**
+ * How many channels are currently opened
+ *
+ * @var int
+ */
+ private $channelCount = 0;
+
+ /**
+ * Does the server support multiple channels? If not then error out
+ * when multiple channels are attempted to be opened
+ *
+ * @var bool
+ */
+ private $errorOnMultipleChannels;
+
/**
* Default Constructor.
*
@@ -1105,84 +1114,86 @@ class SSH2
*/
public function __construct($host, $port = 22, $timeout = 10)
{
- $this->message_numbers = [
- 1 => 'NET_SSH2_MSG_DISCONNECT',
- 2 => 'NET_SSH2_MSG_IGNORE',
- 3 => 'NET_SSH2_MSG_UNIMPLEMENTED',
- 4 => 'NET_SSH2_MSG_DEBUG',
- 5 => 'NET_SSH2_MSG_SERVICE_REQUEST',
- 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT',
- 20 => 'NET_SSH2_MSG_KEXINIT',
- 21 => 'NET_SSH2_MSG_NEWKEYS',
- 30 => 'NET_SSH2_MSG_KEXDH_INIT',
- 31 => 'NET_SSH2_MSG_KEXDH_REPLY',
- 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST',
- 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE',
- 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS',
- 53 => 'NET_SSH2_MSG_USERAUTH_BANNER',
+ if (empty(self::$message_numbers)) {
+ self::$message_numbers = [
+ 1 => 'NET_SSH2_MSG_DISCONNECT',
+ 2 => 'NET_SSH2_MSG_IGNORE',
+ 3 => 'NET_SSH2_MSG_UNIMPLEMENTED',
+ 4 => 'NET_SSH2_MSG_DEBUG',
+ 5 => 'NET_SSH2_MSG_SERVICE_REQUEST',
+ 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT',
+ 20 => 'NET_SSH2_MSG_KEXINIT',
+ 21 => 'NET_SSH2_MSG_NEWKEYS',
+ 30 => 'NET_SSH2_MSG_KEXDH_INIT',
+ 31 => 'NET_SSH2_MSG_KEXDH_REPLY',
+ 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST',
+ 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE',
+ 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS',
+ 53 => 'NET_SSH2_MSG_USERAUTH_BANNER',
- 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST',
- 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS',
- 82 => 'NET_SSH2_MSG_REQUEST_FAILURE',
- 90 => 'NET_SSH2_MSG_CHANNEL_OPEN',
- 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION',
- 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE',
- 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST',
- 94 => 'NET_SSH2_MSG_CHANNEL_DATA',
- 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA',
- 96 => 'NET_SSH2_MSG_CHANNEL_EOF',
- 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE',
- 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST',
- 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS',
- 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE'
- ];
- $this->disconnect_reasons = [
- 1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT',
- 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR',
- 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED',
- 4 => 'NET_SSH2_DISCONNECT_RESERVED',
- 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR',
- 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR',
- 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE',
- 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED',
- 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE',
- 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST',
- 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION',
- 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS',
- 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER',
- 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE',
- 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME'
- ];
- $this->channel_open_failure_reasons = [
- 1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED'
- ];
- $this->terminal_modes = [
- 0 => 'NET_SSH2_TTY_OP_END'
- ];
- $this->channel_extended_data_type_codes = [
- 1 => 'NET_SSH2_EXTENDED_DATA_STDERR'
- ];
+ 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST',
+ 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS',
+ 82 => 'NET_SSH2_MSG_REQUEST_FAILURE',
+ 90 => 'NET_SSH2_MSG_CHANNEL_OPEN',
+ 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION',
+ 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE',
+ 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST',
+ 94 => 'NET_SSH2_MSG_CHANNEL_DATA',
+ 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA',
+ 96 => 'NET_SSH2_MSG_CHANNEL_EOF',
+ 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE',
+ 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST',
+ 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS',
+ 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE'
+ ];
+ self::$disconnect_reasons = [
+ 1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT',
+ 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR',
+ 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED',
+ 4 => 'NET_SSH2_DISCONNECT_RESERVED',
+ 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR',
+ 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR',
+ 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE',
+ 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED',
+ 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE',
+ 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST',
+ 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION',
+ 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS',
+ 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER',
+ 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE',
+ 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME'
+ ];
+ self::$channel_open_failure_reasons = [
+ 1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED'
+ ];
+ self::$terminal_modes = [
+ 0 => 'NET_SSH2_TTY_OP_END'
+ ];
+ self::$channel_extended_data_type_codes = [
+ 1 => 'NET_SSH2_EXTENDED_DATA_STDERR'
+ ];
- $this->define_array(
- $this->message_numbers,
- $this->disconnect_reasons,
- $this->channel_open_failure_reasons,
- $this->terminal_modes,
- $this->channel_extended_data_type_codes,
- [60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'],
- [60 => 'NET_SSH2_MSG_USERAUTH_PK_OK'],
- [60 => 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST',
- 61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE'],
- // RFC 4419 - diffie-hellman-group-exchange-sha{1,256}
- [30 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST_OLD',
- 31 => 'NET_SSH2_MSG_KEXDH_GEX_GROUP',
- 32 => 'NET_SSH2_MSG_KEXDH_GEX_INIT',
- 33 => 'NET_SSH2_MSG_KEXDH_GEX_REPLY',
- 34 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST'],
- // RFC 5656 - Elliptic Curves (for curve25519-sha256@libssh.org)
- [30 => 'NET_SSH2_MSG_KEX_ECDH_INIT',
- 31 => 'NET_SSH2_MSG_KEX_ECDH_REPLY']
- );
+ self::define_array(
+ self::$message_numbers,
+ self::$disconnect_reasons,
+ self::$channel_open_failure_reasons,
+ self::$terminal_modes,
+ self::$channel_extended_data_type_codes,
+ [60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'],
+ [60 => 'NET_SSH2_MSG_USERAUTH_PK_OK'],
+ [60 => 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST',
+ 61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE'],
+ // RFC 4419 - diffie-hellman-group-exchange-sha{1,256}
+ [30 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST_OLD',
+ 31 => 'NET_SSH2_MSG_KEXDH_GEX_GROUP',
+ 32 => 'NET_SSH2_MSG_KEXDH_GEX_INIT',
+ 33 => 'NET_SSH2_MSG_KEXDH_GEX_REPLY',
+ 34 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST'],
+ // RFC 5656 - Elliptic Curves (for curve25519-sha256@libssh.org)
+ [30 => 'NET_SSH2_MSG_KEX_ECDH_INIT',
+ 31 => 'NET_SSH2_MSG_KEX_ECDH_REPLY']
+ );
+ }
/**
* Typehint is required due to a bug in Psalm: https://github.com/vimeo/psalm/issues/7508
@@ -1269,6 +1280,32 @@ class SSH2
$this->send_kex_first = false;
}
+ /**
+ * stream_select wrapper
+ *
+ * Quoting https://stackoverflow.com/a/14262151/569976,
+ * "The general approach to `EINTR` is to simply handle the error and retry the operation again"
+ *
+ * This wrapper does that loop
+ */
+ private static function stream_select(&$read, &$write, &$except, $seconds, $microseconds = null)
+ {
+ $remaining = $seconds + $microseconds / 1000000;
+ $start = microtime(true);
+ while (true) {
+ $result = @stream_select($read, $write, $except, $seconds, $microseconds);
+ if ($result !== false) {
+ return $result;
+ }
+ $elapsed = microtime(true) - $start;
+ $seconds = (int) ($remaining - floor($elapsed));
+ $microseconds = (int) (1000000 * ($remaining - $seconds));
+ if ($elapsed >= $remaining) {
+ return false;
+ }
+ }
+ }
+
/**
* Connect to an SSHv2 server
*
@@ -1333,7 +1370,7 @@ class SSH2
$start = microtime(true);
$sec = (int) floor($this->curTimeout);
$usec = (int) (1000000 * ($this->curTimeout - $sec));
- if (@stream_select($read, $write, $except, $sec, $usec) === false) {
+ if (static::stream_select($read, $write, $except, $sec, $usec) === false) {
throw new \RuntimeException('Connection timed out whilst receiving server identification string');
}
$elapsed = microtime(true) - $start;
@@ -1388,6 +1425,18 @@ class SSH2
throw new UnableToConnectException("Cannot connect to SSH $matches[3] servers");
}
+ // Ubuntu's OpenSSH from 5.8 to 6.9 didn't work with multiple channels. see
+ // https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1334916 for more info.
+ // https://lists.ubuntu.com/archives/oneiric-changes/2011-July/005772.html discusses
+ // when consolekit was incorporated.
+ // https://marc.info/?l=openssh-unix-dev&m=163409903417589&w=2 discusses some of the
+ // issues with how Ubuntu incorporated consolekit
+ $pattern = '#^SSH-2\.0-OpenSSH_([\d.]+)[^ ]* Ubuntu-.*$#';
+ $match = preg_match($pattern, $this->server_identifier, $matches);
+ $match = $match && version_compare('5.8', $matches[1], '<=');
+ $match = $match && version_compare('6.9', $matches[1], '>=');
+ $this->errorOnMultipleChannels = $match;
+
if (!$this->send_id_string_first) {
fputs($this->fsock, $this->identifier . "\r\n");
}
@@ -2121,7 +2170,7 @@ class SSH2
* The $password parameter can be a plaintext password, a \phpseclib3\Crypt\RSA|EC|DSA object, a \phpseclib3\System\SSH\Agent object or an array
*
* @param string $username
- * @param string|AsymmetricKey|array[]|Agent|null ...$args
+ * @param string|PrivateKey|array[]|Agent|null ...$args
* @return bool
* @see self::_login()
*/
@@ -2146,7 +2195,7 @@ class SSH2
* Login Helper
*
* @param string $username
- * @param string ...$args
+ * @param string|PrivateKey|array[]|Agent|null ...$args
* @return bool
* @see self::_login_helper()
*/
@@ -2664,6 +2713,16 @@ class SSH2
throw new ConnectionClosedException('Unexpected response to publickey authentication pt 2');
}
+ /**
+ * Return the currently configured timeout
+ *
+ * @return int
+ */
+ public function getTimeout()
+ {
+ return $this->timeout;
+ }
+
/**
* Set Timeout
*
@@ -2719,32 +2778,11 @@ class SSH2
return false;
}
- if ($this->in_request_pty_exec) {
- throw new \RuntimeException('If you want to run multiple exec()\'s you will need to disable (and re-enable if appropriate) a PTY for each one.');
- }
+ //if ($this->isPTYOpen()) {
+ // throw new \RuntimeException('If you want to run multiple exec()\'s you will need to disable (and re-enable if appropriate) a PTY for each one.');
+ //}
- // RFC4254 defines the (client) window size as "bytes the other party can send before it must wait for the window to
- // be adjusted". 0x7FFFFFFF is, at 2GB, the max size. technically, it should probably be decremented, but,
- // honestly, if you're transferring more than 2GB, you probably shouldn't be using phpseclib, anyway.
- // see http://tools.ietf.org/html/rfc4254#section-5.2 for more info
- $this->window_size_server_to_client[self::CHANNEL_EXEC] = $this->window_size;
- // 0x8000 is the maximum max packet size, per http://tools.ietf.org/html/rfc4253#section-6.1, although since PuTTy
- // uses 0x4000, that's what will be used here, as well.
- $packet_size = 0x4000;
-
- $packet = Strings::packSSH2(
- 'CsN3',
- NET_SSH2_MSG_CHANNEL_OPEN,
- 'session',
- self::CHANNEL_EXEC,
- $this->window_size_server_to_client[self::CHANNEL_EXEC],
- $packet_size
- );
- $this->send_binary_packet($packet);
-
- $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_OPEN;
-
- $this->get_channel_packet(self::CHANNEL_EXEC);
+ $this->openChannel(self::CHANNEL_EXEC);
if ($this->request_pty === true) {
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
@@ -2769,8 +2807,6 @@ class SSH2
$this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION);
throw new \RuntimeException('Unable to request pseudo-terminal');
}
-
- $this->in_request_pty_exec = true;
}
// sending a pty-req SSH_MSG_CHANNEL_REQUEST message is unnecessary and, in fact, in most cases, slows things
@@ -2800,7 +2836,8 @@ class SSH2
$this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA;
- if ($this->in_request_pty_exec) {
+ if ($this->request_pty === true) {
+ $this->channel_id_last_interactive = self::CHANNEL_EXEC;
return true;
}
@@ -2826,37 +2863,80 @@ class SSH2
}
/**
- * Creates an interactive shell
+ * How many channels are currently open?
*
- * @see self::read()
- * @see self::write()
- * @return bool
- * @throws \UnexpectedValueException on receipt of unexpected packets
- * @throws \RuntimeException on other errors
+ * @return int
*/
- private function initShell()
+ public function getOpenChannelCount()
{
- if ($this->in_request_pty_exec === true) {
- return true;
+ return $this->channelCount;
+ }
+
+ /**
+ * Opens a channel
+ *
+ * @param string $channel
+ * @param bool $skip_extended
+ * @return bool
+ */
+ protected function openChannel($channel, $skip_extended = false)
+ {
+ if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) {
+ throw new \RuntimeException('Please close the channel (' . $channel . ') before trying to open it again');
}
- $this->window_size_server_to_client[self::CHANNEL_SHELL] = $this->window_size;
+ $this->channelCount++;
+
+ if ($this->channelCount > 1 && $this->errorOnMultipleChannels) {
+ throw new \RuntimeException("Ubuntu's OpenSSH from 5.8 to 6.9 doesn't work with multiple channels");
+ }
+
+ // RFC4254 defines the (client) window size as "bytes the other party can send before it must wait for the window to
+ // be adjusted". 0x7FFFFFFF is, at 2GB, the max size. technically, it should probably be decremented, but,
+ // honestly, if you're transferring more than 2GB, you probably shouldn't be using phpseclib, anyway.
+ // see http://tools.ietf.org/html/rfc4254#section-5.2 for more info
+ $this->window_size_server_to_client[$channel] = $this->window_size;
+ // 0x8000 is the maximum max packet size, per http://tools.ietf.org/html/rfc4253#section-6.1, although since PuTTy
+ // uses 0x4000, that's what will be used here, as well.
$packet_size = 0x4000;
$packet = Strings::packSSH2(
'CsN3',
NET_SSH2_MSG_CHANNEL_OPEN,
'session',
- self::CHANNEL_SHELL,
- $this->window_size_server_to_client[self::CHANNEL_SHELL],
+ $channel,
+ $this->window_size_server_to_client[$channel],
$packet_size
);
$this->send_binary_packet($packet);
- $this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_OPEN;
+ $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_OPEN;
- $this->get_channel_packet(self::CHANNEL_SHELL);
+ return $this->get_channel_packet($channel, $skip_extended);
+ }
+
+ /**
+ * Creates an interactive shell
+ *
+ * Returns bool(true) if the shell was opened.
+ * Returns bool(false) if the shell was already open.
+ *
+ * @see self::isShellOpen()
+ * @see self::read()
+ * @see self::write()
+ * @return bool
+ * @throws InsufficientSetupException if not authenticated
+ * @throws \UnexpectedValueException on receipt of unexpected packets
+ * @throws \RuntimeException on other errors
+ */
+ public function openShell()
+ {
+ if (!$this->isAuthenticated()) {
+ throw new InsufficientSetupException('Operation disallowed prior to login()');
+ }
+
+ $this->openChannel(self::CHANNEL_SHELL);
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
$packet = Strings::packSSH2(
@@ -2897,14 +2977,18 @@ class SSH2
$this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_DATA;
+ $this->channel_id_last_interactive = self::CHANNEL_SHELL;
+
$this->bitmap |= self::MASK_SHELL;
return true;
}
/**
- * Return the channel to be used with read() / write()
- *
+ * Return the channel to be used with read(), write(), and reset(), if none were specified
+ * @deprecated for lack of transparency in intended channel target, to be potentially replaced
+ * with method which guarantees open-ness of all yielded channels and throws
+ * error for multiple open channels
* @see self::read()
* @see self::write()
* @return int
@@ -2912,15 +2996,26 @@ class SSH2
private function get_interactive_channel()
{
switch (true) {
- case $this->in_subsystem:
+ case $this->is_channel_status_data(self::CHANNEL_SUBSYSTEM):
return self::CHANNEL_SUBSYSTEM;
- case $this->in_request_pty_exec:
+ case $this->is_channel_status_data(self::CHANNEL_EXEC):
return self::CHANNEL_EXEC;
default:
return self::CHANNEL_SHELL;
}
}
+ /**
+ * Indicates the DATA status on the given channel
+ *
+ * @param int $channel The channel number to evaluate
+ * @return bool
+ */
+ private function is_channel_status_data($channel)
+ {
+ return isset($this->channel_status[$channel]) && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA;
+ }
+
/**
* Return an available open channel
*
@@ -2977,26 +3072,41 @@ class SSH2
* Returns when there's a match for $expect, which can take the form of a string literal or,
* if $mode == self::READ_REGEX, a regular expression.
*
+ * If not specifying a channel, an open interactive channel will be selected, or, if there are
+ * no open channels, an interactive shell will be created. If there are multiple open
+ * interactive channels, a legacy behavior will apply in which channel selection prioritizes
+ * an active subsystem, the exec pty, and, lastly, the shell. If using multiple interactive
+ * channels, callers are discouraged from relying on this legacy behavior and should specify
+ * the intended channel.
+ *
* @see self::write()
* @param string $expect
- * @param int $mode
+ * @param int $mode One of the self::READ_* constants
+ * @param int|null $channel Channel id returned by self::getInteractiveChannelId()
* @return string|bool|null
* @throws \RuntimeException on connection error
+ * @throws InsufficientSetupException on unexpected channel status, possibly due to closure
*/
- public function read($expect = '', $mode = self::READ_SIMPLE)
+ public function read($expect = '', $mode = self::READ_SIMPLE, $channel = null)
{
- $this->curTimeout = $this->timeout;
- $this->is_timeout = false;
-
if (!$this->isAuthenticated()) {
throw new InsufficientSetupException('Operation disallowed prior to login()');
}
- if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) {
- throw new \RuntimeException('Unable to initiate an interactive shell session');
+ $this->curTimeout = $this->timeout;
+ $this->is_timeout = false;
+
+ if ($channel === null) {
+ $channel = $this->get_interactive_channel();
}
- $channel = $this->get_interactive_channel();
+ if (!$this->is_channel_status_data($channel) && empty($this->channel_buffers[$channel])) {
+ if ($channel != self::CHANNEL_SHELL) {
+ throw new InsufficientSetupException('Data is not available on channel');
+ } elseif (!$this->openShell()) {
+ throw new \RuntimeException('Unable to initiate an interactive shell session');
+ }
+ }
if ($mode == self::READ_NEXT) {
return $this->get_channel_packet($channel);
@@ -3014,7 +3124,6 @@ class SSH2
}
$response = $this->get_channel_packet($channel);
if ($response === true) {
- $this->in_request_pty_exec = false;
return Strings::shift($this->interactiveBuffer, strlen($this->interactiveBuffer));
}
@@ -3025,22 +3134,39 @@ class SSH2
/**
* Inputs a command into an interactive shell.
*
+ * If not specifying a channel, an open interactive channel will be selected, or, if there are
+ * no open channels, an interactive shell will be created. If there are multiple open
+ * interactive channels, a legacy behavior will apply in which channel selection prioritizes
+ * an active subsystem, the exec pty, and, lastly, the shell. If using multiple interactive
+ * channels, callers are discouraged from relying on this legacy behavior and should specify
+ * the intended channel.
+ *
* @see SSH2::read()
* @param string $cmd
+ * @param int|null $channel Channel id returned by self::getInteractiveChannelId()
* @return void
* @throws \RuntimeException on connection error
+ * @throws InsufficientSetupException on unexpected channel status, possibly due to closure
*/
- public function write($cmd)
+ public function write($cmd, $channel = null)
{
if (!$this->isAuthenticated()) {
throw new InsufficientSetupException('Operation disallowed prior to login()');
}
- if (!($this->bitmap & self::MASK_SHELL) && !$this->initShell()) {
- throw new \RuntimeException('Unable to initiate an interactive shell session');
+ if ($channel === null) {
+ $channel = $this->get_interactive_channel();
}
- $this->send_channel_packet($this->get_interactive_channel(), $cmd);
+ if (!$this->is_channel_status_data($channel)) {
+ if ($channel != self::CHANNEL_SHELL) {
+ throw new InsufficientSetupException('Data is not available on channel');
+ } elseif (!$this->openShell()) {
+ throw new \RuntimeException('Unable to initiate an interactive shell session');
+ }
+ }
+
+ $this->send_channel_packet($channel, $cmd);
}
/**
@@ -3058,22 +3184,7 @@ class SSH2
*/
public function startSubsystem($subsystem)
{
- $this->window_size_server_to_client[self::CHANNEL_SUBSYSTEM] = $this->window_size;
-
- $packet = Strings::packSSH2(
- 'CsN3',
- NET_SSH2_MSG_CHANNEL_OPEN,
- 'session',
- self::CHANNEL_SUBSYSTEM,
- $this->window_size,
- 0x4000
- );
-
- $this->send_binary_packet($packet);
-
- $this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_OPEN;
-
- $this->get_channel_packet(self::CHANNEL_SUBSYSTEM);
+ $this->openChannel(self::CHANNEL_SUBSYSTEM);
$packet = Strings::packSSH2(
'CNsCs',
@@ -3093,8 +3204,7 @@ class SSH2
$this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_DATA;
- $this->bitmap |= self::MASK_SHELL;
- $this->in_subsystem = true;
+ $this->channel_id_last_interactive = self::CHANNEL_SUBSYSTEM;
return true;
}
@@ -3107,8 +3217,9 @@ class SSH2
*/
public function stopSubsystem()
{
- $this->in_subsystem = false;
- $this->close_channel(self::CHANNEL_SUBSYSTEM);
+ if ($this->isInteractiveChannelOpen(self::CHANNEL_SUBSYSTEM)) {
+ $this->close_channel(self::CHANNEL_SUBSYSTEM);
+ }
return true;
}
@@ -3117,10 +3228,23 @@ class SSH2
*
* If read() timed out you might want to just close the channel and have it auto-restart on the next read() call
*
+ * If not specifying a channel, an open interactive channel will be selected. If there are
+ * multiple open interactive channels, a legacy behavior will apply in which channel selection
+ * prioritizes an active subsystem, the exec pty, and, lastly, the shell. If using multiple
+ * interactive channels, callers are discouraged from relying on this legacy behavior and
+ * should specify the intended channel.
+ *
+ * @param int|null $channel Channel id returned by self::getInteractiveChannelId()
+ * @return void
*/
- public function reset()
+ public function reset($channel = null)
{
- $this->close_channel($this->get_interactive_channel());
+ if ($channel === null) {
+ $channel = $this->get_interactive_channel();
+ }
+ if ($this->isInteractiveChannelOpen($channel)) {
+ $this->close_channel($channel);
+ }
}
/**
@@ -3166,7 +3290,7 @@ class SSH2
*/
public function isConnected()
{
- return (bool) ($this->bitmap & self::MASK_CONNECTED);
+ return ($this->bitmap & self::MASK_CONNECTED) && is_resource($this->fsock) && !feof($this->fsock);
}
/**
@@ -3179,6 +3303,49 @@ class SSH2
return (bool) ($this->bitmap & self::MASK_LOGIN);
}
+ /**
+ * Is the interactive shell active?
+ *
+ * @return bool
+ */
+ public function isShellOpen()
+ {
+ return $this->isInteractiveChannelOpen(self::CHANNEL_SHELL);
+ }
+
+ /**
+ * Is the exec pty active?
+ *
+ * @return bool
+ */
+ public function isPTYOpen()
+ {
+ return $this->isInteractiveChannelOpen(self::CHANNEL_EXEC);
+ }
+
+ /**
+ * Is the given interactive channel active?
+ *
+ * @param int $channel Channel id returned by self::getInteractiveChannelId()
+ * @return bool
+ */
+ public function isInteractiveChannelOpen($channel)
+ {
+ return $this->isAuthenticated() && $this->is_channel_status_data($channel);
+ }
+
+ /**
+ * Returns a channel identifier, presently of the last interactive channel opened, regardless of current status.
+ * Returns 0 if no interactive channel has been opened.
+ *
+ * @see self::isInteractiveChannelOpen()
+ * @return int
+ */
+ public function getInteractiveChannelId()
+ {
+ return $this->channel_id_last_interactive;
+ }
+
/**
* Pings a server connection, or tries to reconnect if the connection has gone down
*
@@ -3195,23 +3362,8 @@ class SSH2
return false;
}
- $this->window_size_server_to_client[self::CHANNEL_KEEP_ALIVE] = $this->window_size;
- $packet_size = 0x4000;
- $packet = Strings::packSSH2(
- 'CsN3',
- NET_SSH2_MSG_CHANNEL_OPEN,
- 'session',
- self::CHANNEL_KEEP_ALIVE,
- $this->window_size_server_to_client[self::CHANNEL_KEEP_ALIVE],
- $packet_size
- );
-
try {
- $this->send_binary_packet($packet);
-
- $this->channel_status[self::CHANNEL_KEEP_ALIVE] = NET_SSH2_MSG_CHANNEL_OPEN;
-
- $response = $this->get_channel_packet(self::CHANNEL_KEEP_ALIVE);
+ $this->openChannel(self::CHANNEL_KEEP_ALIVE);
} catch (\RuntimeException $e) {
return $this->reconnect();
}
@@ -3273,9 +3425,9 @@ class SSH2
if (!$this->curTimeout) {
if ($this->keepAlive <= 0) {
- @stream_select($read, $write, $except, null);
+ static::stream_select($read, $write, $except, null);
} else {
- if (!@stream_select($read, $write, $except, $this->keepAlive)) {
+ if (!static::stream_select($read, $write, $except, $this->keepAlive)) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
return $this->get_binary_packet(true);
}
@@ -3289,7 +3441,7 @@ class SSH2
$start = microtime(true);
if ($this->keepAlive > 0 && $this->keepAlive < $this->curTimeout) {
- if (!@stream_select($read, $write, $except, $this->keepAlive)) {
+ if (!static::stream_select($read, $write, $except, $this->keepAlive)) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
$elapsed = microtime(true) - $start;
$this->curTimeout -= $elapsed;
@@ -3303,7 +3455,7 @@ class SSH2
$usec = (int) (1000000 * ($this->curTimeout - $sec));
// this can return a "stream_select(): unable to select [4]: Interrupted system call" error
- if (!@stream_select($read, $write, $except, $sec, $usec)) {
+ if (!static::stream_select($read, $write, $except, $sec, $usec)) {
$this->is_timeout = true;
return true;
}
@@ -3494,7 +3646,7 @@ class SSH2
if (defined('NET_SSH2_LOGGING')) {
$current = microtime(true);
- $message_number = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')';
+ $message_number = isset(self::$message_numbers[ord($payload[0])]) ? self::$message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')';
$message_number = '<- ' . $message_number .
' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
$this->append_log($message_number, $payload);
@@ -3576,7 +3728,7 @@ class SSH2
case NET_SSH2_MSG_DISCONNECT:
Strings::shift($payload, 1);
list($reason_code, $message) = Strings::unpackSSH2('Ns', $payload);
- $this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n$message";
+ $this->errors[] = 'SSH_MSG_DISCONNECT: ' . self::$disconnect_reasons[$reason_code] . "\r\n$message";
$this->bitmap = 0;
return false;
case NET_SSH2_MSG_IGNORE:
@@ -3763,9 +3915,8 @@ class SSH2
*/
public function disablePTY()
{
- if ($this->in_request_pty_exec) {
+ if ($this->isPTYOpen()) {
$this->close_channel(self::CHANNEL_EXEC);
- $this->in_request_pty_exec = false;
}
$this->request_pty = false;
}
@@ -3791,6 +3942,7 @@ class SSH2
* - if the connection times out
* - if the channel status is CHANNEL_OPEN and the response was CHANNEL_OPEN_CONFIRMATION
* - if the channel status is CHANNEL_REQUEST and the response was CHANNEL_SUCCESS
+ * - if the channel status is CHANNEL_CLOSE and the response was CHANNEL_CLOSE
*
* bool(false) is returned if:
*
@@ -3958,7 +4110,10 @@ class SSH2
throw new \RuntimeException('Unable to fulfill channel request');
}
case NET_SSH2_MSG_CHANNEL_CLOSE:
- return $type == NET_SSH2_MSG_CHANNEL_CLOSE ? true : $this->get_channel_packet($client_channel, $skip_extended);
+ if ($client_channel == $channel && $type == NET_SSH2_MSG_CHANNEL_CLOSE) {
+ return true;
+ }
+ return $this->get_channel_packet($client_channel, $skip_extended);
}
}
@@ -3993,14 +4148,15 @@ class SSH2
case NET_SSH2_MSG_CHANNEL_CLOSE:
$this->curTimeout = 5;
- if ($this->bitmap & self::MASK_SHELL) {
- $this->bitmap &= ~self::MASK_SHELL;
- }
+ $this->close_channel_bitmap($channel);
+
if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel]));
}
$this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE;
+ $this->channelCount--;
+
if ($client_channel == $channel) {
return true;
}
@@ -4147,7 +4303,7 @@ class SSH2
if (defined('NET_SSH2_LOGGING')) {
$current = microtime(true);
- $message_number = isset($this->message_numbers[ord($logged[0])]) ? $this->message_numbers[ord($logged[0])] : 'UNKNOWN (' . ord($logged[0]) . ')';
+ $message_number = isset(self::$message_numbers[ord($logged[0])]) ? self::$message_numbers[ord($logged[0])] : 'UNKNOWN (' . ord($logged[0]) . ')';
$message_number = '-> ' . $message_number .
' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)';
$this->append_log($message_number, $logged);
@@ -4156,7 +4312,10 @@ class SSH2
if (strlen($packet) != $sent) {
$this->bitmap = 0;
- throw new \RuntimeException("Only $sent of " . strlen($packet) . " bytes were sent");
+ $message = $sent === false ?
+ 'Unable to write ' . strlen($packet) . ' bytes' :
+ "Only $sent of " . strlen($packet) . " bytes were sent";
+ throw new \RuntimeException($message);
}
}
@@ -4332,22 +4491,36 @@ class SSH2
}
$this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE;
+ $this->channelCount--;
$this->curTimeout = 5;
while (!is_bool($this->get_channel_packet($client_channel))) {
}
- if ($this->is_timeout) {
- $this->disconnect();
- }
-
if ($want_reply) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel]));
}
- if ($this->bitmap & self::MASK_SHELL) {
- $this->bitmap &= ~self::MASK_SHELL;
+ $this->close_channel_bitmap($client_channel);
+ }
+
+ /**
+ * Maintains execution state bitmap in response to channel closure
+ *
+ * @param int $client_channel The channel number to maintain closure status of
+ * @return void
+ */
+ private function close_channel_bitmap($client_channel)
+ {
+ switch ($client_channel) {
+ case self::CHANNEL_SHELL:
+ // Shell status has been maintained in the bitmap for backwards
+ // compatibility sake, but can be removed going forward
+ if ($this->bitmap & self::MASK_SHELL) {
+ $this->bitmap &= ~self::MASK_SHELL;
+ }
+ break;
}
}
@@ -4385,7 +4558,7 @@ class SSH2
* @param mixed[] ...$args
* @access protected
*/
- protected function define_array(...$args)
+ protected static function define_array(...$args)
{
foreach ($args as $arg) {
foreach ($arg as $key => $value) {
@@ -4790,6 +4963,14 @@ class SSH2
];
}
+ /**
+ * Force multiple channels (even if phpseclib has decided to disable them)
+ */
+ public function forceMultipleChannels()
+ {
+ $this->errorOnMultipleChannels = false;
+ }
+
/**
* Allows you to set the terminal
*
diff --git a/script.php b/script.php
index 31c188a66..2ea76bcb8 100644
--- a/script.php
+++ b/script.php
@@ -6146,9 +6146,9 @@ class com_componentbuilderInstallerScript
$joomla_component->type_title = 'Componentbuilder Joomla_component';
$joomla_component->type_alias = 'com_componentbuilder.joomla_component';
$joomla_component->table = '{"special": {"dbtable": "#__componentbuilder_joomla_component","key": "id","type": "Joomla_component","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
- $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_helper_both","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","php_helper_both":"php_helper_both","crowdin_project_identifier":"crowdin_project_identifier","php_method_uninstall":"php_method_uninstall","php_preflight_install":"php_preflight_install","css_admin":"css_admin","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","php_admin_event":"php_admin_event","php_site_event":"php_site_event","description":"description","author":"author","php_postflight_install":"php_postflight_install","email":"email","sql_uninstall":"sql_uninstall","website":"website","debug_linenr":"debug_linenr","add_license":"add_license","license_type":"license_type","add_email_helper":"add_email_helper","php_helper_admin":"php_helper_admin","whmcs_key":"whmcs_key","php_helper_site":"php_helper_site","whmcs_url":"whmcs_url","javascript":"javascript","whmcs_buy_link":"whmcs_buy_link","css_site":"css_site","license":"license","bom":"bom","php_preflight_update":"php_preflight_update","image":"image","php_postflight_update":"php_postflight_update","copyright":"copyright","sql":"sql","addreadme":"addreadme","add_sales_server":"add_sales_server","update_server_url":"update_server_url","component_version":"component_version","add_powers":"add_powers","translation_tool":"translation_tool","crowdin_username":"crowdin_username","buildcompsql":"buildcompsql","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_javascript":"add_javascript","add_menu_prefix":"add_menu_prefix","add_css_admin":"add_css_admin","menu_prefix":"menu_prefix","add_css_site":"add_css_site","dashboard_type":"dashboard_type","dashboard":"dashboard","toignore":"toignore","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","add_php_postflight_install":"add_php_postflight_install","export_key":"export_key","add_php_postflight_update":"add_php_postflight_update","joomla_source_link":"joomla_source_link","add_php_method_uninstall":"add_php_method_uninstall","export_buy_link":"export_buy_link","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","crowdin_project_api_key":"crowdin_project_api_key","crowdin_account_api_key":"crowdin_account_api_key","creatuserhelper":"creatuserhelper","buildcomp":"buildcomp","adduikit":"adduikit","guid":"guid","addfootable":"addfootable","name":"name"}}';
+ $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "css_admin","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","css_admin":"css_admin","php_admin_event":"php_admin_event","php_site_event":"php_site_event","crowdin_username":"crowdin_username","component_version":"component_version","php_postflight_install":"php_postflight_install","remove_line_breaks":"remove_line_breaks","description":"description","sql_uninstall":"sql_uninstall","debug_linenr":"debug_linenr","mvc_versiondate":"mvc_versiondate","php_preflight_install":"php_preflight_install","backup_folder_path":"backup_folder_path","php_method_uninstall":"php_method_uninstall","add_placeholders":"add_placeholders","author":"author","add_sales_server":"add_sales_server","email":"email","translation_tool":"translation_tool","website":"website","buildcompsql":"buildcompsql","add_license":"add_license","php_helper_admin":"php_helper_admin","license_type":"license_type","php_helper_site":"php_helper_site","javascript":"javascript","whmcs_key":"whmcs_key","css_site":"css_site","whmcs_url":"whmcs_url","whmcs_buy_link":"whmcs_buy_link","php_preflight_update":"php_preflight_update","license":"license","php_postflight_update":"php_postflight_update","bom":"bom","sql":"sql","image":"image","addreadme":"addreadme","copyright":"copyright","update_server_url":"update_server_url","add_powers":"add_powers","add_backup_folder_path":"add_backup_folder_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_javascript":"add_javascript","add_menu_prefix":"add_menu_prefix","add_css_admin":"add_css_admin","menu_prefix":"menu_prefix","add_css_site":"add_css_site","dashboard_type":"dashboard_type","dashboard":"dashboard","toignore":"toignore","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","add_php_postflight_install":"add_php_postflight_install","export_key":"export_key","add_php_postflight_update":"add_php_postflight_update","joomla_source_link":"joomla_source_link","add_php_method_uninstall":"add_php_method_uninstall","export_buy_link":"export_buy_link","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","creatuserhelper":"creatuserhelper","adduikit":"adduikit","crowdin_project_api_key":"crowdin_project_api_key","addfootable":"addfootable","crowdin_account_api_key":"crowdin_account_api_key","add_email_helper":"add_email_helper","buildcomp":"buildcomp","add_php_helper_both":"add_php_helper_both","guid":"guid","php_helper_both":"php_helper_both","name":"name"}}';
$joomla_component->router = 'ComponentbuilderHelperRoute::getJoomla_componentRoute';
- $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","mvc_versiondate","remove_line_breaks","add_placeholders","debug_linenr","add_license","license_type","add_email_helper","addreadme","add_sales_server","add_powers","translation_tool","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","creatuserhelper","buildcomp","adduikit","addfootable"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}';
+ $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","remove_line_breaks","debug_linenr","mvc_versiondate","add_placeholders","add_sales_server","translation_tool","add_license","license_type","addreadme","add_powers","add_backup_folder_path","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","addfootable","add_email_helper","buildcomp","add_php_helper_both"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$joomla_component_Inserted = $db->insertObject('#__content_types', $joomla_component);
@@ -7616,9 +7616,9 @@ class com_componentbuilderInstallerScript
$joomla_component->type_title = 'Componentbuilder Joomla_component';
$joomla_component->type_alias = 'com_componentbuilder.joomla_component';
$joomla_component->table = '{"special": {"dbtable": "#__componentbuilder_joomla_component","key": "id","type": "Joomla_component","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
- $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_helper_both","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","php_helper_both":"php_helper_both","crowdin_project_identifier":"crowdin_project_identifier","php_method_uninstall":"php_method_uninstall","php_preflight_install":"php_preflight_install","css_admin":"css_admin","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","php_admin_event":"php_admin_event","php_site_event":"php_site_event","description":"description","author":"author","php_postflight_install":"php_postflight_install","email":"email","sql_uninstall":"sql_uninstall","website":"website","debug_linenr":"debug_linenr","add_license":"add_license","license_type":"license_type","add_email_helper":"add_email_helper","php_helper_admin":"php_helper_admin","whmcs_key":"whmcs_key","php_helper_site":"php_helper_site","whmcs_url":"whmcs_url","javascript":"javascript","whmcs_buy_link":"whmcs_buy_link","css_site":"css_site","license":"license","bom":"bom","php_preflight_update":"php_preflight_update","image":"image","php_postflight_update":"php_postflight_update","copyright":"copyright","sql":"sql","addreadme":"addreadme","add_sales_server":"add_sales_server","update_server_url":"update_server_url","component_version":"component_version","add_powers":"add_powers","translation_tool":"translation_tool","crowdin_username":"crowdin_username","buildcompsql":"buildcompsql","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_javascript":"add_javascript","add_menu_prefix":"add_menu_prefix","add_css_admin":"add_css_admin","menu_prefix":"menu_prefix","add_css_site":"add_css_site","dashboard_type":"dashboard_type","dashboard":"dashboard","toignore":"toignore","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","add_php_postflight_install":"add_php_postflight_install","export_key":"export_key","add_php_postflight_update":"add_php_postflight_update","joomla_source_link":"joomla_source_link","add_php_method_uninstall":"add_php_method_uninstall","export_buy_link":"export_buy_link","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","crowdin_project_api_key":"crowdin_project_api_key","crowdin_account_api_key":"crowdin_account_api_key","creatuserhelper":"creatuserhelper","buildcomp":"buildcomp","adduikit":"adduikit","guid":"guid","addfootable":"addfootable","name":"name"}}';
+ $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "css_admin","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","css_admin":"css_admin","php_admin_event":"php_admin_event","php_site_event":"php_site_event","crowdin_username":"crowdin_username","component_version":"component_version","php_postflight_install":"php_postflight_install","remove_line_breaks":"remove_line_breaks","description":"description","sql_uninstall":"sql_uninstall","debug_linenr":"debug_linenr","mvc_versiondate":"mvc_versiondate","php_preflight_install":"php_preflight_install","backup_folder_path":"backup_folder_path","php_method_uninstall":"php_method_uninstall","add_placeholders":"add_placeholders","author":"author","add_sales_server":"add_sales_server","email":"email","translation_tool":"translation_tool","website":"website","buildcompsql":"buildcompsql","add_license":"add_license","php_helper_admin":"php_helper_admin","license_type":"license_type","php_helper_site":"php_helper_site","javascript":"javascript","whmcs_key":"whmcs_key","css_site":"css_site","whmcs_url":"whmcs_url","whmcs_buy_link":"whmcs_buy_link","php_preflight_update":"php_preflight_update","license":"license","php_postflight_update":"php_postflight_update","bom":"bom","sql":"sql","image":"image","addreadme":"addreadme","copyright":"copyright","update_server_url":"update_server_url","add_powers":"add_powers","add_backup_folder_path":"add_backup_folder_path","crowdin_project_identifier":"crowdin_project_identifier","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_javascript":"add_javascript","add_menu_prefix":"add_menu_prefix","add_css_admin":"add_css_admin","menu_prefix":"menu_prefix","add_css_site":"add_css_site","dashboard_type":"dashboard_type","dashboard":"dashboard","toignore":"toignore","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","add_php_postflight_install":"add_php_postflight_install","export_key":"export_key","add_php_postflight_update":"add_php_postflight_update","joomla_source_link":"joomla_source_link","add_php_method_uninstall":"add_php_method_uninstall","export_buy_link":"export_buy_link","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","add_git_folder_path":"add_git_folder_path","git_folder_path":"git_folder_path","creatuserhelper":"creatuserhelper","adduikit":"adduikit","crowdin_project_api_key":"crowdin_project_api_key","addfootable":"addfootable","crowdin_account_api_key":"crowdin_account_api_key","add_email_helper":"add_email_helper","buildcomp":"buildcomp","add_php_helper_both":"add_php_helper_both","guid":"guid","php_helper_both":"php_helper_both","name":"name"}}';
$joomla_component->router = 'ComponentbuilderHelperRoute::getJoomla_componentRoute';
- $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","mvc_versiondate","remove_line_breaks","add_placeholders","debug_linenr","add_license","license_type","add_email_helper","addreadme","add_sales_server","add_powers","translation_tool","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","creatuserhelper","buildcomp","adduikit","addfootable"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}';
+ $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","remove_line_breaks","debug_linenr","mvc_versiondate","add_placeholders","add_sales_server","translation_tool","add_license","license_type","addreadme","add_powers","add_backup_folder_path","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","add_git_folder_path","creatuserhelper","adduikit","addfootable","add_email_helper","buildcomp","add_php_helper_both"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}';
// Check if joomla_component type is already in content_type DB.
$joomla_component_id = null;
@@ -9437,7 +9437,7 @@ class com_componentbuilderInstallerScript
echo '
- Upgrade to Version 3.1.27 Was Successful! Let us know if anything is not working as expected.
';
+ Upgrade to Version 3.1.28 Was Successful! Let us know if anything is not working as expected.
';
// Set db if not set already.
if (!isset($db))
diff --git a/site/language/en-GB/en-GB.com_componentbuilder.ini b/site/language/en-GB/en-GB.com_componentbuilder.ini
index f6d3fcaa2..0c1f65c4c 100644
--- a/site/language/en-GB/en-GB.com_componentbuilder.ini
+++ b/site/language/en-GB/en-GB.com_componentbuilder.ini
@@ -67,8 +67,12 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY="Joomla Component Build
COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED="Key has not changed"
COM_COMPONENTBUILDER_LICENSE_S="License: %s"
COM_COMPONENTBUILDER_LINK="Link"
+COM_COMPONENTBUILDER_LOADING_THE_PRIVATE_KEY_FILE_FAILED="Loading the private key file failed"
+COM_COMPONENTBUILDER_LOADING_THE_PRIVATE_KEY_TEXT_FAILED="Loading the private key text failed"
COM_COMPONENTBUILDER_LOCAL="Local"
+COM_COMPONENTBUILDER_LOGIN_FAILED="Login failed"
COM_COMPONENTBUILDER_MODULE="Module"
+COM_COMPONENTBUILDER_MOVING_OF_THE_S_FAILED="Moving of the %s failed"
COM_COMPONENTBUILDER_NEW="New"
COM_COMPONENTBUILDER_NONE="None"
COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!"