function PricerrTheme_withdrawals() { $id_icon = 'icon-options-general-withdr'; $ttl_of_stuff = 'PricerrTheme - ' . __('Withdrawal Requests', 'PricerrTheme'); global $wpdb; //------------------------------------------------------ echo '<div class="wrap">'; echo '<div class="icon32" id="' . $id_icon . '"><br/></div>'; echo '<h2 class="my_title_class_sitemile">' . $ttl_of_stuff . '</h2>'; //---------------------------------------- if (isset($_GET['den_id'])) { $tm = current_time('timestamp', 0); $ids = $_GET['den_id']; $s = "select * from " . $wpdb->prefix . "job_withdraw where id='{$ids}'"; $row = $wpdb->get_results($s); $row = $row[0]; if ($row->done == 0) { echo '<div class="saved_thing"><div class="padd10">' . __('Payment rejected!', 'PricerrTheme') . '</div></div>'; $ss = "update " . $wpdb->prefix . "job_withdraw set done='-1', rejected_on='{$tm}', rejected='1', datedone='{$tm}' where id='{$ids}'"; $wpdb->query($ss); $ucr = PricerrTheme_get_credits($row->uid); PricerrTheme_send_email_when_withdraw_rejected($row->uid, $row->methods, PricerrTheme_get_show_price($row->amount)); PricerrTheme_update_credits($row->uid, $ucr + $row->amount); } } if (isset($_GET['tid'])) { $tm = current_time('timestamp', 0); $ids = $_GET['tid']; $s = "select * from " . $wpdb->prefix . "job_withdraw where id='{$ids}'"; $row = $wpdb->get_results($s); $row = $row[0]; if ($row->done == 0) { echo '<div class="saved_thing"><div class="padd10">' . __('Payment completed!', 'PricerrTheme') . '</div></div>'; $ss = "update " . $wpdb->prefix . "job_withdraw set done='1', datedone='{$tm}' where id='{$ids}'"; $wpdb->query($ss); // or die(mysql_error()); PricerrTheme_send_email_when_withdraw_completed($row->uid, $row->methods, PricerrTheme_get_show_price($row->amount)); $reason = sprintf(__('Withdraw to %s - Details: %s', 'PricerrTheme'), $row->methods, $row->payeremail); PricerrTheme_add_history_log('0', $reason, $row->amount, $row->uid); } } //--------------------------------------- ?> <div id="usual2" class="usual"> <ul> <li><a href="#tabs1"><?php _e('Unresolved Requests', 'PricerrTheme'); ?> </a></li> <li><a href="#tabs2"><?php _e('Resolved Requests', 'PricerrTheme'); ?> </a></li> <li><a href="#tabs_rejected"><?php _e('Rejected Requests', 'PricerrTheme'); ?> </a></li> <li><a href="#tabs3"><?php _e('Search Unresolved', 'PricerrTheme'); ?> </a></li> <li><a href="#tabs4"><?php _e('Search Solved', 'PricerrTheme'); ?> </a></li> <li><a href="#tabs_search_rejected"><?php _e('Search Rejected', 'PricerrTheme'); ?> </a></li> </ul> <div id="tabs1"> <?php $s = "select * from " . $wpdb->prefix . "job_withdraw where done='0' order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width="12%" ><?php _e('Username', 'PricerrTheme'); ?> </th> <th><?php _e('Method', 'PricerrTheme'); ?> </th> <th width="20%"><?php _e('Details', 'PricerrTheme'); ?> </th> <th><?php _e('Date Requested', 'PricerrTheme'); ?> </th> <th ><?php _e('Amount', 'PricerrTheme'); ?> </th> <th width="25%"><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $row->methods . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . PricerrTheme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'PricerrTheme') . '</a>' . ' | ' . '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'PricerrTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'PricerrTheme') : __("Rejected", 'PricerrTheme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no unresolved withdrawal requests.', 'PricerrTheme'); ?> </div> <?php } ?> </div> <div id="tabs2"> <?php $s = "select * from " . $wpdb->prefix . "job_withdraw where done='1' order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th ><?php _e('Username', 'PricerrTheme'); ?> </th> <th><?php _e('Details', 'PricerrTheme'); ?> </th> <th><?php _e('Date Requested', 'PricerrTheme'); ?> </th> <th ><?php _e('Amount', 'PricerrTheme'); ?> </th> <th><?php _e('Date Released', 'PricerrTheme'); ?> </th> <th><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . PricerrTheme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->datedone == 0 ? "Not yet" : date('d-M-Y H:i:s', $row->datedone)) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'PricerrTheme') . '</a>' . ' | ' . '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'PricerrTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'PricerrTheme') : __("Rejected", 'PricerrTheme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no resolved withdrawal requests.', 'PricerrTheme'); ?> </div> <?php } ?> </div> <div id="tabs_rejected"> <?php $s = "select * from " . $wpdb->prefix . "job_withdraw where rejected='1' order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th ><?php _e('Username', 'PricerrTheme'); ?> </th> <th><?php _e('Details', 'PricerrTheme'); ?> </th> <th><?php _e('Date Requested', 'PricerrTheme'); ?> </th> <th ><?php _e('Amount', 'PricerrTheme'); ?> </th> <th><?php _e('Date Released', 'PricerrTheme'); ?> </th> <th><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . PricerrTheme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->datedone == 0 ? "Not yet" : date('d-M-Y H:i:s', $row->datedone)) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'PricerrTheme') . '</a>' . ' | ' . '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'PricerrTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'PricerrTheme') : __("Rejected", 'PricerrTheme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no rejected withdrawal requests.', 'PricerrTheme'); ?> </div> <?php } ?> </div> <div id="tabs3"> <form method="get" action="<?php bloginfo('siteurl'); ?> /wp-admin/admin.php"> <input type="hidden" value="withdraw-req" name="page" /> <input type="hidden" value="tabs3" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'PricerrTheme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user']; ?> " name="search_user" size="20" /> <input type="submit" name="PricerrTheme_save3" value="<?php _e('Search', 'PricerrTheme'); ?> "/></td> </tr> </table> </form> <?php if (isset($_GET['PricerrTheme_save3'])) { $search_user = trim($_GET['search_user']); $user = get_userdatabylogin($search_user); $uid = $user->ID; $s = "select * from " . $wpdb->prefix . "job_withdraw where done='0' AND uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width="12%" ><?php _e('Username', 'PricerrTheme'); ?> </th> <th><?php _e('Method', 'PricerrTheme'); ?> </th> <th width="20%"><?php _e('Details', 'PricerrTheme'); ?> </th> <th><?php _e('Date Requested', 'PricerrTheme'); ?> </th> <th ><?php _e('Amount', 'PricerrTheme'); ?> </th> <th width="25%"><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $row->methods . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . PricerrTheme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'PricerrTheme') . '</a>' . ' | ' . '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'PricerrTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'PricerrTheme') : __("Rejected", 'PricerrTheme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no results for your search.', 'PricerrTheme'); ?> </div> <?php } } ?> </div> <div id="tabs4"> <form method="get" action="<?php bloginfo('siteurl'); ?> /wp-admin/admin.php"> <input type="hidden" value="withdraw-req" name="page" /> <input type="hidden" value="tabs4" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'PricerrTheme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user4']; ?> " name="search_user4" size="20" /> <input type="submit" name="PricerrTheme_save4" value="<?php _e('Search', 'PricerrTheme'); ?> "/></td> </tr> </table> </form> <?php if (isset($_GET['PricerrTheme_save4'])) { $search_user = trim($_GET['search_user4']); $user = get_userdatabylogin($search_user); $uid = $user->ID; $s = "select * from " . $wpdb->prefix . "job_withdraw where done='1' AND uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width="12%" ><?php _e('Username', 'PricerrTheme'); ?> </th> <th><?php _e('Method', 'PricerrTheme'); ?> </th> <th width="20%"><?php _e('Details', 'PricerrTheme'); ?> </th> <th><?php _e('Date Requested', 'PricerrTheme'); ?> </th> <th ><?php _e('Amount', 'PricerrTheme'); ?> </th> <th width="25%"><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $row->methods . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . PricerrTheme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'PricerrTheme') . '</a>' . ' | ' . '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'PricerrTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'PricerrTheme') : __("Rejected", 'PricerrTheme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no results for your search.', 'PricerrTheme'); ?> </div> <?php } } ?> </div> <div id="tabs_search_rejected"> <form method="get" action="<?php bloginfo('siteurl'); ?> /wp-admin/admin.php"> <input type="hidden" value="withdraw-req" name="page" /> <input type="hidden" value="tabs_search_rejected" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'PricerrTheme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user5']; ?> " name="search_user5" size="20" /> <input type="submit" name="PricerrTheme_save5" value="<?php _e('Search', 'PricerrTheme'); ?> "/></td> </tr> </table> </form> <?php if (isset($_GET['PricerrTheme_save5'])) { $search_user = trim($_GET['search_user5']); $user = get_userdatabylogin($search_user); $uid = $user->ID; $s = "select * from " . $wpdb->prefix . "job_withdraw where rejected='1' AND uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width="12%" ><?php _e('Username', 'PricerrTheme'); ?> </th> <th><?php _e('Method', 'PricerrTheme'); ?> </th> <th width="20%"><?php _e('Details', 'PricerrTheme'); ?> </th> <th><?php _e('Date Requested', 'PricerrTheme'); ?> </th> <th ><?php _e('Amount', 'PricerrTheme'); ?> </th> <th width="25%"><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $row->methods . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . PricerrTheme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'PricerrTheme') . '</a>' . ' | ' . '<a href="' . get_bloginfo('siteurl') . '/wp-admin/admin.php?page=withdraw-req&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'PricerrTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'PricerrTheme') : __("Rejected", 'PricerrTheme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no results for your search.', 'PricerrTheme'); ?> </div> <?php } } ?> </div> <?php echo '</div>'; }
//----------- global $current_user; get_currentuserinfo; global $wp_query, $wpdb; $orderid = $wp_query->query_vars['orderid']; $s = "select distinct * from " . $wpdb->prefix . "job_orders where id='{$orderid}'"; $r = $wpdb->get_results($s); $row = $r[0]; $post = get_post($row->pid); if ($row->uid == $current_user->ID) { $tm = time(); $s = "update " . $wpdb->prefix . "job_orders set done_buyer='1', closed='1' where id='{$orderid}' "; $wpdb->query($s); //------------------ $raw_amount = $row->mc_gross; $current_cash = PricerrTheme_get_credits($current_user->ID); PricerrTheme_update_credits($current_user->ID, $current_cash + $raw_amount); $reason = sprintf(__('Amount refunded for cancelled job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title); PricerrTheme_add_history_log('1', $reason, $raw_amount, $current_user->ID); //------------------ $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $shp_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_shopping_page_id')) . "/?"; } else { $shp_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_shopping_page_id') . "&"; } PricerrTheme_send_email_when_buyer_closes_the_job($orderid, $row->pid, $post->post_author, $current_user->ID); wp_redirect($shp_pg_lnk . "pg=cancelled"); exit; } echo "oops.error";
wp_redirect(get_bloginfo('siteurl') . "/wp-login.php"); exit; } global $wp_query; $pid = $wp_query->query_vars['jobid']; function Pricerr_filter_ttl($title) { return __("Pay for your job", 'PricerrTheme') . " - " . get_bloginfo('name'); } add_filter('wp_title', 'Pricerr_filter_ttl', 10, 3); global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $post = get_post($pid); $total = get_option('PricerrTheme_featured_fee'); $crds = PricerrTheme_get_credits($uid); //--------------------------------- if (isset($_GET['confirm'])) { session_start(); $datemade = current_time('timestamp', 0); $nts = ''; $mc_gross = $price; global $wpdb; $pref = $wpdb->prefix; $s1 = "select * from " . $pref . "job_orders where pid='{$pid}' AND uid='{$uid}' AND date_made='{$datemade}'"; $r1 = $wpdb->get_results($s1); if (count($r1) == 0) { $price = get_post_meta($pid, 'price', true); if (empty($price)) { $price = get_option('PricerrTheme_job_fixed_amount'); }
function PricerrTheme_mark_completed($orderid, $ok_without_uid = '') { global $current_user, $wpdb; get_currentuserinfo; $s = "select distinct * from " . $wpdb->prefix . "job_orders where id='{$orderid}'"; $r = $wpdb->get_results($s); $row = $r[0]; $post = get_post($row->pid); $pid_d = $row->pid; $tm = current_time('timestamp', 0); do_action('PricerrTheme_do_when_completed', $row); if ($ok_without_uid == 1) { $ok_gen = 1; } else { if ($row->uid == $current_user->ID) { $ok_gen = 1; } else { $ok_gen = 0; } } if ($ok_gen == 1) { $tm = current_time('timestamp', 0); $s = "update " . $wpdb->prefix . "job_orders set done_buyer='1', completed='1', date_completed='{$tm}' where id='{$orderid}' "; $wpdb->query($s); //------------------ PricerrTheme_send_email_when_job_completed($orderid, $pid_d, $post->post_author); //------------------ $raw_amount = $row->mc_gross; $percent_taken = get_option('PricerrTheme_percent_fee_taken'); $percent_taken = apply_filters('PricerrTheme_apply_filters_here_mark_compl', $percent_taken, $pid_d); if (empty($percent_taken)) { $amount_fee = round(get_option('PricerrTheme_solid_fee_taken'), 2); } else { $amount_fee = round($percent_taken * $raw_amount / 100, 2); } $current_cash = PricerrTheme_get_credits($post->post_author); PricerrTheme_update_credits($post->post_author, $current_cash + $raw_amount - $amount_fee); $reason = sprintf(__('Payment received for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title); PricerrTheme_add_history_log('1', $reason, $raw_amount, $post->post_author); $reason = sprintf(__('Fee taken for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title); PricerrTheme_add_history_log('0', $reason, $amount_fee, $post->post_author); $s = "update " . $wpdb->prefix . "job_orders set admin_fee='{$amount_fee}' where id='{$orderid}' "; $wpdb->query($s); //--------------- $g2 = "insert into " . $wpdb->prefix . "job_admin_earnings (orderid, pid, admin_fee, datemade) values('{$orderid}','{$pid_d}','{$amount_fee}','{$tm}')"; $wpdb->query($g2); //emails //------------------ $g1 = "insert into " . $wpdb->prefix . "job_chatbox (datemade, uid, oid, content) values('{$tm}','-2','{$orderid}','{$ccc}')"; $wpdb->query($g1); return 1; } return 0; }
$refund_uid = $row->uid; $current_cash = PricerrTheme_get_credits($refund_uid); PricerrTheme_update_credits($refund_uid, $current_cash + $row->mc_gross); $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title); PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $refund_uid); //-------------------- wp_redirect(get_permalink(get_option('PricerrTheme_my_account_sales_page_id'))); exit; } if (isset($_POST['confirm_force_cancellation'])) { $tm = current_time('timestamp', 0); $s = "update " . $wpdb->prefix . "job_orders set force_cancellation='1', closed='1', date_request_cancellation='{$tm}' where id='{$orderid}'"; $wpdb->query($s); //------------------- $refund_uid = $row->uid; $current_cash = PricerrTheme_get_credits($refund_uid); PricerrTheme_update_credits($refund_uid, $current_cash + $row->mc_gross); $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title); PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $refund_uid); //PricerrTheme_send_email_when_buyer_closes_the_job($orderid, $post->ID, $post->post_author, $refund_uid); PricerrTheme_send_email_when_buyer_closes_the_job($orderid, $post->ID, $refund_uid, $post->post_author); //-------------------- wp_redirect(get_permalink(get_option('PricerrTheme_my_account_sales_page_id'))); exit; } //===================================================== $post = get_post($pid); get_header(); ?> <div id="content">
function PricerrTheme_my_account_payments_area_function() { global $current_user, $wpdb; get_currentuserinfo(); $uid = $current_user->ID; $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $pay_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_payments_page_id')) . "/?"; } else { $pay_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_payments_page_id') . "&"; } //------------------------------------- ?> <div id="content"> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php _e("My Payments", 'PricerrTheme'); ?> </div> <div class="padd10"> <a class="green_btn" href="<?php echo $pay_pg_lnk; ?> pg=withdraw"><?php _e('Withdraw Money', 'PricerrTheme'); ?> </a> <a class="green_btn" href="<?php echo $pay_pg_lnk; ?> pg=transactions"><?php _e('Transactions', 'PricerrTheme'); ?> </a> </div> <div class="clear10"></div> <div class="clear10"></div> <?php $pg = $_GET['pg']; if (!isset($pg)) { $pg = 'home'; } global $wpdb; if ($_GET['pg'] == 'closewithdrawal') { $id = $_GET['id']; $s = "select * from " . $wpdb->prefix . "job_withdraw where id='{$id}' AND uid='{$uid}'"; $r = $wpdb->get_results($s); if (count($r) == 1) { $row = $r[0]; $amount = $row->amount; $cr = PricerrTheme_get_credits($uid); PricerrTheme_update_credits($uid, $cr + $amount); $s = "delete from " . $wpdb->prefix . "job_withdraw where id='{$id}' AND uid='{$uid}'"; $wpdb->query($s); echo __('Request canceled!', 'PricerrTheme') . '<br/><br/>'; } } if ($pg == 'home') { ?> <?php $bal = PricerrTheme_get_credits($uid); echo '<h1 class="balance">' . sprintf(__("Your Current Balance is: %s", "PricerrTheme"), PricerrTheme_get_show_price($bal)) . "</h1>"; ?> <div class="clear10"></div> <div class="box_title"><?php _e('Pending Withdrawals', 'PricerrTheme'); ?> </div> <div class="padd10"> <?php global $wpdb; //---------------- $s = "select * from " . $wpdb->prefix . "job_withdraw where done='0' AND uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No withdrawals pending yet.', 'PricerrTheme'); } else { echo '<table width="100%">'; foreach ($r as $row) { echo '<tr>'; echo '<td>' . date('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td>' . PricerrTheme_get_show_price($row->amount) . ' ' . '</td>'; echo '<td>' . $row->payeremail . '</td>'; echo '<td><a href="' . $pay_pg_lnk . 'pg=closewithdrawal&id=' . $row->id . '" class="green_btn">' . __('Close Request', 'PricerrTheme') . '</a></td>'; echo '</tr>'; } echo '</table>'; } ?> </div> <!-- ###################### --> <div class="clear10"></div> <div class="box_title"><?php _e("Pending Incoming Payments", "PricerrTheme"); ?> </div> <div class="padd10"> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select distinct * from " . $prefix . "job_orders orders, " . $prefix . "posts posts\r\n\t\t\t\t\t where posts.post_author='{$uid}' AND posts.ID=orders.pid AND orders.done_seller='0' AND \r\n\t\t\t\t\t orders.done_buyer='0' AND orders.date_finished='0' AND orders.closed='0' order by orders.id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No payments pending yet.', 'PricerrTheme'); } else { echo '<table width="100%">'; foreach ($r as $row) { $post = get_post($row->pid); $from = get_userdata($row->uid); echo '<tr>'; echo '<td>' . $from->user_login . '</td>'; echo '<td><a href="' . get_permalink($row->pid) . '">' . $post->post_title . '</a></td>'; echo '<td>' . date_i18n('d-M-Y H:i:s', $row->date_made) . '</td>'; echo '<td>' . PricerrTheme_get_show_price($row->mc_gross) . '</td>'; echo '</tr>'; } echo '</table>'; } ?> </div> <?php } elseif ($pg == 'withdraw') { ?> <div class="box_title"><?php _e("Request Withdrawal", "PricerrTheme"); ?> </div> <div class="padd10"> <?php $bal = PricerrTheme_get_credits($uid); echo '<span class="balance">'; printf(__('Your Current Balance is: %s', 'PricerrTheme'), PricerrTheme_get_show_price($bal)); echo "</span><br/><br/>"; if (isset($_POST['withdraw']) or isset($_POST['withdraw2']) or isset($_POST['withdraw3']) or isset($_POST['withdraw4']) or isset($_POST['withdraw5']) or isset($_POST['withdraw6']) or isset($_POST['withdraw7'])) { $amount = trim($_POST['amount']); $paypal = trim($_POST['paypal']); if (isset($_POST['withdraw2'])) { $amount = trim($_POST['amount2']); } if (isset($_POST['withdraw3'])) { $amount = trim($_POST['amount3']); } if (isset($_POST['withdraw4'])) { $amount = trim($_POST['amount4']); } if (isset($_POST['withdraw5'])) { $amount = trim($_POST['amount5']); } if (isset($_POST['withdraw6'])) { $amount = trim($_POST['amount6']); } if (isset($_POST['withdraw7'])) { $amount = trim($_POST['amount7']); } $PricerrTheme_withdraw_limit = get_option('PricerrTheme_withdraw_limit'); if (empty($PricerrTheme_withdraw_limit) or !is_numeric($PricerrTheme_withdraw_limit)) { $PricerrTheme_withdraw_limit = 10; } if (!is_numeric($amount) || $amount < 0) { echo '<span class="error">' . __('ERROR: Provide a well formated amount.', 'PricerrTheme') . '</span>'; } else { if (PricerrTheme_isValidEmail($paypal) == false) { echo '<span class="error">' . __('ERROR: Invalid email provided.', 'PricerrTheme') . '</span>'; } else { if ($amount < $PricerrTheme_withdraw_limit) { echo '<span class="error">' . sprintf(__('ERROR: The amount must be higher than: %s.', 'PricerrTheme'), PricerrTheme_get_show_price($PricerrTheme_withdraw_limit)) . '</span>'; } else { $min = get_option('PricerrTheme_withdraw_limit'); if ($min == 0) { $min = "0"; } if (empty($min)) { $min = 10; } if ($bal < $amount) { echo '<span class="error">' . __('ERROR: Your balance is smaller than the amount requested.', 'PricerrTheme') . '</span>'; } else { $method = "PayPal"; if (isset($_POST['withdraw2'])) { $method = "Moneybookers"; } if (isset($_POST['withdraw3'])) { $method = "Payza"; } $method = apply_filters('PricerrTheme_withdraw_method', $method); $tm = current_time('timestamp', 0); global $wpdb; if (!empty($_POST['tm_tm'])) { $tm = $_POST['tm_tm']; } $s = "select * from " . $wpdb->prefix . "job_withdraw where uid='{$uid}' AND datemade='{$tm}'"; $r = $wpdb->get_results($s); if (count($r) == 0) { $s = "insert into " . $wpdb->prefix . "job_withdraw (payeremail, methods, amount, datemade, uid) \r\n\t\t\t\t\t\t\t\tvalues('{$paypal}', '{$method}','{$amount}','{$tm}','{$uid}')"; $wpdb->query($s); $cr = PricerrTheme_get_credits($uid); PricerrTheme_update_credits($uid, $cr - $amount); //----------------------- PricerrTheme_send_email_when_withdraw_requested($uid, $method, PricerrTheme_get_show_price($amount)); //----------------------- } echo '<span class="balance">' . __('Your request has been queued. Redirecting...', 'PricerrTheme') . '</span>'; $url_redir = $pay_pg_lnk; echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />'; } } } } } global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $opt = get_option('PricerrTheme_paypal_enable'); if ($opt == "yes") { ?> <br /><br /> <table> <form method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <tr> <td><?php _e('Withdraw amount:', 'PricerrTheme'); ?> </td><td> <input value="<?php echo $_POST['amount']; ?> " type="text" size="10" name="amount" /> <?php echo PricerrTheme_get_currency(); ?> </td> </tr> <tr> <td><?php _e('PayPal Email:', 'PricerrTheme'); ?> </td><td><input value="<?php echo get_user_meta($uid, 'paypal_email', true); ?> " type="text" size="30" name="paypal" /></td> </tr> <tr> <td></td> <td> <input type="submit" name="withdraw" value="<?php _e('Withdraw', 'PricerrTheme'); ?> " /></td></tr></form></table> <?php } $opt = get_option('PricerrTheme_moneybookers_enable'); if ($opt == "yes") { ?> <br/><br/> <table> <form method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <tr> <td><?php _e('Withdraw amount:', 'PricerrTheme'); ?> </td><td> <input value="<?php echo $_POST['amount2']; ?> " type="text" size="10" name="amount2" /> <?php echo PricerrTheme_get_currency(); ?> </td> </tr> <tr> <td><?php _e('Moneybookers Email:', 'PricerrTheme'); ?> </td><td><input value="" type="text" size="30" name="paypal" /></td> </tr> <tr> <td></td> <td> <input type="submit" name="withdraw2" value="<?php _e('Withdraw', 'PricerrTheme'); ?> " /></td></tr></form></table> <?php } $opt = get_option('PricerrTheme_alertpay_enable'); if ($opt == "yes") { ?> <br/><br/> <table> <form method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <tr> <td><?php _e('Withdraw amount:', 'PricerrTheme'); ?> </td><td> <input value="<?php echo $_POST['amount3']; ?> " type="text" size="10" name="amount3" /> <?php echo PricerrTheme_get_currency(); ?> </td> </tr> <tr> <td><?php _e('Payza Email:', 'PricerrTheme'); ?> </td><td><input value="" type="text" size="30" name="paypal" /></td> </tr> <tr> <td></td> <td> <input type="submit" name="withdraw3" value="<?php _e('Withdraw', 'PricerrTheme'); ?> " /></td></tr></form></table> <?php } do_action('PricerrTheme_payments_withdraw_options'); ?> </div> <?php } elseif ($pg == 'transactions') { ?> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Transactions", "PricerrTheme"); ?> </div> <div class="padd10"> <?php $s = "select * from " . $wpdb->prefix . "job_payment_transactions where uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No activity yet.', 'PricerrTheme'); } else { $i = 0; echo '<table width="100%" cellpadding="5">'; foreach ($r as $row) { if ($row->tp == 0) { $class = "redred"; $sign = "-"; } else { $class = "greengreen"; $sign = "+"; } echo '<tr style="background:' . ($i % 2 ? "#f2f2f2" : "#f9f9f9") . '" >'; echo '<td>' . $row->reason . '</td>'; echo '<td width="25%">' . date('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td width="20%" class="' . $class . '"><b>' . $sign . PricerrTheme_get_show_price($row->amount) . '</b></td>'; echo '</tr>'; $i++; } echo '</table>'; } ?> </div> </div> </div> <?php } ?> <!-- page content here --> </div> </div> </div> <?php PricerrTheme_get_users_links(); }
function PricerrTheme_pay_for_job_area_function() { global $current_user, $wpdb; get_currentuserinfo(); $uid = $current_user->ID; $pid = trim($_GET['jobid']); $post = get_post($_GET['jobid']); $jbnm = PricerrTheme_wrap_the_title($post->post_title, $pid); $prc = get_option('PricerrTheme_new_job_feat_listing_fee'); if (get_post_meta($pid, 'featured', true) != "1") { $prc = 0; } $PricerrTheme_new_job_listing_fee = get_option('PricerrTheme_new_job_listing_fee'); $prc += $PricerrTheme_new_job_listing_fee; ?> <div id="content"> <div class="box_title"><?php echo sprintf(__('Pay for job: %s', 'PricerrTheme'), $jbnm); ?> </div> <div class="box_content"> <span class="skl_pay_feat"> <?php echo sprintf(__('You are about to pay for the listing fees for your new job. <br/>The fee is <b>%s</b>. Please use the following payment methods.', 'PricerrTheme'), PricerrTheme_get_show_price($prc)); ?> </span> <br/><br/> <?php $PricerrTheme_paypal_enable = get_option('PricerrTheme_paypal_enable'); if ($PricerrTheme_paypal_enable == "yes") { echo '<a class="payment_feat" href="' . get_bloginfo('siteurl') . '/?jb_action=pay_featured&method=paypal&jobid=' . $pid . '">' . __('Pay with PayPal', 'PricerrTheme') . '</a> '; } ?> <?php $PricerrTheme_moneybookers_enable = get_option('PricerrTheme_moneybookers_enable'); if ($PricerrTheme_moneybookers_enable == "yes") { echo '<a class="payment_feat" href="' . get_bloginfo('siteurl') . '/?jb_action=pay_featured&method=moneybookers&jobid=' . $pid . '">' . __('Pay with Moneybookers', 'PricerrTheme') . '</a> '; } ?> <?php $PricerrTheme_alertpay_enable = get_option('PricerrTheme_alertpay_enable'); if ($PricerrTheme_alertpay_enable == "yes") { echo '<a class="payment_feat" href="' . get_bloginfo('siteurl') . '/?jb_action=pay_featured&method=payza&jobid=' . $pid . '">' . __('Pay with Payza', 'PricerrTheme') . '</a> '; } $PricerrTheme_get_credits = PricerrTheme_get_credits($uid); if ($PricerrTheme_get_credits >= $prc) { echo '<a class="payment_feat" href="' . get_bloginfo('siteurl') . '/?jb_action=pay_featured_credits&jobid=' . $pid . '">' . __('Pay by Virtual Currency', 'PricerrTheme') . '</a> '; } do_action('PricerrTheme_pay_for_featured_job', $pid); ?> </div> </div> <div id="right-sidebar"> <ul class="xoxo"> <?php dynamic_sidebar('other-page-area'); ?> </ul> </div> <?php }
function PricerrTheme_my_account_cancel_reqq_area_function() { $oid = $_GET['oid']; global $wpdb, $current_user; get_currentuserinfo(); $uid = $current_user->ID; $s = "select * from " . $wpdb->prefix . "job_orders where id='{$oid}'"; $r = $wpdb->get_results($s); $row = $r[0]; $post_au = get_post($row->pid); $dt = current_time('timestamp', 0); //----------------------- if ($row->request_cancellation_from_seller == 1) { if ($post_au->post_author != $uid) { //i am the buyer here $s_message = __('The seller of this job has requested a mutual cancellation for this order. Please accept or deny it using the controls below:', 'PricerrTheme'); $return_me = get_permalink(get_option('PricerrTheme_my_account_shopping_page_id')); if ($_GET['accept'] == "yes") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='1', closed='1', date_accept_cancellation='{$dt}' where id='{$row->id}'"; $wpdb->query($s1); $current_cash = PricerrTheme_get_credits($row->uid); PricerrTheme_update_credits($row->uid, $current_cash + $row->mc_gross); $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post_au->ID), $post_au->post_title); PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $row->uid); } if ($_GET['accept'] == "no") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='-1' where id='{$row->id}'"; $wpdb->query($s1); } } else { echo 'oups #3211!'; exit; } } if ($row->request_cancellation_from_buyer == 1) { if ($post_au->post_author == $uid) { // i am the seller here $s_message = __('The buyer of this job has requested a mutual cancellation for this order. Please accept or deny it using the controls below:', 'PricerrTheme'); $return_me = get_permalink(get_option('PricerrTheme_my_account_sales_page_id')); if ($_GET['accept'] == "yes") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='1', closed='1', date_accept_cancellation='{$dt}' where id='{$row->id}'"; $wpdb->query($s1); $current_cash = PricerrTheme_get_credits($row->uid); PricerrTheme_update_credits($row->uid, $current_cash + $row->mc_gross); $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post_au->ID), $post_au->post_title); PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $row->uid); } if ($_GET['accept'] == "no") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='-1' where id='{$row->id}'"; $wpdb->query($s1); } } else { echo 'oups #3219!'; exit; } } //----------------------- ?> <div id="content"> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php printf(__("Answer Cancellation Request: #%s", 'PricerrTheme'), $oid); ?> </div> <div style="overflow:hidden; width:100%; float:left"> <div class="clear10"></div> <?php if (isset($_GET['accept'])) { if ($_GET['accept'] == "yes") { ?> <?php printf(__('You have accepted the cancellation request. You can <b><a href="%s">go back</a></b> now', 'PricerrTheme'), $return_me); ?> <?php } else { ?> <?php printf(__('You have not accepted the cancellation request. You can <b><a href="%s">go back</a></b> now', 'PricerrTheme'), $return_me); ?> <?php } } else { ?> <div class="job_content_page_title"> <?php echo '<span class="font_big_it">' . sprintf(__('Job Title: %s', 'PricerrTheme'), $post_au->post_title) . '</span>'; echo '<br/><br/>'; echo $s_message; $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $lnk7 = get_permalink(get_option('PricerrTheme_my_account_mutual_cancellation')) . "?oid=" . $row->id; } else { $lnk7 = get_permalink(get_option('PricerrTheme_my_account_mutual_cancellation')) . "&oid=" . $row->id; } ?> </div> <div class="job_content_page_title"> <a href="<?php echo $lnk7; ?> &accept=yes" class="deactivate_job"><?php _e('Accept Cancellation', 'PricerrTheme'); ?> </a> <a href="<?php echo $lnk7; ?> &accept=no" class="del_job"><?php _e('Deny Cancellation', 'PricerrTheme'); ?> </a> </div> <?php } ?> </div> </div> </div> </div> <?php PricerrTheme_get_users_links(); }