Index: branches/RC/admin/modules/addmodule.php =================================================================== diff -u -N -r8929 -r10832 --- branches/RC/admin/modules/addmodule.php (.../addmodule.php) (revision 8929) +++ branches/RC/admin/modules/addmodule.php (.../addmodule.php) (revision 10832) @@ -5,8 +5,8 @@ ## In-portal ## ## Intechnic Corporation ## ## All Rights Reserved, 1998-2002 ## -## ## -## No portion of this code may be copied, reproduced or ## +## ## +## No portion of this code may be copied, reproduced or ## ## otherwise redistributed without proper written ## ## consent of Intechnic Corporation. Violation will ## ## result in revocation of the license and support ## @@ -68,58 +68,66 @@ while (($file = readdir($dir)) !== false) { if ($file !="." && $file !=".." && substr($file,0,1)!="_") { if (is_dir($path.'/'.$file)) { - $inst_file = $path.'/'.$file.'/'.$admin."/install.php"; - if (file_exists($inst_file)) { + if (file_exists($path . '/' . $file . '/' . $admin . '/install.php')) { if (!$objModules->ModuleInstalled($file)) { - $new[$file] = $inst_file; + $new[$file] = false; // not new module } } + + if (file_exists($path . '/' . $file . '/install.php')) { + if ('/' . $file == ADMIN_DIRECTORY) { + // don't count in-portal folder as module + continue; + } + + if (!$objModules->ModuleInstalled($file)) { + $new[$file] = true; // new module + } + } } } } closedir($dir); } -foreach ($new as $mod => $file) +foreach ($new as $mod => $new_module) { $m = new clsModule(); + $script_location = $new_module ? '' : '/admin'; + unset($data); $data = array(); $status= admin_language("la_text_ready_to_install"); $pre_error = admin_language("la_text_prerequisit_not_passed"); - - $mod_tmp_name_arr = explode('-', $mod); - - $mod_tmp_name = ''; - foreach ($mod_tmp_name_arr as $names) { - $mod_tmp_name .= ucfirst($names)."-"; - } - - $mod_tmp_name = substr($mod_tmp_name, 0, strlen($mod_tmp_name) - 1); - + $mod_tmp_name = implode('-', array_map('ucfirst', explode('-', $mod))); + if (ed592fe427e1ce60e32ffcb0c82d8557($mod_tmp_name)) { - if (file_exists($pathtoroot.strtolower($mod_tmp_name)."/admin/install/prerequisit.php")) { - include_once($pathtoroot.strtolower($mod_tmp_name)."/admin/install/prerequisit.php"); + $result = true; + + if (file_exists($pathtoroot.strtolower($mod_tmp_name) . $script_location . '/install/prerequisit.php')) { + include_once($pathtoroot.strtolower($mod_tmp_name) . $script_location . '/install/prerequisit.php'); } - + if ($result) { // prerequisit check is ok - $data["Url"] = "$status"; + $url = $application->HREF('dummy', '_FRONT_END_', Array ('redirect' => 1, 'admin' => 1), $mod . $script_location . '/install.php'); + $data['Url'] = '' . $status . ''; } else { // prerequisit check failed $show_errors = true; - $data["Url"] = ''.$pre_error.''; + $url = $application->HREF('dummy', '', Array ('module' => strtolower($mod_tmp_name), 'is_new' => (int)$new_module), 'install/prerequisit_errors.php'); + $data['Url'] = ''.$pre_error.''; } } else { - $data["Url"] = ''.admin_language("la_module_not_licensed").''; + $data['Url'] = ''.admin_language("la_module_not_licensed").''; } - - $data["Name"] = $mod_tmp_name; - $objModList->AddItemFromArray($data); + + $data['Name'] = $mod_tmp_name; + $objModList->AddItemFromArray($data); } $itemcount = $objModList->NumItems();