function yss_s3_save()
{
    // saving
    get_currentuserinfo();
    global $wpdb, $current_user, $yss_db, $yss_post_assoc;
    $user = $current_user->ID;
    $file = ym_post('s3_file_select');
    $file = explode('/', $file);
    $bucket = array_shift($file);
    $resource = implode('/', $file);
    $account_types = ym_post('account_types');
    if (is_array($account_types)) {
        $account_types = implode('||', $account_types);
    } else {
        $account_types = '';
    }
    $members = isset($_POST['memberonly']);
    if ($id = ym_post('s3s_id')) {
        $sql = "UPDATE " . $yss_db . " SET\n\t\t\t\t\tbucket = '" . $bucket . "'\n\t\t\t\t\t, resource_path = '" . $resource . "'\n\t\t\t\t\t, postDate = NOW()\n\t\t\t\t\t, user = '******'\n\t\t\t\t\t, members = '" . $members . "'\n\t\t\t\t\t, account_types = '" . mysql_real_escape_string($account_types) . "'\n\t\t\t\tWHERE id = " . $id;
        $wpdb->query($sql);
        $sql = 'DELETE FROM ' . $yss_post_assoc . '
				WHERE s3_id = ' . $id;
        $wpdb->query($sql);
    } else {
        if ($bucket && $resource) {
            $sql = "INSERT INTO " . $yss_db . " (bucket, resource_path, postDate, user, members, account_types)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . $bucket . "'\n\t\t\t\t\t\t, '" . $resource . "'\n\t\t\t\t\t\t, NOW()\n\t\t\t\t\t\t, '" . $user . "'\n\t\t\t\t\t\t, '" . $members . "'\n\t\t\t\t\t\t, '" . mysql_real_escape_string($account_types) . "'\n\t\t\t\t\t)";
            $wpdb->query($sql);
            $id = $wpdb->insert_id;
            if ($id) {
                ym_display_message(__('New video created Successfully', 'yss'));
            } else {
                ym_display_message(__('Failed video Creation ', 'yss'));
            }
        } else {
            ym_display_message(__('No Resource and/or Bucket specified', 'yss'), 'error');
        }
    }
    if ($id) {
        if ($link_ids = ym_post('link_to_post_id')) {
            foreach ($link_ids as $post_id) {
                $sql = 'INSERT INTO ' . $yss_post_assoc . ' (s3_id, post_id)
					VALUES (' . $id . ', ' . $post_id . ')';
                $wpdb->query($sql);
            }
        }
    }
}
예제 #2
0
/**
Default Registration when modified is off
*/
function ym_register_default($user_id)
{
    global $wpdb;
    if (!isset($_SESSION['error_on_page'])) {
        $pack_id = ym_get_default_pack();
        if (!($user_pass = ym_post('ym_password'))) {
            $user_pass = substr(md5(uniqid(microtime())), 0, 7);
        }
        $user_pass_md5 = md5($user_pass);
        $wpdb->query("UPDATE {$wpdb->users} SET user_pass = '******' WHERE ID = '{$user_id}'");
        wp_new_user_notification($user_id, $user_pass);
        // redirect to ym_subscribe
        $userdata = get_userdata($user_id);
        $redirect = add_query_arg(array('username' => $userdata->user_login, 'ym_subscribe' => 1), get_option('siteurl'));
        if ($redirector = ym_post('ym_redirector', ym_post('redirect_to'))) {
            $redirect = add_query_arg(array('redirector' => $redirector), $redirect);
        }
        $redirect = add_query_arg(array('pack_id' => $pack_id), $redirect);
        wp_redirect($redirect);
        exit;
    }
}
예제 #3
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;
     }
 }
예제 #4
0
        echo '<td>' . date(YM_DATE, $transaction->unixtime) . '</td>';
        echo '</tr>';
    }
    echo '</table>';
    echo '</div>';
    return;
}
if ($user_id) {
    $user = get_userdata($user_id);
    echo '<p>' . sprintf(__('Showing Log Information for <strong>%s</strong>', 'ym'), $user->user_login) . '</p>';
}
echo ym_end_box();
$start = 0;
$limit = 50;
$cur = ym_post('start');
if (ym_post('next')) {
    $start = $cur + $limit;
}
if (ym_post('back')) {
    $start = $cur - $limit;
    if ($start < 0) {
        $start = 0;
    }
}
//$user_id = FALSE;
$order_by = 'id DESC';
$deleted = TRUE;
if ($user_id) {
    ym_show_timeline_log(false, $user_id, $limit, $start, $order_by, $deleted);
}
echo '</div>';
예제 #5
0
function ym_fbook_init()
{
    global $facebook_settings, $location;
    //	session_start();// wp does this
    if (ym_request('destroy')) {
        session_destroy();
        header('Location: ' . site_url());
        exit;
    }
    $location = get_permalink() ? get_permalink() : 'http' . (is_ssl() ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    /********************************************/
    /* AWAKE?
    	/********************************************/
    if (!ym_facebook_settings()) {
        // no settings
        // iframe break out if iframe present
        add_action('wp_head', 'ym_fbook_init_iframe_breakout');
        // abort
        return;
    }
    if (!$facebook_settings->enabled) {
        // not enabled
        // iframe break out if iframe present
        add_action('wp_head', 'ym_fbook_init_iframe_breakout');
        // abort
        return;
    }
    /********************************************/
    /* Aborts
    	/********************************************/
    if (is_admin()) {
        // in the admin system
        return;
    }
    // abort login
    if (FALSE !== strpos($_SERVER['REQUEST_URI'], 'wp-login')) {
        return;
    }
    // IPN
    if (ym_request('ym_process')) {
        return;
    }
    // Cron
    if (ym_request('doing_wp_cron')) {
        return;
    }
    /********************************************/
    /* basic defines
    	/********************************************/
    define('YM_FBOOK_APPID', $facebook_settings->app_id);
    define('YM_FBOOK_SECRET', $facebook_settings->app_secret);
    $Location = str_replace('?logged_out=1', '', $location);
    define('YM_FBOOK_IN_HERE', $location);
    // app target
    define('YM_FBOOK_APP_TARGET', 'https://apps.facebook.com/' . $facebook_settings->canvas_url . str_replace(site_url(), '', $location));
    define('YM_FBOOK_PAGE_TARGET', 'https://facebook.com/' . $facebook_settings->page_url . '?sk=app_' . YM_FBOOK_APPID);
    // can't take args
    if (isset($_SESSION['facebook_last_page']) && $_SESSION['facebook_last_page']) {
        define('YM_FBOOK_LAST_PAGE', $_SESSION['facebook_last_page']);
    } else {
        // TODO: use location for now, but should be defined FB Root URL based on page/app
        define('YM_FBOOK_LAST_PAGE', $location);
    }
    $_SESSION['facebook_last_page'] = $location;
    /********************************************/
    /* Linter
    	/********************************************/
    // come back to this if needed
    $test = 'facebookexternalhit';
    if (substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($test)) == $test) {
        return;
    }
    /********************************************/
    /* Scope
    	/********************************************/
    $scope = array();
    global $scopes;
    foreach ($scopes as $fbsetting => $entry) {
        if (isset($facebook_settings->{$fbsetting}) && $facebook_settings->{$fbsetting}) {
            $scope[] = $entry;
        }
    }
    if (count($scope)) {
        $scope = '&scope=' . implode(',', $scope);
    } else {
        $scope = '';
    }
    /********************************************/
    /* Defines
    	/********************************************/
    // oauth target
    $base = 'http://www.facebook.com/dialog/oauth/?client_id=' . YM_FBOOK_APPID . $scope . '&redirect_uri=';
    define('YM_FBOOK_AUTH_APP', $base . urlencode(YM_FBOOK_APP_TARGET));
    define('YM_FBOOK_AUTH_PAGE', $base . urlencode(YM_FBOOK_PAGE_TARGET));
    define('YM_FBOOK_AUTH_NO', $base . urlencode($location));
    /********************************************/
    /* Exceptions
    	/********************************************/
    if (isset($_SESSION['in_facebook']) && $_SESSION['in_facebook'] == 1 && ym_request('leavefacebook') == 1 && $facebook_settings->enable_leave_facebook) {
        // leaving :-(
        unset($_SESSION['in_facebook']);
        // route to last page, not current page (aka location)
        // as that is leavefacebook = 1
        echo '<script type="text/javascript">top.location.href="' . $_SESSION['facebook_last_page'] . '";</script>';
        exit;
    }
    if (ym_request('loggedout') == 1) {
        wp_logout();
        $in_facebook = isset($_SESSION['in_facebook']) ? $_SESSION['in_facebook'] : FALSE;
        $in_facebook_page = isset($_SESSION['in_facebook_page']) ? $_SESSION['in_facebook_page'] : FALSE;
        session_destroy();
        session_start();
        $_SESSION['in_facebook'] = $in_facebook;
        $_SESSION['in_facebook_page'] = $in_facebook_page;
        $r = ym_fbook_oauth_go();
        //		echo $r . '<br />';
        $r = str_replace(array('loggedout=1&', 'loggedout=1'), '', $r);
        $r = str_replace(array(urlencode('loggedout=1&'), urlencode('loggedout=1')), '', $r);
        //		$_SESSION['ym_fb_auth_target'] = $r;
        $_SESSION['ym_fb_auth_target'] = str_replace(array(urlencode('loggedout=1&'), urlencode('loggedout=1'), 'loggedout=1'), '', $_SESSION['ym_fb_auth_target']);
        //		echo $r;
        //echo $_SESSION['ym_fb_auth_target'];
        //echo '<script type="text/javascript">top.location.href="' . $_SESSION['ym_fb_auth_target'] . '";</script>';
        echo '<script type="text/javascript">top.location.href="' . $r . '";</script>';
        exit;
    }
    // Ping check to see if facebook exists and is alive
    // Most commonly analytics
    if (ym_get('ymfbook')) {
        $_SESSION['in_facebook'] = 1;
    }
    if ($_SESSION['in_facebook']) {
        wp_enqueue_script('ym-fb', site_url('wp-content/plugins/ym_facebook/js/fb.js'), array('jquery'), YM_FB_PLUGIN_VERSION);
        wp_enqueue_style('ym-fb-login', site_url('wp-content/plugins/ym_facebook/css/ym_fbook_login.css'), array(), YM_FB_PLUGIN_VERSION);
    }
    // height controls
    if ($facebook_settings->iframe_size == 'scrollbars') {
        if ($facebook_settings->iframe_size_height) {
            define('YM_FBOOK_HEIGHT', 'FB.Canvas.setSize({height: ' . $facebook_settings->iframe_size_height . '});');
        } else {
            define('YM_FBOOK_HEIGHT', '');
            // height of window-ish
        }
    } else {
        define('YM_FBOOK_HEIGHT', 'FB.Canvas.setAutoResize();');
    }
    // width controls
    if (isset($_SESSION['in_facebook_page']) && $_SESSION['in_facebook_page']) {
        $width = 450;
    } else {
        $width = 600;
    }
    define('YM_FBOOK_WIDTH', $width);
    /********************************************/
    /* post or session
    	/********************************************/
    if (ym_post('signed_request', false)) {
        // landed in facebook from the outside world
        // store the request
        $_SESSION['facebook_signed_request'] = $_POST['signed_request'];
        // set in facebook here as we are defo. in facebook
        // cant do it on data uncode as we could be on the main site
        // using a wordpress side facebook like wall
        // for example
        $_SESSION['in_facebook'] = TRUE;
        // if in_facebook then redirect there
        // if in_facebook and in_facebook_page then go to page
        // if in_facebook_page only do nothing (as not in facebook)
        $_SESSION['facebook_signed_request'] = $_POST['signed_request'];
    }
    /********************************************/
    /* force
    	/********************************************/
    if ($facebook_settings->force_facebook && !$_SESSION['in_facebook']) {
        // force
        $_SESSION['in_facebook'] = 1;
        if ($facebook_settings->page_url) {
            $_SESSION['in_facebook_page'] = 1;
        }
        header('Location: ' . ym_fbook_oauth_go());
        //header('Location: ' . ($facebook_settings->page_url ? YM_FBOOK_PAGE_TARGET : YM_FBOOK_APP_TARGET));
        exit;
    }
    /********************************************/
    /* interupt for auth
    	/********************************************/
    // check for a get code
    if (ym_get('code')) {
        // landed with a code
        // oAuth return, validate
        // get token
        if ($_SESSION['in_facebook_page'] && $facebook_settings->page_url) {
            $url = 'https://facebook.com/' . $facebook_settings->page_url . '/';
        } else {
            $url = 'https://apps.facebook.com/' . $facebook_settings->canvas_url . '/';
        }
        if (!$_SESSION['ym_fb_auth_target']) {
            // no target
            ym_fbook_oauth_go();
        }
        // generate auth code
        //		$_SESSION['ym_fb_auth_target'] = str_replace(array(urlencode('loggedout=1&'), urlencode('loggedout=1'), 'loggedout=1&', 'loggedout=1'), '', $_SESSION['ym_fb_auth_target']);
        //			'&redirect_uri=' . urlencode($_SESSION['ym_fb_auth_target']) .
        $auth_code = '?client_id=' . YM_FBOOK_APPID . '&redirect_uri=' . urlencode($url) . '&client_secret=' . YM_FBOOK_SECRET . '&code=' . $_GET['code'];
        //		echo $auth_code;//exit;
        // exchange
        $facebook_auth = new Facebook('', $auth_code);
        // decode
        $auth = $facebook_auth->auth;
        $test = json_decode($auth);
        if ($test->error->message) {
            echo $test->error->message;
            ym_fbook_add_message(str_replace('_', ' ', $test->error->message));
            return;
        }
        parse_str($auth, $query);
        $_SESSION['facebook_oauth_token'] = $query['access_token'];
        $_SESSION['facebook_oauth_start'] = time();
        $_SESSION['facebook_oauth_expires'] = $query['expires'];
        // clean
        $_SESSION['ym_fb_auth_target'] = str_replace('code=' . ym_get('code'), '', $_SESSION['ym_fb_auth_target']);
        echo '<script type="text/javascript">top.location.href="' . $_SESSION['ym_fb_auth_target'] . '"</script>';
        unset($_SESSION['ym_fb_auth_target']);
        // and GO BABY GO!!!!!!!!!!!
        exit;
    }
    /********************************************/
    /* munch
    	/********************************************/
    if (isset($_SESSION['facebook_signed_request']) && $_SESSION['facebook_signed_request']) {
        // exisiting session
        // validate
        $data = facebook_uncode($_SESSION['facebook_signed_request']);
        if ($data) {
            // last control
            if (isset($_SESSION['facebook_use_last_page']) && $_SESSION['facebook_use_last_page']) {
                unset($_SESSION['facebook_use_last_page']);
                header('Location: ' . YM_FBOOK_LAST_PAGE);
                exit;
            }
            if (isset($data->page) && $data->page) {
                $_SESSION['facebook_page'] = $data->page;
                // defo in a page
                // should only occur on landing on the page
                $_SESSION['in_facebook_page'] = TRUE;
                // ALERT LANDING TRIGGER LANDING CONTROLLER
                if ($facebook_settings->page_landing && $_SERVER['REQUEST_URI'] != $facebook_settings->page_landing && $_POST['signed_request']) {
                    // somewhere to land
                    header('Location: /' . $facebook_settings->page_landing);
                    exit;
                }
                define('ym_fbphp_dev_in_page', TRUE);
            } else {
                define('ym_fbphp_dev_in_page', TRUE);
            }
            // landing control needed?
            if ($facebook_settings->canvas_landing && $_SERVER['REQUEST_URI'] != $facebook_settings->canvas_landing && $_POST['signed_request'] && !$_SESSION['facebook_has_landed'] && !$_SESSION['in_facebook_page']) {
                // landing control if the Root Page is requested
                header('Location: /' . $facebook_settings->canvas_landing);
                exit;
            }
            $_SESSION['facebook_has_landed'] = TRUE;
            // oauth
            $_SESSION['facebook_oauth_token'] = $data->oauth_token;
            $_SESSION['facebook_oauth_start'] = $data->issued_at;
            $_SESSION['facebook_oauth_expires'] = $data->expires;
        }
    } else {
        if (isset($_SESSION['facebook_oauth_token']) && $_SESSION['facebook_oauth_token']) {
            // we have a facebook session
        } else {
            // no session
            ym_fbook_do_template();
            return;
        }
    }
    // GIVE ME A CLIENT
    global $facebook_client;
    $facebook_client = new Facebook($_SESSION['facebook_oauth_token']);
    if (!$facebook_client->initok) {
        $facebook_client = FALSE;
    } else {
        // permissions check
        // check oauth granted match what we need
        // in case the game has changed.
        $permissions = $facebook_client->permissions();
        global $scopes;
        $scope_copy = $scopes;
        foreach ($scope_copy as $fbsetting => $entry) {
            if (isset($facebook_settings->{$fbsetting}) && $facebook_settings->{$fbsetting}) {
                // check presence
                if (isset($permissions->data[0]->{$entry}) && $permissions->data[0]->{$entry} == 1) {
                    unset($scope_copy[$fbsetting]);
                }
            } else {
                // not requested
                unset($scope_copy[$fbsetting]);
            }
        }
        if (count($scope_copy)) {
            add_action('ym_fbook_messages', 'ym_fbook_messages');
            add_action('template_redirect', 'ym_fbook_template');
            define('FBOOK_TEMPLATE_OVERRIDE', 'login');
            return;
        }
    }
    if ($facebook_client && !$data) {
        // build data
        $data = new stdClass();
        $data->user_id = $facebook_client->user_data->id;
        $data->locale = $facebook_client->user_data->locale;
    }
    // facebook user ID
    $_SESSION['facebook_user_id'] = $data->user_id;
    $_SESSION['locale'] = isset($data->locale) ? $data->locale : 'en_GB';
    // check facebook login
    if ($facebook_settings->force_facebook_auth && !$data->user_id) {
        // require login
        // redirect to facebook login
        // use template login template
        add_action('ym_fbook_messages', 'ym_fbook_messages');
        add_action('template_redirect', 'ym_fbook_template');
        define('FBOOK_TEMPLATE_OVERRIDE', 'login');
        return;
    }
    if (isset($data->id) && $data->id) {
        ym_fbook_has_oauth_expired();
    }
    // check wordpress login
    ym_fbook_maintain_wordpress();
    /*
    if ($_REQUEST['register'] == 1 && !$_SESSION['facebook_registering']) {
    	// need login.....
    	$_SESSION['facebook_use_last_page'] = 1;
    	$_SESSION['facebook_registering'] = 1;
    	unset($_SESSION['ym_facebook_me_cache']);
    	echo '<script type="text/javascript">top.location.href="' . ym_fbook_oauth_go() . '"</script>';
    	exit;
    }
    if ($_REQUEST['register'] == 1 && $_SESSION['facebook_registering']) {
    	// go register dammit
    	add_action('ym_fbook_messages', 'ym_fbook_messages');
    	add_action('template_redirect', 'ym_fbook_template');
    	define('FBOOK_TEMPLATE_OVERRIDE', 'register');
    	return;
    }
    */
    // Hidden Reg
    if ($facebook_settings->register_with_facebook_hidden && $_SESSION['facebook_user_id'] && !$_SESSION['wordpress_user_id']) {
        // not logged into WP
        // go hidden reg
        ym_fbook_hidden_register();
    }
    // action cases
    if (ym_request('dolink', false)) {
        // go for link
        $_SESSION['dolink'] = 1;
        echo '<script type="text/javascript">top.location.href="' . ym_fbook_oauth_go() . '"</script>';
        exit;
    }
    if (ym_session('dolink')) {
        if (!$_SESSION['facebook_user_id']) {
            header('Location: ' . ym_fbook_oauth_go());
            exit;
        }
        ym_fbook_dolink();
    }
    if (ym_request('dounlink')) {
        // unlink
        ym_fbook_dounlink();
    }
    ym_fbook_do_template();
}
function ym_user_profile_form()
{
    get_currentuserinfo();
    global $current_user, $wpdb;
    $updated = false;
    $action = ym_post('ym_action');
    if ($action == 'ym_user_profile_update') {
        include 'wp-admin/includes/user.php';
        include 'wp-includes/registration.php';
        do_action('personal_options_update', $current_user->ID);
        $errors = edit_user($current_user->ID);
        if (!is_wp_error($errors)) {
            $html = '<p>' . __('Your Profile has been updated') . '</p>';
            $html .= '<meta http-equiv="refresh" content="3" />';
            return $html;
        }
    }
    $html = '';
    if (isset($errors) && is_wp_error($errors)) {
        $html .= '<div class="error"><p>' . implode("</p>\n<p>", $errors->get_error_messages()) . '</p></div>';
    } else {
        if (ym_get('updated')) {
            $html .= '<div id="message" class="updated"><p><strong>' . __('User updated.') . '</strong></p></div>';
        }
    }
    if (!function_exists(_wp_get_user_contactmethods)) {
        function _wp_get_user_contactmethods()
        {
            $user_contactmethods = array('aim' => __('AIM'), 'yim' => __('Yahoo IM'), 'jabber' => __('Jabber / Google Talk'));
            return apply_filters('user_contactmethods', $user_contactmethods);
        }
    }
    $html .= '
<form action="" method="post">
	<input type="hidden" name="ym_action" value="ym_user_profile_update" />
	
<table class="form-table">
	<tr><td colspan="2"><h3>' . __('Name') . '</h3></td></tr>
	<tr>
		<th><label for="first_name">' . __('First Name') . '</label></th>
		<td><input type="text" name="first_name" id="first_name" value="' . esc_attr($current_user->user_firstname) . '" class="regular-text" /></td>
	</tr>

	<tr>
		<th><label for="last_name">' . __('Last Name') . '</label></th>
		<td><input type="text" name="last_name" id="last_name" value="' . esc_attr($current_user->user_lastname) . '" class="regular-text" /></td>
	</tr>

	<tr>
		<th><label for="nickname">' . __('Nickname') . ' <span class="description">' . __('(required)') . '</span></label></th>
		<td><input type="text" name="nickname" id="nickname" value="' . esc_attr($current_user->nickname) . '" class="regular-text" /></td>
	</tr>

	<tr>
		<th><label for="display_name">' . __('Display name publicly as') . '</label></th>
		<td>
			<select name="display_name" id="display_name">
			';
    $public_display = array();
    $public_display['display_username'] = $current_user->user_login;
    $public_display['display_nickname'] = $current_user->nickname;
    if (!empty($profileuser->first_name)) {
        $public_display['display_firstname'] = $current_user->first_name;
    }
    if (!empty($profileuser->last_name)) {
        $public_display['display_lastname'] = $current_user->last_name;
    }
    if (!empty($profileuser->first_name) && !empty($current_user->last_name)) {
        $public_display['display_firstlast'] = $current_user->first_name . ' ' . $current_user->last_name;
        $public_display['display_lastfirst'] = $current_user->last_name . ' ' . $current_user->first_name;
    }
    if (!in_array($current_user->display_name, $public_display)) {
        // Only add this if it isn't duplicated elsewhere
        $public_display = array('display_displayname' => $current_user->display_name) + $public_display;
    }
    $public_display = array_map('trim', $public_display);
    $public_display = array_unique($public_display);
    foreach ($public_display as $id => $item) {
        $html .= '<option id="' . $id . '" value="' . esc_attr($item) . '"' . selected($current_user->display_name, $item, FALSE) . '>' . $item . '</option>';
    }
    $html .= '
			</select>
		</td>
	</tr>
	<tr><td colspan="2">
<h3>' . __('Contact Info') . '</h3>
	</td></tr>
<tr>
	<th><label for="email">' . __('E-mail') . ' <span class="description">' . __('(required)') . '</span></label></th>
	<td><input type="text" name="email" id="email" value="' . esc_attr($current_user->user_email) . '" class="regular-text" />
	';
    $new_email = get_option($current_user->ID . '_new_email');
    if ($new_email && $new_email != $current_user->user_email) {
        $html .= '
	<div class="updated inline">
	<p>' . sprintf(__('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url(admin_url('profile.php?dismiss=' . $current_user->ID . '_new_email'))) . '</p>
	</div>
		';
    }
    $html .= '
	</td>
</tr>

<tr>
	<th><label for="url">' . __('Website') . '</label></th>
	<td><input type="text" name="url" id="url" value="' . esc_attr($current_user->user_url) . '" class="regular-text code" /></td>
</tr>
';
    foreach (_wp_get_user_contactmethods() as $name => $desc) {
        $html .= '
<tr>
	<th><label for="' . $name . '">' . apply_filters('user_' . $name . '_label', $desc) . '</label></th>
	<td><input type="text" name="' . $name . '" id="' . $name . '" value="' . esc_attr($current_user->{$name}) . '" class="regular-text" /></td>
</tr>';
    }
    $html .= '
<tr><td colspan="2">
<h3>' . __('About Yourself') . '</h3>
</td></tr>
<tr>
	<th><label for="description">' . __('Biographical Info') . '</label></th>
	<td><textarea name="description" id="description" rows="5" cols="60">' . esc_html($current_user->description) . '</textarea><br />
	<span class="description">' . __('Share a little biographical information to fill out your profile. This may be shown publicly.') . '</span></td>
</tr>
<tr><td></td><td style="text-align: right;"><input type="submit" class="button-primary" value="' . __('Update Profile') . '" name="submit" /></td></tr>
</table>
</form>
';
    return $html;
}
function wp_ajax_ym_quick_orphan()
{
    ym_ajax_superuser_check();
    $user_id = ym_post('ym_quick_orphan_user_id');
    if ($user_id) {
        $ym_user = new YourMember_User($user_id);
        if ($ym_user->parent_id) {
            ym_group_membership_delete_child_from_parent($user_id, $ym_user->parent_id);
            echo '
<script type="text/javascript">
jQuery(\'.ym_user_orphan_' . $user_id . '\').parents(\'tr\').slideUp(function() {
	jQuery(this).remove();
});
</script>
';
            die;
        }
    }
    echo 'N';
    die;
}
function ym_export_users_do_headers($data, $format)
{
    global $ym_export_did_headers, $xls_row_counter;
    $path = trailingslashit(ym_post('backup_temp_path'));
    $offset = ym_post('offset', 0);
    $headers = ym_post('bkheaders') ? true : false;
    if (!$ym_export_did_headers && !$offset) {
        $ym_export_did_headers = TRUE;
        if ($headers) {
            $row = array();
            foreach ($data as $key => $trash) {
                $row[] = $key;
            }
            // write this row out
            ym_export_users_do_chunk($path, array($row), $format);
            $xls_row_counter = 1;
        }
    } else {
        if ($offset) {
            $xls_row_counter = $offset;
            if ($headers) {
                $xls_row_counter++;
            }
        }
    }
}
예제 #9
0
 function additional_pack_fields()
 {
     $items = array();
     $items[] = array('name' => 'zombaio_price_id', 'label' => __('Zombaio Price ID', 'ym'), 'caption' => __('If unsure, just put the <strong>Join Form URL</strong> here', 'ym'), 'type' => 'text');
     // catch
     if (ym_post('zombaio_price_id')) {
         $entry = ym_post('zombaio_price_id');
         if (FALSE !== strpos($entry, 'zombaio.com')) {
             //https://secure.zombaio.com/?287653677.1384296.ZOM
             list($crap, $zombaio, $com_crap, $id, $zom) = explode('.', $entry);
             $_POST['zombaio_price_id'] = $id;
         }
     }
     return $items;
 }
예제 #10
0
 function additional_pack_fields()
 {
     $items = array();
     $items[] = array('name' => '2checkout_startupfee', 'label' => __('2Checkout StartUp Fee', 'ym'), 'caption' => __('2Checkout Supports a StartUp Fee. You can set this for this package here', 'ym'), 'type' => 'text');
     if (ym_post('2checkout_startupfee')) {
         $_POST['2checkout_startupfee'] = preg_replace('/[^\\d\\.]/', '', $_POST['2checkout_startupfee']);
         $_POST['2checkout_startupfee'] = number_format($_POST['2checkout_startupfee'], 2, '.', '');
     }
     return $items;
 }
예제 #11
0
 function settings(&$break)
 {
     global $ym_formgen, $mm;
     $break = TRUE;
     if ($_POST) {
         if ($apikey = ym_post('apikey')) {
             // verify
             ym_box_top($this->name . ' Settings API Key: Result');
             $this->class_construct($apikey);
             echo '<p>';
             if ($this->construct->error != 'ok') {
                 echo 'Error: ' . $this->construct->error;
             } else {
                 $this->options->apikey = $apikey;
                 $this->options->client = '';
                 $this->saveoptions();
                 echo '</p><p>ApiKey was saved</p>';
                 ym_box_bottom();
                 echo '<meta http-equiv="refresh" content="5" />';
                 return;
             }
             echo '</p>';
             ym_box_bottom();
         }
         if ($client = ym_post('client')) {
             // verify
             ym_box_top($this->name . ' Settings Client: Result');
             $this->class_construct($apikey, $client);
             echo '<p>';
             if ($this->construct->error != 'ok') {
                 echo 'Error: ' . $this->construct->error;
             } else {
                 $this->options->client = $client;
                 $this->saveoptions();
                 echo '</p><p>Client was saved</p>';
                 ym_box_bottom();
                 echo '<meta http-equiv="refresh" content="5" />';
                 return;
             }
             echo '</p>';
             ym_box_bottom();
         }
     }
     // the settings page
     if ($this->options->apikey) {
         ym_box_top($this->name . ' Settings API Key', TRUE, TRUE);
     } else {
         ym_box_top($this->name . ' Settings API Key');
     }
     echo '<form action="" method="post">';
     echo '<table class="form-table">';
     echo $ym_formgen->render_form_table_text_row($this->name . ' API Key', 'apikey', $this->options->apikey, 'Your ' . $this->name . ' API Key');
     echo '</table>';
     echo '<p style="text-align: right;"><input type="submit" value="' . __('Save API Key') . '"</p>';
     echo '</form>';
     ym_box_bottom();
     if ($this->options->apikey) {
         if ($this->options->client) {
             ym_box_top($this->name . ' Settings Client', TRUE, TRUE);
         } else {
             ym_box_top($this->name . ' Settings Client');
         }
         $clients = $this->get_clients(TRUE);
         echo '<form action="" method="post">';
         echo '<table class="form-table">';
         $ym_formgen->render_combo_from_array_row('Client To Send Via', 'client', $clients, $this->options->client);
         echo '</table>';
         echo '<p style="text-align: right;"><input type="submit" value="' . __('Save Client') . '"</p>';
         echo '</form>';
         ym_box_bottom();
         if ($this->options->client) {
             // rest of form
             if ($_POST) {
                 foreach (mailmanager_get_recipients() as $list => $text) {
                     if ($value = ym_post($list)) {
                         $this->associations->{$list} = $value;
                     } else {
                         if ($this->associations->{$list}) {
                             unset($this->associations->{$list});
                         }
                     }
                 }
                 $this->saveassociations();
                 ym_box_top($this->name);
                 echo '<p>' . __('Associations were updated') . '</p>';
                 ym_box_bottom();
                 ym_box_top('Syncing with ' . $this->name);
                 echo '<pre>';
                 $this->sync_with_gateway();
                 echo '</pre>';
                 ym_box_bottom();
             }
             echo '<form action="" method="post">';
             ym_box_top('List Associations');
             $lists = $this->get_lists(TRUE);
             echo '<table class="form-table">';
             foreach (mailmanager_get_recipients() as $list => $text) {
                 echo $ym_formgen->render_combo_from_array_row($text, $list, $lists, $this->associations->{$list}, 'Select a ' . $this->name . ' List to associate with');
             }
             echo '</table>';
             echo '<p style="text-align: right;"><input type="submit" value="' . __('Save Associations') . '" /></p>';
             ym_box_bottom();
             echo '</form>';
         }
     }
 }
예제 #12
0
$ym_year_email_date = ym_post('ym_year_email_date');
$ym_hour_email_date = ym_post('ym_hour_email_date');
$ym_min_email_date = ym_post('ym_min_email_date');
$recipient_list = ym_post('recipient_list');
do_action('mailmanager_broadcast_precontent');
if ($ym_month_email_date) {
    $time = array($ym_month_email_date, $ym_date_email_date, $ym_year_email_date, $ym_hour_email_date, $ym_min_email_date);
} else {
    $time = time();
}
if (!$email_id && (!$email_content || !$email_subject) && $_POST) {
    ym_box_top(__('Broadcast Error', 'ym_mailmanager'));
    echo '<p>' . __('You must provide a Email to send or fill in the a email content and subject', 'ym_mailmanager') . '</p>';
    ym_box_bottom();
} else {
    if (ym_post('submit')) {
        // swotch the time back to unix time
        if (is_array($time)) {
            $value = array();
            $value['month'] = array_shift($time);
            $value['date'] = array_shift($time);
            $value['year'] = array_shift($time);
            $value['hour'] = array_shift($time);
            $value['min'] = array_shift($time);
            $time = mktime($value['hour'], $value['min'], 0, $value['month'], $value['date'], $value['year']);
        }
        global $wpdb;
        do_action('mailmanager_broadcast_create', $email_id, $email_subject, $email_content, $recipient_list, $time);
        if (defined('STOP_BROADCAST')) {
            return;
        }
function ym_coupon_update()
{
    $coupon_id = ym_get('coupon_id');
    $name = ym_post('name');
    $value = ym_post('value');
    $description = ym_post('description');
    $allowed = (ym_post('new_sub') ? '1' : '0') . (ym_post('upgrade') ? '1' : '0') . (ym_post('post') ? '1' : '0') . (ym_post('pack') ? '1' : '0');
    $usage_limit = ym_post('usage_limit');
    if (ym_post('save_coupon')) {
        ym_save_coupon($name, $value, $description, $allowed, $usage_limit);
    }
    if (ym_post('update_coupon')) {
        ym_edit_coupon($coupon_id, $name, $value, $description, $allowed, $usage_limit);
    }
    if (ym_get('delete_coupon')) {
        $coupon_id = ym_get('delete_coupon');
        ym_delete_coupon($coupon_id);
    }
}
예제 #14
0
 function ym_email_message_save()
 {
     $invoice = new ym_invoice();
     $invoice->invoice_email_subject = ym_post('invoice_email_subject');
     $invoice->invoice_email_message = ym_post('invoice_email_message');
     $invoice->save();
 }
		</div>
';
                    }
                }
            }
        }
        echo '
	</fieldset>
</form>
';
        echo '</div></div>';
        ym_box_bottom();
        break;
    case 'update_facebook_widget':
        update_option('ym_register_flow_fb_app_id', ym_post('ym_register_flow_fb_app_id'));
        update_option('ym_register_flow_fb_secret', ym_post('ym_register_flow_fb_secret'));
        ym_display_message(__('Updated Register Flow Facebook Register Widget', 'ym'));
    default:
        ym_box_top(__('Registration Flows', 'ym'));
        echo '<p>' . __('You can create custom Registration Flows for use with the [ym_register] shortcode', 'ym') . '</p>';
        echo '<table class="form-table widefat">
<tr>
	<th>' . __('Flow ID', 'ym') . '</th>
	<th>' . __('Flow Name', 'ym') . '</th>
	<th>' . __('Pages in Flow', 'ym') . '</td>
	<th></th>
</tr>
';
        $query = 'SELECT * FROM ' . $flows_table . ' ORDER BY flow_id ASC';
        foreach ($wpdb->get_results($query) as $row) {
            echo '<tr>';
예제 #16
0
if (!get_option('yss_user_key') || !get_option('yss_secret_key')) {
    echo ym_start_box('Error');
    echo '<p>You need to provide your S3 User and Secret Keys, please visit the the Settings tab to do so.</p>';
    echo ym_end_box();
} else {
    if (in_array($action, array('stream', 'dload'))) {
        // distro select
        yss_s3_distribution($action, ym_request('id'));
    } else {
        if (in_array($action, array('add', 'edit'))) {
            yss_s3_edit($_REQUEST['id']);
        } else {
            if ($action == 'delete') {
                yss_s3_delete();
            }
            if (ym_post('submit_edit_s3')) {
                yss_s3_save();
            }
            yss_s3_list();
        }
    }
}
function yss_s3_distribution($type, $id)
{
    global $ym_formgen, $yss_cloudfront, $yss_db, $wpdb;
    // file details
    $s3file = yss_get($id);
    if ($_POST) {
        // here we go
        $distro = $_POST['distro'];
        list($can, $oai, $bucket, $file, $domain, $type) = explode('|', $distro);
function ym_tos_checks()
{
    global $ym_version_resp, $ym_auth;
    $key = ym_post('registration_email', FALSE);
    $tos_result = FALSE;
    $ym_tos_version_accepted = get_option('ym_tos_version_accepted', 0);
    if ($ym_tos_version_accepted < $ym_version_resp->tos->tos_version_id) {
        if (ym_post('activate_plugin') == 'tosterms') {
            // submitted form
            $tos_result = $ym_auth->tos_submit();
            if (!is_wp_error($tos_result) && $key) {
                // reload for recon
                ym_check_version(TRUE);
                ym_activate_last_step($key);
            }
        }
        // Show FORM
        echo '
<div class="wrap" id="poststuff">
	<h2>' . YM_ADMIN_NAME . '</h2>';
        ym_box_top(__('The End User License has been Updated', 'ym'));
        if (is_wp_error($tos_result)) {
            echo '<div id="message" class="error ym_auth">';
            echo '<div style="margin: 5px 0px; color:red; font-weight:bold;">';
            echo $tos_result->get_error_message();
            echo '</div></div>';
        }
        echo '<iframe src="' . $ym_version_resp->tos->tos_text_url . '" style="width: 100%; height: 500px;"></iframe>';
        echo '<p style="float: right;"><a href="' . $ym_version_resp->tos->tos_text_url . '">' . __('Download EULA', 'ym') . '</a></p>';
        echo '
	<form action="" method="post">
		<fieldset>
			<table class="form-table" style="width: 50%; margin: 10px auto; text-align: center;" >
				<tr>
					<td>
			<label for="confirm_email">' . __('Please confirm your Email', 'ym') . '</label>
					</td><td>
			<input type="email" name="confirm_email" id="confirm_email" value="' . ym_post('confirm_email') . '" style="width: 300px;" />
			<input type="hidden" name="registration_email" value="' . ym_post('registration_email') . '" />
					</td>
				</tr>
				<tr>
					<td colspan="2">

			<p>' . __('To continue you must accept the terms of this agreement:', 'ym') . '</p>
				<input type="hidden" name="activate_plugin" value="tosterms" />
				<input type="hidden" name="tosversion" value="' . $ym_version_resp->tos->tos_version_id . '" />
					</td>
				</tr><tr>
					<td colspan="2">
						<label for="tickbox">' . __('I accept the terms of this agreement:', 'ym') . '</label>
						<input type="checkbox" name="tickbox" id="tickbox" value="ticked" />
					</td>
				</tr><tr>
					<td colspan="2">
						<p class="submit" style="text-align: center;">
							<input type="submit" class="button-secondary" name="tos" value="Uninstall" />
							<input type="submit" class="button-primary" name="tos" value="Continue" style="font-weight: 700;" />
						</p>
					</td>
				</tr>
			</table>
		</fieldset>
	</form>';
        ym_box_bottom();
        echo '
</div>
';
    } else {
        if ($key) {
            // TOS OK/already accepted
            ym_activate_last_step($key);
        } else {
            return FALSE;
        }
    }
    return TRUE;
}
function ym_import_users_from_csv()
{
    if (ym_post('ym_start_import')) {
        if ($_FILES['upload']['error'] != 4) {
            $time = time();
            // since we don't need to keep the file, may as well leave it in tmp!
            $file = $_FILES['upload']['tmp_name'];
            $data_check = TRUE;
            $data_valid = FALSE;
            $import_array = array();
            $headers = array();
            $row = 0;
            if (($handle = fopen($file, "r")) !== FALSE) {
                $data_valid = TRUE;
                while (($data = fgetcsv($handle)) !== FALSE) {
                    if ($data_check) {
                        $headers = $data;
                        $data_check = FALSE;
                    } else {
                        foreach ($data as $index => $item) {
                            $import_array[$row][$headers[$index]] = $item;
                        }
                        $row++;
                    }
                }
            }
            if (!$data_valid) {
                echo '<div id="message" class="error"><p>' . __('Not a Valid CSV File I can handle', 'ym') . '</p></div>';
                return;
            } else {
                $total_success = 0;
                $total_fail = 0;
                $messages = '';
                // user add loop
                foreach ($import_array as $index => $record) {
                    $user = new YourMember_User();
                    // pass it to the pre built create function
                    // no password is exported by the export function
                    $smflag = FALSE;
                    if ($record['smflag']) {
                        $smflag = $record['smflag'];
                    }
                    $package = array();
                    $pack_id = '';
                    if (!$record['pack_id'] || !$record['package_id']) {
                        $package = array('account_type' => $record['account_type'], 'duration' => $record['duration'], 'duration_type' => $record['duration_type']);
                        if ($record['expire_date']) {
                            $package['expire_date'] = $record['expire_date'];
                        }
                    } else {
                        if ($record['pack_id']) {
                            $pack_id = $record['pack_id'];
                        }
                        if ($record['package_id']) {
                            $pack_id = $record['package_id'];
                        }
                    }
                    $password = false;
                    if ($record['password'] || $record['ym_password']) {
                        if ($record['password']) {
                            $password = $record['password'];
                        }
                        if ($record['ym_password']) {
                            $password = $record['password'];
                        }
                    }
                    $expire_date = false;
                    if ($record['expire_date']) {
                        $expire_date = $record['expire_date'];
                    }
                    //Setting package expiry date outside of the package
                    /*
                     * must be true
                     * export does not export the password
                     * so a new one must be generated and sent to the user
                     */
                    // custom fields will ignore stuff that doens't match
                    // run it
                    if ($record['user_email']) {
                        $result = $user->create($record['user_email'], $record['pack_id'], $smflag, $record['user_login'], $password, $record, $package, $expire_date);
                        if (is_wp_error($result)) {
                            $total_fail++;
                            $messages .= $index . '-' . $record['user_login'] . ': ' . $result->get_error_message() . '<br />';
                        } else {
                            $total_success++;
                        }
                    } else {
                        $total_fail++;
                        $messages .= 'No Email address for user, skipping user <br />';
                    }
                    unset($user);
                }
                @ym_log_transaction(11, date(YM_DATE, $time) . ' User import began. added: ' . $total_success . ', failed to add: ' . $total_fail, get_current_user_id());
                echo '<div id="message" class="updated"><p><strong>' . date(YM_DATE, $time) . ' User import began. added: ' . $total_success . ', failed to add: ' . $total_fail . '</strong></p></div>';
                if ($messages) {
                    echo '<div id="message" class="error"><p>' . $messages . '</p></div>';
                }
            }
            // clean up
            unlink($file);
            return;
        }
    }
}
예제 #19
0
         $wpdb->query($sql);
     }
 case 'enable':
     if ($id = ym_get('tseries')) {
         $sql = 'UPDATE ' . $wpdb->prefix . 'mm_series SET enabled = 1 WHERE id = ' . $id;
         $wpdb->query($sql);
         if (!$wpdb->rows_affected) {
             $sql = 'UPDATE ' . $wpdb->prefix . 'mm_series SET enabled = 0 WHERE id = ' . $id;
             $wpdb->query($sql);
         }
     }
 case 'assoc':
     if ($add_id = ym_post('email_id')) {
         $series_id = ym_post('series');
         if ($add_id && $series_id) {
             $delay = ym_post('delay');
             $sql = 'INSERT INTO ' . $wpdb->prefix . 'mm_email_in_series(series_id, email_id, delay_days) VALUES (' . $series_id . ', ' . $add_id . ', ' . $delay . ')';
             $wpdb->query($sql);
             if ($wpdb->insert_id) {
                 echo '<p>' . __('Email Associated', 'ym_mailmanager') . '</p>';
             } else {
                 echo '<p>' . __('Email Failed to be Associated', 'ym_mailmanager') . '</p>';
             }
             ym_box_bottom();
             ym_box_top(__('Email Series', 'ym_mailmanager'));
         }
     } else {
         if ($del_id = ym_get('deleteid')) {
             $sql = 'DELETE FROM ' . $wpdb->prefix . 'mm_email_in_series WHERE id = ' . $del_id;
             $wpdb->query($sql);
         }
예제 #20
0
    function settings(&$break)
    {
        global $ym_formgen, $mm;
        $break = TRUE;
        if ($_POST['distro_code']) {
            // going for connect
            //This code is actually just an application key, application secret, request token, token secret, and oauth_verifier, delimited by pipes (|).
            list($key, $secret, $request_token, $token_secret, $oauth_verifier) = explode('|', $_POST['distro_code']);
            // rebuild with keys
            $this->class_construct($key, $secret);
            // pass in secret
            $this->construct->token_secret = $token_secret;
            // exchange request token for access tokens
            $this->construct->access($request_token, $oauth_verifier);
            // store and set to live
            $this->options->oauth->consumer_key = $key;
            $this->options->oauth->consumer_secret = $secret;
            $this->options->oauth->access_token = $this->construct->access_token;
            $this->options->oauth->access_token_secret = $this->construct->access_token_secret;
            $this->options->oauth->connected = TRUE;
            $this->saveoptions();
            // test connection
            ym_box_top('Aweber Account Selection');
            echo '<p>Testing connection</p>';
            $data = $this->construct->accounts();
            if ($this->construct->disconnected) {
                // destory
                $this->activate();
                echo '<p>Connection Failed</p>';
            } else {
                echo '<p>Connection Complete</p>';
                if (sizeof($data->entries) == 1) {
                    // only 1 account auto associate
                    $this->options->account = $data->entries[0]->id;
                    $this->saveoptions();
                    echo '<p>Associating with the account ' . $data->entries[0]->id . '</p>';
                    ym_box_bottom();
                    unset($_POST);
                }
            }
        }
        if ($this->options->oauth->connected) {
            if ($_POST['account']) {
                $this->options->account = $_POST['account'];
                $this->saveoptions();
                ym_box_top('Settings Updated');
                echo '<p>Settings were updated</p>';
                ym_box_bottom();
            }
            if (!$this->options->account) {
                if (!$data) {
                    ym_box_top('Aweber Account Selection');
                    $data = $this->construct->accounts();
                    $this->construct_check();
                }
                echo '<form action="" method="post">';
                echo '<fieldset><legend>Please Select an Aweber Account to connect to</legend>';
                echo '<table class="form-table">';
                $entries = array();
                if (!$this->options->account) {
                    $entries[] = 'Select';
                }
                foreach ($data->entries as $entry) {
                    $entries[] = $entry->id;
                }
                $ym_formgen->render_combo_from_array_row('Account To Use', 'account', $entries, $this->options->account);
                echo '</table>';
                echo '<p style="text-align: right;"><input type="submit" value="' . __('Save Client') . '"</p>';
                echo '</fieldset></form>';
                ym_box_bottom();
            } else {
                // normal form
                // remove the filter
                remove_filter('mailmanager_adjust_recipients', array($this, 'filter_lists_add_name'));
                if ($_POST) {
                    foreach (mailmanager_get_recipients() as $list => $text) {
                        if ($value = ym_post($list)) {
                            $this->associations->{$list} = $value;
                        } else {
                            if ($this->associations->{$list}) {
                                unset($this->associations->{$list});
                            }
                        }
                    }
                    $this->saveassociations();
                    ym_box_top('Aweber');
                    echo '<p>' . __('Associations were updated') . '</p>';
                    ym_box_bottom();
                    ym_box_top('Syncing with Aweber');
                    echo '<pre>';
                    $this->sync_with_gateway();
                    echo '</pre>';
                    ym_box_bottom();
                }
                echo '<form action="" method="post">';
                ym_box_top('List Associations');
                $lists = $this->get_lists(TRUE);
                echo '<table class="form-table">';
                foreach (mailmanager_get_recipients() as $list => $text) {
                    echo $ym_formgen->render_combo_from_array_row($text, $list, $lists, $this->associations->{$list}, 'Select a ' . $this->name . ' List to associate with');
                }
                echo '</table>';
                echo '<p style="text-align: right;"><input type="submit" value="' . __('Save Associations') . '" /></p>';
                ym_box_bottom();
                echo '</form>';
            }
        } else {
            ym_box_top('Aweber Connect: Instructions');
            echo '<table style="width: 100%;">
			<tr>
			<td style="width: 33%; text-align: center;">Step 1) Login to Aweber</td>
			<td style="width: 33%; text-align: center;">Step 2) Copy the Authorization Code Supplied</td>
			<td style="width: 33%; text-align: center;">Step 3) Paste into the Box Below</td>
			</tr>
			</table>';
            ym_box_bottom();
            ym_box_top('Aweber Connect');
            echo '<iframe src="' . $this->construct->distro_url($this->aweber_id) . '" style="width: 800px; height: 560px;" id="aweberiframe"></iframe>';
            ym_box_bottom();
            ym_box_top('Aweber Authorization Code');
            echo '
			<form action="" method="post">
				<fieldset>
					<legend>Provide your Authorization Code here, the Authorization Code is specific to Your Aweber Account</legend>
					<input type="text" name="distro_code" id="distro_code" style="width: 100%;" />
					<br />
					<input type="submit" />
				</fieldset>
			</form>';
            ym_box_bottom();
        }
    }
예제 #21
0
    function series_replace()
    {
        global $ym_formgen, $mm;
        define('MM_SERIES_REPLACED', TRUE);
        $action = $_POST['action'];
        $offset_units = array('day', 'week', 'month', 'year');
        switch ($action) {
            case 'add':
                $email_subject = ym_post('email_subject');
                $recipient_list = ym_post('recipient_list');
                $items = $this->generate_message_generate($email_subject, $recipient_list);
                $type_opts = array('offset-units' => $offset_units[ym_post('offset_units')], 'offset-time' => ym_post('offset_time'), 'offset-dir' => 'after', 'event' => 'signup');
                $c_id = $this->mailchimp->campaignCreate('auto', $items['data'], $items['content'], $items['segment_opts'], $type_opts);
                if ($this->mailchimp->error == 'ok') {
                    echo '<div id="message" class="updated"><p>' . __('The Auto Responder has been saved activated') . '</p></div>';
                    //					echo '<meta http-equiv="refresh" content="5;' . $mm->page_root . '&mm_action=series" />';
                    unset($_POST);
                    $_POST['action'] = 'start';
                    $_POST['email_id'] = $c_id;
                    $this->series_replace();
                    return;
                } else {
                    echo '<div id="message" class="error"><p>' . __('The Auto Responder failed to be created') . '</p><p>' . $this->mailchimp->error . '</p></div>';
                }
                return;
            case 'new':
                ym_box_top(__('Creating a new Auto Responder'));
                echo '<form action="" method="post">';
                echo '<table class="form-table">';
                $this->generate_message_create_form();
                // additionals
                // offset
                echo '<tr><td><input type="hidden" name="action" value="add" /></td><td>' . __('Send this message to the user, how long after joining/being added to the list') . '</td></tr>';
                $offset_times = array();
                for ($x = 0; $x < 24; $x++) {
                    $offset_times[] = $x;
                }
                unset($offset_times[0]);
                // easy fix like a boss
                $offset_dir = 'after';
                echo $ym_formgen->render_combo_from_array_row(__('Offset Units'), 'offset_units', $offset_units, $offset_unit, __('Time Units'));
                echo $ym_formgen->render_combo_from_array_row(__('Offset Time'), 'offset_time', $offset_times, $offset_time, __('How much of the unit'));
                echo '</table>';
                echo '<p class="submit" style="float: right;"><input type="submit" value="' . __('Add AutoResponder') . ' " /></p>';
                echo '</form>';
                ym_box_bottom();
                return;
            case 'delete':
                $this->view_emails();
                return;
            case 'start':
                $email_id = ym_post('email_id');
                if ($this->mailchimp->campaignResume($email_id)) {
                    echo '<div id="message" class="updated"><p>' . __('Auto Responder has been enabled') . '</p></div>';
                } else {
                    echo '<div id="message" class="error"><p>' . __('Failed to Start the Auto Responder') . '</p></div>';
                }
            case 'deletego':
                if ($action == 'deletego') {
                    $email_id = ym_post('email_id');
                    if ($this->mailchimp->campaignDelete($email_id)) {
                        echo '<div id="message" class="updated"><p>' . __('Your Auto Responder was deleted') . '</p></div>';
                    } else {
                        echo '<div id="message" class="error"><p>' . __('Your Auto Responder was not deleted') . '</p></div>';
                    }
                }
            case 'pause':
                if ($action == 'pause') {
                    $email_id = ym_post('email_id');
                    if ($this->mailchimp->campaignPause($email_id)) {
                        echo '<div id="message" class="updated"><p>' . __('Auto Responder has been Paused') . '</p></div>';
                    } else {
                        echo '<div id="message" class="error"><p>' . __('Failed to Pause the Auto Responder') . '</p></div>';
                    }
                }
            default:
                // get responders
                $options = array('list_id' => $this->options->list, 'type' => 'auto', 'status' => 'save');
                $emails = $this->mailchimp->campaigns($options);
                ym_box_top(__('Drafts'));
                $this->email_list($emails);
                ym_box_bottom();
                $options['status'] = 'paused';
                $emails = $this->mailchimp->campaigns($options);
                if ($emails->total) {
                    ym_box_top(__('Paused'));
                    $this->email_list($emails);
                    ym_box_bottom();
                }
                $options['status'] = 'schedule';
                $emails = $this->mailchimp->campaigns($options);
                if ($emails->total) {
                    ym_box_top(__('Scheduled'));
                    $this->email_list($emails);
                    ym_box_bottom();
                }
                $options['status'] = 'sending';
                $emails = $this->mailchimp->campaigns($options);
                if ($emails->total) {
                    ym_box_top(__('Active/Sending'));
                    $this->email_list($emails);
                    ym_box_bottom();
                }
                $options['status'] = 'sent';
                $emails = $this->mailchimp->campaigns($options);
                if ($emails->total) {
                    ym_box_top(__('Sent'));
                    $this->email_list($emails);
                    ym_box_bottom();
                }
                ym_box_top(__('Actions'));
                echo '
<form action="" method="post">
	<fieldset>
		<p class="submit">
			<input type="hidden" name="action" value="new" />
			<input type="submit" value="' . __('Create New') . '" />
		</p>
	</fieldset>
</form>';
                ym_box_bottom();
        }
    }
             echo $v;
             echo '</option>';
         }
         echo '</select></td></tr>';
         echo '</table>';
         echo '<p style="float: left;" class="submit"><input type="button" value="' . __('Back', 'ym') . '" onclick="location.href = \'' . YM_ADMIN_URL . '&ym_page=' . $_GET['ym_page'] . '\';" /></p>';
         echo '<p style="text-align: right;" class="submit"><input type="submit" class="deletelink" value="' . __('Delete', 'ym') . '" /></p>';
         echo '</form>';
         ym_box_bottom();
     }
     break;
 case 'order':
     $obj = get_option('ym_packs');
     $neworder = get_option('ym_packs');
     $neworder->packs = array();
     $order = ym_post('order');
     if ($order) {
         $order = str_replace('item[]=', '', $order);
         $order = explode('&', $order);
         foreach ($order as $id) {
             $pack = $obj->packs[$id];
             $neworder->packs[] = $pack;
         }
     }
     update_option('ym_packs', $neworder);
     echo '<meta http-equiv="refresh" content="3;' . $link . '&message=order" />';
     echo '</div>';
     return;
 default:
     if (ym_get('message')) {
         echo '<div id="message" class="updated fade"><p>';
function ym_shortcode_ym_group_membership_control()
{
    // @TODO: Finish
    global $ym_user, $ym_formgen;
    if ($ym_user->child_ids || $ym_user->child_accounts_allowed) {
        // has children
        $total_kids = count($ym_user->child_ids);
        $action = ym_post('action', false);
        if ($action == 'ym_add_child_user') {
            if ($ym_user->child_accounts_allowed > $total_kids) {
                $email_address = ym_post('email_address');
                $username = ym_post('username', $email_address);
                $password = ym_post('password');
                $c_password = ym_post('c_password');
                if ($email_address && is_email($email_address)) {
                    if (!empty($password) && $password != $c_password) {
                        ym_display_message(__('Passwords do not match', 'ym'), 'error');
                    }
                    $new_user = new YourMember_User();
                    $result = $new_user->create($email_address, false, false, $username, $password);
                    if (is_wp_error($result)) {
                        ym_display_message($result->get_error_message(), 'error');
                    } else {
                        // apply child
                        $data = array('parent_id' => $ym_user->ID);
                        // package type
                        if (count($ym_user->child_accounts_package_types) > 1) {
                            $data['account_type'] = $ym_user->child_accounts_package_types[0];
                        } else {
                            $data['account_type'] = $ym_user->account_type;
                        }
                        $new_user->update($data);
                        $new_user->save();
                        unset($new_user);
                        //garbage collect
                        $child_ids = $ym_user->child_ids;
                        $child_ids[] = $result;
                        $ym_user->update(array('child_ids' => $child_ids));
                        $ym_user->save();
                        // all done
                        ym_display_message(__('Child User was created successfully', 'ym'));
                    }
                } else {
                    ym_display_message(__('The Email Address was Blank or Invalid', 'ym'), 'error');
                }
            } else {
                ym_display_message(__('You have reached the maximum number of accounts', 'ym'), 'error');
            }
        } else {
            if ($action == 'ym_child_package_type_change') {
                $child_id = ym_post('child_id', false);
                if ($child_id) {
                    $ym_child = new YourMember_User($child_id);
                    if ($ym_child->parent_id = $ym_user->ID) {
                        $ym_child->update(array('account_type' => $_POST['package_type']));
                        $ym_child->save();
                        ym_display_message(__('Child account was updated successfully', 'ym'));
                    } else {
                        ym_display_message(__('You are trying to update someone elses child', 'ym'), 'error');
                    }
                }
            }
        }
        $return .= '<table class="form-table">';
        foreach ($ym_user->child_ids as $child) {
            // loop thru kids
            $ym_child = new YourMember_User($child);
            $return .= '<tr>';
            $return .= '<td>' . $ym_child->data->user_login . '</td>';
            $return .= '<td>';
            $return .= $ym_child->account_type;
            $return .= '</td>';
            $return .= '</tr>';
        }
        $return .= '</table>';
        if ($ym_user->child_accounts_allowed > $total_kids) {
            // can add child
            $return .= '<h4>' . __('Create new Group Account', 'ym') . '</h4>';
            $return .= '<form action="" method="post">
	<input type="hidden" name="action" value="ym_add_child_user" />
<table class="form-table">
';
            $ym_formgen->return = true;
            $return .= $ym_formgen->render_form_table_email_row(__('Email Address', 'ym'), 'email_address');
            $return .= $ym_formgen->render_form_table_text_row(__('Username', 'ym'), 'username', '', __('Leave blank to use the email address', 'ym'));
            $return .= $ym_formgen->render_form_table_password_row(__('Password', 'ym'), 'password', '', __('Leave blank to auto generate', 'ym'));
            $return .= $ym_formgen->render_form_table_password_row(__('Confirm Password', 'ym'), 'c_password');
            $ym_formgen->return = false;
            $return .= '<tr><td colspan="2"><p class="submit"><input type="submit" class="button-primary alignright" value="' . __('Create', 'ym') . '" /></p></td></tr>';
            $return .= '</table></form>';
        }
        return $return;
    } else {
        return '<p>' . __('You do not have access to Group Management', 'ym') . '</p>';
    }
}
<?php

/*
* $Id: ym-advanced-payment_gateway_email.php 2297 2012-08-09 13:30:50Z bcarlyon $
* $Revision: 2297 $
* $Date: 2012-08-09 14:30:50 +0100 (Thu, 09 Aug 2012) $
*/
global $ym_formgen, $ym_res, $ym_sys;
if (ym_post('msgs_update')) {
    $ym_res->update_from_post();
    ym_display_message(__('Messages Saved', 'ym'));
    do_action('ym-advanced-payment_gateway_email_save');
}
?>
<div class="wrap" id="poststuff">
<form action="" method="post">

<div id="ym_messages">
<ul>
	<li><a href="#ym_payment_gateway_base"><?php 
echo __('Payment Gateway Base Emails', 'ym');
?>
</a></li>
	<?php 
do_action('ym-advanced-payment_gateway_email_tabs');
?>
	<li><a href="#ym_payment_gateway_copy_to"><?php 
echo __('Payment Gateway Base Emails CC/BCC', 'ym');
?>
</a></li>
</ul>
예제 #25
0
 function do_process()
 {
     // IPN handler:
     //		echo '<p>One Moment... Processing</p>';
     $code = ym_post('CpiResultsCode', FALSE);
     $what = ym_post('MerchantData', FALSE);
     $hash = ym_post('OrderHash', FALSE);
     if (!isset($_POST['CpiResultsCode']) || !$what || !$hash) {
         echo '<p>Missing Data cannot process</p>';
         exit;
     }
     $amount = ym_post('PurchaseAmount');
     $complete = FALSE;
     if ($code > 0) {
         // error
         if ($code == 1) {
             // use cancel
             header('Location: ' . site_url($this->cancel_url));
             exit;
         }
     } else {
         // code is 0 which is hurrah
         $complete = TRUE;
     }
     // validate Hash
     $calcHash = array($code, ym_post('PurchaseDate'), $what, ym_post('OrderId'), $amount, ym_post('PurchaseCurrency'), ym_post('ShopperEmail'), ym_post('StorefrontId'));
     $calcHash = $this->generateHash($calcHash, $this->cpi_hash_key);
     if ($calcHash != $hash) {
         echo '<p>Hash Mis Match - Security Error</p>';
         exit;
     }
     // convert to primary units
     $amount = $amount / 100;
     $this->common_process($what, $amount, $complete, FALSE);
     if ($complete) {
         list($buy, $what, $id, $user_id) = explode('_', $what);
         if ($what == 'subscription') {
             $url = $this->redirectlogic($id);
         } else {
             if ($what == 'post') {
                 $pack = $this->pay_per_post($amount, '', '', $id);
                 $url = $this->redirectlogic($pack);
             } else {
                 $pack = $this->pay_per_post_bundle($amount, $id, '');
                 $url = $this->redirectlogic($pack);
             }
         }
         header('Location: ' . $url);
         //			echo '<meta http-equiv="refresh" content="0;' . $url . '" />';
     } else {
         //			echo '<p><a href="' . site_url('/') . '">Return Home</a></p>';
         header('Location: ' . site_url($this->error_url));
     }
     exit;
     header('HTTP/1.1 200 OK');
     exit;
 }
예제 #26
0
 function get_pending_reason()
 {
     $pending_str = array('address' => __('Customer did not include a confirmed shipping address', 'ym'), 'authorization' => __('Funds not captured yet', 'ym'), 'echeck' => __('eCheck that has not cleared yet', 'ym'), 'intl' => __('Payment waiting for approval by service provider', 'ym'), 'multi_currency' => __('Payment waiting for service provider to handle multi-currency process', 'ym'), 'unilateral' => __('Customer did not register or confirm his/her email yet', 'ym'), 'upgrade' => __('Waiting for service provider to upgrade the PayPal account', 'ym'), 'verify' => __('Waiting for service provider to verify his/her PayPal account', 'ym'), '*' => __('Unknown error', 'ym'));
     $reason = ym_post('pending_reason');
     $reason = isset($pending_str[$reason]) ? $pending_str[$reason] : $pending_str['*'];
     return $reason;
 }
<?php

echo '	<div class="wrap" id="poststuff">';
ym_coupon_update();
if ($coupon_id = ym_get('coupon_id')) {
    $coupon = ym_get_coupon($coupon_id);
    if (ym_post('edit')) {
        echo ym_start_box(__('Edit coupon: "', 'ym') . $coupon->name . '"');
        ym_render_coupon_edit($coupon_id);
        echo ym_end_box();
    }
    if (ym_post('view')) {
        echo ym_start_box(__('View Users who used Coupon: "', 'ym') . $coupon->name . '"');
        ym_render_coupon_view($coupon_id);
        echo '<form method="POST">
		<input type="hidden" name="ym_coupon_id" value="' . $coupon_id . '" />
		<input class="button" type="submit" name="ym_start_xls_coupon" value="' . __('Export Data', 'ym') . '" />
		 </form>';
        echo ym_end_box();
    }
} else {
    echo ym_start_box(__('Coupon', 'ym'));
    ym_render_coupons();
    echo ym_end_box();
}
echo '</div>';
if ($_POST) {
    $action = ym_post('action', false);
    if ($action == 'deletechildaccount') {
        $id = ym_post('child_id', false);
        if (ym_group_membership_parent_delete_child($id, TRUE)) {
            // reload
            $ym_user = new YourMember_User($ym_user->ID);
        }
    } else {
        if ($action == 'create_child_account') {
            $email_address = ym_post('email_address');
            $username = ym_post('username', $email_address);
            $password = ym_post('password');
            $c_password = ym_post('c_password');
            $sub_id = ym_post('package', false);
            $package_type = ym_post('package_type', false);
            if (ym_group_membership_create_child($email_address, $username, $password, $c_password, $sub_id, $package_type, TRUE)) {
                // reload
                $ym_user = new YourMember_User($ym_user->ID);
            }
        } else {
            ym_display_message(__('Unknown Action Requested', 'ym'), 'error');
        }
    }
}
// get breakdown
$current_counts = ym_group_membership_get_counts();
echo '<div id="poststuff" class="wrap">
	<h2>' . __('Group Membership', 'ym') . '</h2>';
ym_box_top('&nbsp;');
echo '<p>' . sprintf(__('You are eligible to have %s account%s in your Group, you currently have %s Child Account%s', 'ym'), $ym_user->child_accounts_allowed, $ym_user->child_accounts_allowed != 1 ? 's' : '', count($ym_user->child_ids), count($ym_user->child_ids) != 1 ? 's' : '') . '</p>';
예제 #29
0
    header('Location: ' . $download_url);
    exit;
}
if (ym_request('do_munch') && ym_request('download_beta')) {
    ym_check_version();
    global $ym_update_checker, $ym_version_resp;
    $ym_update_checker->checkForUpdates();
    if ($ym_version_resp->version->beta_download_url) {
        header('Location: ' . $ym_version_resp->version->beta_download_url);
        exit;
    }
}
global $wp_version, $ym_version_resp, $wpdb, $ym_update_checker;
$do_check = ym_post('ym_do_version_check');
$check_step = ym_post('ym_do_version_check_step');
$do_beta_toggle = ym_post('ym_do_toggle_beta');
if ($do_beta_toggle) {
    $beta_enable = get_option('ym_beta_notify');
    if ($beta_enable) {
        delete_option('ym_beta_notify');
        $message = __('You will not be notified of Betas', 'ym');
    } else {
        update_option('ym_beta_notify', TRUE);
        $message = __('You will be notified of Betas', 'ym');
    }
    echo '<div id="message" class="updated"><p>' . $message . '</p></div>';
    $do_check = TRUE;
    $check_step = 1;
}
if ($do_check) {
    switch ($check_step) {
예제 #30
0
        echo '</div>';
    }
} else {
    global $ym_version_resp;
    ym_check_version(true);
    // ym conf hook
    if (!isset($_POST['activate_plugin'])) {
        ym_check_for_ymconf();
    }
    $auth_key_result = false;
    // no key
    if (ym_post('activate_plugin', false) && ym_post('registration_email', false)) {
        $auth_key_result = $ym_auth->ym_authorize_key(ym_post('registration_email'));
    }
    global $ym_version_resp;
    if (!is_wp_error($auth_key_result) && ym_post('registration_email')) {
        // key ok TOS check
        ym_tos_checks();
    } else {
        echo '
<div class="wrap" id="poststuff">
	<h2>' . YM_ADMIN_NAME . '</h2>
	<div id="message" class="error ym_auth">
	';
        if (is_wp_error($auth_key_result)) {
            echo '<div style="margin: 5px 0px; color:red; font-weight:bold;">';
            echo $auth_key_result->get_error_message();
            echo '</div>';
        }
        echo '<p><strong>' . YM_ADMIN_NAME . '</strong> ' . __('will not function until a valid Email has been entered.<br />Please enter the <strong>email address</strong> you used to purchase the plugin in the box below to activate it.', 'ym') . '</p>';
        if (YM_ADMIN_NAME == 'Your Members') {