function ym_app_activate()
{
    if (!function_exists('ym_loaded')) {
        // errror
        echo '<strong>Your Members - Adaptive Pricing Plugin</strong>';
        echo '<p>YourMembers does not appear to be installed. <a href="http://yourmembers.co.uk/">YourMembers</a> is required to use Your Members - Adapative Pricing Plugin, visit <a href="http://yourmembers.co.uk/">YourMembers</a> to purchase</p>';
        die;
    }
    // APP installed
    ym_remote_request(YM_APP_INSTALLED_URL);
    // create a log action to use
    global $wpdb;
    if (!defined('YM_APP')) {
        $sql = 'INSERT INTO ' . $wpdb->prefix . 'ym_transaction_action(name, description) VALUES (\'APP\', \'Pricing Models Updated YM Data\')';
        $wpdb->query($sql);
        $log_id = $wpdb->insert_id;
    }
    if (!defined('YM_APP_TIERCHANGE')) {
        $sql = 'INSERT INTO ' . $wpdb->prefix . 'ym_transaction_action(name, description) VALUES (\'APP TierChange\', \'Pricing Models Change Tiers\')';
        $wpdb->query($sql);
        $log_id = $wpdb->insert_id;
    }
    // sql
    $sql = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->ym_app_models . ' (
	  fire_id int(11) NOT NULL AUTO_INCREMENT,
	  fire_name varchar(255) NOT NULL,
	  fire_type int(1) NOT NULL DEFAULT "0",
	  fire_type_id int(11) NOT NULL,
	  fire_enable int(1) NOT NULL DEFAULT "0",
	  fire_end_option int(1) NOT NULL DEFAULT "0",
	  PRIMARY KEY (fire_id)
	)';
    $wpdb->query($sql);
    $sql = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->ym_app_models_tiers . ' (
	  fire_tier_id int(11) NOT NULL AUTO_INCREMENT,
	  fire_id int(11) NOT NULL,
	  fire_price double(6,2) NOT NULL DEFAULT "0.00",
	  fire_limit_by int(1) NOT NULL DEFAULT "0",
	  fire_limit_var int(11) NOT NULL,
	  fire_order int(11) NOT NULL,
	  fire_tier_started int(11) NOT NULL DEFAULT "0",
	  fire_tier_option int(1) NOT NULL DEFAULT "0",
	  PRIMARY KEY (fire_tier_id)
	);';
    $wpdb->query($sql);
    $sql = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->ym_app_ppp_pack . ' (
	  pack_id int(11) NOT NULL,
	  original_cost int(11) NOT NULL,
	  UNIQUE KEY pack_id (pack_id)
	)';
    $wpdb->query($sql);
}
Esempio n. 2
0
 function tos_submit()
 {
     global $ym_version_resp;
     $version_id = ym_post('tosversion');
     $choice = ym_post('tos');
     if ($choice == 'Continue') {
         if (!is_email(ym_post('confirm_email'))) {
             return new WP_Error('email', __('You must provide a valid Email Address', 'ym'));
         }
         if (!ym_post('tickbox')) {
             return new WP_Error('terms', __('You must check the Acceptance Tick Box', 'ym'));
         }
         // accepted
         update_option('ym_tos_version_accepted', $version_id);
         $connection_string = YM_TOS_INFORM_URL . '&email=' . rawurlencode(ym_post('confirm_email'));
         $connection_string .= '&nmp_tos_accept=yes&tos_version_id=' . $version_id . '&choice=' . $choice;
         ym_remote_request($connection_string);
     } else {
         delete_option('ym_license_key');
         delete_option('ym_tos_version_accepted');
         echo '<script>window.location=\'' . $ym_version_resp->tos->tos_no_url . '\';</script>';
         exit;
     }
 }
Esempio n. 3
0
 function verify_ipn_ip()
 {
     if ($this->bypass_ipn_ip_verification) {
         return true;
     }
     $ip = $_SERVER['REMOTE_ADDR'];
     $data = 'http://www.zombaio.com/ip_list.txt';
     $data = ym_remote_request($data);
     if ($data) {
         $ips = explode('|', $data);
         if (in_array($ip, $ips)) {
             return true;
         }
     }
     return false;
 }
Esempio n. 4
0
/*
* $Id: ym-index.php 2198 2012-05-31 13:20:46Z bcarlyon $
* $Revision: 2198 $
* $Date: 2012-05-31 14:20:46 +0100 (Thu, 31 May 2012) $
*/
/**
Uninstall/deactivate handler
Normally fired from the links 
*/
if (ym_get('ym_uninstall') || ym_get('ym_deactivate')) {
    $current = get_option('active_plugins');
    array_splice($current, array_search(YM_META_BASENAME, $current), 1);
    update_option('active_plugins', $ym_pre_admin_loadercurrent);
    do_action('deactivate_' . YM_META_BASENAME);
    $connection_string = YM_DEACTIVATE_URL . '&email=' . get_option('ym_license_key');
    $response = ym_remote_request($connection_string);
    delete_option('ym_license_key');
    delete_option('ym_tos_version_accepted');
    if (ym_get('ym_uninstall')) {
        // nuke it all!
        ym_deactivate();
    }
    echo '<meta http-equiv="refresh" content="0;plugins.php?deactivate=true" />';
    exit;
}
// Database updates can be called on this hook
do_action('ym_pre_admin_loader');
get_currentuserinfo();
global $current_user, $ym_auth, $ym_res, $ym_sys;
$ym_page = ym_get('ym_page');
if ($ym_auth->ym_check_key()) {
 function version_check_fetch()
 {
     // cron
     $json = ym_remote_request($this->version_check_url);
     $packet = array('time' => time(), 'json' => $json);
     update_option('ym_' . get_class($this), json_encode($packet));
     return $json;
 }
        @session_start();
    }
}
if ($_SESSION['ym_facebook_trans_auth']) {
    $since = mktime(0, 0, 0);
    $until = mktime(23, 59, 59);
    //time();
    echo '<div id="ym_facebook_trans_log">';
    //	echo '<ul>';
    $output = '';
    for ($x = 0; $x < 7; $x++) {
        $increase = 86400 * $x;
        $since = $since + $increase;
        $until = $until + $increase;
        $url = 'https://graph.facebook.com/' . $facebook_settings->app_id . '/payments?status=settled&since=' . $since . '&until=' . $until . '&access_token=' . $_SESSION['ym_facebook_trans_auth'];
        $data = ym_remote_request($url);
        //		$data = json_decode($data);
        echo '<p>Owing to lack of test data we do not have this page working</p><p>If you would like to help please email us on sales@codingfutures.co.uk the content of the following box, if you have had some Facebook Credits Transactions:</p>';
        echo '<textarea style="width: 100%; height: 400px;">' . $data . '</textarea>';
        //		print_r($data);
        /*
        if (count($data->data)) {
        	echo '<li><a href="#tr' . $x . '">' . $x . '</a></li>';
        	
        	$ouput .= '<table id="tr' . $x . '">
        	<tr>
        <th>From</th><th>To</th><th>Amount</th><th>Status</th><th>Created</th><th>Updated</th>
        	</tr>';
        	foreach ($data->data as $translog) {
        		$output .= '<tr>';
        		$output .= '<td>' . $translog->from->name . '(' . $translog->from->id . ')</td>';
function ym_check_version($force_ping = FALSE)
{
    global $ym_version_resp, $ym_auth, $ym_update_checker;
    if (is_ym_admin()) {
        $url = YM_VERSION_CHECK_URL;
        if ($ym_auth->ym_get_key()) {
            $key = $ym_auth->ym_get_key();
            $url .= '&key=' . $key;
        } else {
            if (!defined('DISABLE_VERSIONING')) {
                define('DISABLE_VERSIONING', TRUE);
                return;
            }
        }
        if ($data = get_option('ym_vc')) {
            $data = json_decode($data);
        } else {
            $data = false;
            $force_ping = TRUE;
        }
        if ($force_ping || isset($data) && $data->time < time() - 86400) {
            $ym_version_resp = ym_remote_request($url);
            $packet = array('time' => time(), 'json' => $ym_version_resp);
            update_option('ym_vc', json_encode($packet));
        } else {
            $ym_version_resp = $data->json;
        }
        $ym_version_resp = json_decode($ym_version_resp);
        if (defined('DISABLE_VERSIONING')) {
            return;
        }
        $url = str_replace('version_check', 'metafile', YM_VERSION_CHECK_URL);
        $url = $url . '&key=' . $key;
        $ym_update_checker = new PluginUpdateChecker($url, YM_META_BASENAME);
        //, 'ym');
        add_action('admin_notices', 'ym_nag_nag_box');
        add_action('after_plugin_row_' . YM_META_BASENAME, 'ym_new_version_download', 10, 3);
    }
}