#1467 Minor fixes and comment adding

This commit is contained in:
Zacharie Guet
2021-10-16 11:31:37 +02:00
parent 6074e3fd46
commit 1a6fadb468
9 changed files with 137 additions and 40 deletions

View File

@@ -82,6 +82,8 @@ $template->assign('order_options',
// | start template output |
// +-----------------------------------------------------------------------+
// Beta test : show plugins of last version on PEM if the current version isn't present
// If the current version in known, give the current and last version's compatible plugins
$beta_test = false;
if(isset($_GET['beta-test']) && $_GET['beta-test'] == 'true')
@@ -115,26 +117,40 @@ if ($plugins->get_server_plugins(true, $beta_test))
. '&pwg_token='.get_pwg_token()
;
// get the age of the last revision in days
$last_revision_diff = date_diff(date_create($plugin['revision_date']), date_create());
$certification = 1;
$has_compatible_version = false;
if (get_branch_from_version($plugin['compatible_with_versions'][0]) !== get_branch_from_version(PHPWG_VERSION))
{
// Check if the current version is in the compatible version (not necessary if we are in beta test)
if ($beta_test) {
foreach ($plugin['compatible_with_versions'] as $vers) {
if (get_branch_from_version($vers) == get_branch_from_version(PHPWG_VERSION))
{
$has_compatible_version = true;
}
}
} else {
$has_compatible_version = true;
}
if (!$has_compatible_version) {
$certification = -1;
}
elseif ($last_revision_diff->days < 90)
}
elseif ($last_revision_diff->days < 90) // if the last revision is new of 3 month or less
{
$certification = 3;
}
elseif ($last_revision_diff->days < 180)
elseif ($last_revision_diff->days < 180) // 6 month or less
{
$certification = 2;
}
elseif ($last_revision_diff->y > 3)
elseif ($last_revision_diff->y > 3) // 3 years or less
{
$certification = 0;
}
// Between 6 month and 3 years : certification = 1
$template->append('plugins', array(
'ID' => $plugin['extension_id'],
@@ -144,6 +160,7 @@ if ($plugins->get_server_plugins(true, $beta_test))
'BIG_DESC' => $ext_desc,
'VERSION' => $plugin['revision_name'],
'REVISION_DATE' => preg_replace('/[^0-9]/', '', strtotime($plugin['revision_date'])),
'REVISION_FORMATED_DATE' => format_date($plugin['revision_date'], array('day','month','year')),
'AUTHOR' => $plugin['author_name'],
'DOWNLOADS' => $plugin['extension_nb_downloads'],
'URL_INSTALL' => $url_auto_install,