Skip to content

Commit e97ccce

Browse files
committed
Fixed issues in extension installer.
1 parent 074e571 commit e97ccce

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

interface/web/admin/extension_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
// if license has changed
119119
if($extension['license'] != $_POST['license']) {
120120
// check license with regex
121-
if(!preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['license'])) {
121+
if(!empty($_POST['license']) && !preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['license'])) {
122122
show_message('invalid_license_txt', 'admin/extension_repo_list.php');
123123
$success = false;
124124
}

interface/web/admin/lib/lang/en_extension_install_list.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ $wb['license_txt'] = 'License key';
4747
$wb['repo_version_txt'] = 'Repository Version';
4848
$wb['update_extension_txt'] = 'Update Extension';
4949
$wb['btn_save_txt'] = 'Save';
50+
$wb['invalid_license_txt'] = 'Invalid license key';
5051
?>

server/lib/classes/extension_installer.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,13 @@ public function updateLicense($name, $server_id, $license) {
936936
global $app;
937937

938938
// check name with regex
939-
if (!preg_match('/^[a-z0-9_]+$/', $name)) {
939+
if (!preg_match('/^[a-zA-Z0-9\-]+$/', $name)) {
940940
$this->addError('Invalid extension name.');
941941
return false;
942942
}
943943

944944
// check license
945-
if (!preg_match('/^[a-zA-Z0-9\-]+$/', $license)) {
945+
if (!empty($license) && !preg_match('/^[a-zA-Z0-9\-]+$/', $license)) {
946946
$this->addError('Invalid license.');
947947
return false;
948948
}
@@ -978,7 +978,7 @@ public function getLicense($name, $server_id) {
978978
global $app;
979979

980980
// check name with regex
981-
if (!preg_match('/^[a-z0-9_]+$/', $name)) {
981+
if (!preg_match('/^[a-zA-Z0-9\-]+$/', $name)) {
982982
$this->addError('Invalid extension name.');
983983
return false;
984984
}
@@ -1011,7 +1011,7 @@ public function deleteLicense($name, $server_id) {
10111011
global $app;
10121012

10131013
// check name with regex
1014-
if (!preg_match('/^[a-z0-9_]+$/', $name)) {
1014+
if (!preg_match('/^[a-zA-Z0-9\-]+$/', $name)) {
10151015
$this->addError('Invalid extension name.');
10161016
return false;
10171017
}

server/plugins-available/extension_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function extension_action($action_name, $data) {
113113
foreach($app->extension_installer->getErrors() as $error) {
114114
$error_txt .= $error . "\n";
115115
}
116-
$app->log('Extension installer error: ' . $error_txt, LOGLEVEL_WARNING);
116+
$app->log('Extension installer error: ' . $error_txt, LOGLEVEL_WARN);
117117
return 'error';
118118
}
119119

0 commit comments

Comments
 (0)