prefix . "awpcp_adfees"); define('AWPCP_TABLE_ADS', $wpdb->prefix . "awpcp_ads"); define('AWPCP_TABLE_ADSETTINGS', $wpdb->prefix . "awpcp_adsettings"); define('AWPCP_TABLE_ADPHOTOS', $wpdb->prefix . "awpcp_adphotos"); define('AWPCP_TABLE_CATEGORIES', $wpdb->prefix . "awpcp_categories"); define('AWPCP_TABLE_PAGES', $wpdb->prefix . "awpcp_pages"); define('AWPCP_TABLE_PAGENAME', $wpdb->prefix . "awpcp_pagename"); class AWPCP_Installer { private static $instance = null; private function AWPCP_Installer() { // pass } public static function instance() { if (is_null(AWPCP_Installer::$instance)) { AWPCP_Installer::$instance = new AWPCP_Installer(); } return AWPCP_Installer::$instance; } public function column_exists($table, $column) { global $wpdb; $wpdb->hide_errors(); $result = $wpdb->query("SELECT `$column` FROM $table"); $wpdb->show_errors(); return $result !== false; } // public function activate() { // $this->install(); // // not needed anymore, but some plugins may check for it // update_option('awpcp_installationcomplete', 0); // } /** * Creates AWPCP tables. * * If is not a fresh install it calls $this->upgrade(). */ public function install() { global $wpdb, $awpcp_db_version; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $version = get_option('awpcp_db_version'); // if table exists, this is an upgrade $table = $wpdb->get_var("SHOW TABLES LIKE '" . AWPCP_TABLE_CATEGORIES . "'"); if (strcmp($table, AWPCP_TABLE_CATEGORIES) === 0) { return $this->upgrade($version, $awpcp_db_version); } // // Ooops - page already exists - abort this function and queue an admin warning message // if (findpagebyname('AWPCP')) { // update_option('awpcp_pagename_warning', 1); // return; // } else { // delete_option('awpcp_pagename_warning'); // } // create Categories table $sql = "CREATE TABLE IF NOT EXISTS " . AWPCP_TABLE_CATEGORIES . " ( `category_id` int(10) NOT NULL AUTO_INCREMENT, `category_parent_id` int(10) NOT NULL, `category_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `category_order` int(10) NULL DEFAULT '0', PRIMARY KEY (`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; dbDelta($sql); // create Ad Fees table $sql = "CREATE TABLE IF NOT EXISTS " . AWPCP_TABLE_ADFEES . " ( `adterm_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `adterm_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `amount` float(6,2) unsigned NOT NULL DEFAULT '0.00', `recurring` tinyint(1) unsigned NOT NULL DEFAULT '0', `rec_period` int(5) unsigned NOT NULL DEFAULT '0', `rec_increment` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `buys` int(10) unsigned NOT NULL DEFAULT '0', `imagesallowed` int(5) unsigned NOT NULL DEFAULT '0', `is_featured_ad_pricing` tinyint(1) DEFAULT NULL, `categories` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, PRIMARY KEY (`adterm_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; dbDelta($sql); // create Ads table $sql = "CREATE TABLE IF NOT EXISTS " . AWPCP_TABLE_ADS . " ( `ad_id` int(10) NOT NULL AUTO_INCREMENT, `adterm_id` int(10) NOT NULL DEFAULT '0', `ad_fee_paid` float(7,2) NOT NULL, `ad_category_id` int(10) NOT NULL, `ad_category_parent_id` int(10) NOT NULL, `ad_title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_details` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `ad_contact_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_contact_phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_contact_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `websiteurl` varchar( 375 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `ad_city` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_country` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_county_village` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_item_price` int(25) NOT NULL, `ad_views` int(10) NOT NULL DEFAULT 0, `ad_postdate` date NOT NULL DEFAULT '0000-00-00', `ad_last_updated` date NOT NULL, `ad_startdate` datetime NOT NULL, `ad_enddate` datetime NOT NULL, `disabled` tinyint(1) NOT NULL DEFAULT '0', `disabled_date` datetime, `ad_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `ad_transaction_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `payment_gateway` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `payment_status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `is_featured_ad` tinyint(1) DEFAULT NULL, `posterip` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `flagged` tinyint(1) NOT NULL DEFAULT 0, `user_id` INT(10) DEFAULT NULL, `renew_email_sent` TINYINT(1) NOT NULL DEFAULT 0, FULLTEXT KEY `titdes` (`ad_title`,`ad_details`), PRIMARY KEY (`ad_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; dbDelta($sql); // Create Ad Settings table // $sql = "CREATE TABLE IF NOT EXISTS " . AWPCP_TABLE_ADSETTINGS . " ( // `config_option` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', // `config_value` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, // `config_diz` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, // `config_group_id` tinyint(1) unsigned NOT NULL DEFAULT '1', // `option_type` tinyint(1) unsigned NOT NULL DEFAULT '0', // PRIMARY KEY (`config_option`) // ) ENGINE=MyISAM COMMENT='0-checkbox, 1-text,2-textarea';"; // dbDelta($sql); // create Ad Photos table $sql = "CREATE TABLE IF NOT EXISTS " . AWPCP_TABLE_ADPHOTOS . " ( `key_id` int(10) NOT NULL AUTO_INCREMENT, `ad_id` int(10) unsigned NOT NULL DEFAULT '0', `image_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', `disabled` tinyint(1) NOT NULL, PRIMARY KEY (`key_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; dbDelta($sql); // create Pagename table // TODO: not sure if this table is needed at all, we could use an option... $sql = "CREATE TABLE IF NOT EXISTS " . AWPCP_TABLE_PAGENAME . " ( `key_id` int(10) NOT NULL AUTO_INCREMENT, `userpagename` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`key_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; dbDelta($sql); // create Pages table $sql = 'CREATE TABLE IF NOT EXISTS ' . AWPCP_TABLE_PAGES . " ( `page` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `id` INT(10) NOT NULL, PRIMARY KEY (`page`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; dbDelta($sql); // insert deafult category $data = array('category_id' => 1, 'category_parent_id' => 0, 'category_name' => __('General', 'AWPCP'), 'category_order' => 0); $wpdb->insert(AWPCP_TABLE_CATEGORIES, $data); // insert default Fee $data = array('adterm_id' => 1, 'adterm_name' => __('30 Day Listing', 'AWPCP'), 'amount' => 9.99, 'recurring' => 1, 'rec_period' => 31, 'rec_increment' => 'D', 'buys' => 0, 'imagesallowed' => 6); $wpdb->insert(AWPCP_TABLE_ADFEES, $data); do_action('awpcp_install'); return update_option("awpcp_db_version", $awpcp_db_version); } public function uninstall() { global $wpdb, $awpcp_plugin_path, $table_prefix, $awpcp; // Remove the upload folders with uploaded images $dirname = AWPCPUPLOADDIR; if (file_exists($dirname)) { require_once $awpcp_plugin_path.'/fileop.class.php'; $fileop = new fileop(); $fileop->delete($dirname); } // Delete the classifieds page(s) $awpcppageid = awpcp_get_page_id_by_ref('main-page-name'); // TODO: use wp_delete_post and query_posts $query="DELETE FROM {$table_prefix}posts WHERE ID='$awpcppageid' OR post_parent='$awpcppageid' and post_content LIKE '%AWPCP%'"; awpcp_query($query, __LINE__); // Drop the tables $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_CATEGORIES); $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_ADFEES); $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_ADS); $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_ADSETTINGS); $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_ADPHOTOS); $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_PAGENAME); $wpdb->query("DROP TABLE IF EXISTS " . AWPCP_TABLE_PAGES); // TODO: remove other tables created by modules too? $tbl_regions = $wpdb->prefix . "awpcp_regions"; $wpdb->query("DROP TABLE IF EXISTS " . $tbl_regions); // remove AWPCP options from options table delete_option('awpcp_installationcomplete'); delete_option('awpcp_pagename_warning'); delete_option('widget_awpcplatestads'); delete_option('awpcp_db_version'); delete_option($awpcp->settings->option); // delete payment transactions $sql = 'SELECT option_name, option_value FROM ' . $wpdb->options . ' '; $sql.= "WHERE option_name LIKE 'awpcp-payment-transaction-%%'"; $results = $wpdb->get_results($wpdb->prepare($sql)); foreach ($results as $option) { delete_option($option->option_name); } // remove widgets unregister_sidebar_widget('AWPCP Latest Ads', 'widget_awpcplatestads'); unregister_widget_control('AWPCP Latest Ads', 'widget_awpcplatestads_options', 350, 120); // Clear the ad expiration schedule wp_clear_scheduled_hook('doadexpirations_hook'); wp_clear_scheduled_hook('doadcleanup_hook'); wp_clear_scheduled_hook('awpcp_ad_renewal_email_hook'); wp_clear_scheduled_hook('awpcp-clean-up-payment-transactions'); // TODO: use deactivate_plugins function // http://core.trac.wordpress.org/browser/branches/3.2/wp-admin/includes/plugin.php#L548 $thepluginfile = "another-wordpress-classifieds-plugin/awpcp.php"; $current = get_option('active_plugins'); array_splice($current, array_search( $thepluginfile, $current), 1 ); update_option('active_plugins', $current); do_action('deactivate_' . $thepluginfile ); do_action('awpcp_uninstall'); } // TODO: remove settings table after another major release // TODO: remove pagename table after another major release public function upgrade($oldversion, $newversion) { global $wpdb; if (version_compare($oldversion, '1.8.9.4') < 0) { $this->upgrade_to_1_8_9_4($oldversion); } if (version_compare($oldversion, '1.9.9') < 0) { $this->upgrade_to_1_9_9($oldversion); } if (version_compare($oldversion, '2.0.0') < 0) { $this->upgrade_to_2_0_0($oldversion); } if (version_compare($oldversion, '2.0.1') < 0) { $this->upgrade_to_2_0_1($oldversion); } do_action('awpcp_upgrade', $oldversion, $newversion); return update_option("awpcp_db_version", $newversion); } 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 (!is_at_least_awpcp_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 (!$this->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 (!$this->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 (!$this->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 (!$this->column_exists(AWPCP_TABLE_ADS, 'disabled_date')) { $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADS . " ADD `disabled_date` datetime DEFAULT NULL"); } if (!$this->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 (!$this->column_exists(AWPCP_TABLE_ADFEES, 'categories')) { $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADFEES . " ADD `categories` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL"); } if (!$this->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"); } if (!$this->column_exists(AWPCP_TABLE_ADFEES, 'categories')) { $wpdb->query("ALTER TABLE " . AWPCP_TABLE_ADFEES . " ADD `categories` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL"); } // 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); if (!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 (!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); } //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="config_group_id"; $cgid_column_name_exists=mysql_query("SELECT $cgid_column_name FROM " . AWPCP_TABLE_ADSETTINGS); if (mysql_errno() || !$cgid_column_name_exists) { $query=("ALTER TABLE " . AWPCP_TABLE_ADSETTINGS . " ADD `config_group_id` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER config_diz"); awpcp_query($query, __LINE__); $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 (get_awpcp_option_group_id('seofriendlyurls') == 1){ $wpdb->query("UPDATE " . AWPCP_TABLE_ADSETTINGS . " SET `config_group_id` = '11' WHERE `config_option` = 'seofriendlyurls'"); } if (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 (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 (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 (get_awpcp_option_config_diz('awpcpshowtheadlayout') != "