base_prefix; $acrc_chk_aff = $wpdb->get_var('SELECT COUNT(*) FROM information_schema.tables WHERE table_name = ' . '"' . $dbprefix . 'aff_affiliates"'); $acrc_chk_thm = get_current_theme(); //wp_get_theme( 'directorypress123' ); if($acrc_chk_aff <> 1 && $acrc_chk_thm <> '') { echo 'This plugin requires that you have 1. Directory Press, and 2. Affiliates plugins installed'; wp_die('Cannot activate without required plugins!'); } // echo 'TEST1:' . $acrc_chk_aff . 'exists .
'; // echo 'TEST2:' . $acrc_chk_thm . 'exists .
'; } //affiliates_crc_main_cb function affiliates_crc_main_cbc() { global $wpdb; //return error $acrc_chk_aff = $wpdb->get_var('SELECT COUNT(*) FROM information_schema.tables WHERE table_name = ' . '"wp_aff_affiliates"'); $acrc_chk_thm = wp_get_theme( 'directorypress' ); $acrc_chk_affres = $wpdb->get_var($acrc_chk_aff); //wp_options->active_plugins //echo 'TEST2:' . $acrc_chk_affres . '-----' . $acrc_chk_thm->exists . '
'; print_r($acrc_chk_affres); if (is_admin() && $_GET['page'] == 'affiliates_crc/index.php') { echo '
'; echo '
'; echo '

Farhan´s Affiliate Admin Page for Recalculation of Affiliate Coupon Referral

'; echo '
'; echo '
'; echo 'testing'; $acrcstr = 'select * from wp_aff_affiliates'; $acrcrs = $wpdb->get_results($acrcstr); foreach ($acrcrs as $acrcobj) { print_r($acrcobj); echo '
'; } } } function GenAffAlterQry() { global $wpdb; $alterq = 'alter table `wp_affiliates_crc_data` convert to character set utf8 collate utf8_unicode_ci;'; $alterq .= 'alter table `wp_aff_affiliates` convert to character set utf8 collate utf8_unicode_ci;'; $alterq .= 'alter table `wp_aff_affiliates_attributes` convert to character set utf8 collate utf8_unicode_ci;'; $alterq .= 'alter table `wp_aff_affiliates_users` convert to character set utf8 collate utf8_unicode_ci;'; $alterq .= 'alter table `wp_aff_hits` convert to character set utf8 collate utf8_unicode_ci;'; $alterq .= 'alter table `wp_aff_referrals` convert to character set utf8 collate utf8_unicode_ci;'; $alterq .= 'alter table `wp_aff_robots` convert to character set utf8 collate utf8_unicode_ci;'; $wpdb->query($alterq); } function ACRCArrayToObject($array) { $object = new stdClass(); if (is_array($array) && count($array) > 0) { foreach ($array as $name=>$value) { $name = strtolower(trim($name)); if (!empty($name)) { $object->$name = $value; } } } return $object; } function ACRCObjectToArray($object) { $array = array(); if (is_object($object)) { $array = get_object_vars($object); } return $array; } function IPtoDec($srcip) { $iparr = split('\.', $srcip); //print_r($iparr); $ipa = $iparr[0] * 16777216; $ipb = $iparr[1] * 65536; $ipc = $iparr[2] * 256; $ipd = $iparr[3]; $ipbase = $ipa + $ipb + $ipc + $ipd; return $ipbase; } function CreateACRCTable() { global $wpdb; $cacrc = 'DROP TABLE IF EXISTS `wp_aff_crc_data`; CREATE TABLE `wp_aff_crc_data` ( `sno` int(10) unsigned NOT NULL AUTO_INCREMENT, `order_autoid` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_cus_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_order_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_date` date DEFAULT NULL, `order_time` time DEFAULT NULL, `order_total` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_coupon` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_couponcode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_status` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `order_order_ip` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `ref_affiliate_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `acrc_status` int(1) DEFAULT NULL, `acrc_notes` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `acrc_import_datetime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `acrc_last_updated` datetime DEFAULT NULL, PRIMARY KEY (`sno`) ) ENGINE=MyISAM AUTO_INCREMENT=278 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;'; $wpdb->query($cacrc); //Farhan added table create on initialize 201301060018 } ?>