Exemplo n.º 1
0
function ProjectTheme_template_redirect_milestones()
{
    $mlls = "PT_milestone_payments_installed_1_aaa";
    $opt = get_option($mlls);
    if (isset($_POST['submits1no_me_thing_ok'])) {
        wp_redirect(get_permalink(get_option('ProjectTheme_my_account_milestones_id')));
        exit;
    }
    if (isset($_POST['submits1yes_me_ok_p'])) {
        global $wpdb;
        $release_id = $_POST['release_id'];
        $s = "select * from " . $wpdb->prefix . "project_milestone where id='{$release_id}'";
        $r = $wpdb->get_results($s);
        $row = $r[0];
        global $current_user;
        get_currentuserinfo();
        $post_me = get_post($row->pid);
        //-------------------------
        $cr = projectTheme_get_credits($current_user->ID);
        if ($row->released == 0 and $cr >= $row->amount) {
            $amount = $row->amount;
            $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid');
            if (!empty($projectTheme_fee_after_paid)) {
                $deducted = $amount * ($projectTheme_fee_after_paid * 0.01);
            } else {
                $deducted = 0;
            }
            $cr = projectTheme_get_credits($row->uid);
            projectTheme_update_credits($row->uid, $cr + $amount - $deducted);
            $reason = sprintf(__('Milestone payment received from <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($current_user->ID), $current_user->user_login, get_permalink($post_me->ID), $post_me->post_title);
            projectTheme_add_history_log('1', $reason, $amount, $row->uid, $current_user->ID);
            $reason = sprintf(__('Payment fee taken for milestone payment for the project <a href="%s">%s</a>', 'ProjectTheme'), get_permalink($post_me->ID), $post_me->post_title);
            projectTheme_add_history_log('0', $reason, $deducted, $row->uid);
            $wpdb->query("update " . $wpdb->prefix . "project_milestone set released='1' where id='{$release_id}'");
            //-----------------------
            $usr_dt = get_userdata($row->uid);
            $cr = projectTheme_get_credits($current_user->ID);
            //projectTheme_update_credits($row->uid, $cr - $amount);
            projectTheme_update_credits($current_user->ID, $cr - $amount);
            $reason = sprintf(__('Milestone payment sent to <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($usr_dt->ID), $usr_dt->user_login, get_permalink($post_me->ID), $post_me->post_title);
            projectTheme_add_history_log('0', $reason, $amount, $current_user->ID, $row->uid);
        }
        //-------------------------
        wp_redirect(get_permalink(get_option('ProjectTheme_my_account_milestones_id')) . "?submit_ok_p=1");
        exit;
    }
    //---------------------------------
    if (empty($opt)) {
        ProjectTheme_insert_pages('ProjectTheme_my_account_milestones_id', 'Milestone Payments', '[project_theme_my_account_milestones]', get_option('ProjectTheme_my_account_payments_id'));
        update_option($mlls, 'DONE');
        global $wpdb;
        $ss = "CREATE TABLE `" . $wpdb->prefix . "project_milestone` (\n\t\t\t\t\t`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t\t\t`owner` INT NOT NULL ,\n\t\t\t\t\t`pid` INT NOT NULL ,\n\t\t\t\t\t`uid` INT NOT NULL ,\n\t\t\t\t\t`description_content` TEXT NOT NULL ,\n\t\t\t\t\t`datemade` BIGINT NOT NULL DEFAULT '0',\n\t\t\t\t\t`completion_date` BIGINT NOT NULL DEFAULT '0' ,\n\t\t\t\t\t`date_released` BIGINT NOT NULL DEFAULT '0' ,\n\t\t\t\t\t`amount` VARCHAR( 255 ) NOT NULL  \n\t\t\t\t\t \n\t\t\t\t\t) ENGINE = MYISAM ;\n\t\t\t\t\t";
        $wpdb->query($ss);
        $ss = "ALTER TABLE `" . $wpdb->prefix . "project_milestone` ADD  `released` TINYINT NOT NULL DEFAULT '0';";
        $wpdb->query($ss);
    }
}
Exemplo n.º 2
0
function ProjectTheme_epay_deps_deposit_payment_epay()
{
    $c = $_GET['orderid'];
    $c = get_option('hsh_' . $c);
    $c = explode('_', $c);
    $uid = $c[0];
    $tm = $c[1];
    //mail('*****@*****.**','get',print_r($_GET, true));
    //mail('*****@*****.**','post',print_r($_POST, true));
    //-------------------
    $mc_gross = round($_GET['amount'] / 100, 2);
    $cr = projectTheme_get_credits($uid);
    projectTheme_update_credits($uid, $mc_gross + $cr);
    update_option('ProjectTheme_deposit_' . $uid . $datemade, "1");
    $reason = __("Deposit through ePay.", "pt_gateways");
    projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
    $user = get_userdata($uid);
}
Exemplo n.º 3
0
<?php

if ($_POST['status'] > -1) {
    $c = $_POST['field1'];
    $c = explode('|', $c);
    $uid = $c[0];
    $datemade = $c[1];
    //---------------------------------------------------
    $amount = $_POST['amount'];
    $op = get_option('ProjectTheme_deposit_' . $uid . $datemade);
    if ($op != "1") {
        $mc_gross = $amount;
        $cr = projectTheme_get_credits($uid);
        projectTheme_update_credits($uid, $mc_gross + $cr);
        update_option('ProjectTheme_deposit_' . $uid . $datemade, "1");
        $reason = __("Deposit through Moneybookers.", "ProjectTheme");
        projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
        $user = get_userdata($uid);
        //--------------------------------
        // send emails to admin and user
        $message = "The user " . $user->user_login . " has just deposited " . $mc_gross . " " . projectTheme_currency() . " into his account.";
        //	sitemile_send_email(get_bloginfo('admin_email'), __('Money received on your site: Deposit','ProjectTheme') , $message);
        //-------
        $message = "You have just deposited " . $mc_gross . " " . projectTheme_currency() . " into your account.";
        //	sitemile_send_email($user->user_email, __('Money deposit completed.','ProjectTheme') , $message);
        //-------------------------------
    }
    //---------------------------
}
Exemplo n.º 4
0
            echo ProjectTheme_get_payments_page_url('deposit');
            ?>
"><?php 
            echo __('Add More Credits', 'ProjectTheme');
            ?>
</a>
							</div>
                    
							<?php 
        }
    } else {
        $paid = get_post_meta($pid, 'paid', true);
        if ($paid != "1") {
            // echo $pid;
            projectTheme_send_email_to_project_payer($pid, $uid, $post_pr->post_author, $amount, '1');
            projectTheme_update_credits($uid, $cr - $amount);
            $reason = sprintf(__('Listing payment for project <a href="%s">%s</a>', 'ProjectTheme'), $perm, $post_pr->post_title);
            $reason = apply_filters('ProjectTheme_reason_listing_project', $reason, $pid);
            projectTheme_add_history_log('0', $reason, $amount, $uid);
            //---------------------
            update_post_meta($pid, "paid", "1");
            update_post_meta($pid, "paid_listing_date", current_time('timestamp', 0));
            update_post_meta($pid, "closed", "0");
            //--------------------------------------------
            update_post_meta($pid, 'base_fee_paid', '1');
            $featured = get_post_meta($pid, 'featured', true);
            if ($featured == "1") {
                update_post_meta($pid, 'featured_paid', '1');
            }
            $private_bids = get_post_meta($pid, 'private_bids', true);
            if ($private_bids == "1") {
Exemplo n.º 5
0
     $ProjectTheme_get_project_primary_cat = ProjectTheme_get_project_primary_cat($pid);
     $projectTheme_theme_bidding_cat_ = get_option('projectTheme_theme_bidding_cat_' . $ProjectTheme_get_project_primary_cat);
     if ($projectTheme_theme_bidding_cat_ > 0) {
         $ProjectTheme_get_credits = ProjectTheme_get_credits($uid);
         $do_not_show = 0;
         $prc = $projectTheme_theme_bidding_cat_;
         if ($ProjectTheme_get_credits < $projectTheme_theme_bidding_cat_) {
             $do_not_show = 1;
             $prc = $projectTheme_theme_bidding_cat_;
         }
     }
 }
 if ($do_not_show == 0) {
     $pst = get_post($pid);
     $cr = projectTheme_get_credits($uid);
     projectTheme_update_credits($uid, $cr - $prc);
     $reason = sprintf(__('Payment for bidding on project: <a href="%s">%s</a>', 'ProjectTheme'), get_permalink($pid), $pst->post_title);
     projectTheme_add_history_log('0', $reason, $prc, $uid);
 }
 //---------------------
 $closed = get_post_meta($pid, 'closed', true);
 if ($closed == "1") {
     echo 'DEBUG.Project Closed';
     exit;
 }
 //---------------------
 if (empty($days_done) || !is_numeric($days_done)) {
     $days_done = 3;
 }
 $query = "select * from " . $wpdb->prefix . "project_bids where uid='{$uid}' AND pid='{$pid}'";
 $r = $wpdb->get_results($query);
Exemplo n.º 6
0
function ProjectTheme_my_account_payments_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>

<div id="content" class="account-main-area">

            
            <?php 
    $pg = $_GET['pg'];
    if (!isset($pg)) {
        $pg = 'home';
    }
    global $wpdb;
    if ($_GET['pg'] == 'closewithdrawal') {
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_withdraw where id='{$id}' AND uid='{$uid}'";
        $r = $wpdb->get_results($s);
        if (count($r) == 1) {
            $row = $r[0];
            $amount = $row->amount;
            $cr = projectTheme_get_credits($uid);
            projectTheme_update_credits($uid, $cr + $amount);
            $s = "delete from " . $wpdb->prefix . "project_withdraw where id='{$id}' AND uid='{$uid}'";
            $wpdb->query($s);
            echo '<div class="">';
            echo sprintf(__('Request canceled! <a href="%s">Return to payments</a>.', 'ProjectTheme'), get_permalink(get_option('ProjectTheme_my_account_payments_id')));
            echo '</div>';
        }
    }
    if ($_GET['pg'] == 'releasepayment') {
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_escrow where id='{$id}' AND fromid='{$uid}'";
        $r = $wpdb->get_results($s);
        if (count($r) == 1 and $r[0]->released != 1) {
            $row = $r[0];
            $amount = $row->amount;
            $toid = $row->toid;
            $pid = $row->pid;
            $my_pst = get_post($pid);
            $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid);
            ProjectTheme_send_email_when_on_completed_project($pid, $projectTheme_get_winner_bid->uid, $projectTheme_get_winner_bid->bid);
            //-------------------------------------------------------------------------------
            $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid');
            if (!empty($projectTheme_fee_after_paid)) {
                $deducted = $amount * ($projectTheme_fee_after_paid * 0.01);
            } else {
                $deducted = 0;
            }
            //-------------------------------------------------------------------------------
            $cr = projectTheme_get_credits($toid);
            projectTheme_update_credits($toid, $cr + $amount - $deducted);
            $reason = sprintf(__('Escrow payment received from %s for the project <b>%s</b>', 'ProjectTheme'), $current_user->user_login, $my_pst->post_title);
            projectTheme_add_history_log('1', $reason, $amount, $toid, $uid);
            if ($deducted > 0) {
                $reason = sprintf(__('Payment fee for project %s', 'ProjectTheme'), $my_pst->post_title);
            }
            projectTheme_add_history_log('0', $reason, $deducted, $toid);
            //-----------------------------
            $email = get_bloginfo('admin_email');
            $site_name = get_bloginfo('name');
            $usr = get_userdata($uid);
            $subject = __("Money Escrow Completed", 'ProjectTheme');
            $message = sprintf(__("You have released the escrow of: %s", "ProjectTheme"), ProjectTheme_get_show_price($amount));
            //($usr->user_email, $subject , $message);
            //-----------------------------
            $usr = get_userdata($toid);
            $reason = sprintf(__('Escrow Payment completed, sent to %s for project <b>%s</b>', 'ProjectTheme'), $usr->user_login, $my_pst->post_title);
            projectTheme_add_history_log('0', $reason, $amount, $uid, $toid);
            $subject = __("Money Escrow Completed", "ProjectTheme");
            $message = sprintf(__("You have received the amount of: %s", "ProjectTheme"), ProjectTheme_get_show_price($amount));
            //($usr->user_email, $subject , $message);
            //-----------------------------
            $tm = current_time('timestamp', 0);
            update_post_meta($pid, 'paid_user', '1');
            update_post_meta($pid, 'paid_user_date', current_time('timestamp', 0));
            $s = "update " . $wpdb->prefix . "project_escrow set released='1', releasedate='{$tm}' where id='{$id}'";
            $r = $wpdb->query($s);
        }
        echo __('Escrow completed! Redirecting...', 'ProjectTheme');
        echo '<br/><br/>';
        $url_redir = ProjectTheme_get_payments_page_url();
        echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />';
    }
    do_action('ProjectTheme_before_payments_in_payments');
    $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
    if ($ProjectTheme_enable_credits_wallet != 'no') {
        if ($pg == 'home') {
            ?>
            
            
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e("Finances", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
                
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">' . __("Your Current Balance is", "ProjectTheme") . ": " . ProjectTheme_get_show_price($bal, 2) . "</span>";
            ?>
 
    
    
               
            </div>
            </div>
            
            <div class="clear10"></div>
            
            <div class="my_box3">
           
            
            	<div class="box_title"><?php 
            _e('What do you want to do', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
                
                <ul class="cms_cms">
                
               <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('deposit');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Deposit Money', 'ProjectTheme');
            ?>
</a>  </li>
              <li>  <a href="<?php 
            echo ProjectTheme_get_payments_page_url('makepayment');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Make Payment', 'ProjectTheme');
            ?>
</a> </li>
                
                <?php 
            if (ProjectTheme_is_user_business($uid)) {
                ?>
               <li> <a href="<?php 
                echo ProjectTheme_get_payments_page_url('escrow');
                ?>
" class="green_btn old_mm_k"><?php 
                _e('Deposit Escrow', 'ProjectTheme');
                ?>
</a> </li> 
                <?php 
            }
            ?>
                
               <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('withdraw');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Withdraw Money', 'ProjectTheme');
            ?>
</a> </li> 
               <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('transactions');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Transactions', 'ProjectTheme');
            ?>
</a></li>
               <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('bktransfer');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Bank Transfer Details', 'ProjectTheme');
            ?>
</a>   </li> 
    
                  <?php 
            do_action('ProjectTheme_financial_buttons_main');
            ?>
              
              	</ul>
              
            </div>
            </div>
            
            <!-- ###################### -->
                        <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Pending Withdrawals', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
               
                
         				<?php 
            global $wpdb;
            //----------------
            $s = "select * from " . $wpdb->prefix . "project_withdraw where done='0' and rejected!='1' AND uid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No withdrawals pending yet.', 'ProjectTheme');
            } else {
                echo '<table width="100%">';
                foreach ($r as $row) {
                    echo '<tr>';
                    echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                    echo '<td>' . $row->methods . '</td>';
                    echo '<td>' . $row->payeremail . '</td>';
                    echo '<td><a href="' . ProjectTheme_get_payments_page_url('closewithdrawal', $row->id) . '"
							class="green_btn">' . __('Close Request', 'ProjectTheme') . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            ?>
                  
               
            </div>
            </div>
            
            
             <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Rejected Withdrawals', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
               
                
         				<?php 
            global $wpdb;
            //----------------
            $s = "select * from " . $wpdb->prefix . "project_withdraw where done='0' and rejected='1' AND uid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No withdrawals pending yet.', 'ProjectTheme');
            } else {
                echo '<table width="100%">';
                foreach ($r as $row) {
                    echo '<tr>';
                    echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                    echo '<td>' . $row->methods . '</td>';
                    echo '<td>' . $row->payeremail . '</td>';
                    echo '<td> </td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            ?>
                  
               
            </div>
            </div>
            
            
           <!-- ###################### -->
                        <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e("Pending Incoming Payments", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
                
                
   				<?php 
            $s = "select * from " . $wpdb->prefix . "project_escrow where released='0' AND toid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No payments pending yet.', 'ProjectTheme');
            } else {
                echo '<table width="100%">';
                foreach ($r as $row) {
                    $post = get_post($row->pid);
                    $from = get_userdata($row->fromid);
                    echo '<tr>';
                    echo '<td>' . $from->user_login . '</td>';
                    echo '<td>' . $post->post_title . '</td>';
                    echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            ?>
                  
                
            </div>
            </div>
         
         
                    <!-- ###################### -->
                   
                   <?php 
            if (ProjectTheme_is_user_business($uid)) {
                ?>
                   
                        <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
                _e('Pending Outgoing Payments', 'ProjectTheme');
                ?>
</div>
            	<div class="box_content">
                
                
      				<?php 
                $s = "select * from " . $wpdb->prefix . "project_escrow where released='0' AND fromid='{$uid}' order by id desc";
                $r = $wpdb->get_results($s);
                if (count($r) == 0) {
                    echo __('No payments pending yet.', 'ProjectTheme');
                } else {
                    echo '<table width="100%">';
                    echo '<tr>';
                    echo '<td><b>' . __('User', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Project', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Date', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Amount', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Options', 'ProjectTheme') . '</b></td>';
                    echo '</tr>';
                    foreach ($r as $row) {
                        $post = get_post($row->pid);
                        $from = get_userdata($row->toid);
                        echo '<tr>';
                        echo '<td><a href="' . ProjectTheme_get_user_profile_link($from->ID) . '">' . $from->user_login . '</a></td>';
                        echo '<td><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></td>';
                        echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                        echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                        echo '<td><a href="' . ProjectTheme_get_payments_page_url('releasepayment', $row->id) . '" class="green_btn">' . __('Release Payment', 'ProjectTheme') . '</a></td>';
                        echo '</tr>';
                    }
                    echo '</table>';
                }
                ?>
                  
               
            </div>
            </div> <?php 
            }
            ?>
        <?php 
        } elseif ($pg == 'escrow') {
            ?>
        
        
        <div class="my_box3">
           
            
            	<div class="box_title"><?php 
            _e('Make Escrow Payment', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
              
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            if (isset($_POST['escrowme'])) {
                $amount = $_POST['amount'];
                $projects = $_POST['projectss'];
                if (!is_numeric($amount) || $amount < 0) {
                    echo '<div class="newproject_error">' . __('Provide a well formated amount.', 'ProjectTheme') . '</div>';
                } else {
                    if (empty($projects)) {
                        echo '<div class="newproject_error">' . __('Please choose an project.', 'ProjectTheme') . '</div>';
                    } else {
                        if ($bal < $amount) {
                            echo '<div class="newproject_error">' . __('Your balance is smaller than the amount requested.', 'ProjectTheme') . '</div>';
                        } else {
                            $post = get_post($projects);
                            $uid2 = get_post_meta($projects, "winner", true);
                            $tm = $_POST['tm'];
                            if (empty($tm)) {
                                $tm = current_time('timestamp', 0);
                            }
                            if ($post->post_author != $uid) {
                                $uid2 = $post->post_author;
                            }
                            //-----------------------
                            $email = get_bloginfo('admin_email');
                            $site_name = get_bloginfo('name');
                            $usr = get_userdata($uid);
                            $subject = __("Money Escrow Sent", "ProjectTheme");
                            $message = sprintf(__("You have placed in escrow the amount of: %s to user: \n\t\t\t\t\t\t\t<b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $username);
                            //($usr->user_email, $subject , $message);
                            $s = "select * from " . $wpdb->prefix . "project_escrow where datemade='{$tm}' and fromid='{$uid}'";
                            $rr = $wpdb->get_results($s);
                            if (count($rr) == 0) {
                                $s = "insert into " . $wpdb->prefix . "project_escrow (datemade, amount, fromid, toid, pid) \n\t\t\t\t\t\t\t\tvalues('{$tm}','{$amount}','{$uid}','{$uid2}','{$projects}')";
                                $wpdb->query($s);
                                // for logged in user, the user who sends
                                //======================================================
                                $cr = projectTheme_get_credits($uid);
                                projectTheme_update_credits($uid, $cr - $amount);
                            }
                            //======================================================
                            // for other user, the user who receives
                            //======================================================
                            $usr2 = get_userdata($uid2);
                            $subject = __("Money Escrow Received", "ProjectTheme");
                            $message = sprintf(__("You have received in escrow the amount of: %s from user: <b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $usr->user_login);
                            //($usr2->user_email, $subject , $message);
                            //======================================================
                            echo '<div class="saved_thing">' . __('Your payment has been sent. Redirecting...', 'ProjectTheme') . '</div>';
                            $url_redir = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
                            echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />';
                        }
                    }
                }
            }
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">' . sprintf(__('Your Current Balance is: %s', 'ProjectTheme'), ProjectTheme_get_show_price($bal)) . "</span>";
            echo '&nbsp; <a class="post_bid_btn" href="' . ProjectTheme_get_payments_page_url_redir('deposit') . '">' . __('Add More Credits', 'ProjectTheme') . '</a>';
            echo "<br/><br/>";
            ?>
                
                <script>
				
				function on_proj_sel()
				{
					var sel_value = jQuery("#my_proj_sel").val();
					
					$.post("<?php 
            bloginfo('siteurl');
            ?>
/?get_my_project_vl_thing=1", {queryString: ""+sel_value+""}, function(data){
						if(data.length >0) {
							
							var currency = '<?php 
            echo ProjectTheme_get_currency();
            ?>
';
							jQuery("#my_escrow_amount").html(currency  + data);
							jQuery("#amount").val(data);
					
							
						}
					});
					
			 
					
				}
				
				<?php 
            if (!empty($_GET['poid'])) {
                ?>
						jQuery(function() {
							  on_proj_sel();
							});
						
						<?php 
            }
            ?>
				
				
				</script>
                
                
    				<br /><br />
                    <table>
                    <form method="post" action="">
                    <input type="hidden" value="<?php 
            echo current_time('timestamp', 0);
            ?>
" name="tm" />
                    <tr>
                    <td width="150"><?php 
            _e('Escrow amount', 'ProjectTheme');
            ?>
:</td><td> <input value="0" type="hidden" 
                    size="10" name="amount" id="amount" /> <span id="my_escrow_amount"><?php 
            _e('Select your project.', 'ProjectTheme');
            ?>
</span></td>
                    </tr>
                    <tr>
                    <td><?php 
            _e('Escrow for Project', 'ProjectTheme');
            ?>
:</td><td> <?php 
            $st = ProjectTheme_get_my_awarded_projects($uid);
            if ($st == false) {
                echo '<strong>' . __('You dont have any awarded projects.', 'ProjectTheme') . '</strong>';
            } else {
                echo $st;
            }
            ?>
</td>
                    </tr>
                    
                    <tr>
                    <td></td>
                    <td>
                    <input type="submit" name="escrowme" value="<?php 
            _e('Make Escrow', 'ProjectTheme');
            ?>
" /></td></tr></form></table>
    
              
            </div>
            </div> 
        
        
        
        <?php 
        } elseif ($pg == 'bktransfer') {
            ?>
        
        
        <div class="my_box3">
        
            
            	<div class="box_title"><?php 
            _e('Set your Bank Transfer Details', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
                
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            if (isset($_POST['bank_details'])) {
                $bank_details = $_POST['bank_details'];
                update_user_meta($uid, 'bank_details', $bank_details);
                echo __("Saved", "ProjectTheme");
            }
            ?>
    				<br /><br />
                    <table>
                    <form method="post">
                    <tr>
                    <td valign="top"><?php 
            _e("Bank details", "ProjectTheme");
            ?>
:</td>
                    <td> <textarea cols="60" name="bank_details" rows="6"><?php 
            echo get_user_meta($uid, 'bank_details', true);
            ?>
</textarea></td>
                    </tr>
                  
                    
                    <tr>
                    <td></td>
                    <td>
                    <input type="submit" name="submit" value="<?php 
            _e("Save Details", "ProjectTheme");
            ?>
" /></td></tr></form></table>
    			
                  
            </div>
            </div> 
        
        
        
        <?php 
        } elseif ($pg == 'makepayment') {
            ?>
        
          <div class="my_box3">
           
            
            	<div class="box_title"><?php 
            echo __("Make Payment", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
             
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            if (isset($_POST['payme'])) {
                $amount = $_POST['amount'];
                $username = $_POST['username'];
                $username_select = $_POST['projectss'];
                if (!is_numeric($amount) || $amount < 0) {
                    echo '<div class="newproject_error">' . __('ERROR: Provide a well formated amount.', 'ProjectTheme') . '</div>';
                } else {
                    if (projectTheme_username_is_valid($username) == false && empty($username_select)) {
                        echo '<div class="newproject_error">' . __('ERROR: Invalid username provided.', 'ProjectTheme') . '</div>';
                    } else {
                        if ($username == $current_user->user_login) {
                            echo '<div class="newproject_error">' . __('ERROR: You cannot transfer money to your own account.', 'ProjectTheme') . '</div>';
                        } else {
                            $min = get_option('project_theme_transfer_limit');
                            if (empty($min)) {
                                $min = 20;
                            }
                            if ($bal < $amount) {
                                echo '<div class="newproject_error">' . __('ERROR: Your balance is smaller than the amount requested.', 'ProjectTheme') . '</div>';
                            } else {
                                if ($amount < $min) {
                                    echo '<div class="newproject_error">' . sprintf(__('ERROR: The amount should not be less than %s', 'ProjectTheme'), ProjectTheme_get_show_price($min)) . '.</div>';
                                } else {
                                    $tm = current_time('timestamp', 0);
                                    $uid2 = projectTheme_get_userid_from_username($username);
                                    $usr2 = get_userdata($uid2);
                                    if (!empty($username_select)) {
                                        $uid2 = $username_select;
                                        $username = get_userdata($uid2);
                                        $username = $username->user_login;
                                    }
                                    // for logged in user, the user who sends
                                    //======================================================
                                    $cr = projectTheme_get_credits($uid);
                                    projectTheme_update_credits($uid, $cr - $amount);
                                    //-----------------------
                                    $email = get_bloginfo('admin_email');
                                    $site_name = get_bloginfo('name');
                                    $usr = get_userdata($uid);
                                    $subject = __("Money Sent", "ProjectTheme");
                                    $message = sprintf(__("You have sent amount of: %s to user: <b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $usr2->user_login);
                                    //($usr->user_email, $subject , $message);
                                    $reason = sprintf(__("Amount transfered to user %s", "ProjectTheme"), $usr2->user_login);
                                    projectTheme_add_history_log('0', $reason, $amount, $uid, $uid2);
                                    //======================================================
                                    // for other user, the user who receives
                                    //======================================================
                                    $cr = projectTheme_get_credits($uid2);
                                    projectTheme_update_credits($uid2, $cr + $amount);
                                    $subject = __("Money Received", "ProjectTheme");
                                    $message = sprintf(__("You have received amount of: %s from user: <b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $usr->user_login);
                                    //($usr2->user_email, $subject , $message);
                                    $reason = sprintf(__("Amount transfered from user %s", "ProjectTheme"), $usr->user_login);
                                    projectTheme_add_history_log('1', $reason, $amount, $uid2, $uid);
                                    //======================================================
                                    echo '<div class="saved_thing">' . __('Your payment has been sent. Redirecting...', 'ProjectTheme') . '</div>';
                                    $url_redir = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
                                    echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" /><br/>';
                                }
                            }
                        }
                    }
                }
            }
            global $current_user;
            get_currentuserinfo();
            $uid = $current_user->ID;
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">' . sprintf(__("Your Current Balance is %s", ""), ProjectTheme_get_show_price($bal)) . ":</span><br/><br/>";
            ?>
    				<br /><br />
                    <table>
                    <form method="post" enctype="application/x-www-form-urlencoded">
                    <tr>
                    <td><?php 
            echo __("Payment amount", "ProjectTheme");
            ?>
:</td>
                    <td> <input value="<?php 
            echo $_POST['amount'];
            ?>
" type="text" 
                    size="10" name="amount" /> <?php 
            echo projectTheme_currency();
            ?>
</td>
                    </tr>
                    <tr>
                    <td><?php 
            echo __("Pay to user", "ProjectTheme");
            ?>
:</td>
                    <td><input value="<?php 
            echo $_POST['username'];
            ?>
" type="text" size="30" name="username" /> 
					
					
					<?php 
            $trg = ProjectTheme_get_my_awarded_projects2($uid);
            if ($trg) {
                _e('or', 'ProjectTheme') . " &nbsp; ";
                echo ProjectTheme_get_my_awarded_projects2($uid);
            }
            ?>
</td>
                    </tr>
                    
                    <tr>
                    <td></td>
                    <td>
                    <input type="submit" name="payme" value="<?php 
            echo __("Make Payment", "ProjectTheme");
            ?>
" /></td></tr></form></table>
    
              
            </div>
            </div> 
        
              
        <?php 
        } elseif ($pg == 'withdraw') {
            ?>
        
        
               <div class="my_box3">
         
            	<div class="box_title"><?php 
            _e("Request Withdrawal", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
               
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">';
            printf(__('Your Current Balance is: %s', 'ProjectTheme'), ProjectTheme_get_show_price($bal));
            echo "</span><br/><br/>";
            do_action('ProjectTheme_add_new_withdraw_posts');
            if (isset($_POST['withdraw']) or isset($_POST['withdraw2']) or isset($_POST['withdraw3'])) {
                $amount = $_POST['amount'];
                $paypal = $_POST['paypal'];
                $meth = $_POST['meth'];
                if (isset($_POST['withdraw2'])) {
                    $amount = $_POST['amount2'];
                    $paypal = $_POST['paypal2'];
                    $meth = $_POST['meth2'];
                }
                if (isset($_POST['withdraw3'])) {
                    $amount = $_POST['amount3'];
                    $paypal = $_POST['paypal3'];
                    $meth = $_POST['meth3'];
                }
                if (!is_numeric($amount) || $amount < 0) {
                    echo '<br/><span class="newproject_error">' . __('Provide a well formated amount.', 'ProjectTheme') . '</span><br/>';
                } else {
                    if (project_isValidEmail($paypal) == false) {
                        echo '<br/><span class="newproject_error">' . __('Invalid email provided.', 'ProjectTheme') . '</span><br/>';
                    } else {
                        $min = get_option('project_theme_min_withdraw');
                        if (empty($min)) {
                            $min = 25;
                        }
                        if ($bal < $amount) {
                            echo '<br/><span class="newproject_error">' . __('Your balance is smaller than the amount requested.', 'ProjectTheme') . '</span><br/>';
                        } else {
                            if ($amount < $min) {
                                echo '<br/><span class="newproject_error">' . sprintf(__('The amount should not be less than %s', 'ProjectTheme'), projecttheme_get_show_price($min)) . '.</span><br/>';
                            } else {
                                $tm = current_time('timestamp', 0);
                                global $wpdb;
                                $wpdb->show_errors = true;
                                if (!empty($_POST['tm'])) {
                                    $tm = $_POST['tm'];
                                    //current_time('timestamp',0);
                                }
                                $s = "select * from " . $wpdb->prefix . "project_withdraw where uid='{$uid}' and datemade='{$tm}' ";
                                $r = $wpdb->get_results($s);
                                if (count($r) == 0) {
                                    $s = "insert into " . $wpdb->prefix . "project_withdraw (methods, payeremail, amount, datemade, uid, done) \n\t\t\t\t\t\t\t\tvalues('{$meth}','{$paypal}','{$amount}','{$tm}','{$uid}','0')";
                                    $wpdb->query($s);
                                    if (!empty($wpdb->last_error)) {
                                        echo $wpdb->last_error;
                                        exit;
                                    }
                                    $cr = projectTheme_get_credits($uid);
                                    projectTheme_update_credits($uid, $cr - $amount);
                                }
                                //-----------------------
                                $email = get_bloginfo('admin_email');
                                $site_name = get_bloginfo('name');
                                $usr = get_userdata($uid);
                                $subject = __("Money Withdraw Requested", "ProjectTheme");
                                $message = sprintf(__("You have requested a new withdrawal of: %s", "ProjectTheme"), $amount . " " . projectTheme_currency());
                                //($usr->user_email, $subject , $message);
                                //-----------------------
                                echo '<div class="saved_thing">' . __('Your request has been queued. Redirecting...', 'ProjectTheme') . '</div>';
                                $url_redir = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
                                echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />';
                            }
                        }
                    }
                }
            }
            global $current_user;
            get_currentuserinfo();
            $uid = $current_user->ID;
            $opt = get_option('ProjectTheme_paypal_enable');
            if ($opt == "yes") {
                ?>
    				<br /><br />
                    <table>
                    <form method="post" enctype="application/x-www-form-urlencoded">
                    <input type="hidden" name="meth" value="PayPal" />
                    <input type="hidden" name="tm" value="<?php 
                echo current_time('timestamp', 0);
                ?>
" />
                    <tr>
                    <td><?php 
                echo __("Withdraw amount", "ProjectTheme");
                ?>
:</td>
                    <td> <input value="<?php 
                echo $_POST['amount'];
                ?>
" type="text" 
                    size="10" name="amount" /> <?php 
                echo projectTheme_currency();
                ?>
</td>
                    </tr>
                    <tr>
                    <td><?php 
                echo __("PayPal Email", "ProjectTheme");
                ?>
:</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 
                echo __("Withdraw", "ProjectTheme");
                ?>
" /></td></tr></form></table>
                    
                    <?php 
            }
            $opt = get_option('ProjectTheme_moneybookers_enable');
            if ($opt == "yes") {
                ?>
                        <br /><br />
                        <table>
                        <form method="post" enctype="application/x-www-form-urlencoded">
                        <input type="hidden" name="meth2" value="Moneybookers" />
                        <input type="hidden" name="tm" value="<?php 
                echo current_time('timestamp', 0);
                ?>
" />
                        <tr>
                        <td><?php 
                echo __("Withdraw amount", "ProjectTheme");
                ?>
:</td>
                        <td> <input value="<?php 
                echo $_POST['amount2'];
                ?>
" type="text" 
                        size="10" name="amount2" /> <?php 
                echo projectTheme_currency();
                ?>
</td>
                        </tr>
                        <tr>
                        <td><?php 
                echo __("Moneybookers Email", "ProjectTheme");
                ?>
:</td>
                        <td><input value="<?php 
                echo get_user_meta($uid, 'moneybookers_email', true);
                ?>
" type="text" size="30" name="paypal2" /></td>
                        </tr>
                        
                        <tr>
                        <td></td>
                        <td>
                        <input type="submit" name="withdraw2" value="<?php 
                echo __("Withdraw", "ProjectTheme");
                ?>
" /></td></tr></form></table>
    				
					<?php 
            }
            $opt = get_option('ProjectTheme_alertpay_enable');
            if ($opt == "yes") {
                ?>
                        <br /><br />
                        <table>
                        <form method="post" enctype="application/x-www-form-urlencoded">
                        <input type="hidden" name="meth3" value="Payza" />
                        <tr>
                        <td><?php 
                echo __("Withdraw amount", "ProjectTheme");
                ?>
:</td>
                        <td> <input value="<?php 
                echo $_POST['amount3'];
                ?>
" type="text" 
                        size="10" name="amount3" /> <?php 
                echo projectTheme_currency();
                ?>
</td>
                        </tr>
                        <tr>
                        <td><?php 
                echo __("Payza Email", "ProjectTheme");
                ?>
:</td>
                        <td><input value="<?php 
                echo get_user_meta($uid, 'payza_email', true);
                ?>
" type="text" size="30" name="paypal3" /></td>
                        </tr>
                        
                        <tr>
                        <td></td>
                        <td>
                        <input type="submit" name="withdraw3" value="<?php 
                echo __("Withdraw", "ProjectTheme");
                ?>
" /></td></tr></form></table>
    				
					<?php 
            }
            ?>
					
					
               <?php 
            do_action('ProjectTheme_add_new_withdraw_methods');
            ?>
	
               
            </div>
            </div>
            
        
            
        <?php 
        } elseif ($pg == 'deposit') {
            global $USERID;
            $USERID = $uid;
            ?>
        
        
    
        <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Deposit Money', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
                
                <?php 
            $ProjectTheme_bank_details_enable = get_option('ProjectTheme_bank_details_enable');
            if ($ProjectTheme_bank_details_enable == "yes") {
                ?>
                
                <strong><?php 
                _e('Deposit money by Bank Transfer', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <?php 
                echo get_option('ProjectTheme_bank_details_txt');
                ?>
    			<br/><br/>
                <?php 
            }
            ?>
                
                
            	<?php 
            $ProjectTheme_paypal_enable = get_option('ProjectTheme_paypal_enable');
            if ($ProjectTheme_paypal_enable == "yes") {
                ?>
                
                <strong><?php 
                _e('Deposit money by PayPal', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <form method="post" action="<?php 
                bloginfo('siteurl');
                ?>
/?p_action=paypal_deposit_pay">
                <?php 
                _e("Amount to deposit:", "ProjectTheme");
                ?>
 <input type="text" size="10" name="amount" /> <?php 
                echo projectTheme_currency();
                ?>
                &nbsp; &nbsp; <input type="submit" name="deposit" value="<?php 
                _e('Deposit', 'ProjectTheme');
                ?>
" /></form>
    			<br/><br/>
                <?php 
            }
            ?>
                <!-- ################## -->
                
                <?php 
            $ProjectTheme_alertpay_enable = get_option('ProjectTheme_alertpay_enable');
            if ($ProjectTheme_alertpay_enable == "yes") {
                ?>
                
                <strong><?php 
                _e('Deposit money by Payza', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <form method="post" action="<?php 
                bloginfo('siteurl');
                ?>
/?p_action=payza_deposit_pay">
                <?php 
                _e("Amount to deposit:", "ProjectTheme");
                ?>
 <input type="text" size="10" name="amount" /> <?php 
                echo projectTheme_currency();
                ?>
                &nbsp; &nbsp; <input type="submit" name="deposit" value="<?php 
                _e('Deposit', 'ProjectTheme');
                ?>
" /></form>
    			<br/><br/>
                <?php 
            }
            ?>
                
                
                
                <?php 
            $ProjectTheme_moneybookers_enable = get_option('ProjectTheme_moneybookers_enable');
            if ($ProjectTheme_moneybookers_enable == "yes") {
                ?>
                
                
                <strong><?php 
                _e('Deposit money by Moneybookers', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <form method="post" action="<?php 
                bloginfo('siteurl');
                ?>
/?p_action=mb_deposit_pay">
                <?php 
                _e("Amount to deposit:", "ProjectTheme");
                ?>
  <input type="text" size="10" name="amount" /> <?php 
                echo projectTheme_currency();
                ?>
                &nbsp; &nbsp; <input type="submit" name="deposit" value="<?php 
                _e('Deposit', 'ProjectTheme');
                ?>
" /></form>
    			<br/><br/>
                <?php 
            }
            ?>
                
    			<?php 
            do_action('ProjectTheme_deposit_methods', $uid);
            ?>
               
            </div>
            </div>
        
        <?php 
        } elseif ($pg == 'transactions') {
            ?>
	
		
        		
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Payment Transactions', 'ProjectTheme');
            ?>
 </div>
            	<div class="box_content">
            
                
                <?php 
            $s = "select * from " . $wpdb->prefix . "project_payment_transactions where uid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No activity yet.', 'ProjectTheme');
            } 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_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td width="20%" class="' . $class . '"><b>' . $sign . ProjectTheme_get_show_price($row->amount) . '</b></td>';
                    echo '</tr>';
                    $i++;
                }
                echo '</table>';
            }
            ?>
    
                 
            </div>
            </div>
        <?php 
        }
    }
    ?>
            
            
                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Exemplo n.º 7
0
function projectTheme_send_email_to_project_payer($pid, $payer_user_id, $receiver_user_id, $amount, $pay_by_credits = '0')
{
    $paid_user = get_post_meta($pid, 'paid_user', true);
    if ($paid_user == "0") {
        $post = get_post($pid);
        $payer_user = get_userdata($payer_user_id);
        $datemade = current_time('timestamp', 0);
        $perm = get_permalink($pid);
        $receiver_user = get_userdata($receiver_user_id);
        //-----------
        update_post_meta($pid, 'paid_user', "1");
        update_post_meta($pid, "paid_user_date", $datemade);
        $receiver_user_id = get_post_meta($pid, 'winner', true);
        //-----------
        $subject = sprintf(__("Your payment was completed for the project: %s", 'ProjectTheme'), $post->post_title);
        $message = sprintf(__('You have paid for the project <a href="%s">%s</a> the amount of: %s %s to user: 

	<b>%s</b>', "ProjectTheme"), $perm, $post->post_title, $amount, $cure, $receiver_user->user_login);
        //sitemile_send_email($receiver_user->user_email, $subject , $message); // send email for the payment received
        $subject = sprintf(__("Details for closed Project: %s", 'ProjectTheme'), $post->post_title);
        $message = sprintf(__('The project <a href="%s">%s</a> was just closed. Here is the user email for the other party: %s', "ProjectTheme"), $perm, $post->post_title, $payer_user->user_email);
        //sitemile_send_email($receiver_user->user_email, $subject , $message); // send email for the details
        //------------
        $subject = sprintf(__("Your have received payment for the project: %s", 'ProjectTheme'), $post->post_title);
        $message = sprintf(__('You have been just paid for the project <a href="%s">%s</a> the amount of: %s %s from user: 

	<b>%s</b>', "ProjectTheme"), $perm, $post->post_title, $amount, $cure, $payer_user->user_login);
        //sitemile_send_email($payer_user->user_email, $subject , $message); // send email for the payment received
        $subject = sprintf(__("Details for closed Project: %s", 'ProjectTheme'), $post->post_title);
        $message = sprintf(__('The project <a href="%s">%s</a> was just closed. Here is the user email for the other party: %s', "ProjectTheme"), $perm, $post->post_title, $receiver_user->user_email);
        //sitemile_send_email($payer_user->user_email, $subject , $message); // send email for the details
        //------------
        if ($pay_by_credits == '1') {
            $cr = projectTheme_get_credits($payer_user_id);
            projectTheme_update_credits($payer_user_id, $cr - $amount);
            $uprof = ProjectTheme_get_user_profile_link($receiver_user->ID);
            //get_bloginfo('siteurl')."/user-profile/".$receiver_user->user_login;
            $reason = sprintf(__('Payment sent to <a href="%s">%s</a> for project <a href="%s">%s</a>', 'ProjectTheme'), $uprof, $receiver_user->user_login, $perm, $post->post_title);
            projectTheme_add_history_log('0', $reason, $amount, $payer_user_id, $receiver_user_id);
            //=========================
            $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid');
            if (!empty($projectTheme_fee_after_paid)) {
                $deducted = $amount * ($projectTheme_fee_after_paid * 0.01);
            } else {
                $deducted = 0;
            }
            $cr = projectTheme_get_credits($receiver_user_id);
            projectTheme_update_credits($receiver_user_id, $cr + $amount - $deducted);
            $uprof = ProjectTheme_get_user_profile_link($payer_user_id->ID);
            $reason = sprintf(__('Payment received from <a href="%s">%s</a> for project <a href="%s">%s</a>', 'ProjectTheme'), $uprof, $payer_user_id->user_login, $perm, $post->post_title);
            projectTheme_add_history_log('1', $reason, $amount, $receiver_user_id, $payer_user_id);
            //--------
            $reason = sprintf(__('Payment fee for project <a href="%s">%s</a>', 'ProjectTheme'), $perm, $post->post_title);
            projectTheme_add_history_log('0', $reason, $deducted, $receiver_user_id);
        }
    }
    //------------
}
Exemplo n.º 8
0
function projectTheme_theme_withdrawals()
{
    global $menu_admin_project_theme_bull, $wpdb;
    echo '<div class="wrap">';
    echo '<div class="icon32" id="icon-options-general-withdr"><br/></div>';
    echo '<h2 class="my_title_class_sitemile">ProjectTheme Withdrawals</h2>';
    if (isset($_GET['den_id'])) {
        $den_id = $_GET['den_id'];
        $s = "update " . $wpdb->prefix . "project_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 . "project_withdraw where id='{$den_id}' ";
        $r = $wpdb->get_results($s);
        if (count($r) == 1) {
            $row = $r[0];
            $amount = $row->amount;
            $uid = $row->uid;
            $cr = projectTheme_get_credits($uid);
            projectTheme_update_credits($uid, $cr + $amount);
        }
    }
    if (isset($_GET['tid'])) {
        $tm = current_time('timestamp', 0);
        $ids = $_GET['tid'];
        $s = "select * from " . $wpdb->prefix . "project_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 . "project_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", 'ProjectTheme'), projectTheme_get_show_price($row->amount));
            $message = sprintf(__("Your withdrawal has been completed: %s", 'ProjectTheme'), projectTheme_get_show_price($row->amount));
            //sitemile_send_email($usr->user_email, $subject , $message);
            $reason = sprintf(__('Withdraw to PayPal to email: %s', 'ProjectTheme'), $row->payeremail);
            projectTheme_add_history_log('0', $reason, $row->amount, $usr->ID);
        }
    }
    ?>
    
        <div id="usual2" class="usual"> 
  <ul> 
    <ul> 
            <li><a href="#tabs1"><?php 
    _e('Unresolved Requests', 'ProjectTheme');
    ?>
</a></li> 
            <li><a href="#tabs2"><?php 
    _e('Resolved Requests', 'ProjectTheme');
    ?>
</a></li> 
            <li><a href="#tabs_rejected"><?php 
    _e('Rejected Requests', 'ProjectTheme');
    ?>
</a></li> 
            <li><a href="#tabs3"><?php 
    _e('Search Unresolved', 'ProjectTheme');
    ?>
</a></li> 
            <li><a href="#tabs4"><?php 
    _e('Search Solved', 'ProjectTheme');
    ?>
</a></li> 
            <li><a href="#tabs_search_rejected"><?php 
    _e('Search Rejected', 'ProjectTheme');
    ?>
</a></li> 
          </ul> 
  </ul> 
  <div id="tabs1">
          <?php 
    $s = "select * from " . $wpdb->prefix . "project_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('Username', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Method', 'ProjectTheme');
        ?>
</th>
            <th width="20%"><?php 
        _e('Details', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Date Requested', 'ProjectTheme');
        ?>
</th>
            <th ><?php 
        _e('Amount', 'ProjectTheme');
        ?>
</th>
            <th width="25%"><?php 
        _e('Options', 'ProjectTheme');
        ?>
</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>' . ProjectTheme_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', 'ProjectTheme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'ProjectTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'ProjectTheme') : __("Rejected", 'ProjectTheme'))) . '</th>';
            echo '</tr>';
        }
        ?>
            </tbody>
            
            
            </table>
            <?php 
    } else {
        ?>
            
            <div class="padd101">
            <?php 
        _e('There are no unresolved withdrawal requests.', 'ProjectTheme');
        ?>
            </div>
            
            <?php 
    }
    ?>
          
          	
          </div>
          
          <div id="tabs2">	
          
          
          <?php 
    $s = "select * from " . $wpdb->prefix . "project_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', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Method', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Details', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Date Requested', 'ProjectTheme');
        ?>
</th>
            <th ><?php 
        _e('Amount', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Date Released', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Options', 'ProjectTheme');
        ?>
</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>' . ProjectTheme_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', 'ProjectTheme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'ProjectTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'ProjectTheme') : __("Rejected", 'ProjectTheme'))) . '</th>';
            echo '</tr>';
        }
        ?>
            </tbody>
            
            
            </table>
            <?php 
    } else {
        ?>
            
            <div class="padd101">
            <?php 
        _e('There are no resolved withdrawal requests.', 'ProjectTheme');
        ?>
            </div>
            
            <?php 
    }
    ?>
          
          
          </div>
          
          <div id="tabs_rejected">	
          
          
          <?php 
    $s = "select * from " . $wpdb->prefix . "project_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', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Details', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Date Requested', 'ProjectTheme');
        ?>
</th>
            <th ><?php 
        _e('Amount', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Date Released', 'ProjectTheme');
        ?>
</th>
            <th><?php 
        _e('Options', 'ProjectTheme');
        ?>
</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>' . ProjectTheme_get_show_price($row->amount) . '</th>';
            echo '<th>' . __('Rejected', 'ProjectTheme') . '</th>';
            echo '<th>#</th>';
            echo '</tr>';
        }
        ?>
            </tbody>
            
            
            </table>
            <?php 
    } else {
        ?>
            
            <div class="padd101">
            <?php 
        _e('There are no rejected withdrawal requests.', 'ProjectTheme');
        ?>
            </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', 'ProjectTheme');
    ?>
</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="ProjectTheme_save3" value="<?php 
    _e('Search', 'ProjectTheme');
    ?>
"/></td>
                </tr>
     
            
            </table>
            </form> 
            
            <?php 
    if (isset($_GET['ProjectTheme_save3'])) {
        $search_user = trim($_GET['search_user']);
        $user = get_userdatabylogin($search_user);
        $uid = $user->ID;
        $s = "select * from " . $wpdb->prefix . "project_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', 'ProjectTheme');
            ?>
</th>
            <th><?php 
            _e('Method', 'ProjectTheme');
            ?>
</th>
            <th width="20%"><?php 
            _e('Details', 'ProjectTheme');
            ?>
</th>
            <th><?php 
            _e('Date Requested', 'ProjectTheme');
            ?>
</th>
            <th ><?php 
            _e('Amount', 'ProjectTheme');
            ?>
</th>
            <th width="25%"><?php 
            _e('Options', 'ProjectTheme');
            ?>
</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>' . ProjectTheme_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', 'ProjectTheme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'ProjectTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'ProjectTheme') : __("Rejected", 'ProjectTheme'))) . '</th>';
                echo '</tr>';
            }
            ?>
            </tbody>
            
            
            </table>
            <?php 
        } else {
            ?>
            
            <div class="padd101">
            <?php 
            _e('There are no results for your search.', 'ProjectTheme');
            ?>
            </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', 'ProjectTheme');
    ?>
</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="ProjectTheme_save4" value="<?php 
    _e('Search', 'ProjectTheme');
    ?>
"/></td>
                </tr>
     
            
            </table>
            </form> 
          	
             
            <?php 
    if (isset($_GET['ProjectTheme_save4'])) {
        $search_user = trim($_GET['search_user4']);
        $user = get_userdatabylogin($search_user);
        $uid = $user->ID;
        $s = "select * from " . $wpdb->prefix . "project_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', 'ProjectTheme');
            ?>
</th>
            <th><?php 
            _e('Method', 'ProjectTheme');
            ?>
</th>
            <th width="20%"><?php 
            _e('Details', 'ProjectTheme');
            ?>
</th>
            <th><?php 
            _e('Date Requested', 'ProjectTheme');
            ?>
</th>
            <th ><?php 
            _e('Amount', 'ProjectTheme');
            ?>
</th>
            <th width="25%"><?php 
            _e('Options', 'ProjectTheme');
            ?>
</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>' . ProjectTheme_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', 'ProjectTheme') . '</a>' . ' | ' . '<a href="' . get_admin_url() . 'admin.php?page=Withdrawals&den_id=' . $row->id . '" class="awesome">' . __('Deny Request', 'ProjectTheme') . '</a>' : ($row->done == 1 ? __("Completed", 'ProjectTheme') : __("Rejected", 'ProjectTheme'))) . '</th>';
                echo '</tr>';
            }
            ?>
            </tbody>
            
            
            </table>
            <?php 
        } else {
            ?>
            
            <div class="padd101">
            <?php 
            _e('There are no results for your search.', 'ProjectTheme');
            ?>
            </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', 'ProjectTheme');
    ?>
</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="ProjectTheme_save5" value="<?php 
    _e('Search', 'ProjectTheme');
    ?>
"/></td>
                </tr>
     
            
            </table>
            </form> 
          	
            
             <?php 
    if (isset($_GET['ProjectTheme_save5'])) {
        $search_user = trim($_GET['search_user5']);
        $user = get_userdatabylogin($search_user);
        $uid = $user->ID;
        $s = "select * from " . $wpdb->prefix . "project_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', 'ProjectTheme');
            ?>
</th>
            <th><?php 
            _e('Method', 'ProjectTheme');
            ?>
</th>
            <th width="20%"><?php 
            _e('Details', 'ProjectTheme');
            ?>
</th>
            <th><?php 
            _e('Date Requested', 'ProjectTheme');
            ?>
</th>
            <th ><?php 
            _e('Amount', 'ProjectTheme');
            ?>
</th>
            <th width="25%"><?php 
            _e('Options', 'ProjectTheme');
            ?>
</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>' . ProjectTheme_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.', 'ProjectTheme');
            ?>
            </div>
            
            <?php 
        }
    }
    ?>
            
          </div> 
          
          
          

<?php 
    echo '</div>';
}
Exemplo n.º 9
0
function ProjectTheme_my_account_payments_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>

<div id="content" class="account-main-area">

            
            <?php 
    $pg = $_GET['pg'];
    if (!isset($pg)) {
        $pg = 'home';
    }
    global $wpdb;
    if ($_GET['pg'] == 'closewithdrawal') {
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_withdraw where id='{$id}' AND uid='{$uid}'";
        $r = $wpdb->get_results($s);
        if (count($r) == 1) {
            $row = $r[0];
            $amount = $row->amount;
            $cr = projectTheme_get_credits($uid);
            projectTheme_update_credits($uid, $cr + $amount);
            $s = "delete from " . $wpdb->prefix . "project_withdraw where id='{$id}' AND uid='{$uid}'";
            $wpdb->query($s);
            echo '<div class="">';
            echo sprintf(__('Request canceled! <a href="%s">Return to payments</a>.', 'ProjectTheme'), get_permalink(get_option('ProjectTheme_my_account_payments_id')));
            echo '</div>';
        }
    }
    if ($_GET['pg'] == 'releasepayment') {
        $id = $_GET['id'];
        $escrow = Escrow::get_by_field('id', $id);
        $bid = Bid::get_by_id($escrow->bid);
        $s = "select * from " . $wpdb->prefix . "project_escrow where id='{$id}' AND fromid='{$uid}'";
        $r = $wpdb->get_results($s);
        if (count($r) == 1 and $r[0]->released != 1) {
            $row = $r[0];
            $amount = $row->amount;
            $toid = $row->toid;
            $pid = $row->pid;
            $my_pst = get_post($pid);
            $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid);
            ProjectTheme_send_email_when_on_completed_project($pid, $projectTheme_get_winner_bid->uid, $projectTheme_get_winner_bid->bid);
            //-------------------------------------------------------------------------------
            $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid');
            if (!empty($projectTheme_fee_after_paid)) {
                $deducted = $amount * ($projectTheme_fee_after_paid * 0.01);
            } else {
                $deducted = 0;
            }
            //-------------------------------------------------------------------------------
            $cr = projectTheme_get_credits($toid);
            projectTheme_update_credits($toid, $cr + $amount - $deducted);
            $reason = sprintf(__('Escrow payment received from <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($current_user->ID), $current_user->user_login, get_permalink($my_pst->ID), $my_pst->post_title);
            projectTheme_add_history_log('1', $reason, $amount, $toid, $uid);
            if ($deducted > 0) {
                $reason = sprintf(__('Payment fee for project <a href="%s">%s</a>', 'ProjectTheme'), get_permalink($my_pst->ID), $my_pst->post_title);
            }
            projectTheme_add_history_log('0', $reason, $deducted, $toid);
            //-----------------------------
            $email = get_bloginfo('admin_email');
            $site_name = get_bloginfo('name');
            $usr = get_userdata($uid);
            $usr2 = get_userdata($toid);
            $subject = __("Money Escrow Completed", 'ProjectTheme');
            //$message = sprintf(__("You have released the escrow of: %s","ProjectTheme"), ProjectTheme_get_show_price($amount));
            //$message = sprintf(__('Escrow Payment completed, sent %s to <a href="%s">%s</a> for project <a href="%s">%s</a>','ProjectTheme'), $amount, ProjectTheme_get_user_profile_link($usr2->ID), $usr2->user_login, get_permalink($my_pst->ID), $my_pst->post_title);
            $message = sprintf(__('Escrow Payment completed, sent %s to %s for %s', 'ProjectTheme'), $amount, $usr2->user_login, $my_pst->post_title);
            ProjectTheme_send_email($usr->user_email, $subject, $message);
            //($usr->user_email, $subject , $message);
            //-----------------------------
            //$usr = get_userdata($toid);
            $reason = sprintf(__('Escrow Payment completed, sent to <a href="%s">%s</a> for project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($usr2->ID), $usr2->user_login, get_permalink($my_pst->ID), $my_pst->post_title);
            projectTheme_add_history_log('0', $reason, $amount, $uid, $toid);
            $subject = __("Money Escrow Completed", "ProjectTheme");
            //$message = sprintf(__("You have received the amount of: %s","ProjectTheme"), ProjectTheme_get_show_price($amount));
            //$message = sprintf(__('Escrow Payment received $ %s, from <a href="%s">%s</a> for project <a href="%s">%s</a>','ProjectTheme'), $amount, ProjectTheme_get_user_profile_link($usr->ID), $usr->user_login, get_permalink($my_pst->ID), $my_pst->post_title);
            $message = sprintf(__('Escrow Payment received $ %s, from %s for project %s', 'ProjectTheme'), $amount, $usr->user_login, $my_pst->post_title);
            ProjectTheme_send_email($usr2->user_email, $subject, $message);
            //($usr->user_email, $subject , $message);
            //-----------------------------
            /*
             * Update bid and project meta
             */
            $tm = current_time('timestamp', 0);
            if (!empty($bid)) {
                Bid::update_meta_by_id($bid->id, 'paid', "1");
                Bid::update_meta_by_id($bid->id, 'paid_user_date', $tm);
                Project::update_postmeta($bid->pid, 'paid_user');
            } else {
                // for old projects
                update_post_meta($pid, 'paid_user', '1');
                update_post_meta($pid, 'paid_user_date', current_time('timestamp', 0));
            }
            $s = "update " . $wpdb->prefix . "project_escrow set released='1', releasedate='{$tm}' where id='{$id}'";
            $r = $wpdb->query($s);
        }
        echo __('Escrow completed! Redirecting...', 'ProjectTheme');
        echo '<br/><br/>';
        $url_redir = ProjectTheme_get_payments_page_url('transactions');
        //ProjectTheme_get_payments_page_url();
        echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />';
    }
    do_action('ProjectTheme_before_payments_in_payments');
    $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
    if ($ProjectTheme_enable_credits_wallet != 'no') {
        if ($pg == 'home') {
            ?>
            
            
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e("Finances", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
                
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">' . __("Your Current Balance is", "ProjectTheme") . ": " . ProjectTheme_get_show_price($bal, 2) . "</span>";
            ?>
 
    
    
               
            </div>
            </div>
            
            <div class="clear10"></div>
            
            <div class="my_box3">
           
            
            	<div class="box_title"><?php 
            _e('What do you want to do ?', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
                
                <ul class="cms_cms">
                <?php 
            if (ProjectTheme_is_user_business($uid)) {
                ?>
               <li> <a href="<?php 
                echo ProjectTheme_get_payments_page_url('deposit');
                ?>
" class="green_btn old_mm_k"><?php 
                _e('Deposit Money', 'ProjectTheme');
                ?>
</a>  </li>
              <?php 
            }
            ?>
              <li>  <a href="<?php 
            echo ProjectTheme_get_payments_page_url('makepayment');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Make Payment', 'ProjectTheme');
            ?>
</a> </li>
                
                <?php 
            if (ProjectTheme_is_user_business($uid)) {
                ?>
               <li> <a href="<?php 
                echo ProjectTheme_get_payments_page_url('escrow');
                ?>
" class="green_btn old_mm_k"><?php 
                _e('Deposit Escrow', 'ProjectTheme');
                ?>
</a> </li> 
                <?php 
            }
            ?>
                
               <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('withdraw');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Withdraw Money', 'ProjectTheme');
            ?>
</a> </li> 
               <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('transactions');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Transactions', 'ProjectTheme');
            ?>
</a></li>
               <!-- <li> <a href="<?php 
            echo ProjectTheme_get_payments_page_url('bktransfer');
            ?>
" class="green_btn old_mm_k"><?php 
            _e('Bank Transfer Details', 'ProjectTheme');
            ?>
</a>   </li>  -->
    
                  <?php 
            do_action('ProjectTheme_financial_buttons_main');
            ?>
              
              	</ul>
              
            </div>
            </div>
            
            <!-- ###################### -->
                        <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Pending Withdrawals', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
               
                
         				<?php 
            global $wpdb;
            //----------------
            $s = "select * from " . $wpdb->prefix . "project_withdraw where done='0' and rejected!='1' AND uid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No withdrawals pending yet.', 'ProjectTheme');
            } else {
                echo '<table width="100%">';
                foreach ($r as $row) {
                    echo '<tr>';
                    echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                    echo '<td>' . $row->methods . '</td>';
                    echo '<td>' . $row->payeremail . '</td>';
                    echo '<td><a href="' . ProjectTheme_get_payments_page_url('closewithdrawal', $row->id) . '"
							class="green_btn block">' . __('Close Request', 'ProjectTheme') . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            ?>
                  
               
            </div>
            </div>
            
            
             <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Rejected Withdrawals', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
               
                
         				<?php 
            global $wpdb;
            //----------------
            $s = "select * from " . $wpdb->prefix . "project_withdraw where done='0' and rejected='1' AND uid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('no withdrawals rejected yet.', 'ProjectTheme');
            } else {
                echo '<table width="100%">';
                foreach ($r as $row) {
                    echo '<tr>';
                    echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                    echo '<td>' . $row->methods . '</td>';
                    echo '<td>' . $row->payeremail . '</td>';
                    echo '<td> </td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            ?>
                  
               
            </div>
            </div>
            
            
           <!-- ###################### -->
                        <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e("Pending Incoming Payments", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
                
                
   				<?php 
            $s = "select * from " . $wpdb->prefix . "project_escrow where released='0' AND toid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No payments pending yet.', 'ProjectTheme');
            } else {
                echo '<table width="100%">';
                foreach ($r as $row) {
                    $post = get_post($row->pid);
                    $from = get_userdata($row->fromid);
                    echo '<tr>';
                    echo '<td>' . $from->user_login . '</td>';
                    echo '<td>' . $post->post_title . '</td>';
                    echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            ?>
                  
                
            </div>
            </div>
         
         
                    <!-- ###################### -->
                   
                   <?php 
            if (ProjectTheme_is_user_business($uid)) {
                ?>
                   
                        <div class="clear10"></div>
            
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
                _e('Pending Outgoing Payments', 'ProjectTheme');
                ?>
</div>
            	<div class="box_content">
                
                
      				<?php 
                $s = "select * from " . $wpdb->prefix . "project_escrow where released='0' AND fromid='{$uid}' order by id desc";
                $r = $wpdb->get_results($s);
                if (count($r) == 0) {
                    echo __('No payments pending yet.', 'ProjectTheme');
                } else {
                    echo '<table width="100%">';
                    echo '<tr>';
                    echo '<td><b>' . __('User', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Project', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Date', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Amount', 'ProjectTheme') . '</b></td>';
                    echo '<td><b>' . __('Options', 'ProjectTheme') . '</b></td>';
                    echo '</tr>';
                    foreach ($r as $row) {
                        $post = get_post($row->pid);
                        $from = get_userdata($row->toid);
                        echo '<tr>';
                        echo '<td><a href="' . ProjectTheme_get_user_profile_link($from->ID) . '">' . $from->user_login . '</a></td>';
                        echo '<td><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></td>';
                        echo '<td>' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                        echo '<td>' . ProjectTheme_get_show_price($row->amount) . '</td>';
                        echo '<td><a href="' . ProjectTheme_get_payments_page_url('releasepayment', $row->id) . '" class="green_btn  block">' . __('Release Payment', 'ProjectTheme') . '</a></td>';
                        echo '</tr>';
                    }
                    echo '</table>';
                }
                ?>
                  
               
            </div>
            </div> <?php 
            }
            ?>
        <?php 
        } elseif ($pg == 'escrow') {
            ?>
        
        
        <div class="my_box3">
           
            
            	<div class="box_title"><?php 
            _e('Make Escrow Payment', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
              
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            if (isset($_POST['escrowme'])) {
                $amount = $_POST['amount'];
                $projects = $_POST['projectss'];
                $bid_id = $_POST['bid_id'];
                /*$amount_and_ids = explode(',', $_POST['amount_and_ids']);
                		$amount = $amount_and_ids[0]*1;					*/
                if (!is_numeric($amount) || $amount <= 0) {
                    echo '<div class="newproject_error">' . __('Enter a valid amount.', 'ProjectTheme') . '</div>';
                } else {
                    if (empty($projects)) {
                        echo '<div class="newproject_error">' . __('Please choose a project.', 'ProjectTheme') . '</div>';
                    } else {
                        if ($bal < $amount) {
                            echo '<div class="newproject_error">' . __('Your balance is smaller than the amount requested.', 'ProjectTheme') . '</div>';
                        } else {
                            $post = get_post($projects);
                            //							$uid2   = get_post_meta($projects, "winner", true);
                            $bid = Bid::get_by_id($bid_id);
                            $uid2 = $bid->uid;
                            $tm = $_POST['tm'];
                            if (empty($tm)) {
                                $tm = current_time('timestamp', 0);
                            }
                            if ($post->post_author != $uid) {
                                $uid2 = $post->post_author;
                            }
                            $uid2 = $_POST['uids'];
                            //-----------------------
                            $email = get_bloginfo('admin_email');
                            $site_name = get_bloginfo('name');
                            $usr = get_userdata($uid);
                            $subject = __("Money Escrow Sent", "ProjectTheme");
                            $message = sprintf(__("You have placed in escrow the amount of: %s to user: \n\t\t\t\t\t\t\t<b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $username);
                            //($usr->user_email, $subject , $message);
                            $s = "select * from " . $wpdb->prefix . "project_escrow where datemade='{$tm}' and fromid='{$uid}' AND bid='{$bid->id}'";
                            $rr = $wpdb->get_results($s);
                            if (count($rr) == 0) {
                                $s = "insert into " . $wpdb->prefix . "project_escrow (datemade, amount, fromid, toid, pid, bid) \n\t\t\t\t\t\t\t\tvalues('{$tm}','{$amount}','{$uid}','{$uid2}','{$projects}', '{$bid->id}')";
                                $wpdb->query($s);
                                // for logged in user, the user who sends
                                //======================================================
                                $cr = projectTheme_get_credits($uid);
                                projectTheme_update_credits($uid, $cr - $amount);
                            }
                            //======================================================
                            // for other user, the user who receives
                            //======================================================
                            $usr2 = get_userdata($uid2);
                            $subject = __("Money Escrow Received", "ProjectTheme");
                            $message = sprintf(__("You have received in escrow the amount of: \$ %s from user: <b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $usr->user_login);
                            //($usr2->user_email, $subject , $message);
                            //======================================================
                            echo '<div class="saved_thing">' . __('Your payment has been sent. Redirecting...', 'ProjectTheme') . '</div>';
                            $url_redir = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
                            echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />';
                        }
                    }
                }
            }
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">' . sprintf(__('Your Current Balance is: %s', 'ProjectTheme'), ProjectTheme_get_show_price($bal)) . "</span>";
            echo '&nbsp; <a class="post_bid_btn" href="' . ProjectTheme_get_payments_page_url_redir('deposit') . '">' . __('Add More Credits', 'ProjectTheme') . '</a>';
            echo "<br/><br/>";
            ?>
                
                <script>
				
				function on_proj_sel()
				{
					var sel_value = jQuery("#my_proj_sel").val();
					
					$.post("<?php 
            bloginfo('siteurl');
            ?>
/?get_my_project_vl_thing=1", {queryString: ""+sel_value+""}, function(data){
						if(data.length >0) {
							
							//var currency = '<?php 
            echo ProjectTheme_get_currency();
            ?>
';
							/*jQuery("#my_escrow_amount").html(currency  + data);
							jQuery("#amount").val(data);*/
							jQuery("#win_providers").html(data);
                            on_winner_sel();
							
					
							
						}
					});
				}
                
                function on_winner_sel(){
                    var uid = jQuery('select[name=uids]').val();
                    var bid = jQuery('select[name=uids]').children('option[value='+uid+']').attr('bid');
                    jQuery('#bid_id').val(bid);
                
                }
				
				<?php 
            if (!empty($_GET['poid'])) {
                ?>
						jQuery(function() {
							  on_proj_sel();
							});
						
						<?php 
            }
            ?>

				/*jQuery(document).ready(function(){
					jQuery('#make_esc_providers').submit(function(){
						jQuery("#amount").val(jQuery('#win_providers').val());
					});
				});*/
				
				
				</script>
                
                
    				<br /><br />
                    <form id="make_esc_providers" name="form1" method="post" onsubmit="on_winner_sel(); return vali();" action="">
                    <table>
                    
                    <input type="hidden" value="<?php 
            echo current_time('timestamp', 0);
            ?>
" name="tm" />
                    <tr>
                    <td width="150"><?php 
            _e('Escrow amount', 'ProjectTheme');
            ?>
:</td><td> <input value="0"  
                    size="10" name="amount" id="amount" type="text" /> <!-- <span id="my_escrow_amount"><?php 
            _e('Select your project.', 'ProjectTheme');
            ?>
</span> --></td>
                    </tr>
                    <tr>
                    <td><?php 
            _e('Escrow for Project', 'ProjectTheme');
            ?>
:</td><td> <?php 
            $st = ProjectTheme_get_my_awarded_projects($uid);
            if ($st == false) {
                echo '<strong>' . __('You dont have any awarded projects.', 'ProjectTheme') . '</strong>';
            } else {
                echo $st;
            }
            ?>
</td>
                    </tr>
                    <tr>
                    <td><?php 
            _e('Escrow for<br>QA Engineer', 'ProjectTheme');
            ?>
:</td><td id="win_providers"><input type="text"/></td>
					
                    </tr>
                    
                    <tr>
                    <td> <input hidden id="bid_id" name="bid_id" value=""/> </td>
                    <td>
                    <input type="submit" name="escrowme"   value="<?php 
            _e('Make Escrow', 'ProjectTheme');
            ?>
" /></td></tr></table></form>
    
              
            </div>
            </div> 
			  <!-- ----code  updation----->
                   
                   
                    <script>
					function vali()
					{
					var amount=document.form1.amount.value;
				  var decimal= /^\s*-?[1-9]\d*(\.\d{1,2})?\s*$/;  
				  var am=decimal.test(amount);
				  if(am==false)
				  {
					alert("please enter 2 digit decimal point");
					document.form1.amount.focus();
						return false;
					}
					
					}
					</script>
			
        
        
        <?php 
        } elseif ($pg == 'bktransfer') {
            ?>
        
        
        <div class="my_box3">
        
            
            	<div class="box_title"><?php 
            _e('Set your Bank Transfer Details', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
                
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            if (isset($_POST['bank_details'])) {
                $bank_details = $_POST['bank_details'];
                update_user_meta($uid, 'bank_details', $bank_details);
                echo __("Saved", "ProjectTheme");
            }
            ?>
    				<br /><br />
                    <table>
                    <form method="post">
                    <tr>
                    <td valign="top"><?php 
            _e("Bank details", "ProjectTheme");
            ?>
:</td>
                    <td> <textarea cols="60" name="bank_details" rows="6"><?php 
            echo get_user_meta($uid, 'bank_details', true);
            ?>
</textarea></td>
                    </tr>
                  
                    
                    <tr>
                    <td></td>
                    <td>
                    <input type="submit" name="submit" value="<?php 
            _e("Save Details", "ProjectTheme");
            ?>
" /></td></tr></form></table>
    			
                  
            </div>
            </div> 
        
        
        
        <?php 
        } elseif ($pg == 'makepayment') {
            ?>
        
          <div class="my_box3">
           
            
            	<div class="box_title"><?php 
            echo __("Make Payment", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
             
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            if (isset($_POST['payme'])) {
                $amount = $_POST['amount'];
                $username = $_POST['username'];
                $username_select = $_POST['projectss'];
                if (!is_numeric($amount) || $amount < 0) {
                    echo '<div class="newproject_error">' . __('ERROR: Enter a valid amount.', 'ProjectTheme') . '</div>';
                } else {
                    if (projectTheme_username_is_valid($username) == false && empty($username_select)) {
                        echo '<div class="newproject_error">' . __('ERROR: Invalid username provided.', 'ProjectTheme') . '</div>';
                    } else {
                        if ($username == $current_user->user_login) {
                            echo '<div class="newproject_error">' . __('ERROR: You cannot transfer money to your own account.', 'ProjectTheme') . '</div>';
                        } else {
                            $min = get_option('project_theme_transfer_limit');
                            if (empty($min)) {
                                $min = 1;
                            }
                            if ($bal < $amount) {
                                echo '<div class="newproject_error">' . __('ERROR: Your balance is smaller than the amount requested.', 'ProjectTheme') . '</div>';
                            } else {
                                if ($amount < $min) {
                                    echo '<div class="newproject_error">' . sprintf(__('ERROR: The amount should not be less than %s', 'ProjectTheme'), ProjectTheme_get_show_price($min)) . '.</div>';
                                } else {
                                    $tm = current_time('timestamp', 0);
                                    $uid2 = projectTheme_get_userid_from_username($username);
                                    $usr2 = get_userdata($uid2);
                                    if (!empty($username_select)) {
                                        $uid2 = $username_select;
                                        $usr2 = get_userdata($uid2);
                                        /*$username = $username->user_login;*/
                                    }
                                    // for logged in user, the user who sends
                                    //======================================================
                                    $cr = projectTheme_get_credits($uid);
                                    projectTheme_update_credits($uid, $cr - $amount);
                                    //-----------------------
                                    $email = get_bloginfo('admin_email');
                                    $site_name = get_bloginfo('name');
                                    $usr = get_userdata($uid);
                                    $subject = __("Money Sent", "ProjectTheme");
                                    //$message = sprintf(__("You have sent amount of: %s to user: <b>%s</b>","ProjectTheme")
                                    //$message = sprintf(__('You have sent the amount of $%s to the user <a href="%s">%s</a>','ProjectTheme'), $amount, ProjectTheme_get_user_profile_link($usr2->ID), $usr2->user_login);
                                    $message = sprintf(__('You have sent the amount of $%s to the user %s', 'ProjectTheme'), $amount, $usr2->user_login);
                                    //,ProjectTheme_get_show_price($amount),$usr2->user_login);
                                    ProjectTheme_send_email($usr->user_email, $subject, $message);
                                    $subject = __("Money received", "ProjectTheme");
                                    $message = sprintf(__('You have received amount of: $%s from user %s', 'ProjectTheme'), $amount, $usr->user_login);
                                    //$message = sprintf(__('You have received amount of: $%s from user <a href="%s">%s</a>','ProjectTheme'), $amount, ProjectTheme_get_user_profile_link($usr->ID), $usr->user_login);
                                    //$message = sprintf(__("You have sent amount of: %s to user: <b>%s</b>","ProjectTheme")
                                    //,ProjectTheme_get_show_price($amount),$usr2->user_login);
                                    ProjectTheme_send_email($usr2->user_email, $subject, $message);
                                    //($usr->user_email, $subject , $message);
                                    $reason = sprintf(__('Amount transfered to user <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($usr2->ID), $usr2->user_login);
                                    projectTheme_add_history_log('0', $reason, $amount, $uid, $uid2);
                                    //======================================================
                                    // for other user, the user who receives
                                    //======================================================
                                    $cr = projectTheme_get_credits($uid2);
                                    projectTheme_update_credits($uid2, $cr + $amount);
                                    $subject = __("Money Received", "ProjectTheme");
                                    $message = sprintf(__("You have received amount of: \$ %s from user: <b>%s</b>", "ProjectTheme"), ProjectTheme_get_show_price($amount), $usr->user_login);
                                    //($usr2->user_email, $subject , $message);
                                    $reason = sprintf(__('Amount transfered from user <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($usr->ID), $usr->user_login);
                                    projectTheme_add_history_log('1', $reason, $amount, $uid2, $uid);
                                    //======================================================
                                    echo '<div class="saved_thing">' . __('Your payment has been sent. Redirecting...', 'ProjectTheme') . '</div>';
                                    $url_redir = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
                                    echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" /><br/>';
                                }
                            }
                        }
                    }
                }
            }
            global $current_user;
            get_currentuserinfo();
            $uid = $current_user->ID;
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">' . sprintf(__("Your Current Balance is %s", ""), ProjectTheme_get_show_price($bal)) . ":</span><br/><br/>";
            ?>
    				<br /><br />
                    <table>
                    <form method="post" name="form1" id="form1" onsubmit="return vali();" enctype="application/x-www-form-urlencoded">
                    <tr>
                    <td><?php 
            echo __("Payment amount", "ProjectTheme");
            ?>
:</td>
                    <td> <?php 
            echo projectTheme_currency();
            ?>
<input value="<?php 
            echo $_POST['amount'];
            ?>
" type="text" 
                    size="10" name="amount" id="amount" /> </td>
                    </tr>
                    <tr>
                    <td><?php 
            echo __("Pay to user", "ProjectTheme");
            ?>
:</td>
                    <td><input value="<?php 
            echo $_POST['username'];
            ?>
" type="text" size="30" name="username" /> 
					
                    
					
					<?php 
            $trg = ProjectTheme_get_my_awarded_projects2($uid);
            if ($trg) {
                _e('or', 'ProjectTheme') . " &nbsp; ";
                echo ProjectTheme_get_my_awarded_projects2($uid);
            }
            ?>
</td>
                    </tr>
                    <script type="text/javascript">
                    	$(document).ready(function(){
                    		$('select[name="projectss"]').on("change",function(){
                    			$('input[name="username"]').val($('option[value="'+$(this).val()+'"]').text());
                    		});
                    		$('input[name="username"]').on("change",function(){
                    			$('select[name="projectss"]').val('');
                    		});
                    	});
                        
//                        $(document).ready(function(){
//                            $('#form1').submit(function() {
//                                var text = $('input[name="username"]').val();
//                                var sel = $('select[name="projectss"]').val();
//                                var sel_text = $('option[value="'+$(this).val()+'"]').text();
//                                if (sel != '' && sel_text != text){
//                                    alert("<?php 
            // _e("You cannot send payments to multiple different users at the same time.","ProjectTheme");
            ?>
");
//                                    return false;
//                                }
//                                return true; // return false to cancel form action
//                            });
//                        });
                    </script>
                    <tr>
                    <td></td>
                    <td>
                    <input type="submit" name="payme" value="<?php 
            echo __("Make Payment", "ProjectTheme");
            ?>
" /></td></tr></form></table>
    
              
            </div>
            </div> 
        
              <!-- ----code  updation----->
                   
                   
                    <script>
					function vali()
					{
					var amount=document.form1.amount.value;
				  var decimal= /^\s*-?[1-9]\d*(\.\d{1,2})?\s*$/;  
				  var am=decimal.test(amount);
				  if(am==false)
				  {
					alert("please enter 2 digit decimal point");
					document.form1.amount.focus();
						return false;
					}
					
					}
					</script>
			  
        <?php 
        } elseif ($pg == 'withdraw') {
            ?>
        
        
               <div class="my_box3">
         
            	<div class="box_title"><?php 
            _e("Request Withdrawal", "ProjectTheme");
            ?>
</div>
            	<div class="box_content">
               
                
                
                <?php 
            $bal = projectTheme_get_credits($uid);
            echo '<span class="balance">';
            printf(__('Your Current Balance is: %s', 'ProjectTheme'), ProjectTheme_get_show_price($bal));
            echo "</span><br/><br/>";
            do_action('ProjectTheme_add_new_withdraw_posts');
            if (isset($_POST['withdraw']) or isset($_POST['withdraw2']) or isset($_POST['withdraw3'])) {
                function isDomainAvailible($domain)
                {
                    if (!filter_var($domain, FILTER_VALIDATE_URL)) {
                        return false;
                    }
                    $curlInit = curl_init($domain);
                    curl_setopt($curlInit, CURLOPT_CONNECTTIMEOUT, 10);
                    curl_setopt($curlInit, CURLOPT_HEADER, true);
                    curl_setopt($curlInit, CURLOPT_NOBODY, true);
                    curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true);
                    $response = curl_exec($curlInit);
                    curl_close($curlInit);
                    if ($response) {
                        return true;
                    }
                    return false;
                }
                $amount = $_POST['amount'];
                $paypal = $_POST['paypal'];
                $meth = $_POST['meth'];
                if (isset($_POST['withdraw2'])) {
                    $amount = $_POST['amount2'];
                    $paypal = $_POST['paypal2'];
                    $meth = $_POST['meth2'];
                }
                if (isset($_POST['withdraw3'])) {
                    $amount = $_POST['amount3'];
                    $paypal = $_POST['paypal3'];
                    $meth = $_POST['meth3'];
                }
                $em_dom = strstr(trim($paypal), '@');
                $em_dom = str_replace('@', '', $em_dom);
                if (!is_numeric($amount) || $amount < 0) {
                    echo '<br/><span class="newproject_error">' . __('Enter a valid amount.', 'ProjectTheme') . '</span><br/>';
                } else {
                    if (project_isValidEmail($paypal) == false && !isDomainAvailible($em_dom)) {
                        echo '<br/><span class="newproject_error">' . __('Invalid email provided.', 'ProjectTheme') . '</span><br/>';
                    } else {
                        $min = get_option('project_theme_min_withdraw');
                        if (empty($min)) {
                            $min = 25;
                        }
                        if ($bal < $amount) {
                            echo '<br/><span class="newproject_error">' . __('Your balance is smaller than the amount requested.', 'ProjectTheme') . '</span><br/>';
                        } else {
                            if ($amount < $min) {
                                echo '<br/><span class="newproject_error">' . sprintf(__('The amount should not be less than %s', 'ProjectTheme'), projecttheme_get_show_price($min)) . '.</span><br/>';
                            } else {
                                $tm = current_time('timestamp', 0);
                                global $wpdb;
                                $wpdb->show_errors = true;
                                if (!empty($_POST['tm'])) {
                                    $tm = $_POST['tm'];
                                    //current_time('timestamp',0);
                                }
                                $s = "select * from " . $wpdb->prefix . "project_withdraw where uid='{$uid}' and datemade='{$tm}' ";
                                $r = $wpdb->get_results($s);
                                if (count($r) == 0) {
                                    $s = "insert into " . $wpdb->prefix . "project_withdraw (methods, payeremail, amount, datemade, uid, done) \n\t\t\t\t\t\t\t\tvalues('{$meth}','{$paypal}','{$amount}','{$tm}','{$uid}','0')";
                                    $wpdb->query($s);
                                    if (!empty($wpdb->last_error)) {
                                        echo $wpdb->last_error;
                                        exit;
                                    }
                                    $cr = projectTheme_get_credits($uid);
                                    projectTheme_update_credits($uid, $cr - $amount);
                                }
                                //-----------------------
                                $email = get_bloginfo('admin_email');
                                $site_name = get_bloginfo('name');
                                $usr = get_userdata($uid);
                                $subject = __("Money Withdraw Requested", "ProjectTheme");
                                $message = sprintf(__("You have requested a new withdrawal of: %s", "ProjectTheme"), $amount . " " . projectTheme_currency());
                                //($usr->user_email, $subject , $message);
                                //-----------------------
                                echo '<div class="saved_thing">' . __('Your request has been queued. Redirecting...', 'ProjectTheme') . '</div>';
                                $url_redir = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
                                echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />';
                            }
                        }
                    }
                }
            }
            global $current_user;
            get_currentuserinfo();
            $uid = $current_user->ID;
            $opt = get_option('ProjectTheme_paypal_enable');
            if ($opt == "yes") {
                ?>
    				<br /><br />
                   <!-- ----code  updation----->
                   
                   
                    <script>
					function vali()
					{
					var amount=document.form1.amount.value;
				  var decimal= /^\s*-?[1-9]\d*(\.\d{1,2})?\s*$/;  
				  var am=decimal.test(amount);
				  if(am==false)
				  {
					alert("please enter 2 digit decimal point");
					document.form1.amount.focus();
						return false;
					}
					
					}
					</script>
                    
                    <table>
                  <form method="post" enctype="application/x-www-form-urlencoded" action="" name="form1" id="form1" onsubmit="return vali();">
                    <input type="hidden" name="meth" value="PayPal" />
                    <input type="hidden" name="tm" value="<?php 
                echo current_time('timestamp', 0);
                ?>
" />
                    <tr>
                    <td><?php 
                echo __("Withdraw amount", "ProjectTheme");
                ?>
:</td>
                    <td> <?php 
                echo projectTheme_currency();
                ?>
 <input value="<?php 
                echo $_POST['amount'];
                ?>
" type="text" 
                    size="10" name="amount" id="amount" /></td>
                    </tr>
                    <tr>
                    <td><?php 
                echo __("PayPal Email", "ProjectTheme");
                ?>
:</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 
                echo __("Withdraw", "ProjectTheme");
                ?>
" /></td></tr></form></table>
                      <!-- ---- end code  updation----->
                    <?php 
            }
            $opt = get_option('ProjectTheme_moneybookers_enable');
            if ($opt == "yes") {
                ?>
                        <br /><br />
                        <table>
                        <form method="post" name="form1" enctype="application/x-www-form-urlencoded" onsubmit="raturn vali();">
                        <input type="hidden" name="meth2" value="Moneybookers" />
                        <input type="hidden" name="tm" value="<?php 
                echo current_time('timestamp', 0);
                ?>
" />
                        <tr>
                        <td><?php 
                echo __("Withdraw amount", "ProjectTheme");
                ?>
:</td>
                        <td><?php 
                echo projectTheme_currency();
                ?>
 <input value="<?php 
                echo $_POST['amount2'];
                ?>
" type="text" 
                        size="10" name="amount2" id="amount" /> </td>
                        </tr>
                        <tr>
                        <td><?php 
                echo __("Moneybookers Email", "ProjectTheme");
                ?>
:</td>
                        <td><input value="<?php 
                echo get_user_meta($uid, 'moneybookers_email', true);
                ?>
" type="text" size="30" name="paypal2" /></td>
                        </tr>
                        
                        <tr>
                        <td></td>
                        <td>
                        <input type="submit" name="withdraw2" value="<?php 
                echo __("Withdraw", "ProjectTheme");
                ?>
" /></td></tr></form></table>
    				  <!-- ----code  updation----->
                   
                   
                    <script>
					function vali()
					{
					var amount=document.form1.amount.value;
				  var decimal= /^\s*-?[1-9]\d*(\.\d{1,2})?\s*$/;  
				  var am=decimal.test(amount);
				  if(am==false)
				  {
					alert("please enter 2 digit decimal point");
					document.form1.amount.focus();
						return false;
					}
					
					}
					</script>
			
					<?php 
            }
            $opt = get_option('ProjectTheme_alertpay_enable');
            if ($opt == "yes") {
                ?>
                        <br /><br />
                        <table>
                        <form method="post" name="form1" id="form1" onsubmit="return vali();" enctype="application/x-www-form-urlencoded">
                        <input type="hidden" name="meth3" value="Payza" />
                        <tr>
                        <td><?php 
                echo __("Withdraw amount", "ProjectTheme");
                ?>
:</td>
                        <td>  <?php 
                echo projectTheme_currency();
                ?>
<input value="<?php 
                echo $_POST['amount3'];
                ?>
" type="text" 
                        size="10" name="amount3" id="amount"/></td>
                        </tr>
                        <tr>
                        <td><?php 
                echo __("Payza Email", "ProjectTheme");
                ?>
:</td>
                        <td><input value="<?php 
                echo get_user_meta($uid, 'payza_email', true);
                ?>
" type="text" size="30" name="paypal3" /></td>
                        </tr>
                        
                        <tr>
                        <td></td>
                        <td>
                        <input type="submit" name="withdraw3" value="<?php 
                echo __("Withdraw", "ProjectTheme");
                ?>
" /></td></tr></form></table>
    				
					<?php 
            }
            ?>
					
					
               <?php 
            do_action('ProjectTheme_add_new_withdraw_methods');
            ?>
	
               
            </div>
            </div>
            
        
            
        <?php 
        } elseif ($pg == 'deposit') {
            global $USERID;
            $USERID = $uid;
            ?>
        
        
    
        <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Deposit Money', 'ProjectTheme');
            ?>
</div>
            	<div class="box_content">
                
                <?php 
            $ProjectTheme_bank_details_enable = get_option('ProjectTheme_bank_details_enable');
            if ($ProjectTheme_bank_details_enable == "yes") {
                ?>
                
                <strong><?php 
                _e('Deposit money by Bank Transfer', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <?php 
                echo get_option('ProjectTheme_bank_details_txt');
                ?>
    			<br/><br/>
                <?php 
            }
            ?>
                
                
            	<?php 
            $ProjectTheme_paypal_enable = get_option('ProjectTheme_paypal_enable');
            if ($ProjectTheme_paypal_enable == "yes") {
                ?>
                
                <strong><?php 
                _e('Deposit money by PayPal', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <form method="post" name="form1" id="form1" onsubmit="return vali();" action="<?php 
                bloginfo('siteurl');
                ?>
/?p_action=paypal_deposit_pay">
                <?php 
                _e("Amount to deposit:", "ProjectTheme");
                ?>
 <?php 
                echo projectTheme_currency();
                ?>
 <input type="text" size="10" name="amount" id="amount" /> 
                &nbsp; &nbsp; <input type="submit" name="deposit" value="<?php 
                _e('Deposit', 'ProjectTheme');
                ?>
" /></form>
    			<br/><br/>    			
                <?php 
            }
            ?>
                <!-- ################## -->
                  <!-- ----code  updation----->
                   
                   
                    <script>
					function vali()
					{
					var amount=document.form1.amount.value;
				  var decimal= /^\s*-?[1-9]\d*(\.\d{1,2})?\s*$/;  
				  var am=decimal.test(amount);
				  if(am==false)
				  {
					alert("please enter 2 digit decimal point");
					document.form1.amount.focus();
						return false;
					}
					
					}
					</script>
			
                <?php 
            $ProjectTheme_alertpay_enable = get_option('ProjectTheme_alertpay_enable');
            if ($ProjectTheme_alertpay_enable == "yes") {
                ?>
                
                <strong><?php 
                _e('Deposit money by Payza', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <form method="post" name="form1" id="form1" onsubmit="return vali();" action="<?php 
                bloginfo('siteurl');
                ?>
/?p_action=payza_deposit_pay">
                <?php 
                _e("Amount to deposit:", "ProjectTheme");
                ?>
 <?php 
                echo projectTheme_currency();
                ?>
 <input type="text" size="10" name="amount" /> 
                &nbsp; &nbsp; <input type="submit" name="deposit" value="<?php 
                _e('Deposit', 'ProjectTheme');
                ?>
" /></form>
    			<br/><br/>
                <?php 
            }
            ?>
                
                
                
                <?php 
            $ProjectTheme_moneybookers_enable = get_option('ProjectTheme_moneybookers_enable');
            if ($ProjectTheme_moneybookers_enable == "yes") {
                ?>
                
                
                <strong><?php 
                _e('Deposit money by Moneybookers', 'ProjectTheme');
                ?>
</strong><br/><br/>
                
                <form method="post" name="form1" id="form1"  onsubmit="return vali();" action="<?php 
                bloginfo('siteurl');
                ?>
/?p_action=mb_deposit_pay">
                <?php 
                _e("Amount to deposit:", "ProjectTheme");
                ?>
 <?php 
                echo projectTheme_currency();
                ?>
 <input type="text" size="10" name="amount" id="amount" /> 
                &nbsp; &nbsp; <input type="submit" name="deposit" value="<?php 
                _e('Deposit', 'ProjectTheme');
                ?>
" /></form>
    			<br/><br/>
                <?php 
            }
            ?>
                
    			<?php 
            do_action('ProjectTheme_deposit_methods', $uid);
            ?>
               
            </div>
            </div>
        
        <?php 
        } elseif ($pg == 'transactions') {
            ?>
	
		
        		
            <div class="my_box3">
            
            
            	<div class="box_title"><?php 
            _e('Payment Transactions', 'ProjectTheme');
            ?>
 </div>
            	<div class="box_content">
            
                
                <?php 
            $s = "select * from " . $wpdb->prefix . "project_payment_transactions where uid='{$uid}' order by id desc";
            $r = $wpdb->get_results($s);
            if (count($r) == 0) {
                echo __('No activity yet.', 'ProjectTheme');
            } 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_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                    echo '<td width="20%" class="' . $class . '"><b>' . $sign . ProjectTheme_get_show_price($row->amount) . '</b></td>';
                    echo '</tr>';
                    $i++;
                }
                echo '</table>';
            }
            ?>
    
                 
            </div>
            </div>
        <?php 
        }
    }
    ?>
            
            
                
        </div> <!-- end dif content -->

    		

        <script type="text/javascript">
		
		
		
		
		
		
		
		
		
		
        	$(document).ready(function(){
            		$('input[name="deposit"]').click(function(ev){
            			ev.preventDefault();
            			var amount = $(this).parent().find('input[name="amount"]').val();
            			console.log(amount);
            			if (amount>0){
    						
            				$(this).parent().submit();
            			}
            			else{
            				$(this).prev().css('border-color','red');
            			}
    				});

            		$( 'input[name="amount"]' ).keypress(function( event ) {
            		  var kk = event.which;
            		  console.log(kk);
            		  
            		  if((kk>47 && kk<58) || kk==13 || kk==0 || kk==8 || kk==46){
            		  	return true;
            		  }
            		  else{
            		  	return false;
            		  }
            		  
            		});
            	});
        </script>
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Exemplo n.º 10
0
"><?php 
            echo __('Add More Credits', 'ProjectTheme');
            ?>
</a>
							</div>
                    
							<?php 
        }
    } else {
        $paid_mem_date = get_user_meta($uid, "paid_mem_date" . $tm . $uid, true);
        //if(empty($paid_mem_date))
        //{
        $tm = current_time('timestamp', 0);
        update_user_meta($uid, 'membership_available', $tm + 24 * 30 * 3600);
        update_user_meta($uid, "paid_mem_date" . $tm . $uid, '1');
        projectTheme_update_credits($uid, $cr - $total);
        $reason = sprintf(__('Payment for membership', 'ProjectTheme'));
        projectTheme_add_history_log('0', $reason, $amount, $uid);
        //-----------------------
        $projectTheme_monthly_nr_of_bids = get_option('projectTheme_monthly_nr_of_bids');
        if (empty($projectTheme_monthly_nr_of_bids)) {
            $projectTheme_monthly_nr_of_bids = 10;
        }
        update_user_meta($uid, 'projectTheme_monthly_nr_of_bids', $projectTheme_monthly_nr_of_bids);
        //--------------------------------------------
        $projectTheme_monthly_nr_of_projects = get_option('projectTheme_monthly_nr_of_projects');
        if (empty($projectTheme_monthly_nr_of_projects)) {
            $projectTheme_monthly_nr_of_projects = 10;
        }
        update_user_meta($uid, 'projectTheme_monthly_nr_of_projects', $projectTheme_monthly_nr_of_projects);
        //}
Exemplo n.º 11
0
function ProjectTheme_vgspay_deposit_response()
{
    $fch = "demo-1400243125";
    if (1) {
        //isset($_POST['transaction_id'])){
        //get the full transaction details as an xml from voguepay
        $xml = 'https://voguepay.com/?v_transaction_id=demo-1400243125';
        //parse our new xml
        //$xml_elements = new SimpleXMLElement($xml);
        //create new array to store our transaction detail
        //************************************************************************
        // Set the URL to visit
        $url = $xml;
        // In this example we are referring to a page that handles xml
        $headers = array("Content-Type: text/xml");
        // Initialise Curl
        $curl = curl_init();
        if ($curl === false) {
            throw new Exception(' cURL init failed');
        }
        // Configure curl for website
        curl_setopt($curl, CURLOPT_URL, $xml);
        // Set up to view correct page type
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        // Turn on SSL certificate verfication
        curl_setopt($curl, CURLOPT_CAPATH, "/usr/local/www/vhosts/<yourdomainname>/httpdocs/cacert.pem");
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
        // Tell the curl instance to talk to the server using HTTP POST
        curl_setopt($curl, CURLOPT_POST, 1);
        // 1 second for a connection timeout with curl
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        // Try using this instead of the php set_time_limit function call
        curl_setopt($curl, CURLOPT_TIMEOUT, 60);
        // Causes curl to return the result on success which should help us avoid using the writeback option
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec($curl);
        if ($result == false) {
            echo "errorare";
        }
        echo curl_error($curl) . "|" . curl_errno($curl) . "|";
        //*****************************************
        echo "Asd" . $result;
        exit;
        $transaction = array();
        //loop through the $xml_elements and populate our $transaction array
        foreach ($xml_elements as $key => $value) {
            $transaction[$key] = $value;
        }
        /*
        Now we have the following keys in our $transaction array
        $transaction['merchant_id'],
        $transaction['transaction_id'],
        $transaction['email'],
        $transaction['total'], 
        $transaction['merchant_ref'], 
        $transaction['memo'],
        $transaction['status'],
        $transaction['date'],
        $transaction['referrer'],
        $transaction['method']
        */
        //if($transaction['total'] == 0)die('Invalid total');
        //if($transaction['status'] != 'Approved')die('Failed transaction');
        //------------------------------------------
        $c = $transaction['merchant_ref'];
        $c = explode('|', $c);
        $uid = $c[0];
        $tm = $c[1];
        //-------------------
        $mc_gross = $transaction['total'];
        $cr = projectTheme_get_credits($uid);
        projectTheme_update_credits($uid, $mc_gross + $cr);
        update_option('ProjectTheme_deposit_' . $uid . $datemade, "1");
        $reason = __("Deposit through Voguepay.", "pt_gateways");
        projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
        $user = get_userdata($uid);
        mail("*****@*****.**", "vgspay", print_r($transaction, true));
        /*You can do anything you want now with the transaction details or the merchant reference.
        		You should query your database with the merchant reference and fetch the records you saved for this transaction.
        		Then you should compare the $transaction['total'] with the total from your database.*/
    }
}
Exemplo n.º 12
0
function projecthtme_ryuj_templ_redir()
{
    global $wp_query;
    $p_action = $wp_query->query_vars['p_action'];
    if ($p_action == "ruj_listing") {
        ProjectTheme_ruj_listing_payment();
        die;
    }
    if ($p_action == "ruj_pay") {
        ProjectTheme_ruj_deposit_payment();
        die;
    }
    if (isset($_GET['notif_ruj_listing'])) {
        if ($_POST['tr_error'] == "none") {
            $tr_crc = $_POST['tr_crc'];
            $opt = get_option('order_listing_' . $tr_crc);
            $c = explode('_', $opt);
            $pid = $c[0];
            $uid = $c[1];
            $datemade = $c[2];
            //---------------------------------------------------
            global $wpdb;
            $pref = $wpdb->prefix;
            //--------------------------------------------
            update_post_meta($pid, "paid", "1");
            update_post_meta($pid, "paid_listing_date", current_time('timestamp', 0));
            update_post_meta($pid, "closed", "0");
            //--------------------------------------------
            update_post_meta($pid, 'base_fee_paid', '1');
            $featured = get_post_meta($pid, 'featured', true);
            if ($featured == "1") {
                update_post_meta($pid, 'featured_paid', '1');
            }
            $private_bids = get_post_meta($pid, 'private_bids', true);
            if ($private_bids == "1") {
                update_post_meta($pid, 'private_bids_paid', '1');
            }
            $hide_project = get_post_meta($pid, 'hide_project', true);
            if ($hide_project == "1") {
                update_post_meta($pid, 'hide_project_paid', '1');
            }
            //--------------------------------------------
            do_action('ProjectTheme_moneybookers_listing_response', $pid);
            $projectTheme_admin_approves_each_project = get_option('projectTheme_admin_approves_each_project');
            if ($projectTheme_admin_approves_each_project != "yes") {
                wp_publish_post($pid);
                $post_new_date = date('Y-m-d h:s', current_time('timestamp', 0));
                $post_info = array("ID" => $pid, "post_date" => $post_new_date, "post_date_gmt" => $post_new_date, "post_status" => "publish");
                wp_update_post($post_info);
                ProjectTheme_send_email_posted_project_approved($pid);
                ProjectTheme_send_email_posted_project_approved_admin($pid);
            } else {
                ProjectTheme_send_email_posted_project_not_approved($pid);
                ProjectTheme_send_email_posted_project_not_approved_admin($pid);
                ProjectTheme_send_email_subscription($pid);
            }
        }
        //---------------------------
        echo 'TRUE';
        die;
    }
    if (isset($_GET['notif_ruj_deposit'])) {
        if ($_POST['tr_error'] == "none") {
            $tr_crc = $_POST['tr_crc'];
            $opt = get_option('order_dep_' . $tr_crc);
            $opt1 = get_option('order_dep_11' . $tr_crc);
            if (empty($opt1)) {
                $cust = explode("_", $opt);
                $uid = $cust[0];
                $datemade = $cust[1];
                update_option('order_dep_11' . $tr_crc, 'done');
                $mc_gross = $_POST['tr_paid'];
                $cr = projectTheme_get_credits($uid);
                projectTheme_update_credits($uid, $mc_gross + $cr);
                $reason = __("Deposit through Trasnferuj.pl.", "ProjectTheme");
                projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
            }
        }
        echo 'TRUE';
        die;
    }
}
Exemplo n.º 13
0
function ProjectTheme_payfast_deposit_response()
{
    $c = $_POST['custom_str1'];
    $c = explode('|', $c);
    $uid = $c[0];
    $tm = $c[1];
    //-------------------
    $mc_gross = $_POST['amount_net'];
    $cr = projectTheme_get_credits($uid);
    projectTheme_update_credits($uid, $mc_gross + $cr);
    update_option('ProjectTheme_deposit_' . $uid . $datemade, "1");
    $reason = __("Deposit through Payfast.", "pt_gateways");
    projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
    $user = get_userdata($uid);
}
Exemplo n.º 14
0
function projecttheme_deposit_payza_resp()
{
    $c = $_POST['apc_1'];
    $c = explode('|', $c);
    $uid = $c[0];
    $datemade = $c[1];
    //---------------------------------------------------
    $amount = $_POST['ap_amount'];
    $op = get_option('ProjectTheme_deposit_' . $uid . $datemade);
    if ($op != "1") {
        $mc_gross = $amount;
        $cr = projectTheme_get_credits($uid);
        projectTheme_update_credits($uid, $mc_gross + $cr);
        update_option('ProjectTheme_deposit_' . $uid . $datemade, "1");
        $reason = __("Deposit through Payza.", "ProjectTheme");
        projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
        $user = get_userdata($uid);
        //-------------------------------
    }
}
Exemplo n.º 15
0
function ProjectTheme_pesapal_deposit_answer()
{
    include_once 'oauth.php';
    $consumer_key = get_option('ProjectTheme_pesapal_key');
    //Register a merchant account on
    //demo.pesapal.com and use the merchant key for testing.
    //When you are ready to go live make sure you change the key to the live account
    //registered on www.pesapal.com!
    $consumer_secret = get_option('ProjectTheme_pesapal_secret');
    // Use the secret from your test
    //account on demo.pesapal.com. When you are ready to go live make sure you
    //change the secret to the live account registered on www.pesapal.com!
    $statusrequestAPI = 'https://www.pesapal.com/api/querypaymentstatus';
    //http://demo.pesapal.com/api/querypaymentstatus';//change to
    //https://www.pesapal.com/api/querypaymentstatus' when you are ready to go live!
    if (get_option('ProjectTheme_working_mode') == "test") {
        $statusrequestAPI = 'http://demo.pesapal.com/api/querypaymentstatus';
    }
    // Parameters sent to you by PesaPal IPN
    $pesapalNotification = $_GET['pesapal_notification_type'];
    $pesapalTrackingId = $_GET['pesapal_transaction_tracking_id'];
    $pesapal_merchant_reference = $_GET['pesapal_merchant_reference'];
    if ($pesapalTrackingId != '') {
        $token = $params = NULL;
        $consumer = new OAuthConsumer($consumer_key, $consumer_secret);
        $signature_method = new OAuthSignatureMethod_HMAC_SHA1();
        //get transaction status
        $request_status = OAuthRequest::from_consumer_and_token($consumer, $token, "GET", $statusrequestAPI, $params);
        $request_status->set_parameter("pesapal_merchant_reference", $pesapal_merchant_reference);
        $request_status->set_parameter("pesapal_transaction_tracking_id", $pesapalTrackingId);
        $request_status->sign_request($signature_method, $consumer, $token);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $request_status);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        if (defined('CURL_PROXY_REQUIRED')) {
            if (CURL_PROXY_REQUIRED == 'True') {
                $proxy_tunnel_flag = defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE' ? false : true;
                curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
                curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
                curl_setopt($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
            }
        }
        $response = curl_exec($ch);
        $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
        $raw_header = substr($response, 0, $header_size - 4);
        $headerArray = explode("\r\n\r\n", $raw_header);
        $header = $headerArray[count($headerArray) - 1];
        //transaction status
        $elements = preg_split("/=/", substr($response, $header_size));
        $status = $elements[1];
        curl_close($ch);
        //UPDATE YOUR DB TABLE WITH NEW STATUS FOR TRANSACTION WITH pesapal_transaction_tracking_id $pesapalTrackingId
        $opt = get_option('prs_pesa_' . $pesapal_merchant_reference);
        $cust = $opt;
        $cust = explode("|", $cust);
        $uid = $cust[0];
        $datemade = $cust[1];
        if (1) {
            //$payment_status == "Completed"):
            $mc_gross = get_option('amnt_pesa_' . $pesapal_merchant_reference);
            //$_POST['amount_net']; // - $_POST['mc_fee'];
            //-----------------------------------------------------
            global $wpdb;
            $pref = $wpdb->prefix;
            if (count($r1) == 0) {
                $cr = projectTheme_get_credits($uid);
                projectTheme_update_credits($uid, $mc_gross + $cr);
                update_option('ProjectTheme_deposit_' . $uid . $datemade, "1");
                $reason = __("Deposit through PesaPal.", "pt_gateways");
                projectTheme_add_history_log('1', $reason, $mc_gross, $uid);
                $user = get_userdata($uid);
            }
        }
        wp_redirect(get_bloginfo('siteurl'));
    }
}