Esempio n. 1
0
function rss_import_showpage()
{
    global $main_smarty, $the_template, $db;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    require_once 'class.rssimport.php';
    require_once 'modules/rss_import/magpierss/rss_fetch.inc';
    define('MAGPIE_CACHE_DIR', 'cache/templates_c/');
    define('rss_import_export_version', '0.4');
    $smarty = $main_smarty;
    include_once mnminclude . 'qeip_0_3.php';
    force_authentication();
    $amIgod = 0;
    $amIgod = $amIgod + checklevel('god');
    // pagename
    define('modulename', 'rss_import');
    $main_smarty->assign('modulename', modulename);
    // breadcrumbs and page title
    $navwhere['text1'] = $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
    $navwhere['link1'] = getmyurl('admin', '');
    $navwhere['text2'] = $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_RSSImport');
    $smarty->assign('navbar_where', $navwhere);
    $smarty->assign('posttitle', ' / ' . $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_RSSImport'));
    // sidebar
    $main_smarty = do_sidebar($main_smarty);
    if ($amIgod == 1) {
        $tableexists = checkfortable(table_prefix . 'feeds');
        if (!$tableexists) {
            echo "Creating Tables<hr />";
            include_once 'create_feed_tables.php';
            die("<hr />If there are no errors then refresh this page to continue");
        }
        $filename = 'create_feed_tables.php';
        if (file_exists($filename)) {
            // die("Please delete or rename the file create_feed_tables.php, then refresh this page");
        }
        $smarty->register_function('feedsListFeeds', 'smarty_function_feedsListFeeds');
        $smarty->register_function('feedsListFeedLinks', 'smarty_function_feedsListFeedLinks');
        $smarty->register_function('feedsListFeedFields', 'smarty_function_feedsListFeedFields');
        $smarty->register_function('feedsListPliggLinkFields', 'smarty_function_feedsListPliggLinkFields');
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_name', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedName', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_url', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedURL', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_category', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedCategory', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_freq_hours', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedFreqHours', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_votes', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedVotes', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_item_limit', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedItemLimit', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_url_dupe', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedURLDupe', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_title_dupe', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedTitleDupe', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_submitter', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedSubmitter', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'feed_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
        // the type of EIP field to show
        $smarty->assign('qeip_FeedLink_FeedField', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'pligg_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
        // the type of EIP field to show
        $smarty->assign('qeip_FeedLink_PliggField', $QEIPA);
        // feed oldest first
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_last_item_first', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedLastItemFirst', $QEIPA);
        // feed random vote
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_enable', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedRandomVoteEnable', $QEIPA);
        // feed random vote min
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_min', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedRandomVotesMin', $QEIPA);
        // feed random vote max
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_max', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedRandomVotesMax', $QEIPA);
        $QEIP = new QuickEIP();
        if (!isset($_REQUEST['action'])) {
            $smarty->assign('tpl_center', rss_import_tpl_path . 'admin_rss_center');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
            echo $QEIP->ShowOnloadJS();
        } else {
            if ($_REQUEST['action'] == "addnewfieldlink") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
                $RSSImport->new_field_link();
                redirect('module.php?module=rss_import&action=editfeed&feed_id=' . $_REQUEST['FeedLinkId']);
            }
            if ($_REQUEST['action'] == "dropfieldlink") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
                $RSSImport->drop_field_link();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "addnewfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedName = "New Feed";
                $RSSImport->new_feed();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "dropfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $RSSImport->drop_feed();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "save") {
                echo $QEIP->save_field($smarty);
            }
            if ($_REQUEST['action'] == "examinefeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $RSSImport->read_feed();
                $rss = fetch_rss($RSSImport->FeedURL);
                $z = $rss->items[0];
                if ($z) {
                    echo 'First item in the feed.<hr />';
                    print_r_html($z);
                    echo '<hr />Feed dump.<hr />';
                    print_r_html($rss);
                } else {
                    echo '<hr />There are no items in this feed<hr />';
                }
            }
            if ($_REQUEST['action'] == "editfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $smarty->assign('tpl_center', rss_import_tpl_path . 'admin_rss_center2');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
            }
            if ($_REQUEST['action'] == "exportfeed") {
                echo 'copy all the text in the box<br />';
                echo '<textarea rows=10 cols=70>' . serialize_feed($_REQUEST['feed_id']) . '</textarea>';
                echo '<br /><br /><a href = "module.php?module=rss_import">return to the rss importer</a>';
            }
            if ($_REQUEST['action'] == "importprebuiltfeed_go") {
                $feed = stripslashes($_REQUEST['prebuiltfeed']);
                if (strpos($feed, '://') < 10) {
                    $r = new HTTPRequest($feed);
                    $feed = $r->DownloadToString();
                }
                if (import_prebuilt($feed)) {
                    redirect(my_pligg_base . '/module.php?module=rss_import');
                } else {
                    // what do we do if error?
                }
            }
        }
        //echo $QEIP->ShowOnloadJS();
    }
}
Esempio n. 2
0
    $db->query($sql);
    $sql = "DELETE FROM `" . table_config . "` WHERE `var_page` = 'Captcha';";
    $db->query($sql);
    // Change config categories for 1.0
    $sql = "UPDATE `" . table_config . "` SET `var_page` = 'SEO' WHERE `var_page` = 'UrlMethod';";
    $db->query($sql);
    $sql = "UPDATE `" . table_config . "` SET `var_page` = 'SEO' WHERE `var_page` = 'FriendlyURLs';";
    $db->query($sql);
    $sql = "UPDATE `" . table_config . "` SET `var_page` = 'Misc' WHERE `var_page` = 'Trackback';";
    $db->query($sql);
    $sql = "UPDATE `" . table_config . "` SET `var_page` = 'Misc' WHERE `var_page` = 'ExtraFields';";
    $db->query($sql);
    $sql = "UPDATE `" . table_config . "` SET `var_page` = 'Misc' WHERE `var_page` = 'Social';";
    $db->query($sql);
    $tableexists = checkfortable(table_login_attempts);
    if (!$tableexists) {
        $sql = "CREATE TABLE `" . table_login_attempts . "` (\r\n\t\t\t  `login_id` int(11) NOT NULL auto_increment,\r\n\t\t\t  `login_username` varchar(100) collate utf8_general_ci default NULL,\r\n\t\t\t  `login_time` datetime NOT NULL,\r\n\t\t\t  `login_ip` varchar(100) collate utf8_general_ci default NULL,\r\n\t\t\t  `login_count` int(11) NOT NULL default '0',\r\n\t\t\t  PRIMARY KEY  (`login_id`),\r\n\t\t\t  UNIQUE KEY `login_username` (`login_ip`,`login_username`)\r\n\t\t\t) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
        $db->query($sql);
    }
    $tableexists = checkfortable(table_additional_categories);
    if (!$tableexists) {
        $sql = "CREATE TABLE `" . table_additional_categories . "` (\r\n\t\t\t  `ac_link_id` int(11) NOT NULL,\r\n\t\t\t  `ac_cat_id` int(11) NOT NULL,\r\n\t\t\t  UNIQUE KEY `ac_link_id` (`ac_link_id`,`ac_cat_id`)\r\n\t\t\t) ENGINE=MyISAM;";
        $db->query($sql);
    }
    // Update version number
    $sql = "UPDATE `" . table_misc_data . "` SET `data` = '1.2.2' WHERE `name` = 'pligg_version';";
    $db->query($sql);
    echo '<li>Updated version number to 1.2.2</li>';
    // Finished 1.x upgrade
    echo '</ul>';
}
Esempio n. 3
0
         echo '<p>$filename' . $lang['NotFound'] . '</p>';
         exit;
     }
     // Write $languageContent to the opened language file.
     if (fwrite($handle, $languageContent) === FALSE) {
         echo '<p>$filename' . $lang['NotEditable'] . '</p>';
         exit;
     }
     echo '<p>' . $lang['UpgradeLanguage'] . '</p>';
     fclose($handle);
 } else {
     echo '<p>$filename' . $lang['NotEditable'] . '</p>';
 }
 // End Language File Upgrade
 echo '<p>' . $lang['UpgradingTables'] . '<ul>';
 $tableexists = checkfortable(table_misc_data);
 if ($tableexists) {
     // Get version-specific updates
     $sql = "SELECT data FROM " . table_misc_data . " WHERE name = 'pligg_version'";
     $pligg_version = $db->get_var($sql);
     $old_version = str_replace('.', '', $pligg_version);
 }
 if (!$tableexists) {
     $sql = "CREATE TABLE `" . table_misc_data . "` (\n\t\t\t`name` VARCHAR( 20 ) NOT NULL ,\n\t\t\t`data` TEXT NOT NULL ,\n\t\t\tPRIMARY KEY ( `name` )\n\t\t\t) ENGINE = MyISAM;";
     $db->query($sql);
     // Add Pligg version
     $sql = "INSERT INTO `" . table_misc_data . "` ( `name` , `data` ) VALUES ('pligg_version', '2.0.3');";
     $db->query($sql);
     //Captcha upgrade:
     $sql = "INSERT INTO `" . table_misc_data . "` ( `name` , `data` ) VALUES ('captcha_method', 'solvemedia');";
     $db->query($sql);
Esempio n. 4
0
<?php

include '../config.php';
require mnminclude . 'qeip_0_3.php';
require_once '../3rdparty/magpierss/rss_fetch.inc';
require './libs/rssimport.php';
include mnminclude . 'html1.php';
force_authentication();
$amIgod = 0;
$amIgod = $amIgod + checklevel('god');
if ($amIgod == 1) {
    $tableexists = checkfortable(table_prefix . 'feed_import');
    if (!$tableexists) {
        echo "Creating Tables<hr />";
        include_once 'create_mysql_tables.php';
        die("<hr />If there are no errors then refresh this page to continue");
    }
    $filename = 'create_mysql_tables.php';
    if (file_exists($filename)) {
        die("Please delete or rename the file /rss/create_mysql_tables.php, then refresh this page");
    }
    include_once '../Smarty.class.php';
    $smarty = new Smarty();
    $smarty->compile_dir = "templates_c/";
    $smarty->template_dir = "templates/";
    $smarty->config_dir = "";
    $smarty->register_function('feedsListFeeds', 'smarty_function_feedsListFeeds');
    $smarty->register_function('feedsListFeedLinks', 'smarty_function_feedsListFeedLinks');
    $smarty->register_function('feedsListFeedFields', 'smarty_function_feedsListFeedFields');
    $smarty->register_function('feedsListPliggLinkFields', 'smarty_function_feedsListPliggLinkFields');
    $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_name', 'key' => 'feed_id');
Esempio n. 5
0
     $sql = "ALTER TABLE `" . table_categories . "` ADD `category_color` varchar(6) default '000000'";
     $db->query($sql);
     $sql = "ALTER TABLE `" . table_categories . "` DROP INDEX `category_lang`";
     $db->query($sql);
     $sql = "ALTER TABLE `" . table_categories . "` ADD UNIQUE `key` (`category_name`)";
     $db->query($sql);
     $sql = "INSERT INTO `" . table_categories . "` VALUES (0, '" . $dblang . "', 0, 0, 'all', 'all', 0, 0, 2, 0, '000000');";
     $db->query($sql);
     $sql = "UPDATE `" . table_categories . "` SET `category__auto_id` = '0' WHERE `category_name` = 'all' LIMIT 1;";
     $db->query($sql);
 }
 include_once mnminclude . 'dbtree.php';
 rebuild_the_tree();
 ordernew();
 // for the module system
 $tableexists = checkfortable(table_modules);
 if (!$tableexists) {
     $sql = "CREATE TABLE `" . table_modules . "` (\r\n  `id` int(11) NOT NULL auto_increment,\r\n  `name` varchar(50) NOT NULL,\r\n  `version` float NOT NULL,\r\n  `folder` varchar(50) NOT NULL,\r\n  `enabled` tinyint(1) NOT NULL,\r\n  PRIMARY KEY  (`id`)\r\n) TYPE = MyISAM;";
     $db->query($sql);
 }
 $result = mysql_query("select * from `" . table_modules . "` where `name` = 'Javascript Effects Pack';");
 if (mysql_num_rows($result) == 0) {
     $db->query("INSERT INTO `" . table_modules . "` VALUES (1, 'Javascript Effects Pack', 0.1, 'scriptaculous', 1);");
 }
 $result = mysql_query("select * from `" . table_modules . "` where `name` = 'Admin Modify Language';");
 if (mysql_num_rows($result) == 0) {
     $db->query("INSERT INTO `" . table_modules . "` VALUES (2, 'Admin Modify Language', 0.1, 'admin_language', 1);");
 }
 echo 'Clearing templates_c directory...<br />';
 echo "<br /><b>If there were no errors displayed, upgrade is complete!</b>";
 include mnminclude . 'admin_config.php';
Esempio n. 6
0
 private function upgrade_to_1_8_9_4($version)
 {
     global $wpdb;
     // Try to enable the expired ads, bug in 1.0.6.17:
     if ($version == '1.0.6.17') {
         $query = "UPDATE " . AWPCP_TABLE_ADS . " SET DISABLED=0 WHERE ad_enddate >= NOW()";
         $wpdb->query($query);
     }
     if (version_compare($version, '1.8.7.1', "<")) {
         // Fix the problem with disabled_date not being nullable from 1.8.7
         $query = "ALTER TABLE " . AWPCP_TABLE_ADS . " MODIFY disabled_date DATETIME";
         $wpdb->query($query);
     }
     // Upgrade featured ad columns for module
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'is_featured_ad')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `is_featured_ad` TINYINT(1) DEFAULT NULL");
     }
     // Upgrade for tracking poster's IP address
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'posterip')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `posterip` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL");
     }
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'flagged')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `flagged` TINYINT(1) DEFAULT NULL");
     }
     // Upgrade for deleting ads that are marked as disabled or deleted
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'disabled_date')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `disabled_date` DATETIME DEFAULT NULL");
     }
     if (!awpcp_column_exists(AWPCP_TABLE_ADFEES, 'is_featured_ad_pricing')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADFEES . "  ADD `is_featured_ad_pricing` TINYINT(1) DEFAULT NULL");
     }
     if (!awpcp_column_exists(AWPCP_TABLE_ADFEES, 'categories')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADFEES . "  ADD `categories` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci");
     }
     if (!awpcp_column_exists(AWPCP_TABLE_CATEGORIES, 'category_order')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_CATEGORIES . "  ADD `category_order` INT(10) NULL DEFAULT 0 AFTER category_name");
         $wpdb->query("UPDATE " . AWPCP_TABLE_CATEGORIES . " SET category_order=0");
     }
     // Fix the shortcode issue if present in installed version
     $sql = "UPDATE " . $wpdb->posts . " SET post_content='[AWPCPCLASSIFIEDSUI]' ";
     $sql .= "WHERE post_content='[[AWPCPCLASSIFIEDSUI]]'";
     $wpdb->query($sql);
     $settings_table_exists = checkfortable(AWPCP_TABLE_ADSETTINGS);
     if ($settings_table_exists && !field_exists('tos')) {
         // add terms of service field
         $sql = 'INSERT INTO ' . AWPCP_TABLE_ADSETTINGS . '(`config_option`,`config_value`,`config_diz`,`config_group_id`,`option_type`)
             VALUES ("tos","Terms of service go here...","Terms of Service for posting an ad - modify this to fit your needs:","1","0")';
         $wpdb->query($sql);
         $sql = 'INSERT INTO ' . AWPCP_TABLE_ADSETTINGS . '(`config_option`,`config_value`,`config_diz`,`config_group_id`,`option_type`)
             VALUES ("requiredtos", "Display and require Terms of Service","Display and require Terms of Service","1","0")';
         $wpdb->query($sql);
     }
     if ($settings_table_exists && !field_exists('notifyofadexpired')) {
         //add notify of an expired ad field
         $sql = 'insert into ' . AWPCP_TABLE_ADSETTINGS . '(`config_option`,`config_value`,`config_diz`,`config_group_id`,`option_type`)
             values ("notifyofadexpired","Notify admin of expired ads.","Notify admin of expired ads.","1","0")';
         $wpdb->query($sql);
     }
     if ($settings_table_exists && field_exists('notifyofadexpired')) {
         //Fix bug from 1.8.6.4:
         $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET option_type =0 where config_option='notifyofadexpired'");
     }
     // Update ad_settings table to ad field config groud ID if field does not exist in installed version
     $cgid_column_name_exists = $wpdb->get_var("SELECT config_group_id FROM " . AWPCP_TABLE_ADSETTINGS);
     if ($settings_table_exists && ($cgid_column_name_exists === false || is_null($cgid_column_name_exists))) {
         $query = "ALTER TABLE " . AWPCP_TABLE_ADSETTINGS . "  ADD `config_group_id` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER config_diz";
         $wpdb->query($query);
         $myconfig_group_ops_1 = array('showlatestawpcpnews', 'uiwelcome', 'main_page_display', 'useakismet', 'contactformcheckhuman', 'contactformcheckhumanhighnumval', 'awpcptitleseparator', 'showcityinpagetitle', 'showstateinpagetitle', 'showcountryinpagetitle', 'showcategoryinpagetitle', 'showcountyvillageinpagetitle', 'awpcppagefilterswitch', 'activatelanguages', 'sidebarwidgetbeforecontent', 'sidebarwidgetaftercontent', 'sidebarwidgetbeforetitle', 'sidebarwidgetaftertitle', 'usesenderemailinsteadofadmin', 'awpcpadminaccesslevel', 'awpcpadminemail', 'useakismet');
         $myconfig_group_ops_2 = array('addurationfreemode', 'autoexpiredisabledelete', 'maxcharactersallowed', 'notifyofadexpiring', 'notifyofadposted', 'adapprove', 'disablependingads', 'showadcount', 'displayadviews', 'onlyadmincanplaceads', 'allowhtmlinadtext', 'hyperlinkurlsinadtext', 'notice_awaiting_approval_ad', 'buildsearchdropdownlists', 'visitwebsitelinknofollow', 'groupbrowseadsby', 'groupsearchresultsby', 'displayadthumbwidth', 'adresultsperpage', 'displayadlayoutcode', 'awpcpshowtheadlayout');
         $myconfig_group_ops_3 = array('freepay', 'paylivetestmode', 'paypalemail', 'paypalcurrencycode', 'displaycurrencycode', '2checkout', 'activatepaypal', 'activate2checkout', 'twocheckoutpaymentsrecurring', 'paypalpaymentsrecurring');
         $myconfig_group_ops_4 = array('imagesallowdisallow', 'awpcp_thickbox_disabled', 'imagesapprove', 'imagesallowedfree', 'uploadfoldername', 'maximagesize', 'minimagesize', 'imgthumbwidth', 'imgmaxheight', 'imgmaxwidth');
         $myconfig_group_ops_5 = array('useadsense', 'adsense', 'adsenseposition');
         $myconfig_group_ops_6 = array('displayphonefield', 'displayphonefieldreqop', 'displaycityfield', 'displaycityfieldreqop', 'displaystatefield', 'displaystatefieldreqop', 'displaycountryfield', 'displaycountryfieldreqop', 'displaycountyvillagefield', 'displaycountyvillagefieldreqop', 'displaypricefield', 'displaypricefieldreqop', 'displaywebsitefield', 'displaywebsitefieldreqop', 'displaypostedbyfield');
         $myconfig_group_ops_7 = array('requireuserregistration', 'postloginformto', 'registrationurl');
         $myconfig_group_ops_8 = array('contactformsubjectline', 'contactformbodymessage', 'listingaddedsubject', 'listingaddedbody', 'resendakeyformsubjectline', 'resendakeyformbodymessage', 'paymentabortedsubjectline', 'paymentabortedbodymessage', 'adexpiredsubjectline', 'adexpiredbodymessage');
         $myconfig_group_ops_9 = array('usesmtp', 'smtphost', 'smtpport', 'smtpusername', 'smtppassword');
         $myconfig_group_ops_10 = array('userpagename', 'showadspagename', 'placeadpagename', 'page-name-renew-ad', 'browseadspagename', 'browsecatspagename', 'editadpagename', 'paymentthankyoupagename', 'paymentcancelpagename', 'replytoadpagename', 'searchadspagename', 'categoriesviewpagename');
         $myconfig_group_ops_11 = array('seofriendlyurls', 'pathvaluecontact', 'pathvalueshowad', 'pathvaluebrowsecategory', 'pathvalueviewcategories', 'pathvaluecancelpayment', 'pathvaluepaymentthankyou');
         // assign a group value to each setting
         foreach ($myconfig_group_ops_1 as $myconfig_group_op_1) {
             add_config_group_id($cvalue = 1, $myconfig_group_op_1);
         }
         foreach ($myconfig_group_ops_2 as $myconfig_group_op_2) {
             add_config_group_id($cvalue = '2', $myconfig_group_op_2);
         }
         foreach ($myconfig_group_ops_3 as $myconfig_group_op_3) {
             add_config_group_id($cvalue = '3', $myconfig_group_op_3);
         }
         foreach ($myconfig_group_ops_4 as $myconfig_group_op_4) {
             add_config_group_id($cvalue = '4', $myconfig_group_op_4);
         }
         foreach ($myconfig_group_ops_5 as $myconfig_group_op_5) {
             add_config_group_id($cvalue = '5', $myconfig_group_op_5);
         }
         foreach ($myconfig_group_ops_6 as $myconfig_group_op_6) {
             add_config_group_id($cvalue = '6', $myconfig_group_op_6);
         }
         foreach ($myconfig_group_ops_7 as $myconfig_group_op_7) {
             add_config_group_id($cvalue = '7', $myconfig_group_op_7);
         }
         foreach ($myconfig_group_ops_8 as $myconfig_group_op_8) {
             add_config_group_id($cvalue = '8', $myconfig_group_op_8);
         }
         foreach ($myconfig_group_ops_9 as $myconfig_group_op_9) {
             add_config_group_id($cvalue = '9', $myconfig_group_op_9);
         }
         foreach ($myconfig_group_ops_10 as $myconfig_group_op_10) {
             add_config_group_id($cvalue = '10', $myconfig_group_op_10);
         }
         foreach ($myconfig_group_ops_11 as $myconfig_group_op_11) {
             add_config_group_id($cvalue = '11', $myconfig_group_op_11);
         }
     }
     if ($settings_table_exists && get_awpcp_option_group_id('seofriendlyurls') == 1) {
         $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET `config_group_id` = '11' WHERE `config_option` = 'seofriendlyurls'");
     }
     if ($settings_table_exists && get_awpcp_option_type('main_page_display') == 1) {
         $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET `config_value` = 0, `option_type` = 0, `config_diz` = 'Main page layout [ check for ad listings ] [ Uncheck for categories ]',config_group_id=1 WHERE `config_option` = 'main_page_display'");
     }
     if ($settings_table_exists && get_awpcp_option_config_diz('paylivetestmode') != "Put payment gateways in test mode") {
         $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET `config_value` = 0, `option_type` = 0, `config_diz` = 'Put payment gateways in test mode' WHERE `config_option` = 'paylivetestmode'");
     }
     if ($settings_table_exists && get_awpcp_option_config_diz('adresultsperpage') != "Default number of ads per page") {
         $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET `config_value` = '10', `option_type` = 1, `config_diz` = 'Default number of ads per page' WHERE `config_option` = 'adresultsperpage'");
     }
     if ($settings_table_exists && get_awpcp_option_config_diz('awpcpshowtheadlayout') != "<div id=\"showawpcpadpage\"><div class=\"adtitle\">{$ad_title}</div><br/><div class=\"showawpcpadpage\">{$featureimg}<label>Contact Information</label><br/><a href=\"{$quers}/{$codecontact}\">Contact {$adcontact_name}</a>{$adcontactphone} {$location} {$awpcpvisitwebsite}</div>{$aditemprice} {$awpcpextrafields} <div class=\"fixfloat\"></div> {$showadsense1}<div class=\"showawpcpadpage\"><label>More Information</label><br/>{$addetails}</div>{$showadsense2} <div class=\"fixfloat\"></div><div id=\"displayimagethumbswrapper\"><div id=\"displayimagethumbs\"><ul>{$awpcpshowadotherimages}</ul></div></div><span class=\"fixfloat\">{$tweetbtn} {$sharebtn} {$flagad}</span>{$awpcpadviews} {$showadsense3}</div>") {
         $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET `config_value` = '2', `option_type` = '2', `config_diz` = 'Modify as needed to control layout of single ad view page. Maintain code formatted as \$somecodetitle. Changing the code keys will prevent the elements they represent from displaying.', `config_value` = '<div id=\"showawpcpadpage\"><div class=\"adtitle\">\$ad_title</div><br/><div class=\"showawpcpadpage\">\$featureimg<label>Contact Information</label><br/><a href=\"\$quers/\$codecontact\">Contact \$adcontact_name</a>\$adcontactphone \$location \$awpcpvisitwebsite</div>\$aditemprice \$awpcpextrafields <div class=\"fixfloat\"></div> \$showadsense1<div class=\"showawpcpadpage\"><label>More Information</label><br/>\$addetails</div>\$showadsense2 <div class=\"fixfloat\"></div><div id=\"displayimagethumbswrapper\"><div id=\"displayimagethumbs\"><ul>\$awpcpshowadotherimages</ul></div></div><span class=\"fixfloat\">\$tweetbtn \$sharebtn \$flagad</span>\$awpcpadviews \$showadsense3</div>' WHERE `config_option` = 'awpcpshowtheadlayout'");
     }
     ////
     // Match up the ad settings fields of current versions and upgrading versions
     ////
     if ($settings_table_exists) {
         if (!field_exists($field = 'userpagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('userpagename', 'AWPCP', 'Name for classifieds page. [CAUTION: Make sure page does not already exist]','10',1);");
         }
         if (!field_exists($field = 'showadspagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showadspagename', 'Show Ad', 'Name for show ads page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'placeadpagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('placeadpagename', 'Place Ad', 'Name for place ads page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'browseadspagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('browseadspagename', 'Browse Ads', 'Name browse ads apge. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'searchadspagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES        ('searchadspagename', 'Search Ads', 'Name for search ads page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'paymentthankyoupagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paymentthankyoupagename', 'Payment Thank You', 'Name for payment thank you page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'paymentcancelpagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paymentcancelpagename', 'Cancel Payment', 'Name for payment cancel page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'replytoadpagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('replytoadpagename', 'Reply To Ad', 'Name for reply to ad page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'browsecatspagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('browsecatspagename', 'Browse Categories', 'Name for browse categories page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'editadpagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('editadpagename', 'Edit Ad', 'Name for edit ad page. [CAUTION: existing page will be overwritten]','10',1);");
         }
         if (!field_exists($field = 'categoriesviewpagename')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES        ('categoriesviewpagename', 'View Categories', 'Name for categories view page. [ Dynamic Page]','10',1);");
         }
         if (!field_exists($field = 'freepay')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('freepay', 0, 'Charge Listing Fee?','3',0);");
         }
         if (!field_exists($field = 'requireuserregistration')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('requireuserregistration', 0, 'Require user registration?','7',0);");
         }
         if (!field_exists($field = 'postloginformto')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('postloginformto', '', 'Post login form to [Value should be the full URL to the wordpress login script. Example http://www.awpcp.com/wp-login.php **Only needed if registration is required and your login url is mod-rewritten ] ','7',1);");
         }
         if (!field_exists($field = 'registrationurl')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('registrationurl', '', 'Location of registraiton page [Value should be the full URL to the wordpress registration page. Example http://www.awpcp.com/wp-login.php?action=register **Only needed if registration is required and your login url is mod-rewritten ] ','7',1);");
         }
         if (!field_exists($field = 'main_page_display')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('main_page_display', 0, 'Main page layout [ check for ad listings | Uncheck for categories ]',1,0);");
         }
         if (!field_exists($field = 'activatelanguages')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('activatelanguages', 0, 'Activate Language Capability',1,0);");
         }
         if (!field_exists($field = 'awpcpadminaccesslevel')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('awpcpadminaccesslevel', 'admin', 'Set wordpress role of users who can have admin access to classifieds. Choices [admin,editor]. Currently no other roles will be granted access.',1,1);");
         }
         if (!field_exists($field = 'sidebarwidgetaftertitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('sidebarwidgetaftertitle', '</h3>', 'Code to appear after widget title',1,1);");
         }
         if (!field_exists($field = 'sidebarwidgetbeforetitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('sidebarwidgetbeforetitle', '<h3 class=\"widgettitle\">', 'Code to appear before widget title',1,1);");
         }
         if (!field_exists($field = 'sidebarwidgetaftercontent')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('sidebarwidgetaftercontent', '</div>', 'Code to appear after widget content',1,1);");
         }
         if (!field_exists($field = 'sidebarwidgetbeforecontent')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('sidebarwidgetbeforecontent', '<div class=\"widget\">', 'Code to appear before widget content',1,1);");
         }
         if (!field_exists($field = 'usesenderemailinsteadofadmin')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('usesenderemailinsteadofadmin', 0, 'Check this to use the name and email of the sender in the FROM field when someone replies to an ad. When unchecked the messages go out with the website name and WP admin email address in the from field. Some servers will not process outgoing emails that have an email address from gmail, yahoo, hotmail and other free email services in the FROM field. Some servers will also not process emails that have an email address that is different from the email address associated with your hosting account in the FROM field. If you are with such a webhost you need to leave this option unchecked and make sure your WordPress admin email address is tied to your hosting account.',1,0);");
         }
         if (!field_exists($field = 'awpcpadminemail')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('awpcpadminemail', '', 'Emails go out using your WordPress admin email. If you prefer to use a different email enter it here.',1,1);");
         }
         if (!field_exists($field = 'awpcptitleseparator')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('awpcptitleseparator', '-', 'The character to use to separate ad details used in browser page title [Example: | / - ]',1,1);");
         }
         if (!field_exists($field = 'showcityinpagetitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showcityinpagetitle', 1, 'Show city in browser page title when viewing individual ad',1,0);");
         }
         if (!field_exists($field = 'showstateinpagetitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showstateinpagetitle', 1, 'Show state in browser page title when viewing individual ad',1,0);");
         }
         if (!field_exists($field = 'showcountryinpagetitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showcountryinpagetitle', 1, 'Show country in browser page title when viewing individual ad',1,0);");
         }
         if (!field_exists($field = 'showcountyvillageinpagetitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES        ('showcountyvillageinpagetitle', 1, 'Show county/village/other setting in browser page title when viewing individual ad',1,0);");
         }
         if (!field_exists($field = 'showcategoryinpagetitle')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showcategoryinpagetitle', 1, 'Show category in browser page title when viewing individual ad',1,0);");
         }
         if (!field_exists($field = 'awpcppagefilterswitch')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('awpcppagefilterswitch', 1, 'Uncheck this if you need to turn off the awpcp page filter that prevents awpcp classifieds children pages from showing up in your wp pages menu [you might need to do this if for example the awpcp page filter is messing up your page menu. It means you will have to manually exclude the awpcp children pages from showing in your page list. Some of the pages really should not be visible to your users by default]',1,0);");
         }
         if (!field_exists($field = 'paylivetestmode')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paylivetestmode', 0, 'Put Paypal and 2Checkout in test mode.','3',0);");
         }
         if (!field_exists($field = 'useadsense')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('useadsense', 1, 'Activate adsense','5',0);");
         }
         if (!field_exists($field = 'adsense')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('adsense', 'Adsense code', 'Your adsense code [ Best if 468 by 60 text or banner. ]','5','2');");
         }
         if (!field_exists($field = 'adsenseposition')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('adsenseposition', '2', 'Adsense position. [ 1 - above ad text body ] [ 2 - under ad text body ] [ 3 - below ad images. ]','5',1);");
         }
         if (!field_exists($field = 'addurationfreemode')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('addurationfreemode', 0, 'Expire free ads after how many days? [0 for no expiry].','2',1);");
         }
         if (!field_exists($field = 'autoexpiredisabledelete')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('autoexpiredisabledelete', 0, 'Disable expired ads instead of deleting them?','2',0);");
         }
         if (!field_exists($field = 'imagesallowdisallow')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('imagesallowdisallow', 1, 'Allow images in ads? [Affects both free and paid]','4',0);");
         }
         if (!field_exists($field = 'awpcp_thickbox_disabled')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('awpcp_thickbox_disabled', 0, 'Turn off the thickbox/lightbox if it conflicts with other elements of your site','4',0);");
         }
         if (!field_exists($field = 'imagesallowedfree')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('imagesallowedfree', '4', ' Free mode number of images allowed?','4',1);");
         }
         if (!field_exists($field = 'uploadfoldername')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('uploadfoldername', 'uploads', 'Upload folder name. [ Folder must exist and be located in your wp-content directory ]','4',1);");
         }
         if (!field_exists($field = 'maximagesize')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('maximagesize', '150000', 'Maximum size per image user can upload to system.','4',1);");
         }
         if (!field_exists($field = 'minimagesize')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('minimagesize', '300', 'Minimum size per image user can upload to system','4',1);");
         }
         if (!field_exists($field = 'imgthumbwidth')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('imgthumbwidth', '125', 'Minimum height/width for uploaded images (used for both).','4',1);");
         }
         if (!field_exists($field = 'maxcharactersallowed')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('maxcharactersallowed', '750', 'What is the maximum number of characters the text of an ad can contain?','2',1);");
         }
         if (!field_exists($field = 'imgmaxheight')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,`config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('imgmaxheight', '480', 'Max image height. Images taller than this are automatically resized upon upload.','4',1);");
         }
         if (!field_exists($field = 'imgmaxwidth')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('imgmaxwidth', '640', 'Max image width. Images wider than this are automatically resized upon upload.','4',1);");
         }
         if (!field_exists($field = 'paypalemail')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paypalemail', '*****@*****.**', 'Email address for paypal payments [if running in paymode and if paypal is activated]','3',1);");
         }
         if (!field_exists($field = 'paypalcurrencycode')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paypalcurrencycode', 'USD', 'The currency in which you would like to receive your paypal payments','3',1);");
         }
         if (!field_exists($field = 'displaycurrencycode')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycurrencycode', 'USD', 'The currency to show on your payment pages','3',1);");
         }
         if (!field_exists($field = '2checkout')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('2checkout', 'xxxxxxx', 'Account for 2Checkout payments [if running in pay mode and if 2Checkout is activated]','3',1);");
         }
         if (!field_exists($field = 'activatepaypal')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('activatepaypal', 1, 'Activate PayPal','3',0);");
         }
         if (!field_exists($field = 'activate2checkout')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('activate2checkout', 1, 'Activate 2Checkout ','3',0);");
         }
         if (!field_exists($field = 'paypalpaymentsrecurring')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paypalpaymentsrecurring', 0, 'Use recurring payments paypal [ this feature is not fully automated or fully integrated. For more reliable results do not use recurring ','3',0);");
         }
         if (!field_exists($field = 'twocheckoutpaymentsrecurring')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('twocheckoutpaymentsrecurring', 0, 'Use recurring payments 2checkout [ this feature is not fully automated or fully integrated. For more reliable results do not use recurring ','3',0);");
         }
         if (!field_exists($field = 'notifyofadexpiring')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('notifyofadexpiring', 1, 'Notify ad poster that their ad has expired?','2',0);");
         }
         if (!field_exists($field = 'notifyofadposted')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('notifyofadposted', 1, 'Notify admin of new ad.','2',0);");
         }
         if (!field_exists($field = 'listingaddedsubject')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('listingaddedsubject', 'Your classified ad listing has been submitted', 'Subject line for email sent out when someone posts an ad','8',1);");
         }
         if (!field_exists($field = 'listingaddedbody')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('listingaddedbody', 'Thank you for submitting your classified ad. The details of your ad are shown below.', 'Message body text for email sent out when someone posts an ad','8','2');");
         }
         if (!field_exists($field = 'imagesapprove')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('imagesapprove', 0, 'Hide images until admin approves them','4',0);");
         }
         if (!field_exists($field = 'adapprove')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('adapprove', 0, 'Disable ad until admin approves','2',0);");
         }
         if (!field_exists($field = 'displayadthumbwidth')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displayadthumbwidth', '80', 'Width for thumbnails in ad listings view [Only numerical value]','2',1);");
         }
         if (!field_exists($field = 'disablependingads')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('disablependingads', 1, 'Enable paid ads that are pending payment.','2',0);");
         }
         if (!field_exists($field = 'groupbrowseadsby')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('groupbrowseadsby', 1, 'Group ad listings by','2','3');");
         }
         if (!field_exists($field = 'groupsearchresultsby')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('groupsearchresultsby', 1, 'Group ad listings in search results by','2','3');");
         }
         if (!field_exists($field = 'showadcount')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showadcount', 1, 'Show how many ads a category contains.','2',0);");
         }
         if (!field_exists($field = 'adresultsperpage')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('adresultsperpage', '10', 'Default number of ads per page','2',1);");
         }
         if (!field_exists($field = 'noadsinparentcat')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('noadsinparentcat', 0, 'Prevent ads from being posted to top level categories?.','2',0);");
         }
         if (!field_exists($field = 'displayadviews')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displayadviews', 1, 'Show ad views','2',0);");
         }
         if (!field_exists($field = 'displayadlayoutcode')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displayadlayoutcode', '<div class=\"\$awpcpdisplayaditems\"><div style=\"width:\$imgblockwidth;padding:5px;float:left;margin-right:20px;\">\$awpcp_image_name_srccode</div><div style=\"width:50%;padding:5px;float:left;\"><h4>\$ad_title</h4> \$addetailssummary...</div><div style=\"padding:5px;float:left;\"> \$awpcpadpostdate \$awpcp_city_display \$awpcp_state_display \$awpcp_display_adviews \$awpcp_display_price </div><div class=\"fixfloat\"></div></div><div class=\"fixfloat\"></div>', 'Modify as needed to control layout of ad listings page. Maintain code formatted as \$somecodetitle. Changing the code keys will prevent the elements they represent from displaying.','2','2');");
         }
         if (!field_exists($field = 'awpcpshowtheadlayout')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('awpcpshowtheadlayout', '<div id=\"showawpcpadpage\"><div class=\"adtitle\">\$ad_title</div><br/><div class=\"showawpcpadpage\">\$featureimg<label>Contact Information</label><br/><a href=\"\$quers/\$codecontact\">Contact \$adcontact_name</a>\$adcontactphone \$location \$awpcpvisitwebsite</div>\$aditemprice \$awpcpextrafields <div class=\"fixfloat\"></div> \$showadsense1<div class=\"showawpcpadpage\"><label>More Information</label><br/>\$addetails</div>\$showadsense2 <div class=\"fixfloat\"></div><div id=\"displayimagethumbswrapper\"><div id=\"displayimagethumbs\"><ul>\$awpcpshowadotherimages</ul></div></div><span class=\"fixfloat\">\$tweetbtn \$sharebtn \$flagad</span>\$awpcpadviews \$showadsense3</div>', 'Modify as needed to control layout of single ad view page. Maintain code formatted as \$somecodetitle. Changing the code keys will prevent the elements they represent from displaying.','2','2');");
         }
         if (!field_exists($field = 'usesmtp')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('usesmtp', 0, 'Enable external SMTP server [ if emails not processing normally]', 9 ,0);");
         }
         if (!field_exists($field = 'smtphost')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('smtphost', 'mail.example.com', 'SMTP host [ if emails not processing normally]', 9 ,1);");
         }
         if (!field_exists($field = 'smtpport')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('smtpport', '25', 'SMTP port [ if emails not processing normally]', 9 ,1);");
         }
         if (!field_exists($field = 'smtpusername')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('smtpusername', 'smtp_username', 'SMTP username [ if emails not processing normally]', 9,1);");
         }
         if (!field_exists($field = 'smtppassword')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('smtppassword', '', 'SMTP password [ if emails not processing normally]', 9,1);");
         }
         if (!field_exists($field = 'onlyadmincanplaceads')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('onlyadmincanplaceads', 0, 'Only admin can post ads', '2',0);");
         }
         if (!field_exists($field = 'contactformcheckhuman')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('contactformcheckhuman', 1, 'Activate Math ad post and contact form validation', 1,0);");
         }
         if (!field_exists($field = 'useakismet')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('useakismet', 0, 'Use Akismet for Posting Ads/Contact Responses (strong anti-spam)', 1,0);");
         }
         if (!field_exists($field = 'contactformcheckhumanhighnumval')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('contactformcheckhumanhighnumval', '10', 'Math validation highest number', 1,1);");
         }
         if (!field_exists($field = 'contactformsubjectline')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('contactformsubjectline', 'Response to your AWPCP Demo Ad', 'Subject line for email sent out when someone replies to ad','8', 1);");
         }
         if (!field_exists($field = 'contactformbodymessage')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('contactformbodymessage', 'Someone has responded to your AWPCP Demo Ad', 'Message body text for email sent out when someone replies to ad', '8','2');");
         }
         if (!field_exists($field = 'resendakeyformsubjectline')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('resendakeyformsubjectline', 'The classified ad access key you requested', 'Subject line for email sent out when someone requests their ad access key resent','8', 1);");
         }
         if (!field_exists($field = 'resendakeyformbodymessage')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('resendakeyformbodymessage', 'You asked to have your classified ad ad access key resent. Below are all the ad access keys in the system that are tied to the email address you provided', 'Message body text for email sent out when someone requests their ad access key resent', '8','2');");
         }
         if (!field_exists($field = 'paymentabortedsubjectline')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paymentabortedsubjectline', 'There was a problem processing your classified ads listing payment', 'Subject line for email sent out when the payment processing does not complete','8', 1);");
         }
         if (!field_exists($field = 'paymentabortedbodymessage')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('paymentabortedbodymessage', 'There was a problem encountered during your attempt to submit payment for your classified ad listing. If funds were removed from the account you tried to use to make a payment please contact the website admin or the payment website customer service for assistance.', 'Message body text for email sent out when the payment processing does not complete','8','2');");
         }
         if (!field_exists($field = 'adexpiredsubjectline')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('adexpiredsubjectline', 'Your classifieds listing ad has expired', 'Subject line for email sent out when an ad has auto-expired','8', 1);");
         }
         if (!field_exists($field = 'adexpiredbodymessage')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('adexpiredbodymessage', 'This is an automated notification that your classified ad has expired.','Message body text for email sent out when an ad has auto-expired', '8','2');");
         }
         if (!field_exists($field = 'seofriendlyurls')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('seofriendlyurls', 0, 'Search Engine Friendly URLs? [ Does not work in some instances ]', '11',0);");
         }
         if (!field_exists($field = 'pathvaluecontact')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('pathvaluecontact', '3', 'If contact page link not working in seo mode change value until correct path is found. Start at 1', '11',1);");
         }
         if (!field_exists($field = 'pathvalueshowad')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('pathvalueshowad', '3', 'If show ad links not working in seo mode change value until correct path is found. Start at 1', '11',1);");
         }
         if (!field_exists($field = 'pathvaluebrowsecats')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('pathvaluebrowsecats', '2', 'If browse categories links not working in seo mode change value until correct path is found. Start at 1', '11',1);");
         }
         if (!field_exists($field = 'pathvalueviewcategories')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('pathvalueviewcategories', '2', 'If the view categories link is not working in seo mode change value until correct path is found. Start at 1', '11',1);");
         }
         if (!field_exists($field = 'pathvaluecancelpayment')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('pathvaluecancelpayment', '2', 'If the cancel payment buttons are not working in seo mode it means the path the plugin is using is not correct. Change the until the correct path is found. Start at 1', '11',1);");
         }
         if (!field_exists($field = 'pathvaluepaymentthankyou')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('pathvaluepaymentthankyou', '2', 'If the payment thank you page is not working in seo mode it means the path the plugin is using is not correct. Change the until the correct path is found. Start at 1', '11',1);");
         }
         if (!field_exists($field = 'allowhtmlinadtext')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('allowhtmlinadtext', 0, 'Allow HTML in ad text [ Not recommended ]', '2',0);");
         }
         if (!field_exists($field = 'htmlstatustext')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('htmlstatustext', 'No HTML Allowed', 'Display this text above ad detail text input box on ad post page', '2','2');");
         }
         if (!field_exists($field = 'hyperlinkurlsinadtext')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('hyperlinkurlsinadtext', 0, 'Make URLs in ad text clickable', '2',0);");
         }
         if (!field_exists($field = 'visitwebsitelinknofollow')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('visitwebsitelinknofollow', 1, 'Add no follow to links in ads', '2',0);");
         }
         if (!field_exists($field = 'notice_awaiting_approval_ad')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('notice_awaiting_approval_ad', 'All ads must first be approved by the administrator before they are activated in the system. As soon as an admin has approved your ad it will become visible in the system. Thank you for your business.','Text for message to notify user that ad is awaiting approval','2','2');");
         }
         if (!field_exists($field = 'displayphonefield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displayphonefield', 1, 'Show phone field','6',0);");
         }
         if (!field_exists($field = 'displayphonefieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displayphonefieldreqop', 0, 'Require phone','6',0);");
         }
         if (!field_exists($field = 'displaycityfield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycityfield', 1, 'Show city field.','6',0);");
         }
         if (!field_exists($field = 'displaycityfieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycityfieldreqop', 0, 'Require city','6',0);");
         }
         if (!field_exists($field = 'displaystatefield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaystatefield', 1, 'Show state field.','6',0);");
         }
         if (!field_exists($field = 'displaystatefieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaystatefieldreqop', 0, 'Require state','6',0);");
         }
         if (!field_exists($field = 'displaycountryfield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycountryfield', 1, 'Show country field.','6',0);");
         }
         if (!field_exists($field = 'displaycountryfieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycountryfieldreqop', 0, 'Require country','6',0);");
         }
         if (!field_exists($field = 'displaycountyvillagefield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycountyvillagefield', 0, 'Show County/village/other.','6',0);");
         }
         if (!field_exists($field = 'displaycountyvillagefieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaycountyvillagefieldreqop', 0, 'Require county/village/other.','6',0);");
         }
         if (!field_exists($field = 'displaypricefield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaypricefield', 1, 'Show price field.','6',0);");
         }
         if (!field_exists($field = 'displaypricefieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,  `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaypricefieldreqop', 0, 'Require price.','6',0);");
         }
         if (!field_exists($field = 'displaywebsitefield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaywebsitefield', 1, 'Show website field','6',0);");
         }
         if (!field_exists($field = 'displaywebsitefieldreqop')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaywebsitefieldreqop', 0, 'Require website','6',0);");
         }
         if (!field_exists($field = 'displaypostedbyfield')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('displaypostedbyfield', 1, 'Show Posted By field?','6',0);");
         }
         if (!field_exists($field = 'buildsearchdropdownlists')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,    `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('buildsearchdropdownlists', 0, 'The search form can attempt to build drop down country, state, city and county lists if data is available in the system. Limits search to available locations. Note that with the regions module installed the value for this option is overridden.','2',0);");
         }
         if (!field_exists($field = 'uiwelcome')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` ,   `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('uiwelcome', 'Looking for a job? Trying to find a date? Looking for an apartment? Browse our classifieds. Have a job to advertise? An apartment to rent? Post a classified ad.', 'The welcome text for your classified page on the user side',1,'2');");
         }
         if (!field_exists($field = 'showlatestawpcpnews')) {
             $wpdb->query("INSERT  INTO " . AWPCP_TABLE_ADSETTINGS . " (`config_option` , `config_value` , `config_diz` , `config_group_id`, `option_type`    ) VALUES('showlatestawpcpnews', 1, 'Allow AWPCP RSS.',1,0);");
         }
     }
     // create or restore AWPCP pages
     // awpcp_create_pages();
     // Add new field websiteurl to awpcp_ads
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'websiteurl')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `websiteurl` VARCHAR( 500 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `ad_contact_email`");
     }
     $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  DROP INDEX `titdes`");
     $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD FULLTEXT KEY `titdes` (`ad_title`,`ad_details`)");
     // Add new field ad_fee_paid for sorting ads by paid listings first
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'ad_fee_paid')) {
         $query = "ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `ad_fee_paid` FLOAT(7,2) NOT NULL AFTER `adterm_id`";
         $wpdb->query($query);
     }
     // Increase the length value for the ad_item_price field
     $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . " CHANGE `ad_item_price` `ad_item_price` INT( 25 ) NOT NULL");
     // Ad new field add_county_village to awpcp_ads
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'ad_county_village')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `ad_county_village` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `ad_country`");
     }
     // Add field ad_views to table awpcp_ads to track ad views
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'ad_views')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `ad_views` INT(10) NOT NULL DEFAULT 0 AFTER `ad_item_price`");
     }
     // Insert new field ad_item_price into awpcp_ads table
     if (!awpcp_column_exists(AWPCP_TABLE_ADS, 'ad_item_price')) {
         $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . "  ADD `ad_item_price` INT( 10 ) NOT NULL AFTER `ad_country`");
     }
 }
Esempio n. 7
0
function field_exists($field)
{
    global $wpdb;
    if (!checkfortable(AWPCP_TABLE_ADSETTINGS)) {
        return false;
    }
    $query = 'SELECT config_value FROM ' . AWPCP_TABLE_ADSETTINGS . ' WHERE config_option = %s';
    $query = $wpdb->prepare($query, $field);
    $value = $wpdb->get_var($config_value);
    if ($value === false || is_null($value)) {
        return false;
    } else {
        return true;
    }
}