case 'update': validate_security($security_level, 4); // load the module installation class if (!file_exists(DIR_FS_MODULES . $method . '/classes/install.php')) { $messageStack->add(sprintf('Looking for the installation script for module %s, but could not locate it. The module cannot be installed!', $method), 'error'); break; } gen_pull_language($method, 'admin'); gen_pull_language($method); require_once DIR_FS_MODULES . $method . '/config.php'; // config is not loaded yet since module is not installed. require_once DIR_FS_MODULES . $method . '/classes/install.php'; $cName = $method . '_admin'; $mInstall = new $cName(); if ($_REQUEST['action'] == 'install') { if (admin_check_versions($method, $mInstall->prerequisites)) { // Check for version levels $error = true; } elseif (admin_install_dirs($mInstall->dirlist, DIR_FS_MY_FILES . $_SESSION['company'] . '/')) { $error = true; } elseif (admin_install_tables($mInstall->tables)) { // Create the tables $error = true; } else { // Load the installed module version into db write_configure('MODULE_' . strtoupper($method) . '_STATUS', constant('MODULE_' . strtoupper($method) . '_VERSION')); // Load the remaining configuration constants foreach ($mInstall->keys as $key => $value) { write_configure($key, $value); } if ($demo) {
foreach ($contents as $entry) { // install each module if (in_array($entry, $core_modules)) { continue; } // core module, already installed if ($entry != '.' && $entry != '..' && is_dir(DIR_FS_MODULES . $entry)) { if (DEBUG) { $messageStack->debug("\n installing additional module = " . $entry); } if (file_exists(DIR_FS_MODULES . $entry . '/config.php')) { $error = false; require_once DIR_FS_MODULES . $entry . '/classes/install.php'; $classname = $entry . '_admin'; $install_mod = new $classname(); if (admin_check_versions($entry, $install_mod->prerequisites)) { // Check for version levels $error = true; } elseif (admin_install_dirs($install_mod->dirlist, DIR_FS_MY_FILES . $_SESSION['company'] . '/')) { // Create any new directories $error = true; } elseif (admin_install_tables($install_mod->tables)) { // Create the tables $error = true; } else { // Load the installed module version into db write_configure('MODULE_' . strtoupper($entry) . '_STATUS', constant('MODULE_' . strtoupper($entry) . '_VERSION')); // Load the remaining configuration constants foreach ($install_mod->keys as $key => $value) { write_configure($key, $value); }