echo '<br />R: ' . preg_replace('/[^0-9]/', '', $obj->version);
        }
        echo '</td>
			<td width="8%" valign="top">' . $links . '</td>
		</tr>
		';
        $obj = null;
    }
}
?>
</form>
</table>

<?php 
echo ym_end_box();
echo ym_start_box(__('Global Payment Settings', 'ym'));
global $ym_sys, $ym_res, $ym_formgen;
if (isset($_POST['settings_update']) && !empty($_POST['settings_update'])) {
    // currency is in here
    $ym_res->update_from_post();
    // sys
    $ym_sys->update_from_post();
    update_option('ym_sys', $ym_sys);
    ym_display_message(__('System Updated', 'ym'));
}
$sel_currency = ym_get_currency();
$currencies = ym_get_currencies();
echo '
<form action="" method="post">
<table class="form-table">
';
Beispiel #2
0
<?php

/*
* $Id: ym-logs-ipn.php 2166 2012-05-25 14:16:20Z bcarlyon $
* $Revision: 2166 $
* $Date: 2012-05-25 15:16:20 +0100 (Fri, 25 May 2012) $
*/
echo '<div class="wrap" id="poststuff">';
echo ym_start_box(__('IPN Information', 'ym'));
echo '<p>' . __('IPN stands for Instant Payment Notification. It means something of note has happened at a payment processor and they will make a "call" to your site to let you know. Things that happen are usually payments and refunds. YM can then deal with each request appropriately.', 'ym') . '</p>';
$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 ($transactions = ym_get_all_logs(YM_IPN, $user_id, $limit, $start, $order_by, $deleted)) {
    $form = '<tr><td colspan="5" style="text-align: center;"><form action="" method="post">
<input type="hidden" name="start" value="' . $start . '" />';
    if ($start) {
        $form .= '<input type="submit" name="back" value="' . __('Back a Page', 'ym') . '" style="float: left;" />';
    }
Beispiel #3
0
<?php

/*
* $Id: yss_home.php 1754 2012-01-03 16:45:50Z BarryCarlyon $
* $Revision: 1754 $
* $Date: 2012-01-03 16:45:50 +0000 (Tue, 03 Jan 2012) $
*/
echo '<div id="yss_guide">';
echo ym_start_box('Welcome to Your Secure Stream!');
echo '
<p>This plugin (YSS) works in conjunction with <a href="http://www.yourmembers.co.uk" target="_blank">Your Members</a>, allows you to embed Video content uploaded to the <a href="http://aws.amazon.com/s3/" target="_blank">Amazon Simple Storage Server (S3)</a>, as well as protect it.</p>
<p>Use the settings page to add your S3 information then use the Videos page to create a new video link for the site.</p>
<p><strong>Note</strong></p>
<p>You can select which player you wish to use to play your content within as long as you have the relevant (and supported) plugin installed.</p>
<p><strong>Usage Instructions</strong></p>
<p>Videos can be added to posts and pages on your site using <strong>[yss_player id=1234]</strong> as the shortcode. The video size defaults to 640x380, however, you can set these using width and height arguments within the shortcode as follows: <strong>[yss_player id=1234 width=1234 height=1234]</strong></p>';
echo ym_end_box();
echo '</div>';
function yss_s3_list()
{
    get_currentuserinfo();
    global $yss_db, $wpdb, $date_format, $current_user;
    $header_style = 'border-bottom: 1px solid silver; font-weight: bold;';
    $sql = 'SELECT *
			FROM ' . $yss_db . ' 
			ORDER BY id';
    $s3s = $wpdb->get_results($sql);
    echo ym_start_box('Videos');
    echo '<p>' . __('Videos can be associated with content or Package types. When associated, they take on the page or post permissions including post purchased. Non associated videos are accessible by all.', 'yss') . '</p>';
    echo '<p>' . __('YSS will attempt to use Streaming, then Download and finally S3', 'yss') . '</p>';
    echo '<p>' . __('Note: YSS does not support non FLV files in a streaming distribution under FlowPlayer. It just does not work!', 'yss') . '</p>';
    echo '	<table class="widefat form-table" style="width: 100%;" cellspacing="0">
			<thead>
			<tr>
				<td style="' . $header_style . '">' . __('ID', 'yss') . '</td>
				<td style="' . $header_style . '">' . __('Bucket', 'yss') . '</td>
				<td style="' . $header_style . '">' . __('Resource Path', 'yss') . '</td>
				<td style="' . $header_style . '">' . __('Distribution', 'yss') . '</td>
				<td style="' . $header_style . ' width: 150px; text-align: center;">' . __('Limited Access (<span title="Video protected by Your Members Package Types">ACs</span>)', 'yss') . '</td>
				<td style="' . $header_style . ' width: 150px; text-align: center;">' . __('Limited Access (<span title="Video protected via access to Posts/Pages protected by YM">Posts</span>)', 'yss') . '</td>
				<td style="' . $header_style . '">' . __('Posted', 'yss') . '</td>
				<td style="' . $header_style . '">' . __('Action', 'yss') . '</td>
			</tr>
			</thead>
			<tbody>';
    if ($s3s) {
        foreach ($s3s as $s3) {
            $date = date($date_format, strtotime($s3->postDate));
            //			$user = get_userdata($s3->user);
            $stream_distribute = YM_ADMIN_INDEX_URL . '&ym_page=ym-hook-yss_content&task=stream&id=' . $s3->id;
            $download_distribute = YM_ADMIN_INDEX_URL . '&ym_page=ym-hook-yss_content&task=dload&id=' . $s3->id;
            $dl = $s = 'No';
            if ($s3->distribution) {
                $distribution = json_decode($s3->distribution);
                if (isset($distribution->download) && $distribution->download) {
                    $dl = 'Yes';
                }
                if (isset($distribution->streaming) && $distribution->streaming) {
                    $s = 'Yes';
                }
            }
            echo '<tr>
					<td>' . $s3->id . '</td>
					<td>' . $s3->bucket . '</td>
					<td>' . $s3->resource_path . '</td>
					<td>
					';
            if (!get_option('yss_cloudfront_id') || !get_option('yss_cloudfront_private')) {
                echo '
						N/A
					';
            } else {
                echo '
						DL: <a href="' . $download_distribute . '">' . $dl . '</a>
						S: <a href="' . $stream_distribute . '">' . $s . '</a>
					';
            }
            echo '
					</td>
					<td style="text-align:center; font-weight: bold;">
						' . ($s3->account_types ? __('<span style="color: green;">' . implode(', ', explode('||', $s3->account_types)) . '</span>', 'yss') : __('<span style="color: red;">No</span>', 'yss')) . '
					</td>					
					<td style="text-align:center; font-weight: bold;">
						' . ($s3->members ? __('<span style="color: green;">Yes</span>', 'yss') : __('<span style="color: red;">No</span>', 'yss')) . '
					</td>
					<td>' . $date . ' by ' . $current_user->user_login . '</td>
					<td style="line-height: 2em;">
						<a href="' . YM_ADMIN_INDEX_URL . '&ym_page=ym-hook-yss_content&task=edit&id=' . $s3->id . '">Edit</a> | <a href="' . YM_ADMIN_INDEX_URL . '&ym_page=ym-hook-yss_content&task=delete&id=' . $s3->id . '" class="deletelink">Delete</a>
					</td>
				</tr>
				';
        }
    } else {
        echo '	<tr>
				<td colspan="6">' . __('You have yet to add any videos.', 'yss') . '</td>
			</tr>';
    }
    echo '</tbody>';
    echo '			</table>';
    echo '<input type="hidden" name="id" id="yss_edit_id" value="" />';
    echo '
<p class="submit" style="text-align: right;">
	<input type="hidden" name="task" value="add" />
	<input type="submit" value="Add New Video" />
</p>';
    echo ym_end_box();
}
Beispiel #5
0
echo '</ul>';
echo ym_end_box();
echo ym_start_box('Custom Player');
echo '<p>As apposed to using one of the custom players, you can create your Own player code to use</p>';
echo '<p>Just create the code to use (using the needed placeholder shortcodes) in the area provided and select <em>custom player</em> from the drop down</p>';
echo '<p>Shortcodes: 
<ul>
	<li>[yss_video_url] : the video URL</li>
	<li>[yss_streamer] : If streaming is to be used, then replace with the required URL</li>
	<li>[yss_video_height] : height in digits (so you will proabably need px after in your code)</li>
	<li>[yss_video_width] : width in digiits</li>
</ul>
';
echo '<textarea name="yss_custom_player" id="yss_custom_player" style="width: 600px; height: 250px;">' . get_option('yss_custom_player') . '</textarea>';
echo ym_end_box();
echo ym_start_box('Player Settings');
echo '<table class="form-table">';
//	$hours = array();
//	for ($x=0;$x<=24;$x++) {
//		$hours[] = $x;
//	}
//	$ym_formgen->render_combo_from_array_row('Expire Time (Hours)', 'yss_expire_time', $hours, get_option('yss_expire_time'), 'How long a link remains valid, for example if you allow video download, or a member distributes a video link');
//	if (!sizeof($players)) {
//		$players[''] = 'Please install/activate a player';
//	}
$players['custom'] = 'Custom Player';
$ym_formgen->render_combo_from_array_row('Default Player', 'yss_playerofchoice', $players, get_option('yss_playerofchoice'), 'YSS Player of choice');
echo '</table>';
echo ym_end_box();
echo '
	<p class="submit" style="text-align: right;">
<?php

/*
* $Id: ym-profile_content.php 1670 2011-12-16 14:12:47Z BarryCarlyon $
* $Revision: 1670 $
* $Date: 2011-12-16 14:12:47 +0000 (Fri, 16 Dec 2011) $
*/
get_currentuserinfo();
global $current_user, $ym_res;
$html = '';
$html .= '<div class="wrap" id="poststuff">
	<h2>' . __('Members Content', 'ym') . '</h2>';
$html .= ym_membership_content_page(true);
$html .= @$ym_res->members_content_divider2_html;
if (current_user_can('publish_posts')) {
    $html .= ym_start_box(__('My Sold Posts', 'ym'));
    $html .= __('<p>This section displays a list of the posts and pages that you have authored and have sold.</p>', 'ym');
    echo $html;
    $html = '';
    ym_render_all_posts_purchased(false, false, $current_user->ID);
    $html .= ym_end_box();
}
$html .= '</div>';
echo $html;
function ym_show_generic_log($log_type_id = false, $user_id = false)
{
    if ($actions = ym_get_transaction_actions($log_type_id)) {
        foreach ($actions as $i => $log_type) {
            echo ym_start_box($log_type->name);
            echo '<p>' . $log_type->description . '</p>';
            if ($transactions = ym_get_all_logs($log_type->id, $user_id)) {
                echo '<table class="ym_table form-table">
				<thead>
					<tr>';
                if (!$user_id) {
                    echo '	<th>' . __('User ID', 'ym') . '</th>
				<th>' . __('User', 'ym') . '</th>
				<th>' . __('User Email', 'ym') . '</th>';
                }
                echo '		<th>' . __('Log Type', 'ym') . '</th>
				<th>' . __('Data', 'ym') . '</th>
				<th>' . __('Date', 'ym') . '</th>
					</tr>
				</thead>
				<tbody>';
                foreach ($transactions as $transaction) {
                    $mod = unserialize($transaction->data);
                    if (!$user_id) {
                        $user = get_userdata($transaction->user_id);
                    }
                    echo '<tr>';
                    if (!$user_id) {
                        echo '	<td>' . $transaction->user_id . '</td>
							<td><a alt="View user profile" title="View user profile" href="' . YM_ADMIN_URL . 'user-edit.php?user_id=' . $transaction->user_id . '" target="_top">' . $user->user_login . '</a></td>
							<td>' . $user->user_email . '</td>';
                    }
                    echo '	<td>' . (is_array($mod) ? '<pre>' . print_r($mod, true) . '</pre>' : $mod) . '</td>
						<td>' . date(YM_DATE, $transaction->unixtime + get_option('gmt_offset') * 3600) . '</td>
					</tr>';
                }
                echo '</tbody>
				</table>';
            } else {
                echo __('<em>There are no logs for this type.</em>', 'ym');
            }
            echo ym_end_box();
        }
    }
}
_e('This page URL for redirect_to and URL contruction', 'ym');
?>
		</ul>
		
		<table class="form-table">
			<?php 
$ym_formgen->render_form_table_textarea_row(__('Message to show to a Non Logged in User (all content)', 'ym'), 'all_content_not_logged_in', $ym_res->all_content_not_logged_in);
$ym_formgen->render_form_table_textarea_row(__('Message to show to a Non Logged in User (all bundles)', 'ym'), 'all_bundles_not_logged_in', $ym_res->all_bundles_not_logged_in);
$ym_formgen->render_form_table_textarea_row(__('Message to show to a Non Logged in User (featured content)', 'ym'), 'featured_content_not_logged_in', $ym_res->featured_content_not_logged_in);
//$ym_formgen->render_form_table_textarea_row(__('Message to show to a Non Logged in User (featured bundles)', 'ym'), 'featured_bundles_not_logged_in', $ym_res->featured_bundles_not_logged_in);
?>
		</table>
<?php 
echo ym_end_box();
echo '</div><div id="ym_templates">';
echo ym_start_box(__('Templates', 'ym'));
?>
		

		<table class="form-table">
			<?php 
$ym_formgen->render_form_table_textarea_row(__('Membership Pack Description Template', 'ym'), 'pack_string_template', $ym_res->pack_string_template, __('When the packs are shown to the user they are placed in a certain format (eg: Member - 5 USD per 3 Months), this allows you to change it using any or all of the following hooks: [account_type], [cost], [cost_units] (the cost without pence/cents so if the cost is 5.00 this shows 5 only), [currency], [duration], [duration_period]. If your membership packs are a recurring payment and you have limited the number then you can use [num_cycles] below to indicate the number of payments. If you would like to use a Paypal trial then indicate this in the string using [trial_cost] or [trial_cost_units] (no pence/cents), [trial_duration], [trial_duration_period] [description]. Encapsulate any trial specific parts of the string in [if_trial_on][/if_trial_on] and for those that arent using a trial it\'s contents will be removed', 'ym'));
?>
		</table>			
		
<?php 
echo ym_end_box();
echo '</div>
</div>';
?>
		
if (isset($_POST['settings_update']) && !empty($_POST['settings_update'])) {
    $ym_sys->update_from_post();
    // strip spaces just in case
    $ym_sys->register_https_pages = str_replace(' ', '', $ym_sys->register_https_pages);
    update_option('ym_sys', $ym_sys);
    ym_display_message(__('System Updated', 'ym'));
    update_option('users_can_register', ym_post('wp_users_can_register'));
    echo '<meta http-equiv="refresh" content="5;' . YM_ADMIN_URL . '&ym_page=ym-advanced-registration' . '" />';
    return;
}
$wp_users_can_register = get_option('users_can_register');
echo '
<form method="post">
<div class="wrap" id="poststuff">
';
echo ym_start_box(__('Registration Settings', 'ym'));
echo '<table class="form-table">';
$ym_formgen->render_form_table_radio_row(__('Enable WordPress Registration', 'ym'), 'wp_users_can_register', $wp_users_can_register, __('If you are using Registration Flows only, you can Turn this off. It is a Duplicate of the Option found under Settings -> Generate (Membership/Anyone Can Register', 'ym'));
$ym_formgen->render_form_table_url_row(__('Block wp-Login.php?action=register', 'ym'), 'block_wp_login_action_register', $ym_sys->block_wp_login_action_register, __('If Using Registration Flows Only, you can redirect requests for wp-login.php?action=register to this URL', 'ym'));
$ym_formgen->render_form_table_radio_row(__('Enable Modified Registration', 'ym'), 'modified_registration', (int) $ym_sys->modified_registration, __('Adds an extra step to the registration process', 'ym'));
$ym_formgen->render_form_table_radio_row(__('Disable custom registration fields?', 'ym'), 'hide_custom_fields', (int) $ym_sys->hide_custom_fields, __('Choosing Yes will hide custom registration fields from a new Member. But will still show them in their profile', 'ym'));
$ym_formgen->render_form_table_text_row(__('What to show next to required custom fields?', 'ym'), 'required_custom_field_symbol', $ym_sys->required_custom_field_symbol, __('Most commonly "* Required"', 'ym'));
?>
	</table>
	
	<p class="submit" style="text-align: right;">
		<input type="submit" class="button-primary" name="settings_update" value="<?php 
_e('Save Settings', 'ym');
?>
 &raquo;" />
	</p>
    echo '<tr>';
    echo '<td>(' . $purchase->user_id . ') ' . $purchase->display_name . '</td>';
    echo '<td>(' . $purchase->pack_id . ') ' . $purchase->name . '</td>';
    $expires = $purchase->purchaseexpire * 86400 + $purchase->purchasetime;
    echo '<td>' . ($purchase->purchaseexpire ? date(YM_DATE, $expires) : __('No Expire', 'ym')) . '</td>';
    echo '<td>' . date(YM_DATE, $purchase->purchasetime) . '</td>';
    echo '<td>' . $purchase->payment_method . '</td>';
    echo '<td><form action="" method="post">
<input type="hidden" name="delete_bundle_purchase" value="' . $purchase->purchase_id . '" />
<input type="image" src="' . YM_PLUGIN_DIR_URL . '/images/cross.png" alt="Delete" class="deletelink" />
</form></td>';
    echo '</tr>';
}
echo '</table>';
echo ym_end_box();
echo ym_start_box(__('Bundles Purchased Count', 'ym'));
echo '<table style="width: 100%;" class="form-table widefat">
	<tr>
		<th>' . __('(ID) Name', 'ym') . '</th>
		<th>' . __('Cost', 'ym') . '</th>
		<th>' . __('Count', 'ym') . '</th>
	</tr>';
foreach ($bundles as $bundle) {
    $count = ym_bundle_purchased_count($bundle->id);
    echo '<tr>';
    echo '<td>(' . $bundle->id . ') ' . $bundle->name . '</td>';
    echo '<td>' . number_format($bundle->cost, 2) . ' ' . ym_get_currency() . '</td>';
    echo '<td>' . $count . '</td>';
    echo '</tr>';
}
echo '</table>';
        echo '<tr>
			<td>' . $transaction->user_id . '</td>
			<td>' . $profile . '</td>
			<td>' . $transaction->user_email . '</td>			
			<td>' . '(' . $post_id . ') ' . $title . '</td>
			<td>' . date(YM_DATE, $transaction->unixtime) . '</td>
		</tr>';
    }
    echo '</tbody>
	<tfoot>' . $form . '</tfoot>
	</table>';
} else {
    echo __('<em>There are no Purchases logged.</em>', 'ym');
}
echo ym_end_box();
echo ym_start_box(__('Bundles Purchases', 'ym'));
echo '<p>' . __('Once again this section shows a log of all the Bundles that have been purchased and by whom. Use the Content Management menu above to get more data on Bundles sold.', 'ym') . '</p>';
if ($transactions = ym_get_all_logs(YM_PPP_PACK_PURCHASED, $user_id, $limit, $start, $order_by, $deleted)) {
    $form = '<tr><td colspan="5" style="text-align: center;"><form action="" method="post">
<input type="hidden" name="start" value="' . $start . '" />';
    if ($start) {
        $form .= '<input type="submit" name="back" value="' . __('Back a Page', 'ym') . '" style="float: left;" />';
    }
    $count = count($transactions);
    if ($count == $limit) {
        $form .= '<input type="submit" name="next" value="' . __('Next Page', 'ym') . '" style="float: right;"  />';
    }
    $page = $start;
    if ($page == 0) {
        $page = 1;
    } else {
			</td></tr>
			<tr><td></td><td>To make a secured Distribution, you need to Select A Origin Access Identity(OAI)</td></tr>
			<tr><td><label for="oai">Origin Access Identity:</label></td><td id="oais">Waiting....</td></tr>
			<tr><td><label for="origin">Amazon S3 Bucket to deploy:</label></td><td id="origin">Waiting...</td></tr>
			</table>
			
			<p class="submit">
				<input type="submit" value="Create Distribution(s)" />
			</p>
			
		</fieldset>
	</form>
</div>
';
echo ym_end_box();
echo ym_start_box('OAI - Origin Access Identity');
echo '
		<form action="" method="post">
			<fieldset>
				<input type="hidden" name="cloudfronttask" value="deleteoai" />
				
				<label for="deleteoai">Delete Origin Access Identity:</label> <div id="deleteoais">Waiting....</div>
				
				<p class="submit">
					<input type="submit" value="Delete OAI" />
				</p>

			</fieldset>
		</form>
		';
echo ym_end_box();
function ym_download_list()
{
    get_currentuserinfo();
    global $ym_dl_db, $wpdb, $date_format, $current_user, $ym_upload_root;
    if (!is_dir($ym_upload_root)) {
        if (@mkdir($ym_upload_root, 0664)) {
            ym_display_message(__('The uploads directory did not exist so it was created and the permissions set to 664. Please make sure to update these permissions if you are not happy with them.'));
        } else {
            ym_display_message(__('The uploads directory does not exist and it could not be created. Please make sure that "' . $ym_upload_root . '" is present and writeable by PHP before adding any downloads.', 'ym'), 'error');
        }
    }
    $header_style = 'border-bottom: 1px solid silver; font-weight: bold;';
    $downloadurl = get_option('ym_dl_url');
    $downloadtype = get_option('ym_dl_type');
    $sort = ym_request('sort', "title");
    $sql = 'SELECT *
			FROM ' . $ym_dl_db . ' 
			ORDER BY ' . $sort;
    $download = $wpdb->get_results($sql);
    echo '<p>' . __('Downloads can be associated with pages and posts. When associated, they take on the page or post permissions including post purchased. Non associated downloads are accessible by all.', 'ym') . '</p>';
    echo ym_start_box('All Downloads');
    if (!is_writeable($ym_upload_root)) {
        ym_display_message(__('The uploads directory is not writeable by PHP and therefore anything uploaded using this tool will fail. Please set the permissions and then refresh this page to see if you have been successful.', 'ym'), 'error');
    }
    echo '			<table style="width: 100%;" cellspacing="0" class="ym_table">
						<tr>
							<th><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=id">' . __('ID', "ym") . '</a></td>
							<th><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=title">' . __('Title', "ym") . '</a></td>
							<th><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=filename">' . __('File', "ym") . '</a></td>
							<th style="width: 150px; text-align: center;">' . __('Limited Access', "ym") . '</td>
							<th style="width: 140px; text-align: center;">' . __('File Exists?', "ym") . '</td>
							<th style="width: 200px;"><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=postDate">' . __('Posted', "ym") . '</a></td>
							<th style="width: 130px;">' . __('Action', "ym") . '</td>
						</tr>';
    if ($download) {
        foreach ($download as $d) {
            $date = date($date_format, strtotime($d->postDate));
            $path = get_option('siteurl') . "/wp-content/uploads/";
            $file = str_replace($path, "", $d->filename);
            $links = explode("/", $file);
            $file = end($links);
            $user = get_userdata($d->user);
            $abs_file = ym_get_abs_file($d->filename);
            $edit_link = YM_ADMIN_URL . '&ym_page=ym-content-downloads&action=edit&id=' . $d->id . '&sort=' . $sort;
            $delete_link = YM_ADMIN_URL . '&ym_page=ym-content-downloads&action=delete&id=' . $d->id . '&sort=' . $sort;
            echo '	<tr>
						<td>' . $d->id . '</td>
						<td>' . $d->title . '</td>
						<td>' . $file . '</td>
						<td style="text-align:center; font-weight: bold;">
							' . ($d->members ? __('<span style="color: green;">Yes</span>', 'ym') : __('<span style="color: red;">No</span>', 'ym')) . '
						</td>
						<td style="text-align:center; font-weight: bold;">
							' . (file_exists($abs_file) ? __('<span style="color: green;">Yes</span>', 'ym') : __('<span style="color: red;">No</span>', 'ym')) . '
						</td>
						<td>' . $date . ' by ' . $current_user->user_login . '</td>
						<td style="line-height: 2em;">
							<a class="button" href="' . $edit_link . '">' . __('Edit', 'ym') . '</a>
							<a class="button" href="' . $delete_link . '">' . __('Delete', 'ym') . '</a>
						</td>
					</tr>';
        }
    } else {
        echo '	<tr>
					<td colspan="6">' . __('No downloads have been added yet.', "ym") . '</td>
				</tr>';
    }
    echo '			</table>';
    echo '	<p class="submit">
				<form action=""	method="post" id="ym_dl_add" name="add_download">
					<input type="hidden" name="action" value="add" />
					<input type="submit" class="button" name="" value="' . __('Add New Download', "ym") . '" />
				</form>
			</p>';
    echo ym_end_box();
}
<?php

global $wpdb;
echo '	<div class="wrap" id="poststuff">';
ym_check_for_gift_sub();
echo __('<p>Management of content purchased outside of a package subscription</p>', 'ym');
echo ym_start_box(__('Individual Purchases Made', 'ym'));
ym_render_all_posts_purchased(true);
echo ym_end_box();
echo ym_start_box(__('Content Purchased Count', 'ym'));
ym_render_posts_purchased(false);
echo ym_end_box();
echo ym_start_box(__('Gift a post/page', 'ym'));
ym_render_ppp_management();
echo ym_end_box();
echo '</div>';
    }
    echo '	<div class="ym_setting_list_item">
			<label>
				<input type="checkbox" class="checkbox" name="default_account_types[]" value="' . $type . '" ' . $checked . ' /> ' . __($type) . '
			</label>
		</div>';
}
echo ym_end_box();
echo ym_start_box(__('Additional Options', 'ym'));
echo '<table class="form-table">';
echo $ym_formgen->render_form_table_radio_row(__('Enable individual purchase by default?', 'ym'), 'default_ppp', $ym_sys->default_ppp);
echo $ym_formgen->render_form_table_text_row(__('Individual purchase cost default?', 'ym'), 'default_ppp_cost', $ym_sys->default_ppp_cost);
echo $ym_formgen->render_combo_from_array_row(__('Enable Drip Feeding by', 'ym'), 'post_delay_start', array('user_reg' => 'User Registration Date', 'pack_join' => 'Package Join Date'), $ym_sys->post_delay_start);
echo '</table>';
echo ym_end_box();
echo ym_start_box(__('Metered Access', 'ym'));
echo __('<strong>Warning Metered Access can be used to circumvent protection to gain free access if enabled</strong>', 'ym');
echo '<table class="form-table">';
$checked = '';
if ($ym_sys->enable_metered) {
    $checked = 'checked="checked"';
}
echo '	<div class="ym_setting_list_item">
			<label>
				<input type="hidden" name="enable_metered" value="0" />
				<input type="checkbox" class="checkbox" name="enable_metered" value="1" ' . $checked . ' /> ' . __('Enable Metered Access', 'ym') . '
			</label>
		</div>';
echo $ym_formgen->render_form_table_text_row(__('Number of pages viewable?', 'ym'), 'metered_posts', $ym_sys->metered_posts);
echo '<table><td>' . __('Duration:', 'ym') . '
				<input class="ym_input" style="width: 50px; font-family:\'Lucida Grande\',Verdana; font-size: 11px; text-align: right;" name="metered_duration" value="' . $ym_sys->metered_duration . '">
            break;
        }
    }
    $disabled = $field['name'] == 'birthdate' || $field['name'] == 'country' ? 'disabled="disabled"' : '';
    $ro = $field['name'] == 'birthdate' || $field['name'] == 'country' ? 'readonly="readonly"' : '';
    $disabled = isset($field['builtin']) && $field['builtin'] ? 'disabled="disabled"' : '';
    $req_disabled = $disabled;
    $ro = isset($field['builtin']) && $field['builtin'] ? 'readonly="readonly"' : '';
    // build in corrects
    $corrects_ignores = array('first_name', 'last_name', 'ym_password', 'birthdate', 'coupon', 'country', 'user_url', 'user_description');
    if (isset($field['builtin']) && $field['builtin'] && in_array($field['name'], $corrects_ignores)) {
        $req_disabled = FALSE;
    }
    echo '<div class="wrap" id="poststuff">';
    echo '<div id="edit_form">';
    echo ym_start_box(__('Edit Custom Field', 'ym'));
    ?>

 <form action="" method="post">

 <p><label><?php 
    _e('Name:', 'ym');
    ?>
<br />
<?php 
    if (isset($field['builtin']) && $field['builtin']) {
        echo '<input type="hidden" class="ym_long_input" name="name" value="' . $field['name'] . '" ' . $ro . ' />' . $field['name'];
        echo '<input type="hidden" name="type" value="' . $field['type'] . '" />';
    } else {
        echo '<input type="text" class="ym_long_input" name="name" value="' . $field['name'] . '" ' . $ro . ' />';
        echo '<br />';
$ym_formgen->render_form_table_radio_row(__('Enable Post Purchase Failed Receipt', 'ym'), 'payment_gateway_enable_post_failed', $ym_res->payment_gateway_enable_post_failed);
$ym_formgen->render_form_table_text_row(__('Subject for Post Purchase Failed', 'ym'), 'payment_gateway_subject_post_failed', $ym_res->payment_gateway_subject_post_failed);
$ym_formgen->render_form_table_wp_editor_row(__('Post Purchase Failed', 'ym'), 'payment_gateway_message_post_failed', $ym_res->payment_gateway_message_post_failed, __('Sent to User on Post Purchase Failed', 'ym'));
echo '</table>';
echo ym_end_box();
echo ym_start_box(__('Bundle Purchase Receipt', 'ym'));
echo '<table class="form-table">';
$ym_formgen->render_form_table_radio_row(__('Enable Bundle Purchase Success Receipt', 'ym'), 'payment_gateway_enable_ppack_success', $ym_res->payment_gateway_enable_ppack_success);
$ym_formgen->render_form_table_text_row(__('Subject for Bundle Purchase Success', 'ym'), 'payment_gateway_subject_ppack_success', $ym_res->payment_gateway_subject_ppack_success);
$ym_formgen->render_form_table_wp_editor_row(__('Bundle Purchase Success', 'ym'), 'payment_gateway_message_ppack_success', $ym_res->payment_gateway_message_ppack_success, __('Sent to User on Successful Bundle Purchase', 'ym'));
$ym_formgen->render_form_table_radio_row(__('Enable Bundle Purchase Failed Receipt', 'ym'), 'payment_gateway_enable_ppack_failed', $ym_res->payment_gateway_enable_ppack_failed);
$ym_formgen->render_form_table_text_row(__('Subject for Bundle Purchase Failed', 'ym'), 'payment_gateway_subject_ppack_failed', $ym_res->payment_gateway_subject_ppack_failed);
$ym_formgen->render_form_table_wp_editor_row(__('Bundle Purchase Failed', 'ym'), 'payment_gateway_message_ppack_failed', $ym_res->payment_gateway_message_ppack_failed, __('Sent to User on Bundle Purchase Failed', 'ym'));
echo '</table>';
echo ym_end_box();
echo ym_start_box(__('Subscription Purchase Receipt', 'ym'));
echo '<table class="form-table">';
$ym_formgen->render_form_table_radio_row(__('Enable Subscription Purchase Success Receipt', 'ym'), 'payment_gateway_enable_subscription_success', $ym_res->payment_gateway_enable_subscription_success);
$ym_formgen->render_form_table_text_row(__('Subject for Subscription Purchase Success', 'ym'), 'payment_gateway_subject_subscription_success', $ym_res->payment_gateway_subject_subscription_success);
$ym_formgen->render_form_table_wp_editor_row(__('Subscription Purchase Success', 'ym'), 'payment_gateway_message_subscription_success', $ym_res->payment_gateway_message_subscription_success, __('Sent to User on Successful Bundle Purchase', 'ym'));
$ym_formgen->render_form_table_radio_row(__('Enable Subscription Purchase Failed Receipt', 'ym'), 'payment_gateway_enable_subscription_failed', $ym_res->payment_gateway_enable_subscription_failed);
$ym_formgen->render_form_table_text_row(__('Subject for Subscription Purchase Failed', 'ym'), 'payment_gateway_subject_subscription_failed', $ym_res->payment_gateway_subject_subscription_failed);
$ym_formgen->render_form_table_wp_editor_row(__('Subscription Purchase Failed', 'ym'), 'payment_gateway_message_subscription_failed', $ym_res->payment_gateway_message_subscription_failed, __('Sent to User on Bundle Purchase Failed', 'ym'));
echo '</table>';
echo ym_end_box();
echo '</div>';
do_action('ym-advanced-payment_gateway_email_tab_content');
echo '<div id="ym_payment_gateway_copy_to">';
echo '<p>' . __('When an Payment Gateway Receipt Email is sent you can copy the email to another (or more) email address(es)', 'ym') . '</p>';
echo '<p>' . __('If an address is specied and the relevant email is disabled, the CC/BCC will still execute', 'ym') . '</p>';
echo '<table>';
<?php

/*
* $Id: ym-logs-status_updates.php 2166 2012-05-25 14:16:20Z bcarlyon $
* $Revision: 2166 $
* $Date: 2012-05-25 15:16:20 +0100 (Fri, 25 May 2012) $
*/
echo '<div class="wrap" id="poststuff">';
echo ym_start_box(__('Status Updates', 'ym'));
echo '<p>' . __('This simply means when a user status/account type has been updated. For instance an account activated or expired.', 'ym') . '</p>';
$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 ($transactions = ym_get_all_logs(YM_USER_STATUS_UPDATE, $user_id, $limit, $start, $order_by, $deleted)) {
    $form = '<tr><td colspan="5" style="text-align: center;"><form action="" method="post">
<input type="hidden" name="start" value="' . $start . '" />';
    if ($start) {
        $form .= '<input type="submit" name="back" value="' . __('Back a Page', 'ym') . '" style="float: left;" />';
    }
Beispiel #19
0
<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') {
            echo '<p>' . __('If you don\'t have a valid copy then please visit <a href=\'http://www.yourmembers.co.uk\'>http://www.YourMembers.co.uk</a> to purchase one.', 'ym') . '</p>';
        }
        echo '
	</div>';
        echo ym_start_box(YM_ADMIN_NAME . ' Activation', 'ym');
        echo '
		<form action="" method="post">
			<fieldset>
				<table class="form-table">
					<tr>
						<th><label for="registration_email">' . __('Email/Activation Code', 'ym') . '</label></th>
						<td><input type="text" name="registration_email" id="registration_email" style="width: 300px;" /></td>
					</tr><tr>
						<td></td><td>
							<p class="submit" style="text-align: right;">
								<input type="submit" name="activate_plugin" value="' . __('Activate', 'ym') . '" class="button-primary" />
							</p>
						</td>
					</tr>
				</table>
Beispiel #20
0
function ymfire_admin_page()
{
    global $wpdb, $firetypes, $saletypes, $ym_formgen;
    $firesale = ym_request('firesale');
    $months = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
    echo '<div class="wrap" id="poststuff">';
    $fire_id = ym_request('fire_id');
    $tier_id = ym_request('tier_id');
    if ($firesale == 'toggle') {
        $firesale = '';
        if ($fire_id) {
            $sql = 'SELECT fire_enable FROM ' . $wpdb->ym_app_models . ' WHERE fire_id = ' . $fire_id;
            $enabled = $wpdb->get_var($sql);
            $enabled = $enabled ? 0 : 1;
            $sql = 'UPDATE ' . $wpdb->ym_app_models . ' SET fire_enable = ' . $enabled . ' WHERE fire_id = ' . $fire_id;
            $wpdb->query($sql);
        }
    } else {
        if ($firesale == 'delete') {
            $firesale = '';
            if ($fire_id) {
                $wpdb->query('DELETE FROM ' . $wpdb->ym_app_models . ' WHERE fire_id = ' . $fire_id);
                $wpdb->query('DELETE FROM ' . $wpdb->ym_app_models_tiers . ' WHERE fire_id = ' . $fire_id);
            }
            if ($tier_id) {
                $wpdb->query('DELETE FROM ' . $wpdb->ym_app_models_tiers . ' WHERE fire_tier_id = ' . $tier_id);
            }
        } else {
            if ($firesale == 'enable') {
                // enabling a tier
                $sql = 'SELECT * FROM ' . $wpdb->ym_app_models_tiers . ' WHERE fire_tier_id = ' . $tier_id;
                $thetier = $wpdb->get_results($sql);
                $thetier = $thetier[0];
                $fire_id = $thetier->fire_id;
                $tier_order = $thetier->fire_order;
                // reoder (order by)
                $tiers = array();
                foreach (ym_firesale_get_all_tiers($fire_id) as $tier) {
                    $tiers[$tier->fire_order] = $tier;
                }
                unset($tiers[$tier_order]);
                array_unshift($tiers, $thetier);
                foreach ($tiers as $order => $tier) {
                    $sql = 'UPDATE ' . $wpdb->ym_app_models_tiers . ' SET fire_order = ' . $order . ' WHERE fire_tier_id = ' . $tier->fire_tier_id;
                    $wpdb->query($sql);
                }
                echo '<p>Tier Order was updated, if the Pricing Model is not active, it has not been activated yet</p>';
                $firesale = '';
            }
        }
    }
    if ($firesale == 'newtier') {
        $fire_id = ym_post('ym_firesale_add_post_tiers_fire_id');
        $fire_id = str_replace('firesale_', '', $fire_id);
        // put to end
        $sql = 'SELECT fire_order FROM ' . $wpdb->ym_app_models_tiers . ' WHERE fire_id = ' . $fire_id . ' ORDER BY fire_order DESC LIMIT 1';
        $order = $wpdb->get_var($sql);
        if ($order) {
            $order++;
        } else {
            $order = 0;
        }
        $fire_tiers = array();
        $limit_bys = ym_post('ym_new_firesale_limit_by');
        $limit_sales = ym_post('ym_new_firesale_limit_sales');
        $limit_dates = ym_post('ym_date_ym_new_firesale_limit_time');
        $limit_months = ym_post('ym_month_ym_new_firesale_limit_time');
        $limit_years = ym_post('ym_year_ym_new_firesale_limit_time');
        $limit_hours = ym_post('ym_hour_ym_new_firesale_limit_time');
        $limit_mins = ym_post('ym_min_ym_new_firesale_limit_time');
        $limit_by_hours = ym_post('ym_new_firesale_limit_hours');
        foreach (ym_post('ym_new_firesale_price') as $tier_price) {
            $fire_tiers[] = array('tier_price' => $tier_price, 'tier_limit_by' => $limit_bys[0], 'tier_limit_sales' => $limit_sales[0], 'tier_limit_time' => strtotime($limit_dates[0] . ' ' . $months[$limit_months[0]] . ' ' . $limit_years[0] . ' ' . $limit_hours[0] . ':' . $limit_mins[0]), 'tier_limit_hours' => $limit_by_hours[0]);
        }
        foreach ($fire_tiers as $tier) {
            $limit_var = 0;
            switch ($tier['tier_limit_by']) {
                case 2:
                    // hours
                    $limit_by = 2;
                    $limit_var = $tier['tier_limit_hours'];
                    break;
                case 1:
                    // time
                    $limit_by = 1;
                    $limit_var = $tier['tier_limit_time'];
                    break;
                case 0:
                default:
                    //sales
                    $limit_by = 0;
                    $limit_var = $tier['tier_limit_sales'];
            }
            $sql = 'INSERT INTO ' . $wpdb->ym_app_models_tiers . '(fire_id, fire_price, fire_limit_by, fire_limit_var, fire_order)
					VALUES (
						' . $fire_id . ',
						\'' . $tier['tier_price'] . '\',
						' . $limit_by . ',
						' . $limit_var . ',
						' . $order . '
					)';
            $wpdb->query($sql);
            echo ym_start_box('Pricing Models');
            if ($wpdb->insert_id) {
                echo '<div class="message" id="success"><p>Tier Added</p></div>';
            } else {
                echo '<div class="message" id="error"><p>Tier was not added</p></div>';
            }
            echo ym_end_box();
        }
        echo '<meta http-equiv="refresh" content="3;' . YM_PPP_ADMIN_URL . '" />';
    }
    if ($firesale == 'edit') {
        echo ym_start_box('Pricing Models');
        $tier_data = 'SELECT * FROM ' . $wpdb->ym_app_models_tiers . ' WHERE fire_tier_id = ' . $tier_id;
        $tier_data = $wpdb->get_results($tier_data);
        if ($tier_data[0]) {
            $tier_data = $tier_data[0];
            //editing a tier
            echo '<form action="" method="post">
					<fieldset>';
            echo '
<input type="hidden" name="firesale" value="edittier" />
<input type="hidden" name="tier_id" value="' . $tier_id . '"/>
';
            echo '<table>';
            $ym_formgen->render_form_table_text_row('Price', 'ym_new_firesale_price[]', $tier_data->fire_price, 'Price for this Tier');
            $ym_formgen->render_combo_from_array_row('Limit By', 'ym_new_firesale_limit_by[]', $saletypes, $tier_data->fire_limit_by, 'What kind of Tier');
            $ym_formgen->render_form_table_text_row('Limit By Sales', 'ym_new_firesale_limit_sales[]', !$tier_data->fire_limit_by ? $tier_data->fire_limit_var : '', 'Tier ends after this many sales of this Tier');
            $ym_formgen->render_form_table_datetime_picker_row('Limit By Time', 'ym_new_firesale_limit_time[]', $tier_data->fire_limit_by ? $tier_data->fire_limit_var : '', 'Tier ends at this date');
            $ym_formgen->render_form_table_text_row('Hours', 'ym_new_firesale_limit_hours[]', $tier_data->fire_limit_by == 2 ? $tier_data->fire_limit_var : '', 'Expire Tier this many hours after it starts');
            echo '<tr><td colspan="5" style="border-top: 1px solid grey;">&nbsp;</td></tr>';
            echo '</table>';
            echo '
				<p class="submit" style="text-align: right;">
					<input type="submit" value="' . __('Update Pricing Model Tier', 'ym') . ' &raquo;" />
				</p>';
            echo '</fieldset></form>';
        } else {
            echo '<p>Could not find that Tier</p>';
            $firesale = '';
        }
        echo ym_end_box();
    }
    if ($firesale == 'edittier') {
        $fire_tiers = array();
        $limit_bys = ym_post('ym_new_firesale_limit_by');
        $limit_sales = ym_post('ym_new_firesale_limit_sales');
        $limit_dates = ym_post('ym_date_ym_new_firesale_limit_time');
        $limit_months = ym_post('ym_month_ym_new_firesale_limit_time');
        $limit_years = ym_post('ym_year_ym_new_firesale_limit_time');
        $limit_hours = ym_post('ym_hour_ym_new_firesale_limit_time');
        $limit_mins = ym_post('ym_min_ym_new_firesale_limit_time');
        $limit_by_hours = ym_post('ym_new_firesale_limit_hours');
        foreach (ym_post('ym_new_firesale_price') as $tier_price) {
            $fire_tiers[] = array('tier_price' => $tier_price, 'tier_limit_by' => $limit_bys[0], 'tier_limit_sales' => $limit_sales[0], 'tier_limit_time' => strtotime($limit_dates[0] . ' ' . $months[$limit_months[0]] . ' ' . $limit_years[0] . ' ' . $limit_hours[0] . ':' . $limit_mins[0]), 'tier_limit_hours' => $limit_by_hours[0]);
        }
        foreach ($fire_tiers as $tier) {
            $limit_var = 0;
            switch ($tier['tier_limit_by']) {
                case 2:
                    // hours
                    $limit_by = 2;
                    $limit_var = $tier['tier_limit_hours'];
                    break;
                case 1:
                    // time
                    $limit_by = 1;
                    $limit_var = $tier['tier_limit_time'];
                    break;
                case 0:
                default:
                    //sales
                    $limit_by = 0;
                    $limit_var = $tier['tier_limit_sales'];
            }
            $data = array('fire_price' => $tier['tier_price'], 'fire_limit_by' => $limit_by, 'fire_limit_var' => $limit_var);
            $wpdb->update($wpdb->ym_app_models_tiers, $data, array('fire_tier_id' => $tier_id));
            echo ym_start_box('Pricing Models');
            if ($wpdb->rows_affected) {
                echo '<p>Tier Updated</p>';
            } else {
                echo '<p>Tier was not updated</p>';
            }
            echo ym_end_box();
        }
        echo '<meta http-equiv="refresh" content="3;' . YM_PPP_ADMIN_URL . '" />';
    }
    if (empty($firesale)) {
        echo '<div style="width: 43%; float: left;">';
        echo ym_start_box('Pricing Models');
        $firesales = ym_firesale_get_all();
        echo '<h2>All Pricing Models</h2>';
        echo '<p>Click the Link to enable/disable</p>';
        echo '<table style="width: 100%;">';
        echo '<tr><th>Pricing Model Name</th><th>Type</th><th>Tiers</th><th>Enabled</th><th>Edit</th><th>Delete</th></tr>';
        foreach ($firesales as $firesale) {
            if ($firesale->fire_id) {
                echo '<tr>';
                echo '<td>(' . $firesale->fire_id . ')' . $firesale->fire_name . '</td>';
                echo '<td style="text-align: center;">' . $firetypes[$firesale->fire_type] . '</td>';
                echo '<td style="text-align: center;"><a href="#showtiers" class="ym_showtiers" id="tiers_' . $firesale->fire_id . '">' . $firesale->tiers . '</a></td>';
                echo '<td style="text-align: center;"><a href="' . YM_PPP_ADMIN_URL . '&firesale=toggle&fire_id=' . $firesale->fire_id . '">' . ($firesale->fire_enable ? 'Yes' : 'No') . '</a></td>';
                //					echo '<td style="text-align: center;"><a href="admin.php?page=' . YM_ADMIN_DIR . 'ym-index.php&ym_page=ym-other&action=ym_app&firesale=edit&fire_id=' . $firesale->fire_id . '">E</a></td>';
                echo '<td style="text-align: center;"><a href="#addtier" class="ym_firesale_add_post_tier" id="firesale_' . $firesale->fire_id . '">Add Tier</a></td>';
                echo '<td style="text-align: center;"><a href="' . YM_PPP_ADMIN_URL . '&firesale=delete&fire_id=' . $firesale->fire_id . '">X</a></td>';
                echo '</tr>';
                foreach (ym_firesale_get_all_tiers($firesale->fire_id) as $tier) {
                    echo '<tr style="display: none;" class="tiers_' . $firesale->fire_id . '">';
                    echo '<td style="text-align: center;">ID: ' . $tier->fire_tier_id . ' Tier: ' . $tier->fire_order . '</td>';
                    echo '<td style="text-align: center;">' . $saletypes[$tier->fire_limit_by] . '(' . ($tier->fire_limit_by == 1 ? date('r', $tier->fire_limit_var) : $tier->fire_limit_var) . ')</td>';
                    echo '<td></td>';
                    //						echo '<td style="text-align: center;">' . ($tier->fire_tier_started ? 'Yes' : '<a href="admin.php?page=' . YM_ADMIN_DIR . 'ym-index.php&ym_page=ym-other&action=ym_app&firesale=enable&tier_id=' . $tier->fire_tier_id . '">No</a>') . '</td>';
                    echo '<td style="text-align: center;">' . ($tier->fire_tier_started ? 'Yes' : 'No') . '</td>';
                    echo '<td style="text-align: center;"><a href="' . YM_PPP_ADMIN_URL . '&firesale=edit&tier_id=' . $tier->fire_tier_id . '">E</a></td>';
                    echo '<td style="text-align: center;"><a href="' . YM_PPP_ADMIN_URL . '&firesale=delete&tier_id=' . $tier->fire_tier_id . '">X</a></td>';
                    echo '</tr>';
                }
            }
        }
        echo '</table>';
        echo ym_end_box();
        echo '</div>';
        echo '<div style="width: 55%; float: right;">';
        echo ym_start_box('New Pricing Model');
        echo '
<form action="" method="post">
	<fieldset>
		<legend>Create a new Pricing Model</legend>
		<input type="hidden" name="firesale" value="new" />
		<table class="form-table">
		';
        $ym_formgen->render_form_table_text_row('Pricing Model Name', 'ym_new_firesale_name', '', 'A handy name to Remember');
        $ym_formgen->render_combo_from_array_row('Pricing Model Type', 'ym_new_firesale_type', $firetypes, '', 'What type of Pricing Model');
        echo '
		</table>
		<p class="submit" style="text-align: right;">
			<input type="submit" value="' . __('Create Pricing Model', 'ym') . ' &raquo;" />
		</p>
	</fieldset>
</form>';
        echo ym_end_box();
        echo '</div>';
    } else {
        if ($firesale == 'new') {
            echo ym_start_box('Pricing Model');
            echo '<form action="" method="post">
				<fieldset>
					<input type="hidden" name="firesale" value="create" />
			';
            $firesale = array('fire_name' => ym_post('ym_new_firesale_name') ? ym_post('ym_new_firesale_name') : 'pricing_model_' . date('dMY_His', time()), 'fire_type' => ym_post('ym_new_firesale_type'));
            echo '<p>Creating a new Pricing Model: <strong>' . $firesale['fire_name'] . '</strong> of Type: <strong>' . $firetypes[$firesale['fire_type']] . '</strong></p>';
            echo '<input type="hidden" name="ym_new_firesale_name" value="' . $firesale['fire_name'] . '" />';
            echo '<input type="hidden" name="ym_new_firesale_type" value="' . $firesale['fire_type'] . '" />';
            echo '<table class="form-table">';
            switch ($firesale['fire_type']) {
                case 2:
                    // pppp pack
                    $packs = array();
                    foreach (ym_get_ppp_packs() as $pack) {
                        $packs[$pack->id] = $pack->name . ' (' . number_format($pack->cost, 2) . ')';
                    }
                    $ym_formgen->render_combo_from_array_row('Post Pack', 'ym_new_firesale_target_id', $packs, '', 'Which post pack to apply this Model to?');
                    $ym_formgen->render_form_table_radio_row('End Sale', 'ym_end_firesale_ppp', 0, 'Take Post Pack off Sale after Last Tier');
                    break;
                case 1:
                    // subsc
                    $packs = array();
                    foreach (ym_get_packs() as $pack) {
                        $packs[$pack['id']] = $pack['account_type'] . ' (' . $pack['duration'] . ' ' . $pack['duration_type'] . ') ' . $pack['cost'];
                    }
                    $ym_formgen->render_combo_from_array_row('Pack', 'ym_new_firesale_target_id', $packs, '', 'Which pack to apply this Model to?');
                    break;
                case 0:
                default:
                    // get all ppp's
                    $posts = array();
                    foreach (ym_get_all_ppp_posts() as $post) {
                        $posts[$post->ID] = $post->post_title;
                    }
                    $ym_formgen->render_combo_from_array_row('Post', 'ym_new_firesale_target_id', $posts, '', 'Which post to apply this Model to?');
                    $ym_formgen->render_form_table_radio_row('End Sale', 'ym_end_firesale_ppp', 0, 'Take Post off Sale after Last Tier');
                    break;
            }
            echo '<tr><td colspan="2"><p>Tiers</p></td></tr>';
            echo '<tr><td><a href="#addtier" id="ym_firesale_addtier">Click to Add Tier</a></td></tr>';
            echo '</table>';
            echo '<p class="submit" style="text-align: right;">
				<input type="submit" value="' . __('Create Pricing Model', 'ym') . ' &raquo;" />
			</p>';
            echo '</fieldset></form>';
            echo ym_end_box();
        } else {
            if ($firesale == 'create') {
                echo ym_start_box('Pricing Models');
                $firesale = array('fire_name' => ym_post('ym_new_firesale_name') ? ym_post('ym_new_firesale_name') : 'pricing_model_' . date('dMY_His', time()), 'fire_type' => ym_post('ym_new_firesale_type'), 'fire_type_id' => ym_post('ym_new_firesale_target_id'), 'fire_end_action' => ym_post('ym_end_firesale_ppp') ? ym_post('ym_end_firesale_ppp') : 0);
                // get tiers
                $fire_tiers = array();
                $limit_bys = ym_post('ym_new_firesale_limit_by');
                $limit_sales = ym_post('ym_new_firesale_limit_sales');
                $limit_dates = ym_post('ym_date_ym_new_firesale_limit_time');
                $limit_months = ym_post('ym_month_ym_new_firesale_limit_time');
                $limit_years = ym_post('ym_year_ym_new_firesale_limit_time');
                $limit_hours = ym_post('ym_hour_ym_new_firesale_limit_time');
                $limit_mins = ym_post('ym_min_ym_new_firesale_limit_time');
                $limit_by_hours = ym_post('ym_new_firesale_limit_hours');
                foreach (ym_post('ym_new_firesale_price') as $key => $tier_price) {
                    $fire_tiers[] = array('tier_price' => $tier_price, 'tier_limit_by' => $limit_bys[$key], 'tier_limit_sales' => $limit_sales[$key], 'tier_limit_time' => strtotime($limit_dates[$key] . ' ' . $months[$limit_months[$key]] . ' ' . $limit_years[$key] . ' ' . $limit_hours[$key] . ':' . $limit_mins[$key]), 'tier_limit_hours' => $limit_by_hours[$key]);
                }
                // DATABASE!
                $sql = 'INSERT INTO ' . $wpdb->ym_app_models . '(fire_name, fire_type, fire_type_id, fire_end_option) VALUES (\'' . $firesale['fire_name'] . '\', \'' . $firesale['fire_type'] . '\', \'' . $firesale['fire_type_id'] . '\', \'' . $firesale['fire_end_action'] . '\')';
                $wpdb->query($sql);
                if (FALSE !== ($firesale_id = $wpdb->insert_id)) {
                    echo '<p>Added the Pricing Models ' . $firesale['fire_name'];
                    // tiers
                    foreach ($fire_tiers as $key => $tier) {
                        $limit_var = 0;
                        switch ($tier['tier_limit_by']) {
                            case 2:
                                // hours
                                $limit_by = 2;
                                $limit_var = $tier['tier_limit_hours'];
                                break;
                            case 1:
                                // time
                                $limit_by = 1;
                                $limit_var = $tier['tier_limit_time'];
                                break;
                            case 0:
                            default:
                                //sales
                                $limit_by = 0;
                                $limit_var = $tier['tier_limit_sales'];
                        }
                        $sql = 'INSERT INTO ' . $wpdb->ym_app_models_tiers . '(fire_id, fire_price, fire_limit_by, fire_limit_var, fire_order)
						VALUES (
							' . $firesale_id . ',
							\'' . $tier['tier_price'] . '\',
							' . $limit_by . ',
							' . $limit_var . ',
							' . $key . '
						)';
                        $wpdb->query($sql);
                        if ($wpdb->insert_id) {
                            echo '<br />Tier Added';
                        }
                    }
                    echo '</p>';
                    echo '<meta http-equiv="refresh" content="3;' . YM_PPP_ADMIN_URL . '" />';
                } else {
                    echo '<p>There was a problem adding the Pricing Model: ' . $firesale['fire_name'] . '</p>';
                }
                echo ym_end_box();
            } else {
                // bad firesale function
            }
        }
    }
    echo '
		<div id="ym_firesale_add_post_tiers_form" style="display: none; clear: both;">';
    echo ym_start_box('Adding a Tier');
    echo '
		<form method="post" action="">
			<fieldset>
				<legend>Add a Tier to the selected Pricing Model</legend>
				<input type="hidden" name="ym_firesale_add_post_tiers_fire_id" id="ym_firesale_add_post_tiers_fire_id" />
				<input type="hidden" name="firesale" value="newtier" />
				
				<table id="ym_firesale_add_post_tiers">
				</table>
				
				<p class="submit" style="text-align: right;">
					<input type="submit" value="' . __('Add New Pricing Model Tier', 'ym') . ' &raquo;" />
				</p>
			</fieldset>
		</form>
		';
    echo ym_end_box();
    echo '
		</div>';
    echo '</div>';
    echo '<table id="ym_firesale_tier_source">';
    ym_fire_tier_form();
    echo '</table>';
}
Beispiel #21
0
    echo '<label for="group_log_id">' . __('Select a Log Group ID', 'ym');
    echo ' <select name="group_log_id" id="group_log_id">';
    foreach ($wpdb->get_results($query) as $row) {
        echo '<option value="' . $row->transaction_id . '" ';
        if ($row->transaction_id == $transaction_id) {
            echo 'selected="selected" ';
        }
        echo '>' . $row->transaction_id . '</option>';
    }
    echo '</select></label>';
    echo '<input type="submit" value="' . __('Get Log Group', 'ym') . '" />';
    echo '</form>';
}
if ($_POST) {
    echo ym_end_box();
    echo ym_start_box(__('Logs', 'ym'));
}
if ($transaction_id) {
    echo '<p>' . sprintf(__('Transaction Group: %s', 'ym'), $transaction_id);
    $query = 'SELECT * FROM ' . $wpdb->prefix . 'ym_transaction WHERE transaction_id = ' . $transaction_id;
    echo '<table class="form-table">
	<tr><th style="width: 75px;">ID</th><th>User</th><th>Action</th><th>Data</th><th>Date</th></tr>';
    foreach ($wpdb->get_results($query) as $transaction) {
        echo '<tr>';
        echo '<td>' . $transaction->id . '</td>';
        echo '<td nowrap="nowrap">(' . $transaction->user_id . ') ';
        $user = get_user_by('id', $transaction->user_id);
        echo $user->user_login;
        echo '</td>';
        $log_type = ym_get_transaction_action($transaction->action_id);
        echo '<td>' . $log_type->name . '</td>';
Beispiel #22
0
<?php

/*
* $Id: yss_content.php 1842 2012-02-01 14:26:14Z BarryCarlyon $
* $Revision: 1842 $
* $Date: 2012-02-01 14:26:14 +0000 (Wed, 01 Feb 2012) $
*/
$action = ym_request('task');
$date_format = get_option('date_format');
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 ym_membership_content_page($with_boxes = false, $with_snippets = TRUE, $with_expires = FALSE, $show = 'posts,bundles,premium')
{
    get_currentuserinfo();
    global $current_user, $wpdb, $ym_res;
    $snippet_length = 200;
    $max_loops = 30;
    $html = '';
    $membership_level = ym_get_user_package_type($current_user->ID);
    $posts = false;
    $show = explode(',', $show);
    if (in_array('posts', $show)) {
        if ($pp = ym_render_my_purchased_posts($current_user->ID, false, true, $with_expires, $with_snippets)) {
            if ($with_boxes) {
                $html .= ym_start_box(__('My Purchased Posts', 'ym'));
            }
            $html .= $pp;
            if ($with_boxes) {
                $html .= ym_end_box();
            }
        }
    }
    if (in_array('bundles', $show)) {
        // bundle
        if ($bundles = ym_render_my_purchased_bundles($current_user->ID, $with_expires, TRUE, $with_snippets)) {
            if ($with_boxes) {
                $html .= ym_start_box(__('My Purchased Bundles', 'ym'));
            }
            $html .= $bundles;
            if ($with_boxes) {
                $html .= ym_end_box();
            }
        }
    }
    if (in_array('premium', $show)) {
        $sql = 'SELECT DISTINCT(ID), post_title, post_date, post_content
				FROM
					' . $wpdb->posts . ' p
					JOIN ' . $wpdb->postmeta . ' pm ON (
						p.ID = pm.post_id
						AND p.post_status = "publish"
						AND pm.meta_key = "_ym_account_type"
						AND pm.meta_value LIKE "%' . $membership_level . '%"
						AND post_type = "post"
					)
				ORDER BY post_date DESC';
        $results = $wpdb->get_results($sql);
        $loops = 0;
        if ($members_pages = count($results)) {
            foreach ($results as $id => $obj) {
                if (!ym_user_has_access($obj->ID)) {
                    $membership_pages--;
                    continue;
                }
                $published = date(YM_DATEFORMAT, strtotime($obj->post_date));
                $full_content = apply_filters('the_content', $obj->post_content);
                $title = $obj->post_title;
                if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
                    $title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($title);
                    $full_content = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($full_content);
                }
                $row = '<tr>
				<td style="border-top: 1px solid silver;">
					<div style="margin-bottom: 5px;"><a href="' . get_permalink($obj->ID) . '">' . $title . '</a></div>
					';
                if ($with_snippets) {
                    $content = substr(strip_tags($full_content), 0, $snippet_length);
                    //$content = preg_replace("'\[/?\s?private\s?\]'i",'', $content);
                    $ending = strlen($full_content) > strip_tags($snippet_length) ? '...' : '';
                    $row .= '<div style="font-size: 10px; margin-bottom: 5px;">' . $content . $ending . '</div>';
                }
                $row .= '
				</td>
				<td style="vertical-align: top; border-top: 1px solid silver;">' . $published . '</td>
			</tr>';
                $posts .= $row;
                $loops++;
                if ($loops >= $max_loops) {
                    break;
                }
            }
        }
        $table_intro = 'Showing the most recent ' . $loops . ' posts of a total ' . $members_pages . ' available to you.';
        $html .= $ym_res->members_content_divider_html;
        if ($with_boxes) {
            $html .= ym_start_box(__('Premium Content', 'ym'));
        }
        $html .= '	<div class="premium_content_intro">' . __('Your membership level is:', "ym") . ' <strong>' . $membership_level . '</strong>. 	
				' . __('You have access to a total of', "ym") . ' ' . $members_pages . ' ' . __('premium', 'ym') . ' ' . ($members_pages == 1 ? __('post', 'ym') : __('posts', 'ym')) . ' 
			</div>';
        if ($members_pages > 0) {
            $html .= $table_intro;
            $html .= '<div style="padding-top: 10px; margin-bottom: 10px;">
				<table style="width: 100%" cellspacing="0" cellpadding="2">
				<tr>
					<th style="text-align: left;">Post Title</th>
					<th style="width: 160px; text-align: left;">Published</th>
				</tr>
					' . $posts . '
			</table></div>';
        }
        if ($with_boxes) {
            $html .= ym_end_box();
        }
    }
    return $html;
}
Beispiel #24
0
 function ym_email_message_content()
 {
     $invoice = new ym_invoice();
     echo '<div id="ym_payment_gateway_invoice">';
     echo ym_start_box(__('Invoice Gateway Emails', 'ym'));
     echo '<table class="form-table">';
     global $ym_formgen;
     $ym_formgen->render_form_table_text_row(__('Invoice Email Subject', 'ym'), 'invoice_email_subject', $invoice->invoice_email_subject, __('When sending a Invoice Email use this subject, supports [blogname]', 'ym'));
     $ym_formgen->render_form_table_wp_editor_row(__('Invoice Email Message', 'ym'), 'invoice_email_message', $invoice->invoice_email_message, __('Use this message, supports [user_name], [pack_name], [pack_cost] (includes Currency Code), [pay_days], [ym_user_custom], [ym_user_is], [ym_user_is_not], [ym_user_custom_is] and [ym_user_custom_is_not]', 'ym'));
     echo '</table>';
     echo ym_end_box();
     echo '</div>';
 }
<?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>';
		<p class="submit"><input type="submit" name="migrate" class="button-primary" value="' . __('Setup', 'ym') . '" style="float: right;"/>
	';
            if ($post_count == $limit) {
                echo '<a href="' . YM_ADMIN_URL . '&ym_page=ym-content-mass_content_setup&offset=' . ($offset + $limit) . '" class="button-secondary" style="float: left;">' . __('Next Page of Content', 'ym') . '</a>';
            }
            echo '</p>';
        } else {
            echo '<div style="color: gray; font-style: italic;">' . sprintf(__('There are no <strong>%s</strong> posts available to mass update.', 'ym'), $type) . '</div>';
        }
        echo ym_end_box();
        echo '</div>';
        $tbl_head = str_replace($type, 'YMHEREHERE', $tbl_head);
    }
}
echo '<div id="masspostsetup_category">';
echo ym_start_box('&nbsp;');
$categories = get_categories();
if (count($categories)) {
    echo '<div style="font-weight: bold; margin-top: 10px;">' . __('Please select one or more <b>Categories</b> to update, this will update all posts within that Category', 'ym') . '</div>';
    $tbl_head = str_replace('YMHEREHERE', 'category', $tbl_head);
    echo '
	<div id="tableDivCategorys" class="ym_migrate_table_div">
	<table id="tabletablecategorys" class="ym_migrate_table">
		<thead>' . $tbl_head . '</thead>
		<tbody>
		';
    foreach ($categories as $category) {
        echo '<tr>';
        echo '<td><input type="checkbox" class="categorys" id="category_' . $category->cat_ID . '" name="categorys[]" value="' . $category->cat_ID . '" /> ' . $category->category_nicename . '</td>';
        foreach ($ym_package_types->types as $type) {
            echo '<td>';