Пример #1
0
    mf_do_query($query, $params, $dbh);
    $theme_id = (int) $dbh->lastInsertId();
} else {
    //If this is old theme, update the data
    mf_ap_form_themes_update($theme_id, $theme_properties, $dbh);
    //if the theme is being deleted (status=0)
    //we need to update ap_forms table and update all forms which use the deleted theme
    $theme_status = (int) $theme_properties['status'];
    if (empty($theme_status)) {
        $query = "update " . MF_TABLE_PREFIX . "forms set form_theme_id=0 where form_theme_id=?";
        $params = array($theme_id);
        mf_do_query($query, $params, $dbh);
    }
}
//create/update the CSS file for the theme
$css_theme_filename = $mf_settings['data_dir'] . "/themes/theme_{$theme_id}.css";
$css_theme_content = mf_theme_get_css_content($dbh, $theme_id);
$fpc_result = @file_put_contents($css_theme_filename, $css_theme_content);
if (empty($fpc_result)) {
    //if we're unable to write into the css file, set the 'theme_has_css' to 0
    $params = array(0, $theme_id);
} else {
    $params = array(1, $theme_id);
}
$query = "UPDATE " . MF_TABLE_PREFIX . "form_themes SET theme_has_css = ? WHERE theme_id = ?";
mf_do_query($query, $params, $dbh);
if (!empty($theme_id)) {
    echo '{ "status" : "ok", "theme_id" : "' . $theme_id . '" }';
} else {
    echo '{ "status" : "error", "message" : "Unable to save theme." }';
}
Пример #2
0
function do_delta_update_2_x_to_3_0($dbh, $options = array())
{
    $post_install_error = '';
    $license_key = $options['license_key'];
    $new_machform_version = $options['new_machform_version'];
    $admin_username = $options['admin_username'];
    //1. Backup the old database
    if (SKIP_DB_BACKUP !== true) {
        $db_backup = new DBBackup(array('driver' => 'mysql', 'host' => MF_DB_HOST, 'user' => MF_DB_USER, 'password' => MF_DB_PASSWORD, 'database' => MF_DB_NAME));
        $backup_data = $db_backup->backup();
        if (!$backup['error']) {
            $fpc_result = file_put_contents('./data/machform2_backup.sql.php', "<?php\n" . $backup_data['msg'] . "\n?>");
        } else {
            echo 'An error has ocurred during database backup.';
        }
        unset($db_backup);
        unset($backup_data);
    }
    //2. Alter table ap_forms
    //add new columns
    $query = "ALTER TABLE `" . MF_TABLE_PREFIX . "forms`\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_tags` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_redirect_enable` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_captcha_type` char(1) NOT NULL DEFAULT 'r',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_theme_id` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_resume_enable` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_limit_enable` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_limit` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_label_alignment` varchar(11) NOT NULL DEFAULT 'top_label',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_language` varchar(50) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_page_total` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_lastpage_title` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_submit_primary_text` varchar(255) NOT NULL DEFAULT 'Submit',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_submit_secondary_text` varchar(255) NOT NULL DEFAULT 'Previous',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_submit_primary_img` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_submit_secondary_img` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_submit_use_image` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_primary_text` varchar(255) NOT NULL DEFAULT 'Submit',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_secondary_text` varchar(255) NOT NULL DEFAULT 'Previous',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_primary_img` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_secondary_img` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_use_image` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_title` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_review_description` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_pagination_type` varchar(11) NOT NULL DEFAULT 'steps',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_schedule_enable` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_schedule_start_date` date DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_schedule_end_date` date DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_schedule_start_hour` time DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `form_schedule_end_hour` time DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `esl_enable` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `esr_enable` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_enable_merchant` int(1) NOT NULL DEFAULT '-1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_merchant_type` varchar(25) NOT NULL DEFAULT 'paypal_standard',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_paypal_email` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_paypal_language` varchar(5) NOT NULL DEFAULT 'US',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_currency` varchar(5) NOT NULL DEFAULT 'USD',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_show_total` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_total_location` varchar(11) NOT NULL DEFAULT 'top',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_enable_recurring` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_recurring_cycle` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_recurring_unit` varchar(5) NOT NULL DEFAULT 'month',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_price_type` varchar(11) NOT NULL DEFAULT 'fixed',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_price_amount` decimal(62,2) NOT NULL DEFAULT '0.00',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `payment_price_name` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `entries_sort_by` varchar(100) NOT NULL DEFAULT 'id-desc',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `entries_enable_filter` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `entries_filter_type` varchar(5) NOT NULL DEFAULT 'all' COMMENT 'all or any';";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //3. Alter table ap_form_elements
    $query = "ALTER TABLE `" . MF_TABLE_PREFIX . "form_elements` \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_css_class` varchar(255) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_range_min` bigint(11) unsigned NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_range_max` bigint(11) unsigned NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_range_limit_by` char(1) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_status` int(1) NOT NULL DEFAULT '2',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_choice_columns` int(1) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_choice_has_other` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_choice_other_label` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_time_showsecond` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_time_24hour` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_address_hideline2` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_address_us_only` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_enable_range` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_range_min` date DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_range_max` date DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_enable_selection_limit` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_selection_max` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_past_future` char(1) NOT NULL DEFAULT 'p',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_disable_past_future` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_disable_weekend` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_disable_specific` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_date_disabled_list` text CHARACTER SET utf8 COLLATE utf8_bin,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_enable_type_limit` int(1) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_block_or_allow` char(1) NOT NULL DEFAULT 'b',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_type_list` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_as_attachment` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_enable_advance` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_auto_upload` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_enable_multi_upload` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_max_selection` int(11) NOT NULL DEFAULT '5',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_enable_size_limit` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_file_size_max` int(11) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_matrix_allow_multiselect` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_matrix_parent_id` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_submit_use_image` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_submit_primary_text` varchar(255) NOT NULL DEFAULT 'Continue',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_submit_secondary_text` varchar(255) NOT NULL DEFAULT 'Previous',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_submit_primary_img` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_submit_secondary_img` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_page_title` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `element_page_number` int(11) NOT NULL DEFAULT '1';";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //change the field size of element_constraint
    $query = "ALTER TABLE `" . MF_TABLE_PREFIX . "form_elements` CHANGE COLUMN `element_constraint` `element_constraint` varchar(255) DEFAULT NULL;";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //update the element_status value to 1
    $query = "UPDATE `" . MF_TABLE_PREFIX . "form_elements` SET `element_status`=1";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //4. Create table ap_element_prices
    $query = "CREATE TABLE `" . MF_TABLE_PREFIX . "element_prices` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `aep_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `element_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `option_id` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `price` decimal(62,2) NOT NULL DEFAULT '0.00',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  PRIMARY KEY (`aep_id`),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  KEY `form_id` (`form_id`),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  KEY `element_id` (`element_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //5. Create table ap_fonts
    $query = "CREATE TABLE `" . MF_TABLE_PREFIX . "fonts` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t  `font_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  `font_origin` varchar(11) NOT NULL DEFAULT 'google',\r\n\t\t\t\t\t\t\t\t\t\t\t\t  `font_family` varchar(100) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  `font_variants` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  `font_variants_numeric` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t  PRIMARY KEY (`font_id`),\r\n\t\t\t\t\t\t\t\t\t\t\t\t  KEY `font_family` (`font_family`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //insert into ap_fonts table
    $query = "INSERT INTO `" . MF_TABLE_PREFIX . "fonts` (`font_id`, `font_origin`, `font_family`, `font_variants`, `font_variants_numeric`)\r\n\tVALUES\r\n\t\t(1,'google','Open Sans','300,300italic,400,400italic,600,600italic,700,700italic,800,800italic','300,300-italic,400,400-italic,600,600-italic,700,700-italic,800,800-italic'),\r\n\t\t(2,'google','Droid Sans','regular,bold','400,700'),\r\n\t\t(3,'google','Oswald','regular','400'),\r\n\t\t(4,'google','Droid Serif','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(5,'google','Lora','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(6,'google','Yanone Kaffeesatz','200,300,400,700','200,300,400,700'),\r\n\t\t(7,'google','PT Sans','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(8,'google','Lobster','regular','400'),\r\n\t\t(9,'google','Ubuntu','300,300italic,regular,italic,500,500italic,bold,bolditalic','300,300-italic,400,400-italic,500,500-italic,700,700-italic'),\r\n\t\t(10,'google','Arvo','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(11,'google','Coming Soon','regular','400'),\r\n\t\t(12,'google','PT Sans Narrow','regular,bold','400,700'),\r\n\t\t(13,'google','The Girl Next Door','regular','400'),\r\n\t\t(14,'google','Lato','100,100italic,300,300italic,400,400italic,700,700italic,900,900italic','100,100-italic,300,300-italic,400,400-italic,700,700-italic,900,900italic'),\r\n\t\t(15,'google','Shadows Into Light','regular','400'),\r\n\t\t(16,'google','Dancing Script','regular,bold','400,700'),\r\n\t\t(17,'google','Marck Script','400','400'),\r\n\t\t(18,'google','Cabin','400,400italic,500,500italic,600,600italic,bold,bolditalic','400,400-italic,500,500-italic,600,600-italic,700,700-italic'),\r\n\t\t(19,'google','Calligraffitti','regular','400'),\r\n\t\t(20,'google','Josefin Sans','100,100italic,300,300italic,400,400italic,600,600italic,700,700italic','100,100-italic,300,300-italic,400,400-italic,600,600-italic,700,700-italic'),\r\n\t\t(21,'google','Nobile','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(22,'google','Crafty Girls','regular','400'),\r\n\t\t(23,'google','Rock Salt','regular','400'),\r\n\t\t(24,'google','Reenie Beanie','regular','400'),\r\n\t\t(25,'google','Bitter','400,400italic,700','400,400-italic,700'),\r\n\t\t(26,'google','Francois One','regular','400'),\r\n\t\t(27,'google','Raleway','100','100'),\r\n\t\t(28,'google','Cherry Cream Soda','regular','400'),\r\n\t\t(29,'google','Syncopate','regular,bold','400,700'),\r\n\t\t(30,'google','Tangerine','regular,bold','400,700'),\r\n\t\t(31,'google','Molengo','regular','400'),\r\n\t\t(32,'google','Play','regular,bold','400,700'),\r\n\t\t(33,'google','Pacifico','regular','400'),\r\n\t\t(34,'google','Arimo','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(35,'google','Chewy','regular','400'),\r\n\t\t(36,'google','Cuprum','regular','400'),\r\n\t\t(37,'google','Cantarell','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(38,'google','Walter Turncoat','regular','400'),\r\n\t\t(39,'google','Anton','regular','400'),\r\n\t\t(40,'google','Luckiest Guy','regular','400'),\r\n\t\t(41,'google','Open Sans Condensed','300,300italic','300,300-italic'),\r\n\t\t(42,'google','Vollkorn','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(43,'google','Josefin Slab','100,100italic,300,300italic,400,400italic,600,600italic,700,700italic','100,100-italic,300,300-italic,400,400-italic,600,600-italic,700,700-italic'),\r\n\t\t(44,'google','PT Serif','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(45,'google','Homemade Apple','regular','400'),\r\n\t\t(46,'google','Copse','regular','400'),\r\n\t\t(47,'google','Terminal Dosis','200,300,400,500,600,700,800','200,300,400,500,600,700,800'),\r\n\t\t(48,'google','Slackey','regular','400'),\r\n\t\t(49,'google','Kreon','300,400,700','300,400,700'),\r\n\t\t(50,'google','Permanent Marker','regular','400'),\r\n\t\t(51,'google','Crimson Text','regular,400italic,600,600italic,700,700italic','400,400-italic,600,600-italic,700,700-italic'),\r\n\t\t(52,'google','Maven Pro','400,500,700,900','400,500,700,900'),\r\n\t\t(53,'google','Droid Sans Mono','regular','400'),\r\n\t\t(54,'google','Varela Round','regular','400'),\r\n\t\t(55,'google','Philosopher','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(56,'google','News Cycle','regular','400'),\r\n\t\t(57,'google','Fontdiner Swanky','regular','400'),\r\n\t\t(58,'google','Amaranth','regular,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(59,'google','Covered By Your Grace','regular','400'),\r\n\t\t(60,'google','Marvel','400,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(61,'google','Actor','regular','400'),\r\n\t\t(62,'google','Nunito','300,400,700','300,400,700'),\r\n\t\t(63,'google','Paytone One','regular','400'),\r\n\t\t(64,'google','Ubuntu Condensed','400','400'),\r\n\t\t(65,'google','Gloria Hallelujah','regular','400'),\r\n\t\t(66,'google','Lobster Two','400,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(67,'google','Bevan','regular','400'),\r\n\t\t(68,'google','Merriweather','300,regular,700,900','300,400,700,900'),\r\n\t\t(69,'google','Old Standard TT','regular,italic,bold','400,400-italic,700'),\r\n\t\t(70,'google','Rokkitt','regular,700','400,700'),\r\n\t\t(71,'google','PT Sans Caption','regular,bold','400,700'),\r\n\t\t(72,'google','Architects Daughter','regular','400'),\r\n\t\t(73,'google','Abel','regular','400'),\r\n\t\t(74,'google','Neucha','regular','400'),\r\n\t\t(75,'google','Istok Web','400,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(76,'google','Allerta','regular','400'),\r\n\t\t(77,'google','Questrial','400','400'),\r\n\t\t(78,'google','Allerta Stencil','regular','400'),\r\n\t\t(79,'google','MedievalSharp','regular','400'),\r\n\t\t(80,'google','Indie Flower','regular','400'),\r\n\t\t(81,'google','Carter One','regular','400'),\r\n\t\t(82,'google','Cabin Sketch','regular,bold','400,700'),\r\n\t\t(83,'google','Cardo','regular,400italic,700','400,400-italic,700'),\r\n\t\t(84,'google','Schoolbell','regular','400'),\r\n\t\t(85,'google','Miltonian Tattoo','regular','400'),\r\n\t\t(86,'google','Neuton','200,300,regular,italic,700,800','200,300,400,400-italic,700,800'),\r\n\t\t(87,'google','Muli','300,300italic,400,400italic','300,300-italic,400,400-italic'),\r\n\t\t(88,'google','Tinos','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(89,'google','Puritan','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(90,'google','Merienda One','regular','400'),\r\n\t\t(91,'google','Crushed','regular','400'),\r\n\t\t(92,'google','Inconsolata','regular','400'),\r\n\t\t(93,'google','Gruppo','regular','400'),\r\n\t\t(94,'google','Goudy Bookletter 1911','regular','400'),\r\n\t\t(95,'google','Maiden Orange','regular','400'),\r\n\t\t(96,'google','Podkova','regular,700','400,700'),\r\n\t\t(97,'google','Rancho','400','400'),\r\n\t\t(98,'google','Signika','300,400,600,700','300,400,600,700'),\r\n\t\t(99,'google','Waiting for the Sunrise','regular','400'),\r\n\t\t(100,'google','Salsa','400','400'),\r\n\t\t(101,'google','Six Caps','regular','400'),\r\n\t\t(102,'google','Didact Gothic','regular','400'),\r\n\t\t(103,'google','Sunshiney','regular','400'),\r\n\t\t(104,'google','Just Another Hand','regular','400'),\r\n\t\t(105,'google','Orbitron','400,500,700,900','400,500,700,900'),\r\n\t\t(106,'google','Mountains of Christmas','regular,700','400,700'),\r\n\t\t(107,'google','Kranky','regular','400'),\r\n\t\t(108,'google','IM Fell DW Pica','regular,italic','400,400-italic'),\r\n\t\t(109,'google','Jura','300,400,500,600','300,400,500,600'),\r\n\t\t(110,'google','Unkempt','regular,700','400,700'),\r\n\t\t(111,'google','Volkhov','400,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(112,'google','Kristi','regular','400'),\r\n\t\t(113,'google','Pinyon Script','regular','400'),\r\n\t\t(114,'google','IM Fell English','regular,italic','400,400-italic'),\r\n\t\t(115,'google','EB Garamond','regular','400'),\r\n\t\t(116,'google','PT Serif Caption','regular,italic','400,400-italic'),\r\n\t\t(117,'google','Quattrocento Sans','regular','400'),\r\n\t\t(118,'google','Bentham','regular','400'),\r\n\t\t(119,'google','Shanti','regular','400'),\r\n\t\t(120,'google','Chivo','400,400italic,900,900italic','400,400-italic,900,900italic'),\r\n\t\t(121,'google','Metrophobic','regular','400'),\r\n\t\t(122,'google','Delius','400','400'),\r\n\t\t(123,'google','Cousine','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(124,'google','Carme','regular','400'),\r\n\t\t(125,'google','Changa One','regular,italic','400,400-italic'),\r\n\t\t(126,'google','Kameron','400,700','400,700'),\r\n\t\t(127,'google','Yellowtail','regular','400'),\r\n\t\t(128,'google','Special Elite','regular','400'),\r\n\t\t(129,'google','Love Ya Like A Sister','regular','400'),\r\n\t\t(130,'google','Comfortaa','300,400,700','300,400,700'),\r\n\t\t(131,'google','Bangers','regular','400'),\r\n\t\t(132,'google','Mako','regular','400'),\r\n\t\t(133,'google','Quattrocento','regular','400'),\r\n\t\t(134,'google','Stardos Stencil','regular,bold','400,700'),\r\n\t\t(135,'google','Michroma','regular','400'),\r\n\t\t(136,'google','Bowlby One SC','regular','400'),\r\n\t\t(137,'google','Leckerli One','regular','400'),\r\n\t\t(138,'google','Rosario','regular,italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(139,'google','Hammersmith One','regular','400'),\r\n\t\t(140,'google','Passion One','400,700,900','400,700,900'),\r\n\t\t(141,'google','Rochester','regular','400'),\r\n\t\t(142,'google','Allan','bold','700'),\r\n\t\t(143,'google','Geo','regular','400'),\r\n\t\t(144,'google','Varela','regular','400'),\r\n\t\t(145,'google','Alice','regular','400'),\r\n\t\t(146,'google','Sorts Mill Goudy','400,400italic','400,400-italic'),\r\n\t\t(147,'google','Corben','400,bold','400,700'),\r\n\t\t(148,'google','Coda','400,800','400,800'),\r\n\t\t(149,'google','Andika','regular','400'),\r\n\t\t(150,'google','Playfair Display','regular,400italic','400,400-italic'),\r\n\t\t(151,'google','Sue Ellen Francisco','regular','400'),\r\n\t\t(152,'google','Jockey One','400','400'),\r\n\t\t(153,'google','Coustard','400,900','400,900'),\r\n\t\t(154,'google','Patrick Hand','regular','400'),\r\n\t\t(155,'google','Cabin Condensed','400,500,600,700','400,500,600,700'),\r\n\t\t(156,'google','Redressed','regular','400'),\r\n\t\t(157,'google','Aclonica','regular','400'),\r\n\t\t(158,'google','Poly','400,400italic','400,400-italic'),\r\n\t\t(159,'google','Quicksand','300,400,700','300,400,700'),\r\n\t\t(160,'google','Sancreek','400','400'),\r\n\t\t(161,'google','VT323','regular','400'),\r\n\t\t(162,'google','Lekton','400,italic,700','400,400-italic,700'),\r\n\t\t(163,'google','Antic','400','400'),\r\n\t\t(164,'google','UnifrakturMaguntia','regular','400'),\r\n\t\t(165,'google','Brawler','regular','400'),\r\n\t\t(166,'google','Nothing You Could Do','regular','400'),\r\n\t\t(167,'google','IM Fell DW Pica SC','regular','400'),\r\n\t\t(168,'google','Coda Caption','800','800'),\r\n\t\t(169,'google','Satisfy','400','400'),\r\n\t\t(170,'google','Days One','400','400'),\r\n\t\t(171,'google','Anonymous Pro','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(172,'google','IM Fell English SC','regular','400'),\r\n\t\t(173,'google','Over the Rainbow','regular','400'),\r\n\t\t(174,'google','Amatic SC','400,700','400,700'),\r\n\t\t(175,'google','Artifika','regular','400'),\r\n\t\t(176,'google','Aldrich','regular','400'),\r\n\t\t(177,'google','La Belle Aurore','regular','400'),\r\n\t\t(178,'google','Nixie One','regular','400'),\r\n\t\t(179,'google','Spinnaker','regular','400'),\r\n\t\t(180,'google','Pompiere','regular','400'),\r\n\t\t(181,'google','Smythe','regular','400'),\r\n\t\t(182,'google','Delius Swash Caps','400','400'),\r\n\t\t(183,'google','Mate','400,400italic','400,400-italic'),\r\n\t\t(184,'google','Ultra','regular','400'),\r\n\t\t(185,'google','Sansita One','regular','400'),\r\n\t\t(186,'google','Damion','regular','400'),\r\n\t\t(187,'google','Limelight','regular','400'),\r\n\t\t(188,'google','Cedarville Cursive','regular','400'),\r\n\t\t(189,'google','IM Fell French Canon SC','regular','400'),\r\n\t\t(190,'google','Montez','regular','400'),\r\n\t\t(191,'google','Forum','regular','400'),\r\n\t\t(192,'google','Aladin','400','400'),\r\n\t\t(193,'google','Delius Unicase','400,700','400,700'),\r\n\t\t(194,'google','Hanuman','regular,bold','400,700'),\r\n\t\t(195,'google','Wire One','regular','400'),\r\n\t\t(196,'google','Expletus Sans','400,400italic,500,500italic,600,600italic,700,700italic','400,400-italic,500,500-italic,600,600-italic,700,700-italic'),\r\n\t\t(197,'google','Annie Use Your Telescope','regular','400'),\r\n\t\t(198,'google','Snippet','regular','400'),\r\n\t\t(199,'google','Just Me Again Down Here','regular','400'),\r\n\t\t(200,'google','Ubuntu Mono','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(201,'google','Inder','400','400'),\r\n\t\t(202,'google','Candal','regular','400'),\r\n\t\t(203,'google','Adamina','400','400'),\r\n\t\t(204,'google','Gentium Basic','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(205,'google','IM Fell Great Primer SC','regular','400'),\r\n\t\t(206,'google','IM Fell Double Pica SC','regular','400'),\r\n\t\t(207,'google','Black Ops One','regular','400'),\r\n\t\t(208,'google','Dawning of a New Day','regular','400'),\r\n\t\t(209,'google','Buda','300','300'),\r\n\t\t(210,'google','Kenia','regular','400'),\r\n\t\t(211,'google','Cookie','400','400'),\r\n\t\t(212,'google','UnifrakturCook','bold','700'),\r\n\t\t(213,'google','Voltaire','400','400'),\r\n\t\t(214,'google','Caudex','400,italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(215,'google','Rationale','regular','400'),\r\n\t\t(216,'google','Gentium Book Basic','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(217,'google','Nova Round','regular','400'),\r\n\t\t(218,'google','IM Fell Great Primer','regular,italic','400,400-italic'),\r\n\t\t(219,'google','Short Stack','400','400'),\r\n\t\t(220,'google','Federo','regular','400'),\r\n\t\t(221,'google','Tenor Sans','regular','400'),\r\n\t\t(222,'google','Julee','regular','400'),\r\n\t\t(223,'google','Vibur','regular','400'),\r\n\t\t(224,'google','Nova Slim','regular','400'),\r\n\t\t(225,'google','IM Fell French Canon','regular,italic','400,400-italic'),\r\n\t\t(226,'google','Loved by the King','regular','400'),\r\n\t\t(227,'google','Viga','400','400'),\r\n\t\t(228,'google','Gochi Hand','400','400'),\r\n\t\t(229,'google','Holtwood One SC','regular','400'),\r\n\t\t(230,'google','Zeyada','regular','400'),\r\n\t\t(231,'google','Contrail One','regular','400'),\r\n\t\t(232,'google','Vidaloka','400','400'),\r\n\t\t(233,'google','Nova Oval','regular','400'),\r\n\t\t(234,'google','Montserrat','400','400'),\r\n\t\t(235,'google','Meddon','regular','400'),\r\n\t\t(236,'google','Swanky and Moo Moo','regular','400'),\r\n\t\t(237,'google','Nova Script','regular','400'),\r\n\t\t(238,'google','Ovo','regular','400'),\r\n\t\t(239,'google','Irish Grover','regular','400'),\r\n\t\t(240,'google','League Script','400','400'),\r\n\t\t(241,'google','Petrona','400','400'),\r\n\t\t(242,'google','Yeseva One','regular','400'),\r\n\t\t(243,'google','Squada One','400','400'),\r\n\t\t(244,'google','Numans','400','400'),\r\n\t\t(245,'google','Prata','400','400'),\r\n\t\t(246,'google','Gravitas One','regular','400'),\r\n\t\t(247,'google','IM Fell Double Pica','regular,italic','400,400-italic'),\r\n\t\t(248,'google','Prociono','400','400'),\r\n\t\t(249,'google','Astloch','regular,bold','400,700'),\r\n\t\t(250,'google','Kelly Slab','regular','400'),\r\n\t\t(251,'google','Asset','regular','400'),\r\n\t\t(252,'google','Nova Flat','regular','400'),\r\n\t\t(253,'google','Judson','400,400italic,700','400,400-italic,700'),\r\n\t\t(254,'google','Lusitana','400,bold','400,700'),\r\n\t\t(255,'google','Radley','regular,400italic','400,400-italic'),\r\n\t\t(256,'google','Abril Fatface','400','400'),\r\n\t\t(257,'google','GFS Neohellenic','regular,italic,bold,bolditalic','400,400-italic,700,700-italic'),\r\n\t\t(258,'google','Cambo','400','400'),\r\n\t\t(259,'google','Arapey','400,400italic','400,400-italic'),\r\n\t\t(260,'google','Tulpen One','regular','400'),\r\n\t\t(261,'google','Convergence','400','400'),\r\n\t\t(262,'google','Rammetto One','400','400'),\r\n\t\t(263,'google','Alike','regular','400'),\r\n\t\t(264,'google','Esteban','400','400'),\r\n\t\t(265,'google','Modern Antiqua','regular','400'),\r\n\t\t(266,'google','Tienne','400,700,900','400,700,900'),\r\n\t\t(267,'google','Megrim','regular','400'),\r\n\t\t(268,'google','Give You Glory','regular','400'),\r\n\t\t(269,'google','Monoton','400','400'),\r\n\t\t(270,'google','Unna','regular','400'),\r\n\t\t(271,'google','Mate SC','400','400'),\r\n\t\t(272,'google','Devonshire','400','400'),\r\n\t\t(273,'google','Electrolize','400','400'),\r\n\t\t(274,'google','Geostar','regular','400'),\r\n\t\t(275,'google','Andada','400','400'),\r\n\t\t(276,'google','Handlee','400','400'),\r\n\t\t(277,'google','Bowlby One','regular','400'),\r\n\t\t(278,'google','Wallpoet','regular','400'),\r\n\t\t(279,'google','Suwannaphum','regular','400'),\r\n\t\t(280,'google','Fanwood Text','400,400italic','400,400-italic'),\r\n\t\t(281,'google','Sofia','400','400'),\r\n\t\t(282,'google','Goblin One','regular','400'),\r\n\t\t(283,'google','GFS Didot','regular','400'),\r\n\t\t(284,'google','Miltonian','regular','400'),\r\n\t\t(285,'google','Fjord One','400','400'),\r\n\t\t(286,'google','Sniglet','800','800'),\r\n\t\t(287,'google','Lancelot','400','400'),\r\n\t\t(288,'google','Ruslan Display','regular','400'),\r\n\t\t(289,'google','Nova Cut','regular','400'),\r\n\t\t(290,'google','Bigshot One','regular','400'),\r\n\t\t(291,'google','Duru Sans','400','400'),\r\n\t\t(292,'google','Nova Mono','regular','400'),\r\n\t\t(293,'google','Vast Shadow','regular','400'),\r\n\t\t(294,'google','Dorsa','400','400'),\r\n\t\t(295,'google','Sigmar One','regular','400'),\r\n\t\t(296,'google','Nova Square','regular','400'),\r\n\t\t(297,'google','Alike Angular','regular','400'),\r\n\t\t(298,'google','Linden Hill','400,400italic','400,400-italic'),\r\n\t\t(299,'google','Monofett','regular','400'),\r\n\t\t(300,'google','Patua One','400','400'),\r\n\t\t(301,'google','Passero One','regular','400'),\r\n\t\t(302,'google','Baumans','400','400'),\r\n\t\t(303,'google','Atomic Age','400','400'),\r\n\t\t(304,'google','Bad Script','400','400'),\r\n\t\t(305,'google','Poller One','regular','400'),\r\n\t\t(306,'google','Supermercado One','400','400'),\r\n\t\t(307,'google','Geostar Fill','regular','400'),\r\n\t\t(308,'google','Smokum','regular','400'),\r\n\t\t(309,'google','Federant','400','400'),\r\n\t\t(310,'google','Engagement','400','400'),\r\n\t\t(311,'google','Aubrey','regular','400'),\r\n\t\t(312,'google','Boogaloo','regular','400'),\r\n\t\t(313,'google','Alfa Slab One','400','400'),\r\n\t\t(314,'google','Ribeye','400','400'),\r\n\t\t(315,'google','Signika Negative','300,400,600,700','300,400,600,700'),\r\n\t\t(316,'google','Quantico','400,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(317,'google','Ruluko','400','400'),\r\n\t\t(318,'google','Niconne','regular','400'),\r\n\t\t(319,'google','Bree Serif','400','400'),\r\n\t\t(320,'google','Mr Dafoe','400','400'),\r\n\t\t(321,'google','Crete Round','400,400italic','400,400-italic'),\r\n\t\t(322,'google','Marmelad','400','400'),\r\n\t\t(323,'google','Italianno','400','400'),\r\n\t\t(324,'google','Fredericka the Great','regular','400'),\r\n\t\t(325,'google','Trade Winds','400','400'),\r\n\t\t(326,'google','Magra','400,bold','400,700'),\r\n\t\t(327,'google','Iceland','400','400'),\r\n\t\t(328,'google','Stint Ultra Condensed','400','400'),\r\n\t\t(329,'google','Chelsea Market','400','400'),\r\n\t\t(330,'google','Bubblegum Sans','400','400'),\r\n\t\t(331,'google','Trykker','400','400'),\r\n\t\t(332,'google','Acme','400','400'),\r\n\t\t(333,'google','Overlock','400,400italic,700,700italic,900,900italic','400,400-italic,700,700-italic,900,900italic'),\r\n\t\t(334,'google','Armata','400','400'),\r\n\t\t(335,'google','Playball','400','400'),\r\n\t\t(336,'google','Habibi','400','400'),\r\n\t\t(337,'google','Oldenburg','400','400'),\r\n\t\t(338,'google','Galdeano','400','400'),\r\n\t\t(339,'google','Dynalight','400','400'),\r\n\t\t(340,'google','Enriqueta','400,700','400,700'),\r\n\t\t(341,'google','Concert One','400','400'),\r\n\t\t(342,'google','Overlock SC','400','400'),\r\n\t\t(343,'google','Noticia Text','400,400italic,700,700italic','400,400-italic,700,700-italic'),\r\n\t\t(344,'google','Righteous','400','400'),\r\n\t\t(345,'google','Cagliostro','400','400'),\r\n\t\t(346,'google','Arizonia','400','400'),\r\n\t\t(347,'google','Rouge Script','400','400'),\r\n\t\t(348,'google','Knewave','400','400'),\r\n\t\t(349,'google','Miniver','400','400'),\r\n\t\t(350,'google','Qwigley','400','400'),\r\n\t\t(351,'google','Flamenco','300,400','300,400'),\r\n\t\t(352,'google','Asul','400,bold','400,700'),\r\n\t\t(353,'google','Bokor','regular','400'),\r\n\t\t(354,'google','Monsieur La Doulaise','400','400'),\r\n\t\t(355,'google','Gudea','400,italic,bold','400,400-italic,700'),\r\n\t\t(356,'google','Flavors','400','400'),\r\n\t\t(357,'google','Ruda','400,bold,900','400,700,900'),\r\n\t\t(358,'google','Stoke','400','400'),\r\n\t\t(359,'google','Spirax','400','400'),\r\n\t\t(360,'google','Uncial Antiqua','400','400'),\r\n\t\t(361,'google','Telex','400','400'),\r\n\t\t(362,'google','Alex Brush','400','400'),\r\n\t\t(363,'google','Yesteryear','400','400'),\r\n\t\t(364,'google','Fresca','400','400'),\r\n\t\t(365,'google','Original Surfer','400','400'),\r\n\t\t(366,'google','Buenard','400,bold','400,700'),\r\n\t\t(367,'google','Medula One','400','400'),\r\n\t\t(368,'google','Ruthie','400','400'),\r\n\t\t(369,'google','Bilbo','400','400'),\r\n\t\t(370,'google','Basic','400','400'),\r\n\t\t(371,'google','Nosifer','400','400'),\r\n\t\t(372,'google','Fondamento','400,400italic','400,400-italic'),\r\n\t\t(373,'google','Mrs Sheppards','400','400'),\r\n\t\t(374,'google','Marko One','400','400'),\r\n\t\t(375,'google','Caesar Dressing','400','400'),\r\n\t\t(376,'google','Lemon','400','400'),\r\n\t\t(377,'google','Metal','regular','400'),\r\n\t\t(378,'google','Moulpali','regular','400'),\r\n\t\t(379,'google','Balthazar','400','400'),\r\n\t\t(380,'google','Chicle','400','400'),\r\n\t\t(381,'google','Spicy Rice','400','400'),\r\n\t\t(382,'google','Almendra','400,bold','400,700'),\r\n\t\t(383,'google','Frijole','400','400'),\r\n\t\t(384,'google','Bilbo Swash Caps','400','400'),\r\n\t\t(385,'google','Ribeye Marrow','400','400'),\r\n\t\t(386,'google','Sail','400','400'),\r\n\t\t(387,'google','Battambang','regular,bold','400,700'),\r\n\t\t(388,'google','Wellfleet','400','400'),\r\n\t\t(389,'google','Jim Nightshade','400','400'),\r\n\t\t(390,'google','Piedra','400','400'),\r\n\t\t(391,'google','Eater','400','400'),\r\n\t\t(392,'google','Belgrano','400','400'),\r\n\t\t(393,'google','Fugaz One','400','400'),\r\n\t\t(394,'google','Creepster','regular','400'),\r\n\t\t(395,'google','Content','regular,bold','400,700'),\r\n\t\t(396,'google','Homenaje','400','400'),\r\n\t\t(397,'google','Titan One','400','400'),\r\n\t\t(398,'google','Aguafina Script','400','400'),\r\n\t\t(399,'google','Fascinate Inline','400','400'),\r\n\t\t(400,'google','Dr Sugiyama','400','400'),\r\n\t\t(401,'google','Metamorphous','400','400'),\r\n\t\t(402,'google','Angkor','regular','400'),\r\n\t\t(403,'google','Inika','400,bold','400,700'),\r\n\t\t(404,'google','Ruge Boogie','400','400'),\r\n\t\t(405,'google','Alegreya SC','400,400italic,700,700italic,900,900italic','400,400-italic,700,700-italic,900,900italic'),\r\n\t\t(406,'google','Alegreya','400,400italic,700,700italic,900,900italic','400,400-italic,700,700-italic,900,900italic'),\r\n\t\t(407,'google','Sarina','400','400'),\r\n\t\t(408,'google','Lustria','400','400'),\r\n\t\t(409,'google','Chango','400','400'),\r\n\t\t(410,'google','Dangrek','regular','400'),\r\n\t\t(411,'google','Unlock','regular','400'),\r\n\t\t(412,'google','Sonsie One','400','400'),\r\n\t\t(413,'google','Arbutus','400','400'),\r\n\t\t(414,'google','Mr De Haviland','400','400'),\r\n\t\t(415,'google','Plaster','400','400'),\r\n\t\t(416,'google','Miss Fajardose','400','400'),\r\n\t\t(417,'google','Amethysta','400','400'),\r\n\t\t(418,'google','Khmer','regular','400'),\r\n\t\t(419,'google','Macondo Swash Caps','400','400'),\r\n\t\t(420,'google','Fascinate','400','400'),\r\n\t\t(421,'google','Trochut','400,italic,bold','400,400-italic,700'),\r\n\t\t(422,'google','Junge','400','400'),\r\n\t\t(423,'google','Herr Von Muellerhoff','400','400'),\r\n\t\t(424,'google','Bayon','regular','400'),\r\n\t\t(425,'google','Preahvihear','regular','400'),\r\n\t\t(426,'google','Ceviche One','400','400'),\r\n\t\t(427,'google','Freehand','regular','400'),\r\n\t\t(428,'google','Nokora','400,700','400,700'),\r\n\t\t(429,'google','Bonbon','400','400'),\r\n\t\t(430,'google','Almendra SC','400','400'),\r\n\t\t(431,'google','Moul','regular','400'),\r\n\t\t(432,'google','Sirin Stencil','400','400'),\r\n\t\t(433,'google','Germania One','400','400'),\r\n\t\t(434,'google','Montaga','400','400'),\r\n\t\t(435,'google','Odor Mean Chey','regular','400'),\r\n\t\t(436,'google','Macondo','400','400'),\r\n\t\t(437,'google','Chenla','regular','400'),\r\n\t\t(438,'google','Siemreap','regular','400'),\r\n\t\t(439,'google','Taprom','regular','400'),\r\n\t\t(440,'google','Port Lligat Sans','400','400'),\r\n\t\t(441,'google','Port Lligat Slab','400','400'),\r\n\t\t(442,'google','Koulen','regular','400'),\r\n\t\t(443,'google','Emblema One','400','400'),\r\n\t\t(444,'google','Butcherman','400','400');";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //6. Create table ap_form_filters
    $query = "CREATE TABLE `" . MF_TABLE_PREFIX . "form_filters` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `aff_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `element_name` varchar(50) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `filter_condition` varchar(15) NOT NULL DEFAULT 'is',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `filter_keyword` varchar(255) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  PRIMARY KEY (`aff_id`),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  KEY `form_id` (`form_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //7. Create table ap_form_themes
    $query = "CREATE TABLE `" . MF_TABLE_PREFIX . "form_themes` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `theme_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `status` int(1) DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `theme_has_css` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `theme_name` varchar(255) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `theme_built_in` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `logo_type` varchar(11) NOT NULL DEFAULT 'default' COMMENT 'default,custom,disabled',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `logo_custom_image` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `logo_custom_height` int(11) NOT NULL DEFAULT '40',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `logo_default_image` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `logo_default_repeat` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `wallpaper_bg_type` varchar(11) NOT NULL DEFAULT 'color' COMMENT 'color,pattern,custom',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `wallpaper_bg_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `wallpaper_bg_pattern` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `wallpaper_bg_custom` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `header_bg_type` varchar(11) NOT NULL DEFAULT 'color' COMMENT 'color,pattern,custom',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `header_bg_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `header_bg_pattern` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `header_bg_custom` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_bg_type` varchar(11) NOT NULL DEFAULT 'color' COMMENT 'color,pattern,custom',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_bg_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_bg_pattern` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_bg_custom` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `highlight_bg_type` varchar(11) NOT NULL DEFAULT 'color' COMMENT 'color,pattern,custom',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `highlight_bg_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `highlight_bg_pattern` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `highlight_bg_custom` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_bg_type` varchar(11) NOT NULL DEFAULT 'color' COMMENT 'color,pattern,custom',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_bg_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_bg_pattern` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_bg_custom` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_bg_type` varchar(11) NOT NULL DEFAULT 'color' COMMENT 'color,pattern,custom',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_bg_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_bg_pattern` varchar(50) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_bg_custom` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_title_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_title_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_title_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_title_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_title_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_desc_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_desc_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_desc_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_desc_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_desc_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_title_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_title_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_title_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_title_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_title_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `guidelines_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_title_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_title_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_title_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_title_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_title_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_desc_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_desc_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_desc_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_desc_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `section_desc_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_text_font_type` varchar(50) NOT NULL DEFAULT 'Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_text_font_weight` int(11) NOT NULL DEFAULT '400',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_text_font_style` varchar(25) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_text_font_size` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `field_text_font_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_form_width` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_form_style` varchar(11) NOT NULL DEFAULT 'solid',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_form_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_guidelines_width` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_guidelines_style` varchar(11) NOT NULL DEFAULT 'solid',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_guidelines_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_section_width` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_section_style` varchar(11) NOT NULL DEFAULT 'solid',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `border_section_color` varchar(11) DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_shadow_style` varchar(25) NOT NULL DEFAULT 'WarpShadow',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_shadow_size` varchar(11) NOT NULL DEFAULT 'large',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_shadow_brightness` varchar(11) NOT NULL DEFAULT 'normal',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_button_type` varchar(11) NOT NULL DEFAULT 'text',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_button_text` varchar(100) NOT NULL DEFAULT 'Submit',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_button_image` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `advanced_css` text,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  PRIMARY KEY (`theme_id`),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  KEY `theme_name` (`theme_name`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //insert into ap_form_themes table
    $query = "INSERT INTO `" . MF_TABLE_PREFIX . "form_themes` (`theme_id`, `status`, `theme_has_css`, `theme_name`, `theme_built_in`, `logo_type`, `logo_custom_image`, `logo_custom_height`, `logo_default_image`, `logo_default_repeat`, `wallpaper_bg_type`, `wallpaper_bg_color`, `wallpaper_bg_pattern`, `wallpaper_bg_custom`, `header_bg_type`, `header_bg_color`, `header_bg_pattern`, `header_bg_custom`, `form_bg_type`, `form_bg_color`, `form_bg_pattern`, `form_bg_custom`, `highlight_bg_type`, `highlight_bg_color`, `highlight_bg_pattern`, `highlight_bg_custom`, `guidelines_bg_type`, `guidelines_bg_color`, `guidelines_bg_pattern`, `guidelines_bg_custom`, `field_bg_type`, `field_bg_color`, `field_bg_pattern`, `field_bg_custom`, `form_title_font_type`, `form_title_font_weight`, `form_title_font_style`, `form_title_font_size`, `form_title_font_color`, `form_desc_font_type`, `form_desc_font_weight`, `form_desc_font_style`, `form_desc_font_size`, `form_desc_font_color`, `field_title_font_type`, `field_title_font_weight`, `field_title_font_style`, `field_title_font_size`, `field_title_font_color`, `guidelines_font_type`, `guidelines_font_weight`, `guidelines_font_style`, `guidelines_font_size`, `guidelines_font_color`, `section_title_font_type`, `section_title_font_weight`, `section_title_font_style`, `section_title_font_size`, `section_title_font_color`, `section_desc_font_type`, `section_desc_font_weight`, `section_desc_font_style`, `section_desc_font_size`, `section_desc_font_color`, `field_text_font_type`, `field_text_font_weight`, `field_text_font_style`, `field_text_font_size`, `field_text_font_color`, `border_form_width`, `border_form_style`, `border_form_color`, `border_guidelines_width`, `border_guidelines_style`, `border_guidelines_color`, `border_section_width`, `border_section_style`, `border_section_color`, `form_shadow_style`, `form_shadow_size`, `form_shadow_brightness`, `form_button_type`, `form_button_text`, `form_button_image`, `advanced_css`)\r\n\tVALUES\r\n\t\t(1,1,0,'Green Senegal',1,'default','http://',40,'machform.png',0,'color','#cfdfc5','','','color','#bad4a9','','','color','#ffffff','','','color','#ecf1ea','','','color','#ecf1ea','','','color','#cfdfc5','','','Philosopher',700,'normal','','#80af1b','Philosopher',400,'normal','100%','#80af1b','Philosopher',700,'normal','110%','#80af1b','Ubuntu',400,'normal','','#666666','Philosopher',700,'normal','110%','#80af1b','Philosopher',400,'normal','95%','#80af1b','Ubuntu',400,'normal','','#666666',1,'solid','#bad4a9',1,'dashed','#bad4a9',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(2,1,0,'Blue Bigbird',1,'default','http://',40,'machform.png',0,'color','#336699','','','color','#6699cc','','','color','#ffffff','','','color','#ccdced','','','color','#6699cc','','','color','#ffffff','','','Open Sans',600,'normal','','','Open Sans',400,'normal','','','Open Sans',700,'normal','100%','','Ubuntu',400,'normal','80%','#ffffff','Open Sans',600,'normal','','','Open Sans',400,'normal','95%','','Open Sans',400,'normal','','',1,'solid','#336699',1,'dotted','#6699cc',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(3,1,0,'Blue Pionus',1,'default','http://',40,'machform.png',0,'color','#556270','','','color','#6b7b8c','','','color','#ffffff','','','color','#99aec4','','','color','#6b7b8c','','','color','#ffffff','','','Istok Web',400,'normal','170%','','Maven Pro',400,'normal','100%','','Istok Web',700,'normal','100%','','Maven Pro',400,'normal','95%','#ffffff','Istok Web',400,'normal','110%','','Maven Pro',400,'normal','95%','','Maven Pro',400,'normal','','',1,'solid','#556270',1,'solid','#6b7b8c',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(4,1,0,'Brown Conure',1,'default','http://',40,'machform.png',0,'pattern','#948c75','pattern_036.gif','','color','#b3a783','','','color','#ffffff','','','color','#e0d0a2','','','color','#948c75','','','color','#f0f0d8','pattern_036.gif','','Molengo',400,'normal','170%','','Molengo',400,'normal','110%','','Molengo',400,'normal','110%','','Nobile',400,'normal','','#ececec','Molengo',400,'normal','130%','','Molengo',400,'normal','100%','','Molengo',400,'normal','110%','',1,'solid','#948c75',1,'solid','#948c75',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(5,1,0,'Yellow Lovebird',1,'default','http://',40,'machform.png',0,'color','#f0d878','','','color','#edb817','pattern_158.gif','','color','#ffffff','','','color','#f5d678','','','color','#f7c52e','','','color','#ffffff','','','Amaranth',700,'normal','170%','','Amaranth',400,'normal','100%','','Amaranth',700,'normal','100%','','Amaranth',400,'normal','','#444444','Amaranth',400,'normal','110%','','Amaranth',400,'normal','95%','','Amaranth',400,'normal','100%','',1,'solid','#f0d878',1,'solid','#f7c52e',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(6,1,0,'Pink Starling',1,'default','http://',40,'machform.png',0,'color','#ff6699','','','color','#d93280','','','color','#ffffff','','','color','#ffd0d4','','','color','#f9fad2','','','color','#ffffff','','','Josefin Sans',600,'normal','160%','','Josefin Sans',400,'normal','110%','','Josefin Sans',700,'normal','110%','','Josefin Sans',600,'normal','100%','','Josefin Sans',700,'normal','','','Josefin Sans',400,'normal','110%','','Josefin Sans',400,'normal','130%','',1,'solid','#ff6699',1,'dashed','#f56990',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(8,1,0,'Red Rabbit',1,'default','http://',40,'machform.png',0,'color','#a40802','','','color','#800e0e','','','color','#ffffff','','','color','#ffa4a0','','','color','#800e0e','','','color','#ffffff','','','Lobster',400,'normal','','#000000','Ubuntu',400,'normal','100%','#000000','Lobster',400,'normal','110%','#222222','Ubuntu',400,'normal','85%','#ffffff','Lobster',400,'normal','130%','#000000','Ubuntu',400,'normal','95%','#000000','Ubuntu',400,'normal','','#333333',1,'solid','#a40702',1,'solid','#800e0e',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(9,1,0,'Orange Robin',1,'default','http://',40,'machform.png',0,'color','#f38430','','','color','#fa6800','','','color','#ffffff','','','color','#a7dbd8','','','color','#e0e4cc','','','color','#ffffff','','','Lucida Grande',400,'normal','','#000000','Nobile',400,'normal','','#000000','Nobile',700,'normal','','#000000','Lucida Grande',400,'normal','','#444444','Nobile',700,'normal','100%','#000000','Nobile',400,'normal','','#000000','Nobile',400,'normal','95%','#333333',1,'solid','#f38430',1,'solid','#e0e4cc',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(10,1,0,'Orange Sunbird',1,'default','http://',40,'machform.png',0,'color','#d95c43','','','color','#c02942','','','color','#ffffff','','','color','#d95c43','','','color','#53777a','','','color','#ffffff','','','Lucida Grande',400,'normal','','#000000','Lucida Grande',400,'normal','','#000000','Lucida Grande',700,'normal','','#222222','Lucida Grande',400,'normal','','#ffffff','Lucida Grande',400,'normal','','#000000','Lucida Grande',400,'normal','','#000000','Lucida Grande',400,'normal','','#333333',1,'solid','#d95c43',1,'solid','#53777a',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(11,1,0,'Green Ringneck',1,'default','http://',40,'machform.png',0,'color','#0b486b','','','color','#3b8686','','','color','#ffffff','','','color','#cff09e','','','color','#79bd9a','','','color','#a8dba8','','','Delius Swash Caps',400,'normal','','#000000','Delius Swash Caps',400,'normal','100%','#000000','Delius Swash Caps',400,'normal','100%','#222222','Delius',400,'normal','85%','#ffffff','Delius Swash Caps',400,'normal','','#000000','Delius Swash Caps',400,'normal','95%','#000000','Delius',400,'normal','','#515151',1,'solid','#0b486b',1,'solid','#79bd9a',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(12,1,0,'Brown Finch',1,'default','http://',40,'machform.png',0,'color','#774f38','','','color','#e08e79','','','color','#ffffff','','','color','#ece5ce','','','color','#c5e0dc','','','color','#f9fad2','','','Arvo',700,'normal','','#000000','Arvo',400,'normal','','#000000','Arvo',700,'normal','','#222222','Arvo',400,'normal','','#444444','Arvo',400,'normal','','#000000','Arvo',400,'normal','85%','#000000','Arvo',400,'normal','','#333333',1,'solid','#774f38',1,'dashed','#e08e79',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(14,1,0,'Brown Macaw',1,'default','http://',40,'machform.png',0,'color','#413e4a','','','color','#73626e','','','pattern','#ffffff','pattern_022.gif','','color','#f0b49e','','','color','#b38184','','','color','#ffffff','','','Cabin',500,'normal','160%','#000000','Cabin',400,'normal','100%','#000000','Cabin',700,'normal','110%','#222222','Lucida Grande',400,'normal','','#ececec','Cabin',600,'normal','','#000000','Cabin',600,'normal','95%','#000000','Cabin',400,'normal','110%','#333333',1,'solid','#413e4a',1,'dotted','#ff9900',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(15,1,0,'Pink Thrush',1,'default','http://',40,'machform.png',0,'color','#ff9f9d','','','color','#ff3d7e','','','color','#ffffff','','','color','#7fc7af','','','color','#3fb8b0','','','color','#ffffff','','','Crafty Girls',400,'normal','','#000000','Crafty Girls',400,'normal','100%','#000000','Crafty Girls',400,'normal','100%','#222222','Nobile',400,'normal','80%','#ffffff','Crafty Girls',400,'normal','','#000000','Crafty Girls',400,'normal','95%','#000000','Molengo',400,'normal','110%','#333333',1,'solid','#ff9f9d',1,'solid','#3fb8b0',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(16,1,0,'Yellow Bulbul',1,'default','http://',40,'machform.png',0,'color','#f8f4d7','','','color','#f4b26c','','','color','#f4dec2','','','color','#f2b4a7','','','color','#e98976','','','color','#ffffff','','','Special Elite',400,'normal','','#000000','Special Elite',400,'normal','','#000000','Special Elite',400,'normal','95%','#222222','Cousine',400,'normal','80%','#ececec','Special Elite',400,'normal','','#000000','Special Elite',400,'normal','','#000000','Cousine',400,'normal','','#333333',1,'solid','#f8f4d7',1,'solid','#f4b26c',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(17,1,0,'Blue Canary',1,'default','http://',40,'machform.png',0,'color','#81a8b8','','','color','#a4bcc2','','','color','#ffffff','','','color','#e8f3f8','','','color','#dbe6ec','','','color','#ffffff','','','PT Sans',400,'normal','','#000000','PT Sans',400,'normal','100%','#000000','PT Sans',700,'normal','100%','#222222','PT Sans',400,'normal','','#666666','PT Sans',700,'normal','','#000000','PT Sans',400,'normal','100%','#000000','PT Sans',400,'normal','110%','#333333',1,'solid','#81a8b8',1,'dashed','#a4bcc2',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(18,1,0,'Red Mockingbird',1,'default','http://',40,'machform.png',0,'color','#6b0103','','','color','#a30005','','','color','#c21b01','','','color','#f03d02','','','color','#1c0113','','','color','#ffffff','','','Oswald',400,'normal','','#ffffff','Open Sans',400,'normal','','#ffffff','Oswald',400,'normal','95%','#ffffff','Open Sans',400,'normal','','#ececec','Oswald',400,'normal','','#ececec','Lucida Grande',400,'normal','','#ffffff','Open Sans',400,'normal','','#333333',1,'solid','#6b0103',1,'solid','#1c0113',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(13,1,0,'Green Sparrow',1,'default','http://',40,'machform.png',0,'color','#d1f2a5','','','color','#f56990','','','color','#ffffff','','','color','#ffc48c','','','color','#ffa080','','','color','#ffffff','','','Open Sans',400,'normal','','#000000','Open Sans',400,'normal','','#000000','Open Sans',700,'normal','','#222222','Ubuntu',400,'normal','85%','#f4fce8','Open Sans',600,'normal','','#000000','Open Sans',400,'normal','95%','#000000','Open Sans',400,'normal','','#333333',10,'solid','#f0fab4',1,'solid','#ffa080',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(21,1,0,'Purple Vanga',1,'default','http://',40,'machform.png',0,'color','#7b85e2','','','color','#7aa6d6','','','color','#d1e7f9','','','color','#7aa6d6','','','color','#fbfcd0','','','color','#ffffff','','','Droid Sans',400,'normal','160%','#444444','Droid Sans',400,'normal','95%','#444444','Open Sans',700,'normal','95%','#444444','Droid Sans',400,'normal','85%','#444444','Droid Sans',400,'normal','110%','#444444','Droid Sans',400,'normal','95%','#000000','Droid Sans',400,'normal','100%','#333333',0,'solid','#CCCCCC',1,'solid','#fbfcd0',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(22,1,0,'Purple Dove',1,'default','http://',40,'machform.png',0,'color','#c0addb','','','color','#a662de','','','pattern','#ffffff','pattern_044.gif','','color','#a662de','pattern_028.gif','','color','#a662de','','','color','#c0addb','','','Pacifico',400,'normal','180%','#000000','Open Sans',400,'normal','95%','#000000','Pacifico',400,'normal','95%','#222222','Open Sans',400,'normal','80%','#ececec','Pacifico',400,'normal','110%','#000000','Open Sans',400,'normal','95%','#000000','Open Sans',400,'normal','100%','#333333',0,'solid','#a662de',1,'dashed','#CCCCCC',1,'dashed','#a662de','StandShadow','large','dark','text','Submit','http://',''),\r\n\t\t(20,1,0,'Pink Flamingo',1,'default','http://',40,'machform.png',0,'color','#f87d7b','','','color','#5ea0a3','','','color','#ffffff','','','color','#fab97f','','','color','#dcd1b4','','','color','#ffffff','','','Lucida Grande',400,'normal','160%','#b05573','Lucida Grande',400,'normal','95%','#b05573','Lucida Grande',700,'normal','95%','#b05573','Lucida Grande',400,'normal','80%','#444444','Lucida Grande',400,'normal','110%','#b05573','Lucida Grande',400,'normal','85%','#b05573','Lucida Grande',400,'normal','100%','#333333',0,'solid','#f87d7b',1,'dotted','#fab97f',1,'dotted','#CCCCCC','WarpShadow','large','normal','text','Submit','http://',''),\r\n\t\t(19,1,0,'Yellow Kiwi',1,'default','http://',40,'machform.png',0,'color','#ffe281','','','color','#ffbb7f','','','color','#eee9e5','','','color','#fad4b2','','','color','#ff9c97','','','color','#ffffff','','','Lucida Grande',400,'normal','160%','#000000','Lucida Grande',400,'normal','95%','#000000','Lucida Grande',700,'normal','95%','#222222','Lucida Grande',400,'normal','80%','#ffffff','Lucida Grande',400,'normal','110%','#000000','Lucida Grande',400,'normal','85%','#000000','Lucida Grande',400,'normal','100%','#333333',1,'solid','#ffe281',1,'solid','#CCCCCC',1,'dotted','#cdcdcd','WarpShadow','large','normal','text','Submit','http://','');";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //8. Create table ap_settings
    $query = "CREATE TABLE `" . MF_TABLE_PREFIX . "settings` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_enable` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_host` varchar(255) NOT NULL DEFAULT 'localhost',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_port` int(11) NOT NULL DEFAULT '25',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_auth` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_username` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_password` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `smtp_secure` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `upload_dir` varchar(255) NOT NULL DEFAULT './data',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `data_dir` varchar(255) NOT NULL DEFAULT './data',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `default_from_name` varchar(255) NOT NULL DEFAULT 'MachForm',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `default_from_email` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `base_url` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_manager_max_rows` int(11) DEFAULT '10',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `form_manager_sort_by` varchar(25) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `admin_login` varchar(255) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `admin_password` varchar(255) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `cookie_hash` varchar(25) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `admin_image_url` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `disable_machform_link` int(1) DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `customer_id` varchar(100) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `customer_name` varchar(100) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `license_key` varchar(50) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  `machform_version` varchar(10) NOT NULL DEFAULT '3.3',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  PRIMARY KEY (`id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //9. Insert into ap_settings table
    $domain = str_replace('www.', '', $_SERVER['SERVER_NAME']);
    $default_from_email = "no-reply@{$domain}";
    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
        $ssl_suffix = 's';
    } else {
        $ssl_suffix = '';
    }
    $machform_base_url = 'http' . $ssl_suffix . '://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/';
    $hasher = new PasswordHash(8, FALSE);
    $default_password_hash = $hasher->HashPassword('machform');
    $query = "INSERT INTO `" . MF_TABLE_PREFIX . "settings` (`id`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_enable`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_host`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_port`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_auth`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_username`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_password`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`smtp_secure`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`upload_dir`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`data_dir`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`default_from_name`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`default_from_email`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`base_url`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`form_manager_max_rows`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`form_manager_sort_by`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`admin_login`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`admin_password`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`cookie_hash`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`admin_image_url`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`disable_machform_link`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`license_key`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`machform_version`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(1,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 0,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'localhost',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t25,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'./data',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'./data',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'MachForm',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$default_from_email}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$machform_base_url}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t10,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'date_created',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$admin_username}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$default_password_hash}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$license_key}',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$new_machform_version}');";
    $params = array();
    $sth = $dbh->prepare($query);
    try {
        $sth->execute($params);
    } catch (PDOException $e) {
        $post_install_error .= $e->getMessage() . '<br/><br/>';
    }
    //10. Loop through each form table and alter table structure
    $query = "select `form_id`,`form_email`,`esr_email_address`,`form_redirect` from " . MF_TABLE_PREFIX . "forms";
    $params = array();
    $sth = mf_do_query($query, $params, $dbh);
    $email_enable_status_array = array();
    $redirect_enable_status_array = array();
    while ($row = mf_do_fetch_result($sth)) {
        $form_id = $row['form_id'];
        $form_id_array[] = $form_id;
        if (!empty($row['form_email'])) {
            $email_enable_status_array[$form_id]['esl_enable'] = 1;
        } else {
            $email_enable_status_array[$form_id]['esl_enable'] = 0;
        }
        if (!empty($row['esr_email_address'])) {
            $email_enable_status_array[$form_id]['esr_enable'] = 1;
        } else {
            $email_enable_status_array[$form_id]['esr_enable'] = 0;
        }
        if (!empty($row['form_redirect'])) {
            $redirect_enable_status_array[$form_id] = 1;
        } else {
            $redirect_enable_status_array[$form_id] = 0;
        }
    }
    foreach ($form_id_array as $form_id) {
        //add new columns
        $query = "ALTER TABLE `" . MF_TABLE_PREFIX . "form_{$form_id}`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `status` int(4) unsigned NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `resume_key` varchar(10) default NULL;";
        $params = array();
        $sth = $dbh->prepare($query);
        try {
            $sth->execute($params);
        } catch (PDOException $e) {
            $post_install_error .= $e->getMessage() . '<br/><br/>';
        }
        $query = "ALTER TABLE `" . MF_TABLE_PREFIX . "form_{$form_id}_review`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `status` int(4) unsigned NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  ADD COLUMN `resume_key` varchar(10) default NULL;";
        $params = array();
        $sth = $dbh->prepare($query);
        try {
            $sth->execute($params);
        } catch (PDOException $e) {
            //do nothing, ignore if table review not exist
        }
        //update the esl_enable/esr_enable/redirect_enable
        $query = "UPDATE `" . MF_TABLE_PREFIX . "forms` SET esl_enable = ?,esr_enable = ?,form_redirect_enable = ? WHERE form_id = ?";
        $params = array($email_enable_status_array[$form_id]['esl_enable'], $email_enable_status_array[$form_id]['esr_enable'], $redirect_enable_status_array[$form_id], $form_id);
        $sth = $dbh->prepare($query);
        try {
            $sth->execute($params);
        } catch (PDOException $e) {
            $post_install_error .= $e->getMessage() . '<br/><br/>';
        }
    }
    //11. Loop through each CSS file and create a theme for each form
    //first delete htaccess file if exist
    if (file_exists('./data/.htaccess')) {
        @unlink('./data/.htaccess');
    }
    //Create "themes" folder
    if (is_writable("./data")) {
        $old_mask = umask(0);
        mkdir("./data/themes", 0777);
        umask($old_mask);
    }
    foreach ($form_id_array as $form_id) {
        $advanced_css = '';
        if (file_exists("./data/form_{$form_id}/css/view.css")) {
            rename("./data/form_{$form_id}/css/view.css", "./data/form_{$form_id}/css/view.old.css");
            //copy default view.css to css folder
            $old_mask = umask(0);
            if (copy("./view.css", "./data/form_{$form_id}/css/view.css")) {
                $form_has_css = 1;
            } else {
                $form_has_css = 0;
            }
            umask($old_mask);
            //update form_has_css value
            $query = "UPDATE " . MF_TABLE_PREFIX . "forms set form_has_css=? where form_id=?";
            $params = array($form_has_css, $form_id);
            $sth = $dbh->prepare($query);
            try {
                $sth->execute($params);
            } catch (PDOException $e) {
                $post_install_error .= $e->getMessage() . '<br/><br/>';
            }
            $advanced_css = file_get_contents("./data/form_{$form_id}/css/view.old.css");
            //store the old view.css content as advanced code
            //insert into ap_form_themes  table
            $query = "INSERT INTO \r\n\t\t\t\t\t\t\t\t`" . MF_TABLE_PREFIX . "form_themes` \r\n\t\t\t\t\t\t\t\t\t\t( \r\n\t\t\t\t\t\t\t\t\t\t`status`, \r\n\t\t\t\t\t\t\t\t\t\t`theme_has_css`, \r\n\t\t\t\t\t\t\t\t\t\t`theme_name`, \r\n\t\t\t\t\t\t\t\t\t\t`theme_built_in`, \r\n\t\t\t\t\t\t\t\t\t\t`logo_type`, \r\n\t\t\t\t\t\t\t\t\t\t`logo_custom_image`, \r\n\t\t\t\t\t\t\t\t\t\t`logo_custom_height`, \r\n\t\t\t\t\t\t\t\t\t\t`logo_default_image`, \r\n\t\t\t\t\t\t\t\t\t\t`logo_default_repeat`, \r\n\t\t\t\t\t\t\t\t\t\t`wallpaper_bg_type`, \r\n\t\t\t\t\t\t\t\t\t\t`wallpaper_bg_color`, \r\n\t\t\t\t\t\t\t\t\t\t`wallpaper_bg_pattern`, \r\n\t\t\t\t\t\t\t\t\t\t`wallpaper_bg_custom`, \r\n\t\t\t\t\t\t\t\t\t\t`header_bg_type`, \r\n\t\t\t\t\t\t\t\t\t\t`header_bg_color`, \r\n\t\t\t\t\t\t\t\t\t\t`header_bg_pattern`, \r\n\t\t\t\t\t\t\t\t\t\t`header_bg_custom`, \r\n\t\t\t\t\t\t\t\t\t\t`form_bg_type`, \r\n\t\t\t\t\t\t\t\t\t\t`form_bg_color`, \r\n\t\t\t\t\t\t\t\t\t\t`form_bg_pattern`, \r\n\t\t\t\t\t\t\t\t\t\t`form_bg_custom`, \r\n\t\t\t\t\t\t\t\t\t\t`highlight_bg_type`, \r\n\t\t\t\t\t\t\t\t\t\t`highlight_bg_color`, \r\n\t\t\t\t\t\t\t\t\t\t`highlight_bg_pattern`, \r\n\t\t\t\t\t\t\t\t\t\t`highlight_bg_custom`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_bg_type`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_bg_color`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_bg_pattern`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_bg_custom`, \r\n\t\t\t\t\t\t\t\t\t\t`field_bg_type`, \r\n\t\t\t\t\t\t\t\t\t\t`field_bg_color`, \r\n\t\t\t\t\t\t\t\t\t\t`field_bg_pattern`, \r\n\t\t\t\t\t\t\t\t\t\t`field_bg_custom`, \r\n\t\t\t\t\t\t\t\t\t\t`form_title_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`form_title_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`form_title_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`form_title_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`form_title_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`form_desc_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`form_desc_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`form_desc_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`form_desc_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`form_desc_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`field_title_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`field_title_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`field_title_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`field_title_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`field_title_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`guidelines_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`section_title_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`section_title_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`section_title_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`section_title_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`section_title_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`section_desc_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`section_desc_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`section_desc_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`section_desc_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`section_desc_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`field_text_font_type`, \r\n\t\t\t\t\t\t\t\t\t\t`field_text_font_weight`, \r\n\t\t\t\t\t\t\t\t\t\t`field_text_font_style`, \r\n\t\t\t\t\t\t\t\t\t\t`field_text_font_size`, \r\n\t\t\t\t\t\t\t\t\t\t`field_text_font_color`, \r\n\t\t\t\t\t\t\t\t\t\t`border_form_width`, \r\n\t\t\t\t\t\t\t\t\t\t`border_form_style`, \r\n\t\t\t\t\t\t\t\t\t\t`border_form_color`, \r\n\t\t\t\t\t\t\t\t\t\t`border_guidelines_width`, \r\n\t\t\t\t\t\t\t\t\t\t`border_guidelines_style`, \r\n\t\t\t\t\t\t\t\t\t\t`border_guidelines_color`, \r\n\t\t\t\t\t\t\t\t\t\t`border_section_width`, \r\n\t\t\t\t\t\t\t\t\t\t`border_section_style`, \r\n\t\t\t\t\t\t\t\t\t\t`border_section_color`, \r\n\t\t\t\t\t\t\t\t\t\t`form_shadow_style`, \r\n\t\t\t\t\t\t\t\t\t\t`form_shadow_size`, \r\n\t\t\t\t\t\t\t\t\t\t`form_shadow_brightness`, \r\n\t\t\t\t\t\t\t\t\t\t`form_button_type`, \r\n\t\t\t\t\t\t\t\t\t\t`form_button_text`, \r\n\t\t\t\t\t\t\t\t\t\t`form_button_image`, \r\n\t\t\t\t\t\t\t\t\t\t`advanced_css`)\r\n\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t(1,0,?,0,'default','http://',40,'machform.png',0,'color','#ececec','','','color','#DEDEDE','','',\r\n\t\t\t\t\t\t\t\t\t'color','#ffffff','','','color','#FFF7C0','','','color','#F5F5F5','','','color','#ffffff','','','Lucida Grande',\r\n\t\t\t\t\t\t\t\t\t400,'normal','160%','#000000','Lucida Grande',400,'normal','95%','#000000','Lucida Grande',700,'normal','95%','#222222',\r\n\t\t\t\t\t\t\t\t\t'Lucida Grande',400,'normal','80%','#444444','Lucida Grande',400,'normal','110%','#000000','Lucida Grande',400,'normal',\r\n\t\t\t\t\t\t\t\t\t'85%','#000000','Lucida Grande',400,'normal','100%','#333333',1,'solid','#CCCCCC',1,'solid','#CCCCCC',1,'dotted','#CCCCCC',\r\n\t\t\t\t\t\t\t\t\t'WarpShadow','large','normal','text','Submit','http://',?);";
            $theme_name = 'Form #' . $form_id . ' Theme';
            $params = array($theme_name, $advanced_css);
            $sth = $dbh->prepare($query);
            try {
                $sth->execute($params);
            } catch (PDOException $e) {
                $post_install_error .= $e->getMessage() . '<br/><br/>';
            }
            $theme_id = (int) $dbh->lastInsertId();
            //create/update the CSS file for the theme
            $css_theme_filename = "./data/themes/theme_{$theme_id}.css";
            $css_theme_content = mf_theme_get_css_content($dbh, $theme_id);
            $fpc_result = @file_put_contents($css_theme_filename, $css_theme_content);
            if (!empty($fpc_result)) {
                //if we're able to write into the css file, set the 'theme_has_css' to 1
                $params = array(1, $theme_id);
                $query = "UPDATE " . MF_TABLE_PREFIX . "form_themes SET theme_has_css = ? WHERE theme_id = ?";
                $sth = $dbh->prepare($query);
                try {
                    $sth->execute($params);
                } catch (PDOException $e) {
                    $post_install_error .= $e->getMessage() . '<br/><br/>';
                }
            }
            //update ap_forms table to use the new theme
            $query = "UPDATE " . MF_TABLE_PREFIX . "forms set form_theme_id=? where form_id=?";
            $params = array($theme_id, $form_id);
            $sth = $dbh->prepare($query);
            try {
                $sth->execute($params);
            } catch (PDOException $e) {
                $post_install_error .= $e->getMessage() . '<br/><br/>';
            }
        }
        //end file_exists
    }
    //end foreach form_id_array
    return $post_install_error;
}