$dir_source = DIR_FS_MY_FILES . $_SESSION['company'] . '/' . $source_dir . '/'; $dir_dest = DIR_FS_MY_FILES . $db_name . '/' . $source_dir . '/'; @mkdir(DIR_FS_MY_FILES . $db_name . '/' . $source_dir); $backup->copy_dir($dir_source, $dir_dest); } } break; default: // skip, should not happen } } // install reports now that categories are set up if ($_POST['phreeform_action'] != 'data') { // if=data reports have been copied, else load basic reports foreach ($copy_modules as $entry) { admin_add_reports($entry, DIR_FS_MY_FILES . $db_name . '/phreeform/'); } } } if (!$error && $_POST['phreebooks_action'] != 'data') { // install fiscal year if the phreebooks data is not copied $db->Execute("TRUNCATE TABLE " . TABLE_ACCOUNTING_PERIODS); require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php'; $dates = gen_get_dates(); validate_fiscal_year($dates['ThisYear'], '1', $dates['ThisYear'] . '-' . $dates['ThisMonth'] . '-01'); build_and_check_account_history_records(); gen_auto_update_period(false); } if (!$error) { // reset SESSION['company'] to new company and redirect to install->store_setup $db->Execute("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $co_name . "' \n\t where configuration_key = 'COMPANY_NAME'");
write_configure('MODULE_SHIPPING_USPS_STATUS', '0.1'); } // load the phreeform module gen_pull_language('phreeform', 'admin'); require_once DIR_FS_MODULES . 'phreeform/config.php'; require_once DIR_FS_MODULES . 'phreeform/defaults.php'; require_once DIR_FS_MODULES . 'phreeform/classes/install.php'; $mInstall = new phreeform_admin(); admin_install_dirs($mInstall->dirlist, DIR_FS_MY_FILES . $_SESSION['company'] . '/'); admin_install_tables($mInstall->tables); write_configure('MODULE_PHREEFORM_STATUS', constant('MODULE_PHREEFORM_VERSION')); foreach ($mInstall->keys as $key => $value) { write_configure($key, $value); } $mInstall->load_reports('phreeform'); admin_add_reports('phreeform'); $mInstall->install('phreeform'); // load installed modules and build report folders $contents = scandir(DIR_FS_MODULES); foreach ($contents as $entry) { // load the configuration files to load version info if ($entry != '.' && $entry != '..' && is_dir(DIR_FS_MODULES . $entry)) { if (defined('MODULE_' . strtoupper($entry) . '_STATUS') && $entry != 'phreeform') { // build the directories gen_pull_language($entry, 'admin'); require_once DIR_FS_MODULES . $entry . '/config.php'; require_once DIR_FS_MODULES . $entry . '/classes/install.php'; $classname = $entry . '_admin'; $install_mod = new $classname(); $install_mod->load_reports($entry); }
} if (sizeof($install_mod->notes) > 0) { $params = array_merge($params, $install_mod->notes); } } } } } if (!$error) { if (DEBUG) { $messageStack->debug("\n installing reports"); } foreach ($contents as $entry) { // install reports now that categories are set up if ($entry != '.' && $entry != '..') { admin_add_reports($entry, DIR_FS_MY_FILES . $_SESSION['company'] . '/phreeform/'); } } } if (!$error) { // input admin username record, clear the tables first if (DEBUG) { $messageStack->debug("\n installing users"); } $db->Execute("TRUNCATE TABLE " . TABLE_USERS); $db->Execute("TRUNCATE TABLE " . TABLE_USERS_PROFILES); $security = load_full_access_security(); $db->Execute($sql = "insert into " . TABLE_USERS . " set\n\t\t admin_name = '" . $user_username . "', \n\t\t\t admin_email = '" . $user_email . "', \n\t\t \t admin_pass = '******',\n\t\t\t admin_security = '" . $security . "'"); $user_id = $db->insert_ID(); if (sizeof($params) > 0) { // create My Notes dashboard entries