From bf32acaadda0a8c0908387bb95f9c0df9c6a2109 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2017 01:13:41 +0100 Subject: [PATCH] Fix control of module format. --- htdocs/admin/tools/update.php | 12 +++++++++--- htdocs/langs/en_US/errors.lang | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index e306862b67a..b062f509388 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -69,12 +69,18 @@ if ($action=='install') } else { - if (! preg_match('/\.zip/i',$original_file)) + if (! preg_match('/\.zip$/i',$original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors'); $error++; } + if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file)) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors'); + $error++; + } } if (! $error) @@ -117,7 +123,7 @@ if ($action=='install') //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { - setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), null, 'errors'); + setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'
'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors'); $error++; } } @@ -168,7 +174,7 @@ print load_fiche_titre($langs->trans("Upgrade"),'','title_setup'); print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; -if (function_exists('curl_init')) +if (!function_exists('curl_init')) { $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0e0b3e40960..2596aef5ee8 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -177,6 +177,8 @@ ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s t ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'. ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed. +ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format. +ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (%s) does not match expected name syntax: %s # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.