Example #1
0
// |                                                                 |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/phreebooks/updates/R18toR19.php
//
// This script updates Release 1.8 to Release 1.9, it is included as part of the updater script
// *************************** IMPORTANT UPDATE INFORMATION *********************************//
//********************************* END OF IMPORTANT ****************************************//
// Release 1.8 to 1.9
if (!file_exists(DIR_FS_MY_FILES . $_SESSION['company'] . '/index.html')) {
    install_blank_webpage(DIR_FS_MY_FILES . '/index.html');
    install_blank_webpage(DIR_FS_MY_FILES . 'backups/index.html');
    install_blank_webpage(DIR_FS_MY_FILES . $_SESSION['company'] . '/index.html');
}
if (!db_field_exists(TABLE_JOURNAL_MAIN, 'printed')) {
    $db->Execute("ALTER TABLE " . TABLE_JOURNAL_MAIN . " ADD printed enum('0','1') NOT NULL DEFAULT '0' AFTER closed");
    $db->Execute("ALTER TABLE " . TABLE_JOURNAL_MAIN . " ADD INDEX (closed)");
    $db->Execute("ALTER TABLE " . TABLE_JOURNAL_MAIN . " ADD INDEX (bill_acct_id)");
}
if (!db_field_exists(TABLE_JOURNAL_ITEM, 'project_id')) {
    $db->Execute("ALTER TABLE " . TABLE_JOURNAL_ITEM . " ADD project_id VARCHAR(16) NULL AFTER serialize_number");
}
if (!db_table_exists(TABLE_PROJECTS_PHASES)) {
    $db->Execute("CREATE TABLE " . TABLE_PROJECTS_PHASES . " (\n\tphase_id int(8) NOT NULL auto_increment,\n\tdescription_short varchar(16) collate utf8_unicode_ci NOT NULL default '',\n\tdescription_long varchar(64) collate utf8_unicode_ci NOT NULL default '',\n\tcost_type varchar(3) collate utf8_unicode_ci default NULL,\n\tcost_breakdown enum('0','1') collate utf8_unicode_ci NOT NULL default '0',\n\tinactive enum('0','1') collate utf8_unicode_ci NOT NULL default '0',\n\tPRIMARY KEY (phase_id),\n\tKEY description_short (description_short)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
}
if (!db_table_exists(TABLE_PROJECTS_COSTS)) {
    $db->Execute("CREATE TABLE " . TABLE_PROJECTS_COSTS . " (\n\tcost_id int(8) NOT NULL auto_increment,\n\tdescription_short varchar(16) collate utf8_unicode_ci NOT NULL default '',\n\tdescription_long varchar(64) collate utf8_unicode_ci NOT NULL default '',\n\tcost_type varchar(3) collate utf8_unicode_ci default NULL,\n\tinactive enum('0','1') collate utf8_unicode_ci NOT NULL default '0',\n\tPRIMARY KEY (cost_id),\n\tKEY description_short (description_short)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
}
Example #2
0
function install_build_dirs($company, $include_demo = false)
{
    global $messageStack;
    if (!file_exists(DIR_FS_MY_FILES . 'backups')) {
        $status = mkdir(DIR_FS_MY_FILES . 'backups');
    }
    if (!$status) {
        $messageStack->add('Cannot create directory (' . DIR_FS_MY_FILES . 'backups' . ') check your permissions.', 'error');
        return false;
    }
    install_blank_webpage(DIR_FS_MY_FILES . 'backups/index.html');
    // protect backups directory from spiders
    if (!file_exists(DIR_FS_MY_FILES . $company)) {
        mkdir(DIR_FS_MY_FILES . $company);
    }
    install_blank_webpage(DIR_FS_MY_FILES . $company . '/index.html');
    // protect company directory from spiders
    if (!file_exists(DIR_FS_MY_FILES . $company . '/images')) {
        mkdir(DIR_FS_MY_FILES . $company . '/images');
    }
    if (!file_exists(DIR_FS_MY_FILES . $company . '/inventory')) {
        mkdir(DIR_FS_MY_FILES . $company . '/inventory');
    }
    if (!file_exists(DIR_FS_MY_FILES . $company . '/inventory/images')) {
        mkdir(DIR_FS_MY_FILES . $company . '/inventory/images');
    }
    if (!file_exists(DIR_FS_MY_FILES . $company . '/shipping')) {
        mkdir(DIR_FS_MY_FILES . $company . '/shipping');
    }
    if (!file_exists(DIR_FS_MY_FILES . $company . '/temp')) {
        mkdir(DIR_FS_MY_FILES . $company . '/temp');
    }
    @chmod(DIR_FS_MY_FILES . $company . '/temp', 0777);
    // needed for db access
    // now copy some startup files
    $source = DIR_FS_MY_FILES . '../themes/default/images/phreebooks_logo.jpg';
    // default logo for forms
    $dest = DIR_FS_MY_FILES . $company . '/images/phreebooks_logo.jpg';
    copy($source, $dest);
    if ($include_demo) {
        // now copy the demo image files
        $source_dir = DIR_FS_MY_FILES . '../themes/default/images/demo';
        $dest_dir = DIR_FS_MY_FILES . $company . '/inventory/images/demo';
        dircopy($source_dir, $dest_dir);
    }
    return true;
}