コード例 #1
0
ファイル: user-profile.php プロジェクト: simplix-fr/o-g
 $query = "select * from " . $wpdb->prefix . "project_ratings where touser='******' AND awarded='1' order by id desc limit 5";
 $r = $wpdb->get_results($query);
 if (count($r) > 0) {
     echo '<table width="100%">';
     echo '<tr>';
     echo '<th>&nbsp;</th>';
     echo '<th><b>' . __('Project Title', 'ProjectTheme') . '</b></th>';
     echo '<th><b>' . __('From User', 'ProjectTheme') . '</b></th>';
     echo '<th><b>' . __('Aquired on', 'ProjectTheme') . '</b></th>';
     echo '<th><b>' . __('Price', 'ProjectTheme') . '</b></th>';
     echo '<th><b>' . __('Rating', 'ProjectTheme') . '</b></th>';
     echo '</tr>';
     foreach ($r as $row) {
         $post = $row->pid;
         $post = get_post($post);
         $bid = projectTheme_get_winner_bid($row->pid);
         $user = get_userdata($row->fromuser);
         echo '<tr>';
         echo '<th><img class="img_class" src="' . ProjectTheme_get_first_post_image($row->pid, 42, 42) . '" 
                             alt="' . $post->post_title . '" width="42" /></th>';
         echo '<th><a href="' . get_permalink($row->pid) . '">' . $post->post_title . '</a></th>';
         echo '<th><a href="' . ProjectTheme_get_user_profile_link($user->user_login) . '">' . $user->user_login . '</a></th>';
         echo '<th>' . date('d-M-Y H:i:s', get_post_meta($row->pid, 'closed_date', true)) . '</th>';
         echo '<th>' . projectTheme_get_show_price($bid->bid) . '</th>';
         echo '<th>' . ProjectTheme_get_project_stars(floor($row->grade / 2)) . ' (' . floor($row->grade / 2) . '/5)</th>';
         echo '</tr>';
         echo '<tr>';
         echo '<th></th>';
         echo '<th colspan="5"><b>' . __('Comment', 'ProjectTheme') . ':</b> ' . $row->comment . '</th>';
         echo '</tr>';
         echo '<tr><th colspan="6"><hr color="#eee" /></th></tr>';
コード例 #2
0
ファイル: payments.php プロジェクト: roberto95117/auction
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 
}
コード例 #3
0
<?php

global $wp_query, $wpdb;
$pid = $wp_query->query_vars['pid'];
global $current_user, $wpdb;
get_currentuserinfo();
$uid = $current_user->ID;
$bid = projectTheme_get_winner_bid($pid);
$total = $bid->bid;
$projectplugin_signature = get_option('project_theme_signature');
$projectplugin_apipass = get_option('project_theme_apipass');
$projectplugin_apiuser = get_option('project_theme_apiuser');
$projectplugin_appid = get_option('project_theme_appid');
$signature = $projectplugin_signature;
$api_pass = $projectplugin_apipass;
$api_user = $projectplugin_apiuser;
$apiid = $projectplugin_appid;
//------------------------------------------------------------------------
$pmnt_id = time() . $pid;
$ret = get_bloginfo('siteurl') . "/?return_chained=" . $pmnt_id;
$receiver_user_id = $bid->uid;
$fee = get_option('projectTheme_fee_after_paid');
if (empty($fee)) {
    die('ERROR. Please specify an amount for the percent taken by admin for each project.');
}
//-------------------------------------------------------------------------
$adminfee = $total * ($fee * 0.01);
$receiver1 = get_option('ProjectTheme_paypal_email');
if (empty($receiver1)) {
    die('ERROR. The site admin has no paypal email defined.');
}
コード例 #4
0
ファイル: admin_menu.php プロジェクト: simplix-fr/o-g
function projectTheme_orders()
{
    global $menu_admin_project_theme_bull;
    echo '<div class="wrap">';
    echo '<div class="icon32" id="icon-options-general-orders"><br/></div>';
    echo '<h2 class="my_title_class_sitemile">ProjectTheme Orders</h2>';
    if (isset($_GET['mark_delivered'])) {
        $tm = current_time('timestamp', 0);
        $pid = $_GET['mark_delivered'];
        update_post_meta($pid, 'mark_coder_delivered', "1");
        update_post_meta($pid, 'mark_coder_delivered_date', $tm);
        $winner_bd = projectTheme_get_winner_bid($pid);
        //------------------------------------------------------------------------------
        ProjectTheme_send_email_on_delivered_project_to_bidder($pid, $winner_bd->uid);
        ProjectTheme_send_email_on_delivered_project_to_owner($pid);
        echo '<div class="saved_thing">Marked Delivered!</div>';
    }
    if (isset($_GET['mark_completed'])) {
        $tm = current_time('timestamp', 0);
        $pid = $_GET['mark_completed'];
        $pstpst = get_post($pid);
        update_post_meta($pid, 'mark_seller_accepted', "1");
        update_post_meta($pid, 'mark_seller_accepted_date', $tm);
        update_post_meta($pid, 'outstanding', "0");
        update_post_meta($pid, 'delivered', "1");
        //update_post_meta($pid, 'paid_user',		"1");
        //------------------------------------------------------------------------------
        ProjectTheme_send_email_on_completed_project_to_bidder($pid, $pstpst->post_author);
        ProjectTheme_send_email_on_completed_project_to_owner($pid);
        echo '<div class="saved_thing">Marked Completed!</div>';
    }
    if (isset($_GET['mark_paid'])) {
        $tm = current_time('timestamp', 0);
        $pid = $_GET['mark_paid'];
        update_post_meta($pid, 'paid_user_date', $tm);
        update_post_meta($pid, 'paid_user', "1");
        echo '<div class="saved_thing">Marked Paid!</div>';
    }
    ?>
    
        <div id="usual2" class="usual"> 
  <ul> 
    <li><a href="#tabs1">Open Orders</a></li> 
    <li><a href="#tabs2">Delivered Orders</a></li>
    <li><a href="#tabs3">Completed Orders</a></li>
    <li><a href="#tabs4">Paid Orders</a></li>
    <!-- <li><a href="#tabs4">Failed &amp; Disputed Orders</a></li> -->
    <?php 
    do_action('ProjectTheme_main_menu_orders_tabs');
    ?>
  </ul> 
  <div id="tabs1" style="display: none; ">
    	<?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $outstanding = array('key' => 'outstanding', 'value' => "1", 'compare' => '=');
    $winner = array('key' => 'winner', 'value' => 0, 'compare' => '!=');
    $delivered2 = array('key' => 'delivered', 'value' => "1", 'compare' => '!=');
    $mark_coder_delivered = array('key' => 'mark_coder_delivered', 'value' => "1", 'compare' => '!=');
    $pj = $_GET['pj1'];
    if (empty($_GET['pj1'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'order' => 'DESC', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($outstanding, $winner, $delivered2, $mark_coder_delivered));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Expected Delivery</th>';
        echo '<th>Options</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bidsa = $bid;
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'expected_delivery', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th><a href="' . get_admin_url() . 'admin.php?page=orders&pj1=' . $pj . '&mark_delivered=' . get_the_ID() . '">Mark Delivered</a></th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj1=' . $i . '">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no outstanding projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
        
          </div> 
        
        
        <div id="tabs2" style="display: none; ">
        
        <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $delivered = array('key' => 'mark_coder_delivered', 'value' => "1", 'compare' => '=');
    $mark_seller_accepted = array('key' => 'mark_seller_accepted', 'value' => "1", 'compare' => '!=');
    $paid = array('key' => 'paid_user', 'value' => "0", 'compare' => '=');
    $pj = $_GET['pj2'];
    if (empty($_GET['pj2'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($delivered, $paid, $mark_seller_accepted));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Delivered On</th>';
        echo '<th>Options</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'mark_coder_delivered_date', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th><a href="' . get_admin_url() . 'admin.php?page=orders&pj2=' . $pj . '&active_tab=tabs2&mark_completed=' . get_the_ID() . '">Mark Completed</a></th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj2=' . $i . '&active_tab=tabs2">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no delivered projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
        
        </div> 
       
       
        
        
         <div id="tabs3" style="display: none; ">
         
         
         <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $delivered = array('key' => 'mark_seller_accepted', 'value' => "1", 'compare' => '=');
    $delivered2 = array('key' => 'delivered', 'value' => "1", 'compare' => '=');
    $paid = array('key' => 'paid_user', 'value' => "0", 'compare' => '=');
    $pj = $_GET['pj3'];
    if (empty($_GET['pj3'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($delivered, $delivered2, $paid));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Completed On</th>';
        echo '<th>Options</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'mark_seller_accepted_date', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $paid_user = get_post_meta(get_the_ID(), 'paid_user', true);
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th>' . '<a href="' . get_admin_url() . 'admin.php?active_tab=tabs3&page=orders&pj3=' . $pj . '&mark_paid=' . get_the_ID() . '">Mark Paid</a>' . '</th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj3=' . $i . '&active_tab=tabs3">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no completed projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
         
         
         </div> 
         
         
         
         
         <div id="tabs4" style="display: none; ">
         
         
         <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $delivered = array('key' => 'mark_seller_accepted', 'value' => "1", 'compare' => '=');
    $delivered2 = array('key' => 'delivered', 'value' => "1", 'compare' => '=');
    $paid = array('key' => 'paid_user', 'value' => "1", 'compare' => '=');
    $pj = $_GET['pj4'];
    if (empty($_GET['pj4'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($delivered, $delivered2, $paid));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Completed On</th>';
        echo '<th>Paid On</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'mark_seller_accepted_date', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $paid_user = get_post_meta(get_the_ID(), 'paid_user', true);
            $paid_user_date = get_post_meta(get_the_ID(), 'paid_user_date', true);
            if (!empty($paid_user_date)) {
                $paid_user_date = date_i18n('d-M-Y H:i:s', $paid_user_date);
            }
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th>' . $paid_user_date . '</th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj4=' . $i . '&active_tab=tabs4">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no paid projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
         
         
         </div> 
         
         
         
         
         </div> 
         

    	
        <?php 
    do_action('ProjectTheme_main_menu_orders_content');
    ?>
    
    <?php 
    echo '</div>';
}
コード例 #5
0
ファイル: functions.php プロジェクト: vicpril/rep_bidqa
function ProjectTheme_send_email_on_win_to_bidder($pid, $winner_uid)
{
    $enable = get_option('ProjectTheme_won_project_winner_email_enable');
    $subject = get_option('ProjectTheme_won_project_winner_email_subject');
    $message = get_option('ProjectTheme_won_project_winner_email_message');
    if ($enable != "no") {
        $post = get_post($pid);
        $post_title = ProjectTheme_get_project_link($pid, true, true);
        $user = get_userdata($winner_uid);
        $site_login_url = ProjectTheme_login_url();
        $site_name = get_bloginfo('name');
        $account_url = get_permalink(get_option('ProjectTheme_my_account_page_id'));
        $messenger_link = $account_url . 'private-messages/';
        $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid);
        $usrnm = get_userdata($winner_uid);
        $winner_bid_username = $usrnm->user_login;
        $winner_bid_value = projecttheme_get_show_price($projectTheme_get_winner_bid->bid);
        $find = array('##username##', '##username_email##', '##site_login_url##', '##your_site_name##', '##your_site_url##', '##my_account_url##', '##messenger_link##', '##project_name##', '##project_title##', '##project_link##', '##winner_bid_value##');
        $replace = array($user->user_login, $user->user_email, $site_login_url, $site_name, get_bloginfo('siteurl'), $account_url, $messenger_link, $post->post_title, $post_title, get_permalink($pid), $winner_bid_value);
        $tag = 'ProjectTheme_send_email_on_win_to_bidder';
        $find = apply_filters($tag . '_find', $find);
        $replace = apply_filters($tag . '_replace', $replace);
        $message = ProjectTheme_replace_stuff_for_me($find, $replace, $message);
        $subject = ProjectTheme_replace_stuff_for_me($find, $replace, $subject);
        //--------------------------------------
        ProjectTheme_send_email($user->user_email, $subject, $message, false);
    }
}
コード例 #6
0
ファイル: payments.php プロジェクト: vicpril/rep_bidqa
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 
}
コード例 #7
0
ファイル: feedbacks.php プロジェクト: simplix-fr/o-g
function ProjectTheme_my_account_feedbacks_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
  <div id="content" class="account-main-area">
	
	 <div class="box_title"><?php 
    _e("Reviews I need to award", 'ProjectTheme');
    ?>
</div>
	 <div class="my_box3">
                <div class="box_content">    
				
              	<?php 
    global $wpdb;
    $query = "select * from " . $wpdb->prefix . "project_ratings where fromuser='******' AND awarded='0'";
    $r = $wpdb->get_results($query);
    if (count($r) > 0) {
        echo '<table class="table">';
        echo '<tr>';
        echo '<th>&nbsp;</th>';
        echo '<th><b>' . __('Project Title', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('To User', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Aquired on', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Price', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Options', 'ProjectTheme') . '</b></th>';
        echo '</tr>';
        foreach ($r as $row) {
            $post = $row->pid;
            $post = get_post($post);
            $bid = projectTheme_get_winner_bid($row->pid);
            $user = get_userdata($row->touser);
            $dmt2 = get_post_meta($row->pid, 'closed_date', true);
            if (!empty($dmt2)) {
                $dmt = date_i18n('d-M-Y H:i:s', $dmt2);
            }
            echo '<tr>';
            echo '<th><img class="img_class" width="42" height="42" src="' . ProjectTheme_get_first_post_image($row->pid, 42, 42) . '" 
                                alt="' . $post->post_title . '" /></th>';
            echo '<th><a href="' . get_permalink($row->pid) . '">' . $post->post_title . '</a></th>';
            echo '<th><a href="' . ProjectTheme_get_user_profile_link($user->ID) . '">' . $user->user_login . '</a></th>';
            echo '<th>' . $dmt . '</th>';
            echo '<th>' . projectTheme_get_show_price($bid->bid) . '</th>';
            echo '<th><a href="' . get_bloginfo('siteurl') . '/?p_action=rate_user&rid=' . $row->id . '">' . __('Rate User', 'ProjectTheme') . '</a></th>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        _e("There are no reviews to be awarded.", "ProjectTheme");
    }
    ?>
                
                
           </div>
           </div>    
           
           <!-- ##### -->
           <div class="clear10"></div>
           
           
           
           <div class="box_title"><?php 
    _e("Reviews I am waiting ", 'ProjectTheme');
    ?>
</div>
           
           <div class="my_box3"> 
                <div class="box_content">    
				
              	<?php 
    global $wpdb;
    $query = "select * from " . $wpdb->prefix . "project_ratings where touser='******' AND awarded='0'";
    $r = $wpdb->get_results($query);
    if (count($r) > 0) {
        echo '<table class="table">';
        echo '<tr>';
        echo '<th>&nbsp;</th>';
        echo '<th><b>' . __('Project Title', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('From User', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Aquired on', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Price', 'ProjectTheme') . '</b></th>';
        //echo '<th><b>'.__('Options','ProjectTheme').'</b></th>';
        echo '</tr>';
        foreach ($r as $row) {
            $post = $row->pid;
            $post = get_post($post);
            $bid = projectTheme_get_winner_bid($row->pid);
            $user = get_userdata($row->fromuser);
            $dmt2 = get_post_meta($row->pid, 'closed_date', true);
            if (!empty($dmt2)) {
                $dmt = date_i18n('d-M-Y H:i:s', $dmt2);
            }
            echo '<tr>';
            echo '<th><img class="img_class" width="42" height="42"  src="' . ProjectTheme_get_first_post_image($row->pid, 42, 42) . '" 
                                alt="' . $post->post_title . '" /></th>';
            echo '<th><a href="' . get_permalink($row->pid) . '">' . $post->post_title . '</a></th>';
            echo '<th><a href="' . ProjectTheme_get_user_profile_link($user->ID) . '">' . $user->user_login . '</a></th>';
            echo '<th>' . $dmt . '</th>';
            echo '<th>' . projectTheme_get_show_price($bid->bid) . '</th>';
            //echo '<th><a href="#">Rate User</a></th>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        _e("There are no reviews to be awarded.", "ProjectTheme");
    }
    ?>
                
                
           </div>
           </div>    
           
           <div class="clear10"></div>
           
           
           <div class="box_title"><?php 
    _e("Reviews I was awarded ", 'ProjectTheme');
    ?>
</div>
           <div class="my_box3"> 
                <div class="box_content">    
				
              	<?php 
    global $wpdb;
    $query = "select * from " . $wpdb->prefix . "project_ratings where touser='******' AND awarded='1'";
    $r = $wpdb->get_results($query);
    if (count($r) > 0) {
        echo '<table class="table">';
        echo '<tr>';
        echo '<th>&nbsp;</th>';
        echo '<th><b>' . __('Project Title', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('From User', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Aquired on', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Price', 'ProjectTheme') . '</b></th>';
        echo '<th><b>' . __('Rating', 'ProjectTheme') . '</b></th>';
        echo '</tr>';
        foreach ($r as $row) {
            $post = $row->pid;
            $post = get_post($post);
            $bid = projectTheme_get_winner_bid($row->pid);
            $user = get_userdata($row->fromuser);
            $dmt2 = get_post_meta($row->pid, 'closed_date', true);
            if (!empty($dmt2)) {
                $dmt = date_i18n('d-M-Y H:i:s', $dmt2);
            }
            echo '<tr>';
            echo '<th><img width="42" height="42" class="img_class" src="' . ProjectTheme_get_first_post_image($row->pid, 42, 42) . '" 
                                alt="' . $post->post_title . '" /></th>';
            echo '<th><a href="' . get_permalink($row->pid) . '">' . $post->post_title . '</a></th>';
            echo '<th><a href="' . ProjectTheme_get_user_profile_link($user->ID) . '">' . $user->user_login . '</a></th>';
            echo '<th>' . $dmt . '</th>';
            echo '<th>' . projectTheme_get_show_price($bid->bid) . '</th>';
            echo '<th>' . floor($row->grade / 2) . '/5</th>';
            echo '</tr>';
            echo '<tr>';
            echo '<th></th>';
            echo '<th colspan="5"><b>' . __('Comment', 'ProjectTheme') . ':</b> ' . $row->comment . '</th>';
            echo '</tr>';
            echo '<tr><th colspan="6"><hr color="#eee" /></th></tr>';
        }
        echo '</table>';
    } else {
        _e("There are no reviews to be awarded.", "ProjectTheme");
    }
    ?>
                
              
           </div>
           </div>    
	
	
	
	
	
		</div>
        
<?php 
    ProjectTheme_get_users_links();
}
コード例 #8
0
function ProjectTheme_my_account_pay4project_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $pid = $wp_query->query_vars['pid'];
    $post = get_post($pid);
    ?>
    	<div id="content">
        	
            <div class="my_box3 ">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    echo sprintf(__("Pay for project - %s", "ProjectTheme"), $post->post_title);
    ?>
</div>
                <div class="box_content"> 
            	
                

                
                <div class="post no_border_btm" id="post-<?php 
    the_ID();
    ?>
">
                <div class="padd10">
                <div class="image_holder">
                <a href="<?php 
    echo get_permalink($pid);
    ?>
"><img width="45" height="35" class="image_class" 
                src="<?php 
    echo ProjectTheme_get_first_post_image($pid, 45, 35);
    ?>
" /></a>
                </div>
                <div  class="title_holder" > 
                     <h2><a href="<?php 
    the_permalink();
    ?>
" rel="bookmark" title="Permanent Link to <?php 
    echo $post->post_title;
    ?>
">
                        <?php 
    echo $post->post_title;
    ?>
</a></h2>
      			</div>
                
                <div class="details_holder">
             <?php 
    $bid = projectTheme_get_winner_bid($pid);
    echo __('You are about to pay for this project. Use the accepted methods below to pay for it.', 'ProjectTheme');
    ?>
                <b><?php 
    echo sprintf(__('The price for the project is: %s', 'ProjectTheme'), projectTheme_get_show_price($bid->bid));
    ?>
</b>
                <br/><br/>
                
                <a href="<?php 
    bloginfo('siteurl');
    ?>
/?p_action=pay_for_project_paypal&pid=<?php 
    echo $pid;
    ?>
"><img 
                src="<?php 
    echo get_bloginfo('template_url');
    ?>
/images/paypal.jpg" border="0" /></a><br/><br/>
                
                <?php 
    do_action('ProjectTheme_pay_for_actual_project_payment_options', $pid);
    ?>
                
                <?php 
    $show_cr = true;
    $show_cr = apply_filters('ProjectTheme_show_cr_filter', $show_cr);
    if ($show_cr == true) {
        ?>
                <a class="post_bid_btn" href="<?php 
        echo ProjectTheme_get_pay_with_credits_page_url($pid);
        ?>
"><?php 
        echo __('Pay by credits', 'ProjectTheme');
        ?>
</a>
                <?php 
    }
    ?>
                </div>
                
                </div>
                </div>
      

                
                </div>
                </div>
                </div>
                </div>   
<?php 
    ProjectTheme_get_users_links();
}
コード例 #9
0
ファイル: deleted-code.php プロジェクト: vicpril/rep_bidqa
function projectTheme_get_post_awaiting_compl_function_old()
{
    $ending = get_post_meta(get_the_ID(), 'ending', true);
    $sec = $ending - current_time('timestamp', 0);
    $location = get_post_meta(get_the_ID(), 'Location', true);
    $closed = get_post_meta(get_the_ID(), 'closed', true);
    $featured = get_post_meta(get_the_ID(), 'featured', true);
    $mark_coder_delivered = get_post_meta(get_the_ID(), 'mark_coder_delivered', true);
    $post = get_post(get_the_ID());
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>

				<div class="post" id="post-<?php 
    the_ID();
    ?>
"><div class="padd10">

                

                <?php 
    if ($featured == "1") {
        ?>

                <div class="featured-one"></div>

                <?php 
    }
    ?>

                

                

                <?php 
    if ($private_bids == "yes" or $private_bids == "1") {
        ?>

                <div class="sealed-one"></div>

                <?php 
    }
    ?>

                

                

                <div class="padd10_only_top">

                <div class="image_holder">

                 <?php 
    $ProjectTheme_enable_images_in_projects = get_option('ProjectTheme_enable_images_in_projects');
    if ($ProjectTheme_enable_images_in_projects == "yes") {
        $width = 40;
        $height = 32;
        $image_class = "image_class";
        $width = apply_filters("ProjectTheme_awaiting_completion_proj_img_width", $width);
        $height = apply_filters("ProjectTheme_awaiting_completion_proj_img_height", $height);
        $image_class = apply_filters("ProjectTheme_awaiting_completion_proj_img_class", $image_class);
        ?>

                

                <a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title();
        ?>
"><img alt="<?php 
        the_title();
        ?>
" width="<?php 
        echo $width;
        ?>
" height="<?php 
        echo $height;
        ?>
" class="<?php 
        echo $image_class;
        ?>
" 

                src="<?php 
        echo ProjectTheme_get_first_post_image(get_the_ID(), $width, $height);
        ?>
" /></a>

               

               <?php 
    }
    ?>

               

                </div>

                <div class="title_holder" > 

                     <h2><a class="post-title-class" href="<?php 
    the_permalink();
    ?>
" rel="bookmark" title="<?php 
    the_title();
    ?>
"><?php 
    the_title();
    ?>
</a></h2>

                        

    

                        

                  <p class="mypostedon">

                        <?php 
    _e("Posted in", 'ProjectTheme');
    ?>
: <?php 
    echo get_the_term_list(get_the_ID(), 'project_cat', '', ', ', '');
    ?>
 

                        <?php 
    _e("by", 'ProjectTheme');
    ?>
: <a href="<?php 
    bloginfo('siteurl');
    ?>
?p_action=user_profile&post_author=<?php 
    echo $post->post_author;
    ?>
"><?php 
    the_author();
    ?>
</a> 

                  </p>

                       

                        

              <p class="task_buttons">   

                        

		

       				<?php 
    if ($mark_coder_delivered != "1") {
        ?>

       

                        <?php 
        _e('The winner must mark this as delivered.', 'ProjectTheme');
        ?>

                        <?php 
        if (!projecttheme_escrow_was_made_for_project_done(get_the_ID())) {
            $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
            if ($ProjectTheme_enable_credits_wallet != 'no') {
                ?>
 

                        <br/>

                        <a href="<?php 
                echo ProjectTheme_get_payments_page_url_redir('escrow');
                ?>
" class="post_bid_btn"><?php 
                _e('Make Escrow', 'ProjectTheme');
                ?>
</a>

                        

                        <?php 
            }
        } else {
            echo '<br/>';
            _e('Escrow was made for this project.', 'ProjectTheme');
        }
    } else {
        $dv = get_post_meta(get_the_ID(), 'mark_coder_delivered_date', true);
        $dv = date_i18n('d-M-Y H:i:s', $dv);
        ?>

                   

                   <span class="zbk_zbk">

                   <?php 
        printf(__("Marked as delivered on: %s", "ProjectTheme"), $dv);
        ?>
<br/><br/>

                   <?php 
        _e('Accept this project and: ', 'ProjectTheme');
        ?>

                     <a href="<?php 
        echo get_bloginfo('siteurl');
        ?>
/?p_action=mark_completed&pid=<?php 
        the_ID();
        ?>
" 

                        class="green_btn"><?php 
        echo __("Mark Completed", "ProjectTheme");
        ?>
</a>

                   

                   </span>

                   

                   <?php 
    }
    ?>

                   



                  </p>

      </div> 

                     

                  <div class="details_holder"> 



                  

                  <ul class="project-details1 project-details1_a">

							<li>

								<img src="<?php 
    echo get_bloginfo('template_url');
    ?>
/images/price.png" width="15" height="15" /> 

								<h3><?php 
    echo __("Budget", 'ProjectTheme');
    ?>
:</h3>

								<p><?php 
    $sel = get_post_meta(get_the_ID(), 'budgets', true);
    echo ProjectTheme_get_budget_name_string_fromID($sel);
    ?>

                                

                                </p>

							</li>

                            

                            

                            <li>

								<img src="<?php 
    echo get_bloginfo('template_url');
    ?>
/images/price.png" width="15" height="15" /> 

								<h3><?php 
    echo __("Winning Bid", 'ProjectTheme');
    ?>
:</h3>

								<p><?php 
    $bid = projectTheme_get_winner_bid(get_the_ID());
    echo ProjectTheme_get_show_price($bid->bid);
    ?>

                                

                                </p>

							</li>

					

             				

                            <li>

								<img src="<?php 
    echo get_bloginfo('template_url');
    ?>
/images/location.png" width="15" height="15" /> 

								<h3><?php 
    echo __("Winner", 'ProjectTheme');
    ?>
:</h3>

								<p><?php 
    $winner = get_post_meta(get_the_ID(), 'winner', true);
    $winner = get_userdata($winner);
    echo '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
    ?>
</p>

							</li>

                        



							

                            <li>

								<img src="<?php 
    echo get_bloginfo('template_url');
    ?>
/images/clock.png" width="15" height="15" /> 

								<h3><?php 
    echo __("Delivery On", 'ProjectTheme');
    ?>
:</h3>

								<p><?php 
    $tm_d = get_post_meta(get_the_ID(), 'expected_delivery', true);
    echo date_i18n('d-M-Y H:i:s', $tm_d);
    ?>
</p>

							</li>

							

					

                    

						</ul>

                      

               

                  </div>   

                     

                     </div></div></div> <?php 
}
コード例 #10
0
ファイル: pay_with_credits.php プロジェクト: simplix-fr/o-g
function ProjectTheme_my_account_pay_with_credits_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $pid = $_GET['pid'];
    $post_ar = get_post($pid);
    ?>
    	
        
        <div id="content" class="account-main-area">      
        
        	<div class="my_box3 border_bottom_0">
            	
            
            	<div class="box_title"><?php 
    _e("Pay with virtual currency", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">    
				
                
           
           <div class="post no_border_btm" id="post-<?php 
    the_ID();
    ?>
">
                
                <div class="image_holder">
                <a href="<?php 
    echo get_permalink($pid);
    ?>
"><img width="45" height="45" class="image_class" 
                src="<?php 
    echo ProjectTheme_get_first_post_image($pid, 45, 45);
    ?>
" /></a>
                </div>
                <div  class="title_holder" > 
                     <h2><a href="<?php 
    echo get_permalink($pid);
    ?>
" rel="bookmark" title="Permanent Link to <?php 
    echo $post_ar->post_title;
    ?>
">
                        <?php 
    echo $post_ar->post_title;
    ?>
</a></h2>
      			</div>
                <?php 
    if (isset($_GET['pay'])) {
        echo '<div class="details_holder sk_sk_class">';
        $post_ar = get_post($pid);
        $cr = projectTheme_get_credits($uid);
        $bid = projectTheme_get_winner_bid($pid);
        $amount = $bid->bid;
        if ($cr < $amount) {
            echo '<div class="error2">';
            echo __('You do not have enough credits to pay for this project.', 'ProjectTheme');
            echo '</div><div class="clear10 flt_lft"></div>';
            ?>
                            
							<div class="tripp">
							<a class="post_bid_btn" href="<?php 
            echo ProjectTheme_get_payments_page_url('deposit');
            ?>
"><?php 
            echo __('Add More Credits', 'ProjectTheme');
            ?>
</a>
							</div>
                    
							<?php 
        } else {
            projectTheme_send_email_to_project_payer($pid, $uid, $bid->uid, $amount, '1');
            echo __('Your payment has been sent.', 'ProjectTheme');
        }
        echo '</div>';
        ?>
           
                
                <?php 
    } else {
        ?>
                <div class="details_holder sk_sk_class mm11">  
           
                <b>
                 <?php 
        echo __('The price for the project is', 'ProjectTheme');
        ?>
: <?php 
        $bid = projectTheme_get_winner_bid($pid);
        echo projectTheme_get_show_price($bid->bid);
        ?>
</b>
                <br/><br/>
                
               <?php 
        _e("Your credits amount", 'ProjectTheme');
        ?>
: <?php 
        echo projectTheme_get_credits($uid);
        ?>
 <?php 
        echo projectTheme_currency();
        ?>
 <br/><br/>
               <a class="post_bid_btn" href="<?php 
        echo ProjectTheme_get_pay_with_credits_page_url($pid, '&pay=yes');
        ?>
"><?php 
        echo __('Pay Now', 'ProjectTheme');
        ?>
</a> 
               
               <a class="post_bid_btn" href="<?php 
        echo ProjectTheme_get_payments_page_url('deposit');
        ?>
"><?php 
        echo __('Add More Credits', 'ProjectTheme');
        ?>
</a>
                </div><?php 
    }
    ?>
                
               
           </div></div>
           </div>    
        
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
コード例 #11
0
ファイル: mark_delivered.php プロジェクト: vicpril/rep_bidqa
    exit;
}
//-----------
add_filter('sitemile_before_footer', 'projectTheme_my_account_before_footer');
function projectTheme_my_account_before_footer()
{
    echo '<div class="clear10"></div>';
}
//----------
global $wpdb, $wp_rewrite, $wp_query, $current_user;
$pid = $wp_query->query_vars['pid'];
get_currentuserinfo();
$uid = $current_user->ID;
$post_pr = get_post($pid);
//---------------------------
$winner_bd = projectTheme_get_winner_bid($pid, $single = false);
foreach ($winner_bd as $key => $bidd) {
    if ($bidd->uid == $uid) {
        // get current bid
        $bol = true;
        $bid = $bidd;
        break;
    } else {
        $bol = false;
    }
}
if (!$bol) {
    wp_redirect(get_bloginfo('siteurl'));
    exit;
}
//if($uid != $winner_bd->uid) { wp_redirect(get_bloginfo('siteurl')); exit; }
コード例 #12
0
ファイル: mark_delivered.php プロジェクト: vicpril/wp_bidqa
}
//-----------
add_filter('sitemile_before_footer', 'projectTheme_my_account_before_footer');
function projectTheme_my_account_before_footer()
{
    echo '<div class="clear10"></div>';
}
//----------
global $wpdb, $wp_rewrite, $wp_query, $current_user;
$pid = $wp_query->query_vars['pid'];
get_currentuserinfo();
$uid = $current_user->ID;
$post_pr = get_post($pid);
//---------------------------
$ar = 1;
$winner_bd = projectTheme_get_winner_bid($pid, $ar);
foreach ($winner_bd as $key => $bidd) {
    if ($bidd->uid == $uid) {
        $bol = true;
        break;
    } else {
        $bol = false;
    }
}
if (!$bol) {
    wp_redirect(get_bloginfo('siteurl'));
    exit;
}
//if($uid != $winner_bd->uid) { wp_redirect(get_bloginfo('siteurl')); exit; }
//---------------------------
if (isset($_POST['yes'])) {
コード例 #13
0
ファイル: disputes.php プロジェクト: vicpril/rep_bidqa
function ProjectTheme_my_account_disputes_area_function()
{
    $no_comment_admin = 0;
    $no_comment = 0;
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    if ($_POST) {
        if ($_POST['disp_id']) {
            $disp_id = $_POST['disp_id'];
            $closedon = current_time('timestamp', 0);
            $admin_comment = trim($_POST['admin_comment']);
            if (!$admin_comment) {
                $no_comment_admin = 1;
            } else {
                $no_comment_admin = 0;
                $winner = $_POST['winner'];
                if (!$winner) {
                    $s = "update " . $wpdb->prefix . "project_disputes SET `solution`=1, `closedon`={$closedon}, `admin_comment`='{$admin_comment}' WHERE `id`={$disp_id}";
                    $wpdb->query($s);
                } else {
                    $s = "update " . $wpdb->prefix . "project_disputes SET `solution`=1, `winner`={$winner}, `closedon`={$closedon}, `admin_comment`='{$admin_comment}' WHERE `id`={$disp_id}";
                    $wpdb->query($s);
                }
            }
        } else {
            $initiator = $_POST['initiator'];
            $datemade = current_time('timestamp', 0);
            $comment = trim($_POST['comment']);
            $pid_defendant = explode('/', $_POST['defendant']);
            $pid = $pid_defendant[0];
            $defendant = $pid_defendant[1];
            if ($comment) {
                $no_comment = 0;
                $s = "insert into " . $wpdb->prefix . "project_disputes (initiator,pid,datemade,solution,winner,closedon,comment,defendant,admin_comment)\n                    values('{$initiator}','{$pid}','{$datemade}',0,0,0,'{$comment}','{$defendant}','')";
                if ($wpdb->query($s)) {
                    $created_success = 1;
                } else {
                    $created_success = 0;
                }
            } else {
                $no_comment = 1;
            }
        }
    }
    ?>
<div id="content" class="account-main-area">
            <?php 
    if ($created_success) {
        echo '<div class="saved_thing">Dispute created.</div>';
    }
    ?>
            <?php 
    if ($no_comment) {
        echo '<div class="errrs">You cannot leave the dispute comment blank!</div>';
    }
    ?>
            
            <?php 
    if ($no_comment_admin) {
        echo '<div class="errrs">You cannot leave the Comment for closing dispute blank!</div>';
    }
    ?>

            
            
        <div class="my_box3">
            <div class="padd10">
        
            <div class="box_title"><?php 
    _e("Create Dispute", "ProjectTheme");
    ?>
</div>
            <div class="box_content"> 
            <?php 
    if (ProjectTheme_is_user_business($uid)) {
        //                    $querystr = "
        //                                    SELECT distinct wposts.*
        //                                    FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
        //                                    WHERE wposts.post_author='$uid'
        //                                    AND  wposts.ID = wpostmeta.post_id
        //                                    AND wpostmeta.meta_key = 'closed'
        //                                    AND wpostmeta.meta_value = '0'
        //                                    AND wposts.post_status = 'publish'
        //                                    AND wposts.post_type = 'project'
        //                                    ORDER BY wposts.post_date DESC";
        $querystr = "\n                                    SELECT distinct wposts.* \n                                    FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta \n                                    WHERE wposts.post_author='{$uid}' \n                                    AND  wposts.ID = wpostmeta.post_id \n                                    AND wposts.post_status = 'publish' \n                                    AND wposts.post_type = 'project'\n                                    ORDER BY wposts.post_date DESC";
        $r = $wpdb->get_results($querystr);
        foreach ($r as $row) {
            $pid = $row->ID;
            $ar = 1;
            $bids = projectTheme_get_winner_bid($pid, $ar);
            foreach ($bids as $key => $bid) {
                $user = get_userdata($bid->uid);
                $Defendants[$pid][$bid->uid]['user_name'] = $user->user_login;
                $Defendants[$pid][$bid->uid]['post_title'] = get_the_title($pid);
            }
        }
    } elseif (ProjectTheme_is_user_provider($uid)) {
        $querystr = "\n                                   SELECT * \n                                   FROM " . $wpdb->prefix . "project_bids\n                                   WHERE `uid`='{$uid}' \n                                   AND  `winner` = '1'\n                                   ORDER BY `date_made` DESC";
        $r = $wpdb->get_results($querystr);
        foreach ($r as $row) {
            $pid = $row->pid;
            $post = get_post($pid);
            $user = get_userdata($post->post_author);
            $Defendants[$pid][$post->post_author]['user_name'] = $user->user_login;
            $Defendants[$pid][$post->post_author]['post_title'] = get_the_title($pid);
        }
    }
    ?>

                <form method="POST">
                    <input hidden name="initiator" value="<?php 
    echo $uid;
    ?>
">        
                    <?php 
    //var_dump($Defendants);
    ?>
                
                    <label>Defendant
                            <?php 
    if (isset($Defendants)) {
        ?>
                        <select name="defendant">
                            <?php 
        foreach ($Defendants as $pid => $Defendant) {
            foreach ($Defendant as $f_uid => $Def) {
                echo '<option value="' . $pid . '/' . $f_uid . '">' . $Def['post_title'] . ' - ' . $Def['user_name'] . '</option>';
            }
        }
        ?>
    
                        </select>
                            <?php 
    }
    ?>
                    </label>
                        <?php 
    if (!isset($Defendants)) {
        echo '<p>' . __("There are no available users for disput", "ProjectTheme") . '</p>';
    }
    ?>
                        
                    <br>
                    <label class="disput_comment">Comment
                        <textarea class="disput_comment" name="comment"></textarea>
                    </label><br>
                    <input type="submit" value="Create Dispute">
                </form>                         
            
            
            
            </div>
            </div>
            </div>

<?php 
    $querystr = "\n                                        SELECT * \n                                        FROM " . $wpdb->prefix . "project_disputes\n                                        WHERE `solution`=0\n                                        AND  `initiator` = '{$uid}' \n                                        ORDER BY `datemade` DESC";
    $open_disputes = $wpdb->get_results($querystr);
    $querystr = "\n                                        SELECT * \n                                        FROM " . $wpdb->prefix . "project_disputes\n                                        WHERE `solution`=0\n                                        AND  `defendant` = '{$uid}' \n                                        ORDER BY `datemade` DESC";
    $open_disputes_on_me = $wpdb->get_results($querystr);
    $querystr = "\n                                        SELECT * \n                                        FROM " . $wpdb->prefix . "project_disputes\n                                        WHERE `solution`=1\n                                        AND  `initiator` = '{$uid}' \n                                        ORDER BY `datemade` DESC";
    $closed_disputes = $wpdb->get_results($querystr);
    $querystr = "\n                                        SELECT * \n                                        FROM " . $wpdb->prefix . "project_disputes\n                                        WHERE `solution`=1\n                                        AND  `defendant` = '{$uid}' \n                                        ORDER BY `datemade` DESC";
    $closed_disputes_on_me = $wpdb->get_results($querystr);
    ?>
<div class="clear10"></div>
    	
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    _e("Open Disputes", "ProjectTheme");
    ?>
</div>

                <div class="box_content"> 
                <div class="box_title"><?php 
    _e("As Initiator", "ProjectTheme");
    ?>
</div>
            	
                    <?php 
    if ($open_disputes) {
        echo '<table class="open_disputes">';
        echo '<tr>';
        echo '<td>Date create</td>';
        echo '<td>Defendant</td>';
        echo '<td>Comment</td>';
        //echo '<td>Winner</td>';
        echo '<td>Comment for closing this dispute</td>';
        echo '<td>Action</td>';
        echo '</tr>';
        foreach ($open_disputes as $key => $open_dispute) {
            $user = get_userdata($open_dispute->defendant);
            $user_winner = get_userdata($open_dispute->winner);
            echo '<tr>';
            echo '<form method="POST">';
            //echo '<td>'.date('m-d-Y H:i',$open_dispute->datemade).'</td>';
            echo '<td class="conv_time">' . $open_dispute->datemade . '</td>';
            echo '<td>' . $user->user_login . '</td>';
            echo '<td class="disp_com">' . $open_dispute->comment . '</td>';
            //echo '<td><label>'.$current_user->user_login.'<input type="radio" name="winner" value="'.$open_dispute->initiator.'"></label><label>'.$user->user_login.'<input type="radio" name="winner" value="'.$open_dispute->defendant.'"></label></td>';
            echo '<td> <textarea name="admin_comment"></textarea></td>';
            echo '<td> <input hidden name="disp_id" value="' . $open_dispute->id . '"><input type="submit" value="Close"></td>';
            echo '</form>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        _e('There are no open disputes.', 'ProjectTheme');
    }
    ?>
               
                
                
                </div>

                <div class="box_content"> 
                <div class="box_title"><?php 
    _e("As Defendant", "ProjectTheme");
    ?>
</div>
                
                    <?php 
    if ($open_disputes_on_me) {
        echo '<table class="open_disputes">';
        echo '<tr>';
        echo '<td>Date create</td>';
        echo '<td>Initiator</td>';
        echo '<td>Comment</td>';
        echo '</tr>';
        foreach ($open_disputes_on_me as $key => $open_dispute) {
            $user = get_userdata($open_dispute->initiator);
            $user_winner = get_userdata($open_dispute->winner);
            echo '<tr>';
            //echo '<td>'.date('m-d-Y H:i',$open_dispute->datemade).'</td>';
            echo '<td class="conv_time">' . $open_dispute->datemade . '</td>';
            echo '<td>' . $user->user_login . '</td>';
            echo '<td class="disp_com">' . $open_dispute->comment . '</td>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        _e('There are no open disputes.', 'ProjectTheme');
    }
    ?>
               
                
                
                </div>
                </div>
                </div>
                
                
                
                
                
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    _e("Closed Disputes", "ProjectTheme");
    ?>
</div>
                <div class="box_content"> 
                <div class="box_title"><?php 
    _e("As Initiator", "ProjectTheme");
    ?>
</div>
                    <?php 
    if ($closed_disputes) {
        echo '<table class="closed_disputes">';
        echo '<tr>';
        echo '<td>Date create</td>';
        echo '<td>Defendant</td>';
        echo '<td>Comment</td>';
        echo '<td>Winner</td>';
        echo '<td>Closed on</td>';
        echo '<td>Verdict</td>';
        echo '</tr>';
        foreach ($closed_disputes as $key => $closed_dispute) {
            $user = get_userdata($closed_dispute->defendant);
            $user_winner = get_userdata($closed_dispute->winner);
            echo '<tr>';
            //echo '<td>'.date('m-d-Y H:i',$closed_dispute->datemade).'</td>';
            echo '<td class="conv_time">' . $closed_dispute->datemade . '</td>';
            echo '<td>' . $user->user_login . '</td>';
            echo '<td class="disp_com">' . $closed_dispute->comment . '</td>';
            echo '<td>' . $user_winner->user_login . '</td>';
            echo '<td>' . date('m-d-Y H:i', $closed_dispute->closedon) . '</td>';
            echo '<td class="disp_com">' . $closed_dispute->admin_comment . '</td>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        _e('There are no closed disputes.', 'ProjectTheme');
    }
    ?>
                
                </div>
                <div class="box_content"> 
                <div class="box_title"><?php 
    _e("As Defendant", "ProjectTheme");
    ?>
</div>
                    <?php 
    if ($closed_disputes_on_me) {
        echo '<table class="closed_disputes">';
        echo '<tr>';
        echo '<td>Date create</td>';
        echo '<td>Initiator</td>';
        echo '<td>Comment</td>';
        echo '<td>Winner</td>';
        echo '<td>Closed on</td>';
        echo '<td>Verdict</td>';
        echo '</tr>';
        foreach ($closed_disputes_on_me as $key => $closed_dispute) {
            $user = get_userdata($closed_dispute->initiator);
            $user_winner = get_userdata($closed_dispute->winner);
            echo '<tr>';
            //echo '<td>'.date('m-d-Y H:i',$closed_dispute->datemade).'</td>';
            echo '<td class="conv_time">' . $closed_dispute->datemade . '</td>';
            echo '<td>' . $user->user_login . '</td>';
            echo '<td class="disp_com">' . $closed_dispute->comment . '</td>';
            echo '<td>' . $user_winner->user_login . '</td>';
            echo '<td>' . date('m-d-Y H:i', $closed_dispute->closedon) . '</td>';
            echo '<td class="disp_com">' . $closed_dispute->admin_comment . '</td>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        _e('There are no closed disputes.', 'ProjectTheme');
    }
    ?>
                
                </div>
                </div>
                </div>

                <div class="clear10"></div>
                
                
                
                
                </div>  
                 <script type="text/javascript">
            $(document).ready(function(){
                
                $('.conv_time').each(function(){
                    var tm = parseInt($(this).text())*1000;
                    console.log(tm);
                    var time = new Date(tm);
                    $(this).text(time.toLocaleString());
                });
            });
        </script> 
<?php 
    ProjectTheme_get_users_links();
}
コード例 #14
0
ファイル: payfast_project.php プロジェクト: vicpril/rep_bidqa
function ProjectTheme_payfast_main_payment_submit_payment()
{
    global $wp_query, $wpdb, $current_user;
    $pid = $wp_query->query_vars['pid'];
    get_currentuserinfo();
    $uid = $current_user->ID;
    $post = get_post($pid);
    $business = get_option('ProjectTheme_payfast_id');
    if (empty($business)) {
        die('ERROR. Please input your PayFast ID.');
    }
    //-------------------------------------------------------------------------
    $bid = projectTheme_get_winner_bid($pid);
    $my_total = $bid->bid;
    //----------------------------------------------
    $additional_payfast = 0;
    $additional_payfast = apply_filters('ProjectTheme_filter_paypal_listing_additional', $additional_paypal, $pid);
    $total = $my_total + $additional_payfast;
    $title_post = $post->post_title;
    $title_post = apply_filters('ProjectTheme_filter_paypal_listing_title', $title_post, $pid);
    //---------------------------------
    $tm = current_time('timestamp', 0);
    $cancel_url = get_bloginfo("siteurl") . '/?p_action=payfast_project_response&pid=' . $pid;
    $response_url = get_bloginfo('siteurl') . '/?p_action=payfast_project_response';
    $ccnt_url = get_permalink(get_option('ProjectTheme_my_account_page_id'));
    //get_bloginfo('siteurl').'/?p_action=edit_project&paid=ok&pid=' . $pid;
    $currency = get_option('ProjectTheme_currency');
    //https://www.payfast.co.za/eng/process
    ?>


<html>
<head><title>Processing PayFast Payment...</title></head>
<body onLoad="document.frmPay.submit();">
<center><h3><?php 
    _e('Please wait, your order is being processed...', 'pt_gateways');
    ?>
</h3></center>

	
    <form action="https://www.payfast.co.za/eng/process" method="post" name="frmPay" id="frmPay">

        <!-- Receiver Details -->
        <input type="hidden" name="merchant_id" value="<?php 
    echo get_option('ProjectTheme_payfast_id');
    ?>
">
        <input type="hidden" name="merchant_key" value="<?php 
    echo get_option('ProjectTheme_payfast_key');
    ?>
">
        <input type="hidden" name="return_url" value="<?php 
    echo $ccnt_url;
    ?>
">
        <input type="hidden" name="cancel_url" value="<?php 
    echo $cancel_url;
    ?>
">
        <input type="hidden" name="notify_url" value="<?php 
    echo $response_url;
    ?>
">
        

        <!-- Transaction Details -->
        <input type="hidden" name="m_payment_id" value="<?php 
    echo $pid . '_' . $tm;
    ?>
">
        <input type="hidden" name="custom_str1" value="<?php 
    echo $pid . '|' . $tm;
    ?>
">
        
        
        
        <input type="hidden" name="amount" value="<?php 
    echo $total;
    ?>
">
        <input type="hidden" name="item_name" value="Project:">
        <input type="hidden" name="item_description" value="<?php 
    echo $title_post;
    ?>
">
 
        
        </form>
    
 

</body>
</html>

<?php 
}