Esempio n. 1
0
 }
 //----------------------------------------------------
 $shipping = get_post_meta($pid, 'shipping', true);
 if (empty($shipping)) {
     $shipping = 0;
 }
 $ttotal = $shipping + $extr_ttl + $price;
 if ($ttotal > $crds) {
     echo 'NO_CREDITS_LEFT';
     exit;
 }
 //-----------------------------------------------------------
 $mc_gross = $ttotal;
 PricerrTheme_update_credits($uid, $crds - ($price + $shipping + $extr_ttl));
 $reason = sprintf(__('Payment for job: %s', 'PricerrTheme'), '<a href="' . get_permalink($pid) . '">' . $post->post_title . '</a>');
 PricerrTheme_add_history_log('0', $reason, $price + $shipping + $extr_ttl, $uid);
 $s1 = "insert into " . $pref . "job_orders (pid,uid,date_made, mc_gross, notes_to_seller, extra1, extra2, extra3, extra4, extra5, extra6, extra7, extra8, extra9, extra10) \n\t\t\tvalues('{$pid}','{$uid}','{$datemade}','{$mc_gross}', '{$nts}','{$xtra1}','{$xtra2}','{$xtra3}','{$xtra4}','{$xtra5}','{$xtra6}','{$xtra7}','{$xtra8}','{$xtra9}','{$xtra10}')";
 $wpdb->query($s1);
 //--------------
 $s1 = "select * from " . $pref . "job_orders where pid='{$pid}' AND uid='{$uid}' AND date_made='{$datemade}'";
 $r1 = $wpdb->get_results($s1);
 $orderid = $r1[0]->id;
 //------------------------
 $g1 = "insert into " . $pref . "job_chatbox (datemade, uid, oid, content) values('{$datemade}','0','{$orderid}','{$ccc}')";
 $wpdb->query($g1);
 //--------------
 $uid_a = get_post($pid);
 $uid_a = $uid_a->post_author;
 $s1 = "insert into " . $pref . "job_ratings (orderid, uid, pid) values('{$orderid}','{$uid_a}','{$pid}')";
 $wpdb->query($s1);
 $sales = get_post_meta($pid, 'sales', true);
Esempio n. 2
0
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>';
}
    <div class="box_content">
    
    <?php 
if (isset($_GET['confirm'])) {
    echo sprintf(__('Your payment has been received. <a href="%s">Go back</a> to your account', 'PricerrTheme'), get_permalink(get_option('PricerrTheme_my_account_page_id')));
    $paid = get_post_meta($pid, 'paid', true);
    if ($paid != "1") {
        global $wpdb;
        $pref = $wpdb->prefix;
        update_post_meta($pid, 'paid', "1");
        update_post_meta($pid, 'featured', "1");
        //----------------------------
        $crds = PricerrTheme_get_credits($uid);
        PricerrTheme_update_credits($uid, $crds - $prc);
        $reason = sprintf(__('Payment for listing featured job: %s', 'PricerrTheme'), '<a href="' . get_permalink($pid) . '">' . $post->post_title . '</a>');
        PricerrTheme_add_history_log('0', $reason, $prc, $uid);
        //----------------------------
        $PricerrTheme_admin_approve_job = get_option('PricerrTheme_admin_approve_job');
        if ($PricerrTheme_admin_approve_job == "no") {
            wp_publish_post($pid);
            $mypost = array();
            $mypost['ID'] = $pid;
            $mypost['post_status'] = 'publish';
            wp_update_post($mypost);
        }
    }
    ?>
    
    
    <?php 
} else {
Esempio n. 4
0
//-----------
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";
Esempio n. 5
0
 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;
 }
    $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">

	
    		<div class="my_box3">
            <div class="padd10">
    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>  &nbsp; 
        <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();
    }