diff --git a/catalog/admin/modules.php b/catalog/admin/modules.php index 234608307..925d442c6 100644 --- a/catalog/admin/modules.php +++ b/catalog/admin/modules.php @@ -67,6 +67,33 @@ } require(DIR_WS_INCLUDES . 'template_top.php'); + + $modules_installed = (defined($module_key) ? explode(';', constant($module_key)) : array()); + $new_modules_counter = 0; + + $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); + $directory_array = array(); + if ($dir = @dir($module_directory)) { + while ($file = $dir->read()) { + if (!is_dir($module_directory . $file)) { + if (substr($file, strrpos($file, '.')) == $file_extension) { + if (isset($HTTP_GET_VARS['list']) && ($HTTP_GET_VARS['list'] = 'new')) { + if (!in_array($file, $modules_installed)) { + $directory_array[] = $file; + } + } else { + if (in_array($file, $modules_installed)) { + $directory_array[] = $file; + } else { + $new_modules_counter++; + } + } + } + } + } + sort($directory_array); + $dir->close(); + } ?>
' . tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_MODULES, 'set=' . $set)) . ' | '; } else { - echo '' . tep_draw_button(IMAGE_MODULE_INSTALL, 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&list=new')) . ' | '; + echo '' . tep_draw_button(IMAGE_MODULE_INSTALL . ' (' . $new_modules_counter . ')', 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&list=new')) . ' | '; } ?> @@ -95,30 +122,6 @@read()) { - if (!is_dir($module_directory . $file)) { - if (substr($file, strrpos($file, '.')) == $file_extension) { - if (isset($HTTP_GET_VARS['list']) && ($HTTP_GET_VARS['list'] = 'new')) { - if (!in_array($file, $modules_installed)) { - $directory_array[] = $file; - } - } else { - if (in_array($file, $modules_installed)) { - $directory_array[] = $file; - } - } - } - } - } - sort($directory_array); - $dir->close(); - } - $installed_modules = array(); for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) { $file = $directory_array[$i]; @@ -280,17 +283,19 @@ $contents[] = array('text' => ' |