function shipme_template_redirect() { global $post; $my_pid = $post->ID; $shipme_account_page_id = get_option('shipme_account_page_id'); $shipme_post_new_page_id = get_option('shipme_post_new_page_id'); //------------------------------- if (isset($_GET['crds'])) { if (!current_user_can('level_10')) { exit; } $uid = $_GET['uid']; if (!empty($_GET['increase_credits'])) { if ($_GET['increase_credits'] > 0) { if (is_numeric($_GET['increase_credits'])) { $cr = shipme_get_credits($uid); shipme_update_credits($uid, $cr + $_GET['increase_credits']); $reason = __('Payment received from site admin', 'shipme'); shipme_add_history_log('1', $reason, trim($_GET['increase_credits']), $uid); } } } else { if ($_GET['decrease_credits'] > 0) { if (is_numeric($_GET['decrease_credits'])) { $cr = shipme_get_credits($uid); shipme_update_credits($uid, $cr - $_GET['decrease_credits']); $reason = __('Payment subtracted by site admin', 'shipme'); shipme_add_history_log('0', $reason, trim($_GET['decrease_credits']), $uid); } } } //echo shipme_get_credits($uid); echo $sign . shipme_get_show_price(shipme_get_credits($uid)); exit; } if (isset($_GET['get_bidding_panel'])) { get_template_part('lib/bidding_panel'); die; } if (isset($_GET['_ad_delete_pid'])) { if (is_user_logged_in()) { $pid = $_GET['_ad_delete_pid']; $pstpst = get_post($pid); global $current_user; get_currentuserinfo(); if ($pstpst->post_author == $current_user->ID or current_user_can('manage_options')) { wp_delete_post($_GET['_ad_delete_pid']); echo "done"; } } exit; } //------------------------------- if (isset($_GET['my_upload_of_job_files2'])) { get_template_part('lib/upload_main/uploady'); die; } //------------------------------- if (isset($_GET['my_upload_of_jb_files_proj'])) { get_template_part('lib/upload_main/uploady5'); die; } //------------------------------- if ($my_pid == $shipme_post_new_page_id) { if (!isset($_GET['jobid'])) { $set_ad = 1; } else { $set_ad = 0; } global $current_user; get_currentuserinfo(); if ($set_ad == 1) { //if(!is_user_logged_in()) { wp_redirect(shipme_login_url()); exit; } $pid = shipme_get_auto_draft($current_user->ID); wp_redirect(shipme_post_new_with_pid_stuff_thg($pid)); } get_template_part('lib/post_new_post'); } if (isset($_GET['get_subcats_for_me'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('job_ship_cat', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="form-control do_input" name="subcat">'; $ret .= '<option value="">' . __('Select Subcategory', 'shipme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } }
function shipme_theme_withdrawals() { global $menu_admin_shipme_bull, $wpdb; echo '<div class="wrap">'; echo '<div class="icon32" id="icon-options-general-withdr"><br/></div>'; echo '<h2 class="my_title_class_sitemile">shipme Withdrawals</h2>'; if (isset($_GET['den_id'])) { $den_id = $_GET['den_id']; $s = "update " . $wpdb->prefix . "shipme_withdraw set rejected='1' where id='{$den_id}'"; $row = $wpdb->get_results($s); echo '<div class="saved_thing">Request denied!</div>'; $s = "select * from " . $wpdb->prefix . "shipme_withdraw where id='{$den_id}' "; $r = $wpdb->get_results($s); if (count($r) == 1) { $row = $r[0]; $amount = $row->amount; $uid = $row->uid; $cr = shipme_get_credits($uid); shipme_update_credits($uid, $cr + $amount); } } if (isset($_GET['tid'])) { $tm = current_time('timestamp', 0); $ids = $_GET['tid']; $s = "select * from " . $wpdb->prefix . "shipme_withdraw where id='{$ids}'"; $row = $wpdb->get_results($s); $row = $row[0]; if ($row->done == 0) { echo '<div class="saved_thing">Payment completed!</div>'; $ss = "update " . $wpdb->prefix . "shipme_withdraw set done='1', datedone='{$tm}' where id='{$ids}'"; $wpdb->query($ss); // or die(mysql_error()); $usr = get_userdata($row->uid); $site_name = get_bloginfo('name'); $email = get_bloginfo('admin_email'); $subject = sprintf(__("Your withdrawal has been completed: %s", 'shipme'), shipme_get_show_price($row->amount)); $message = sprintf(__("Your withdrawal has been completed: %s", 'shipme'), shipme_get_show_price($row->amount)); //sitemile_send_email($usr->user_email, $subject , $message); $reason = sprintf(__('Withdraw to PayPal to email: %s', 'shipme'), $row->payeremail); shipme_add_history_log('0', $reason, $row->amount, $usr->ID); } } ?> <div id="usual2" class="usual"> <ul> <ul> <li><a href="#tabs1"><?php _e('Unresolved Requests', 'shipme'); ?> </a></li> <li><a href="#tabs2"><?php _e('Resolved Requests', 'shipme'); ?> </a></li> <li><a href="#tabs_rejected"><?php _e('Rejected Requests', 'shipme'); ?> </a></li> <li><a href="#tabs3"><?php _e('Search Unresolved', 'shipme'); ?> </a></li> <li><a href="#tabs4"><?php _e('Search Solved', 'shipme'); ?> </a></li> <li><a href="#tabs_search_rejected"><?php _e('Search Rejected', 'shipme'); ?> </a></li> </ul> </ul> <div id="tabs1"> <?php $s = "select * from " . $wpdb->prefix . "shipme_withdraw where done='0' and 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 width="12%" ><?php _e('Mobile Number', 'shipme'); ?> </th> <th><?php _e('Method', 'shipme'); ?> </th> <th width="20%"><?php _e('Details', 'shipme'); ?> </th> <th><?php _e('Date Requested', 'shipme'); ?> </th> <th ><?php _e('Amount', 'shipme'); ?> </th> <th width="25%"><?php _e('Options', 'shipme'); ?> </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>' . shipme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'shipme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'shipme') . '</a>' : ($row->done == 1 ? __("Completed", 'shipme') : __("Rejected", 'shipme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no unresolved withdrawal requests.', 'shipme'); ?> </div> <?php } ?> </div> <div id="tabs2"> <?php $s = "select * from " . $wpdb->prefix . "shipme_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('Mobile Number', 'shipme'); ?> </th> <th><?php _e('Method', 'shipme'); ?> </th> <th><?php _e('Details', 'shipme'); ?> </th> <th><?php _e('Date Requested', 'shipme'); ?> </th> <th ><?php _e('Amount', 'shipme'); ?> </th> <th><?php _e('Date Released', 'shipme'); ?> </th> <th><?php _e('Options', 'shipme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $user = get_userdata($row->uid); echo '<tr>'; echo '<th>' . $user->user_login . '</th>'; echo '<th>' . $user->methods . '</th>'; echo '<th>' . $row->payeremail . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>' . shipme_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_admin_url() . 'admin.php?page=Withdrawals&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'shipme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'shipme') . '</a>' : ($row->done == 1 ? __("Completed", 'shipme') : __("Rejected", 'shipme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no resolved withdrawal requests.', 'shipme'); ?> </div> <?php } ?> </div> <div id="tabs_rejected"> <?php $s = "select * from " . $wpdb->prefix . "shipme_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('Mobile Number', 'shipme'); ?> </th> <th><?php _e('Details', 'shipme'); ?> </th> <th><?php _e('Date Requested', 'shipme'); ?> </th> <th ><?php _e('Amount', 'shipme'); ?> </th> <th><?php _e('Date Released', 'shipme'); ?> </th> <th><?php _e('Options', 'shipme'); ?> </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>' . shipme_get_show_price($row->amount) . '</th>'; echo '<th>' . __('Rejected', 'shipme') . '</th>'; echo '<th>#</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no rejected withdrawal requests.', 'shipme'); ?> </div> <?php } ?> </div> <div id="tabs3"> <form method="get" action="<?php echo get_admin_url(); ?> admin.php"> <input type="hidden" value="Withdrawals" name="page" /> <input type="hidden" value="tabs3" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'shipme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user']; ?> " name="search_user" size="20" /> <input type="submit" class="button button-primary button-large" name="shipme_save3" value="<?php _e('Search', 'shipme'); ?> "/></td> </tr> </table> </form> <?php if (isset($_GET['shipme_save3'])) { $search_user = trim($_GET['search_user']); $user = get_userdatabylogin($search_user); $uid = $user->ID; $s = "select * from " . $wpdb->prefix . "shipme_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('Mobile Number', 'shipme'); ?> </th> <th><?php _e('Method', 'shipme'); ?> </th> <th width="20%"><?php _e('Details', 'shipme'); ?> </th> <th><?php _e('Date Requested', 'shipme'); ?> </th> <th ><?php _e('Amount', 'shipme'); ?> </th> <th width="25%"><?php _e('Options', 'shipme'); ?> </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>' . shipme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'shipme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'shipme') . '</a>' : ($row->done == 1 ? __("Completed", 'shipme') : __("Rejected", 'shipme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no results for your search.', 'shipme'); ?> </div> <?php } } ?> </div> <div id="tabs4"> <form method="get" action="<?php echo get_admin_url(); ?> admin.php"> <input type="hidden" value="Withdrawals" name="page" /> <input type="hidden" value="tabs4" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'shipme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user4']; ?> " name="search_user4" size="20" /> <input type="submit" class="button button-primary button-large" name="shipme_save4" value="<?php _e('Search', 'shipme'); ?> "/></td> </tr> </table> </form> <?php if (isset($_GET['shipme_save4'])) { $search_user = trim($_GET['search_user4']); $user = get_userdatabylogin($search_user); $uid = $user->ID; $s = "select * from " . $wpdb->prefix . "shipme_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('Mobile Number', 'shipme'); ?> </th> <th><?php _e('Method', 'shipme'); ?> </th> <th width="20%"><?php _e('Details', 'shipme'); ?> </th> <th><?php _e('Date Requested', 'shipme'); ?> </th> <th ><?php _e('Amount', 'shipme'); ?> </th> <th width="25%"><?php _e('Options', 'shipme'); ?> </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>' . shipme_get_show_price($row->amount) . '</th>'; echo '<th>' . ($row->done == 0 ? '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&active_tab=tabs1&tid=' . $row->id . '" class="awesome">' . __('Make Complete', 'shipme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'shipme') . '</a>' : ($row->done == 1 ? __("Completed", 'shipme') : __("Rejected", 'shipme'))) . '</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no results for your search.', 'shipme'); ?> </div> <?php } } ?> </div> <div id="tabs_search_rejected"> <form method="get" action="<?php echo get_admin_url(); ?> admin.php"> <input type="hidden" value="Withdrawals" name="page" /> <input type="hidden" value="tabs_search_rejected" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'shipme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user5']; ?> " name="search_user5" size="20" /> <input type="submit" class="button button-primary button-large" name="shipme_save5" value="<?php _e('Search', 'shipme'); ?> "/></td> </tr> </table> </form> <?php if (isset($_GET['shipme_save5'])) { $search_user = trim($_GET['search_user5']); $user = get_userdatabylogin($search_user); $uid = $user->ID; $s = "select * from " . $wpdb->prefix . "shipme_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('Mobile Number', 'shipme'); ?> </th> <th><?php _e('Method', 'shipme'); ?> </th> <th width="20%"><?php _e('Details', 'shipme'); ?> </th> <th><?php _e('Date Requested', 'shipme'); ?> </th> <th ><?php _e('Amount', 'shipme'); ?> </th> <th width="25%"><?php _e('Options', 'shipme'); ?> </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>' . shipme_get_show_price($row->amount) . '</th>'; echo '<th>#</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no results for your search.', 'shipme'); ?> </div> <?php } } ?> </div> <?php echo '</div>'; }