Example #1
0
function load_db_table($filename)
{
    global $messageStack;
    $result = db_executeSql($filename, DB_DATABASE);
    if (count($result['errors']) > 0) {
        $messageStack->add(SETUP_CO_MGR_ERROR_1, 'error');
        break;
    }
    return true;
}
<title>PhreeBooks&trade; Installer</title>
<link rel="stylesheet" type="text/css" href="<?php 
                echo DIR_WS_INSTALL_CSS;
                ?>
stylesheet.css">
</head>
<div id="wrap">
  <div id="header"><img src="<?php 
                echo DIR_WS_INSTALL_IMAGES;
                ?>
phreebooks_logo.png" height="80"></div>
  <div class="progress" align="center">Installation In Progress...<br /><br />
<?php 
            }
            // create the database tables
            db_executeSql('sql/current/tables.sql', $_POST['db_name'], $_POST['db_prefix']);
            // populate the necessary table data
            require '../../includes/database_tables.php';
            load_startup_table_data($language = $_GET['language']);
            $db->Close();
            // Create the directory and subdirectories to store company data
            define('DIR_FS_MY_FILES', '../../my_files/');
            install_build_dirs($_POST['db_name'], false);
            // done - now onto next page for Store Setup (entries into database)
            if ($zc_show_progress == 'yes') {
                $linkto = 'index.php?main_page=admin_setup&language=' . $language;
                $link = '<a href="' . $linkto . '">' . '<br /><br />Done!<br />Click Here To Continue<br /><br />' . '</a>';
                echo "\n<script type=\"text/javascript\">\nwindow.location=\"{$linkto}\";\n</script>\n";
                echo '<noscript>' . $link . '</noscript><br /><br />';
                echo '<div id="footer"><p>Copyright &copy; ' . date('Y', time()) . '<a href="http://www.PhreeSoft.com" target="_blank">PhreeSoft</a></p></div></div></body></html>';
            }
 $db_old->connect($_SESSION['db_server'], $_SESSION['db_user'], $_SESSION['db_pw'], $_SESSION['company']);
 $db = new queryFactory();
 if (!$db->connect($db_server, $db_user, $db_pw, $company)) {
     $result = $db_old->Execute_return_error("create database " . $company);
     if ($db_old->error_number) {
         $messageStack->add('DB Error # ' . $db_old->error_number . ' ' . $db_old->error_text, 'error');
         $messageStack->add(SETUP_CO_MGR_NO_DB, 'error');
         break;
     } else {
         if (!$db->connect(DB_SERVER, $db_user, $db_pw, $company)) {
             $messageStack->add(SETUP_CO_MGR_CANNOT_CONNECT, 'error');
             break;
         }
     }
 }
 $result = db_executeSql(DIR_FS_MODULES . 'install/sql/current/tables.sql', $company, DB_PREFIX);
 if (count($result['errors']) > 0) {
     $messageStack->add(SETUP_CO_MGR_ERROR_1, 'error');
     break;
 }
 // copy the required table data
 if ($action == 'new' || $action == 'copy' && !$cb_all) {
     // only if not copying all the data
     $result = load_startup_table_data($language = 'en_us');
     if (!$result) {
         $messageStack->add(SETUP_CO_MGR_ERROR_2, 'error');
         break;
     }
 }
 // create the new directory and sub-directories
 if (!install_build_dirs($company, $cb_demo)) {