$addons = CAT_Helper_Addons::getInstance(); // Get name and type of add on $type = $val->sanitizePost('type', NULL, true); $addon_name = $val->sanitizePost('file'); $file = $type == 'language' ? $addon_name . '.php' : $addon_name; // Check if user selected a module if (trim($file) == '' || trim($type) == '') { header("Location: index.php"); exit(0); } $js_back = CAT_ADMIN_URL . '/addons/index.php'; // Check if the module exists if (!$addons->isModuleInstalled($addon_name, NULL, preg_replace('~s$~', '', $type))) { $backend->print_error('Not installed', $js_back, false); } $path = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/' . $type . 's/' . $file); if (!file_exists($path)) { $backend->print_error('Not installed', $js_back, false); } // Check if we have permissions on the directory if (!is_writable($path)) { $backend->print_error('Unable to write to the target directory', $js_back); } $result = CAT_Helper_Addons::uninstallModule($type . 's', $addon_name); if ($result !== true) { $backend->print_error($result, $js_back, false); } else { $backend->print_success('Uninstalled successfully'); } // Print admin footer $backend->print_footer();