Пример #1
0
function ProjectTheme_template_redirect_milestones()
{
    $mlls = "PT_milestone_payments_installed_1_aaa";
    $opt = get_option($mlls);
    if (isset($_POST['submits1no_me_thing_ok'])) {
        wp_redirect(get_permalink(get_option('ProjectTheme_my_account_milestones_id')));
        exit;
    }
    if (isset($_POST['submits1yes_me_ok_p'])) {
        global $wpdb;
        $release_id = $_POST['release_id'];
        $s = "select * from " . $wpdb->prefix . "project_milestone where id='{$release_id}'";
        $r = $wpdb->get_results($s);
        $row = $r[0];
        global $current_user;
        get_currentuserinfo();
        $post_me = get_post($row->pid);
        //-------------------------
        $cr = projectTheme_get_credits($current_user->ID);
        if ($row->released == 0 and $cr >= $row->amount) {
            $amount = $row->amount;
            $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid');
            if (!empty($projectTheme_fee_after_paid)) {
                $deducted = $amount * ($projectTheme_fee_after_paid * 0.01);
            } else {
                $deducted = 0;
            }
            $cr = projectTheme_get_credits($row->uid);
            projectTheme_update_credits($row->uid, $cr + $amount - $deducted);
            $reason = sprintf(__('Milestone payment received from <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($current_user->ID), $current_user->user_login, get_permalink($post_me->ID), $post_me->post_title);
            projectTheme_add_history_log('1', $reason, $amount, $row->uid, $current_user->ID);
            $reason = sprintf(__('Payment fee taken for milestone payment for the project <a href="%s">%s</a>', 'ProjectTheme'), get_permalink($post_me->ID), $post_me->post_title);
            projectTheme_add_history_log('0', $reason, $deducted, $row->uid);
            $wpdb->query("update " . $wpdb->prefix . "project_milestone set released='1' where id='{$release_id}'");
            //-----------------------
            $usr_dt = get_userdata($row->uid);
            $cr = projectTheme_get_credits($current_user->ID);
            //projectTheme_update_credits($row->uid, $cr - $amount);
            projectTheme_update_credits($current_user->ID, $cr - $amount);
            $reason = sprintf(__('Milestone payment sent to <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($usr_dt->ID), $usr_dt->user_login, get_permalink($post_me->ID), $post_me->post_title);
            projectTheme_add_history_log('0', $reason, $amount, $current_user->ID, $row->uid);
        }
        //-------------------------
        wp_redirect(get_permalink(get_option('ProjectTheme_my_account_milestones_id')) . "?submit_ok_p=1");
        exit;
    }
    //---------------------------------
    if (empty($opt)) {
        ProjectTheme_insert_pages('ProjectTheme_my_account_milestones_id', 'Milestone Payments', '[project_theme_my_account_milestones]', get_option('ProjectTheme_my_account_payments_id'));
        update_option($mlls, 'DONE');
        global $wpdb;
        $ss = "CREATE TABLE `" . $wpdb->prefix . "project_milestone` (\n\t\t\t\t\t`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t\t\t`owner` INT NOT NULL ,\n\t\t\t\t\t`pid` INT NOT NULL ,\n\t\t\t\t\t`uid` INT NOT NULL ,\n\t\t\t\t\t`description_content` TEXT NOT NULL ,\n\t\t\t\t\t`datemade` BIGINT NOT NULL DEFAULT '0',\n\t\t\t\t\t`completion_date` BIGINT NOT NULL DEFAULT '0' ,\n\t\t\t\t\t`date_released` BIGINT NOT NULL DEFAULT '0' ,\n\t\t\t\t\t`amount` VARCHAR( 255 ) NOT NULL  \n\t\t\t\t\t \n\t\t\t\t\t) ENGINE = MYISAM ;\n\t\t\t\t\t";
        $wpdb->query($ss);
        $ss = "ALTER TABLE `" . $wpdb->prefix . "project_milestone` ADD  `released` TINYINT NOT NULL DEFAULT '0';";
        $wpdb->query($ss);
    }
}
Пример #2
0
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        if ($instance['title']) {
            echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
        }
        $user_limit = $instance['user_limit'];
        $user_tp = $instance['user_tp'];
        global $wpdb;
        if ($user_tp == "both") {
            $inr = '';
            $whr = '';
        }
        if ($user_tp == "service_provider") {
            $inr = "INNER JOIN {$wpdb->usermeta} m ON m.user_id = users.ID ";
            $whr = "m.meta_key = 'wp_capabilities' AND m.meta_value LIKE '%service_provider%' AND";
        }
        if ($user_tp == "service_contractor") {
            $inr = "INNER JOIN {$wpdb->usermeta} m ON m.user_id = users.ID ";
            $whr = "m.meta_key = 'wp_capabilities' AND m.meta_value LIKE '%business_owner%' AND";
        }
        //$widget_id = $args['widget_id'];
        if (empty($user_limit)) {
            $user_limit = 5;
        }
        $querystr = "\r\n\t\t\t\t\tSELECT users.user_email email,users.ID UID, users.user_registered dt, users.user_login username, ratings.touser uid, \r\n\t\t\t\t\tAVG(ratings.grade) rate FROM " . $wpdb->prefix . "project_ratings ratings, {$wpdb->users} users \r\n\t\t\t\t\t" . $inr . " where " . $whr . "\t\t\t\t\r\n\t\t\t\t\tusers.ID=ratings.touser \r\n\t\t\t\t\tgroup by ratings.touser order by rate DESC LIMIT {$user_limit}";
        $r = $wpdb->get_results($querystr);
        if (count($r) == 0) {
            echo __('No rated users yet.', 'ProjectTheme');
        } else {
            echo '<table width="100%">';
            foreach ($r as $row) {
                $hash = md5(strtolower(trim($row->email)));
                $dt = date_i18n("jS \\of F, Y", strtotime($row->dt));
                echo '<tr>';
                echo '<td width="20%"><a href="' . ProjectTheme_get_user_profile_link($row->UID) . '"><img class="image_class"
						src="' . ProjectTheme_get_avatar($row->UID, 40, 40) . '" width="40" /></a></td>';
                echo '<td><b><a href="' . ProjectTheme_get_user_profile_link($row->UID) . '">' . $row->username . '</a></b><br/>
						 ' . sprintf(__('Joined on: %s', 'ProjectTheme'), $dt) . '
						<br/>' . ProjectTheme_get_project_stars(floor($row->rate / 2)) . '
						</td>';
                echo '</tr>';
            }
            echo '</table>';
        }
        echo $after_widget;
    }
Пример #3
0
     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>';
     }
     echo '</table>';
 } else {
     _e("There are no reviews to be awarded.", "ProjectTheme");
 }
 ?>
Пример #4
0
function ProjectTheme_my_account_payments_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>

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

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

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

	<b>%s</b>', "ProjectTheme"), $perm, $post->post_title, $amount, $cure, $payer_user->user_login);
        //sitemile_send_email($payer_user->user_email, $subject , $message); // send email for the payment received
        $subject = sprintf(__("Details for closed Project: %s", 'ProjectTheme'), $post->post_title);
        $message = sprintf(__('The project <a href="%s">%s</a> was just closed. Here is the user email for the other party: %s', "ProjectTheme"), $perm, $post->post_title, $receiver_user->user_email);
        //sitemile_send_email($payer_user->user_email, $subject , $message); // send email for the details
        //------------
        if ($pay_by_credits == '1') {
            $cr = projectTheme_get_credits($payer_user_id);
            projectTheme_update_credits($payer_user_id, $cr - $amount);
            $uprof = ProjectTheme_get_user_profile_link($receiver_user->ID);
            //get_bloginfo('siteurl')."/user-profile/".$receiver_user->user_login;
            $reason = sprintf(__('Payment sent to <a href="%s">%s</a> for project <a href="%s">%s</a>', 'ProjectTheme'), $uprof, $receiver_user->user_login, $perm, $post->post_title);
            projectTheme_add_history_log('0', $reason, $amount, $payer_user_id, $receiver_user_id);
            //=========================
            $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid');
            if (!empty($projectTheme_fee_after_paid)) {
                $deducted = $amount * ($projectTheme_fee_after_paid * 0.01);
            } else {
                $deducted = 0;
            }
            $cr = projectTheme_get_credits($receiver_user_id);
            projectTheme_update_credits($receiver_user_id, $cr + $amount - $deducted);
            $uprof = ProjectTheme_get_user_profile_link($payer_user_id->ID);
            $reason = sprintf(__('Payment received from <a href="%s">%s</a> for project <a href="%s">%s</a>', 'ProjectTheme'), $uprof, $payer_user_id->user_login, $perm, $post->post_title);
            projectTheme_add_history_log('1', $reason, $amount, $receiver_user_id, $payer_user_id);
            //--------
            $reason = sprintf(__('Payment fee for project <a href="%s">%s</a>', 'ProjectTheme'), $perm, $post->post_title);
            projectTheme_add_history_log('0', $reason, $deducted, $receiver_user_id);
        }
    }
    //------------
}
Пример #6
0
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>';
}
Пример #7
0
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_private_messages_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $myuid = $uid;
    ?>
    	 
       <?php 
    global $wpdb, $wp_rewrite, $wp_query;
    $third_page = $wp_query->query_vars['pg'];
    if (empty($third_page)) {
        $third_page = 'home';
    }
    ?>
        <div class="clear10"></div>
      <div id="content" class="account-main-area mess_break">
        
        <div class="my_box3"><div class="padd10">
          <div class="clear10"></div>
          
            
                <ul class="cms_cms"> 
                <li><a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url();
    ?>
" class="green_btn"><?php 
    _e("Messaging Home", "ProjectTheme");
    ?>
</a></li>
               <li> <a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url('send');
    ?>
" class="green_btn"><?php 
    _e("Send New Message", "ProjectTheme");
    ?>
</a></li>
                <li><a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url('inbox');
    ?>
" class="green_btn"><?php 
    _e("Inbox", "ProjectTheme");
    global $current_user;
    get_currentuserinfo();
    $rd = projectTheme_get_unread_number_messages($current_user->ID);
    if ($rd > 0) {
        echo ' (' . $rd . ')';
    }
    ?>
</a></li>
                <li><a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url('sent-items');
    ?>
" class="green_btn"><?php 
    _e("Sent Items", "ProjectTheme");
    ?>
</a></li>
             	
                </ul>
                
        </div></div>
        <div class="clear10"></div>
        <?php 
    if ($third_page == 'home') {
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        ?>
        
        
		<!-- page content here -->	
			
            
            	
            	<div class="my_box3">
            	
            	<div class="box_title"><?php 
        _e("Latest Received Messages", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $uidsss = $current_user->ID;
        $s = "select * from " . $wpdb->prefix . "project_pm where user='******'  AND show_to_destination='1' and approved='1'  order by id desc limit 4";
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            echo '<table width="100%" class="privatemesg">';
            echo '<tr>';
            echo '<td>' . __('From User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                if ($row->rd == 0) {
                    $cls = 'bold_stuff';
                } else {
                    $cls = '';
                }
                $user = get_userdata($row->initiator);
                echo '<tr>';
                echo '<td class="' . $cls . '"><a href="' . get_bloginfo('siteurl') . '/?p_action=user_profile&post_author=' . $user->ID . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . substr($row->subject, 0, 30) . '</td>';
                //echo '<td class="'.$cls.'">'.date_i18n('d-M-Y H:i:s',$row->datemade).'</td>';
                echo '<td class="' . $cls . ' conv_time">' . $row->datemade . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
            
                </div>
                </div>
            
            <!--#######-->
            
            <div class="clear10"></div>
            
            	<div class="my_box3">
            	
            
            	<div class="box_title"><?php 
        _e("Latest Sent Items", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $uidss = $current_user->ID;
        $s = "select * from " . $wpdb->prefix . "project_pm where initiator='{$uidss}'  AND show_to_source='1' order by id desc limit 4";
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            echo '<table width="100%" class="privatemesg">';
            echo '<tr>';
            echo '<td>' . __('To User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                //if($row->rd == 0) $cls = 'bold_stuff';
                //else
                $cls = '';
                $user = get_userdata($row->user);
                echo '<tr>';
                echo '<td class="' . $cls . '"><a href="' . ProjectTheme_get_user_profile_link($row->user) . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . substr($row->subject, 0, 30) . '</td>';
                //echo '<td class="'.$cls.'">'.date_i18n('d-M-Y H:i:s',$row->datemade).'</td>';
                echo '<td class="' . $cls . ' conv_time">' . $row->datemade . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a id="privatedel"  href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
                 
               
                </div>
                </div>
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'inbox') {
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        //echo $myuid;
        ?>
        
        
		<!-- page content here -->	
			
            
            	<div class="my_box3">
           
            
            	<div class="box_title"><?php 
        _e("Private Messages: Inbox", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $page_rows = 20;
        $page_rows = apply_filters('ProjectTheme_nr_of_messages_priv_pagination', $page_rows);
        $pagenum = isset($_GET['pagenum']) ? $_GET['pagenum'] : 1;
        $max = ' limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows;
        $s = "select count(id) tots from " . $wpdb->prefix . "project_pm where user='******' AND show_to_destination='1' and approved='1'";
        $r = $wpdb->get_results($s);
        $total = $r[0]->tots;
        $last = ceil($total / $page_rows);
        //-------------------------
        $s = "select * from " . $wpdb->prefix . "project_pm where user='******' AND show_to_destination='1' and approved='1' order by id desc " . $max;
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            ?>
                    
                    <script>
					
					$(document).ready(function() {
						//set initial state.

					 $('#privatedel').click(function(){ 
              
              var ss=$(this).parent().text();
             alert(ss);
             
           });
					
						$('#select_all_stuff').change(function() {
							if($(this).is(":checked")) {
								
								$('.message_select_bx').attr("checked", true);
							}
							else
							{
								$('.message_select_bx').attr("checked", false);	
							}
						});
					});
											
					
					</script>
                    
                    <?php 
            echo '<form method="post" action="' . ProjectTheme_get_priv_mess_page_url('delete-message', '', '&return=inbox') . '">';
            echo '<table width="100%">';
            echo '<tr>';
            echo '<td><input type="checkbox" name="" id="select_all_stuff" value="1" /> ' . __('Select All', 'ProjectTheme') . ' </td>';
            echo '<td>' . __('From User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                if ($row->rd == 0) {
                    $cls = 'bold_stuff';
                } else {
                    $cls = '';
                }
                $user = get_userdata($row->initiator);
                echo '<tr>';
                echo '<td><input type="checkbox" class="message_select_bx" name="message_ids[]" value="' . $row->id . '" /></td>';
                echo '<td class="' . $cls . '"><a href="' . get_bloginfo('siteurl') . '/?p_action=user_profile&post_author=' . $user->ID . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . substr($row->subject, 0, 30) . '</td>';
                //echo '<td class="'.$cls.'">'.date_i18n('d-M-Y H:i:s',$row->datemade).'</td>';
                echo '<td class="' . $cls . ' conv_time">' . $row->datemade . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '<tr><td colspan="5"><input type="submit" value="' . __('Delete Selected', 'ProjectTheme') . '" name="delete_sel" /></td></tr>';
            echo '<tr><td colspan="5">  ';
            echo ProjectTheme_get_my_pagination_main(get_bloginfo('siteurl') . "/?page_id=" . get_option('ProjectTheme_my_account_private_messages_id'), $pagenum, 'pagenum', $last, '&pg=inbox');
            echo ' </td></tr>';
            echo '</table></form>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
             
                </div>
                </div>
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'sent-items') {
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        ?>
        
        		<script>
					
					$(document).ready(function() {
						//set initial state.
					 
					
						$('#select_all_stuff').change(function() {
							if($(this).is(":checked")) {
								
								$('.message_select_bx').attr("checked", true);
							}
							else
							{
								$('.message_select_bx').attr("checked", false);	
							}
						});
					});
											
					
					</script>
		<!-- page content here -->	
			
            
            	<div class="my_box3">
            
            
            	<div class="box_title"><?php 
        _e("Private Messages: Sent Items", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $page_rows = 20;
        $page_rows = apply_filters('ProjectTheme_nr_of_messages_priv_pagination', $page_rows);
        $pagenum = isset($_GET['pagenum']) ? $_GET['pagenum'] : 1;
        $max = ' limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows;
        //---------------------------------
        $s = "select count(id) tots from " . $wpdb->prefix . "project_pm where initiator='{$myuid}' AND show_to_source='1' and approved='1'";
        $r = $wpdb->get_results($s);
        $total = $r[0]->tots;
        $last = ceil($total / $page_rows);
        //---------------------------------
        $s = "select * from " . $wpdb->prefix . "project_pm where initiator='{$myuid}' AND show_to_source='1' and approved='1' order by id desc " . $max;
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            echo '<form method="post" action="' . ProjectTheme_get_priv_mess_page_url('delete-message', '', '&return=outbox') . '">';
            echo '<table width="100%">';
            echo '<tr>';
            echo '<td><input type="checkbox" name="" id="select_all_stuff" value="1" /> ' . __('Select All', 'ProjectTheme') . ' </td>';
            echo '<td>' . __('To User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                //if($row->rd == 0) $cls = 'bold_stuff';
                //else
                $cls = '';
                $user = get_userdata($row->user);
                echo '<tr>';
                echo '<td><input type="checkbox" class="message_select_bx" name="message_ids[]" value="' . $row->id . '" /></td>';
                echo '<td class="' . $cls . '"><a href="' . ProjectTheme_get_user_profile_link($row->user) . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . substr($row->subject, 0, 30) . '</td>';
                //echo '<td class="'.$cls.'">'.date_i18n('d-M-Y H:i:s',$row->datemade).'</td>';
                echo '<td class="' . $cls . ' conv_time">' . $row->datemade . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '<tr><td colspan="5"><input type="submit" value="' . __('Delete Selected', 'ProjectTheme') . '" name="delete_sel" /></td></tr>';
            echo '<tr><td colspan="5">  ';
            echo ProjectTheme_get_my_pagination_main(get_bloginfo('siteurl') . "/?page_id=" . get_option('ProjectTheme_my_account_private_messages_id'), $pagenum, 'pagenum', $last, '&pg=sent-items');
            echo ' </td></tr>';
            echo '</table></form>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
                </div>
                </div>
        
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'delete-message') {
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_pm where id='{$id}' AND (user='******' OR initiator='{$myuid}')";
        $r = $wpdb->get_results($s);
        $row = $r[0];
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        if ($myuid == $row->initiator) {
            $owner = true;
        } else {
            $owner = false;
        }
        //if(!$owner)
        //$wpdb->query("update_i18n ".$wpdb->prefix."auction_pm set rd='1' where id='{$row->id}'");
        ?>
        
        
		<!-- page content here -->	
			
            
            	<div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
        if (isset($_POST['delete_sel'])) {
            _e("Delete Selected Message: ", "ProjectTheme");
        } else {
            _e("Delete Message: ", "ProjectTheme");
            echo " " . substr($row->subject, 0, 30);
        }
        ?>
</div>
                <div class="box_content">  
                
                <?php 
        if (isset($_POST['message_ids'])) {
            $message_ids2 = $_POST['message_ids'];
            foreach ($message_ids2 as $message_id) {
                $ss1 = "select * from " . $wpdb->prefix . "project_pm where id='{$message_id}'";
                $rr1 = $wpdb->get_results($ss1);
                $rrow1 = $rr1[0];
                $user = get_userdata($rrow1->initiator);
                //							echo '#'.$rrow1->id." ".substr($rrow1->subject,0,30).'<br/>';
                echo 'Message from <b>' . $user->user_login . '</b>. Subject: ' . substr($rrow1->subject, 0, 30) . '<br/>';
            }
            echo '<br/>';
        }
        ?>
                
                <?php 
        //echo $row->content;
        ?>
      <br/> <br/>
      
      <?php 
        if (1) {
            //$owner == false):
            if (isset($_POST['delete_sel'])) {
                $message_ids = $_POST['message_ids'];
                if (count($message_ids) == 0) {
                    _e("No messsages selected.", "ProjectTheme");
                } else {
                    $attash = '';
                    foreach ($message_ids as $message_id) {
                        $attash .= '&message_id[]=' . $message_id;
                    }
                    ?>
					
                   <a href="javascript:history.go(-1)<?php 
                    //echo ($_GET['rdr']);
                    ?>
" class="nice_link"><?php 
                    _e("Cancel", 'ProjectTheme');
                    ?>
</a>
                    
                    <a href="<?php 
                    echo ProjectTheme_get_priv_mess_page_url('delete-message', '', '&confirm_message_deletion=yes&return=' . urlencode($_GET['rdr'])) . $attash;
                    ?>
" 
       				class="nice_link"  onclick="return privatedel()"><?php 
                    _e("Confirm Deletion", 'ProjectTheme');
                    ?>
</a>
                  
                <?php 
                }
            } else {
                ?>
      
      <a href="javascript:history.go(-1)<?php 
                //echo ($_GET['rdr']);
                ?>
" class="nice_link"><?php 
                _e("Cancel", 'ProjectTheme');
                ?>
</a>
      
       <a href="<?php 
                echo ProjectTheme_get_priv_mess_page_url('delete-message', $row->id, '&confirm_message_deletion=yes&return=' . urlencode($_GET['rdr']));
                ?>
" 
       class="nice_link"  onclick="return privatedel()"><?php 
                _e("Confirm Deletion", 'ProjectTheme');
                ?>
</a> <?php 
            }
        }
        ?>
                </div>
                </div>
                </div>
            
           <script type="text/javascript">
				   
					function privatedel()
					{
						var ms='Want To Delete <?php 
        echo $row->subject;
        ?>
';
						//alert(ms);
						if(confirm(ms))
						{return true;}
					else {return false;}
					}
					</script> 
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'read-message') {
        global $current_user, $wpdb;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_pm where id='{$id}'  AND (user='******' OR initiator='{$myuid}')";
        $r = $wpdb->get_results($s);
        $row = $r[0];
        if ($myuid == $row->initiator) {
            $owner = true;
        } else {
            $owner = false;
        }
        // mark messags is read if user = myuid
        if ($myuid == $row->user) {
            $wpdb->query("update " . $wpdb->prefix . "project_pm set rd='1' where id='{$row->id}'");
        }
        ?>
        
        
		<!-- page content here -->	
			
            
            	<div class="my_box3">
           
            
            	<div class="box_title"><?php 
        _e("Read Message: ", "ProjectTheme");
        echo " " . $row->subject;
        ?>
</div>
                <div class="box_content">  
                <?php 
        echo $row->content;
        ?>
      <br/> <br/>
      
      <?php 
        if (!empty($row->file_attached)) {
            echo sprintf(__('File Attached: %s', 'ProjectTheme'), '<a href="' . wp_get_attachment_url($row->file_attached) . '">' . wp_get_attachment_url($row->file_attached) . "</a>");
        }
        ?>
      
      
      <?php 
        if ($owner == false) {
            ?>
       <br><a href="<?php 
            echo ProjectTheme_get_priv_mess_page_url('send', '', '&pid=' . $row->pid . '&uid=' . $row->initiator . '&in_reply_to=' . $row->id);
            ?>
" class="nice_link"><?php 
            _e("Reply", 'ProjectTheme');
            ?>
</a> <?php 
        }
        ?>
                </div>
                </div>
             
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'send') {
        ?>
        <?php 
        $pid = $_GET['pid'];
        $uid = $_GET['uid'];
        $user = get_userdata($uid);
        if (!empty($pid)) {
            $post = get_post($pid);
            $subject = "RE: " . $post->post_title;
        } elseif (!empty($_GET['in_reply_to'])) {
            global $wpdb;
            $ssp = "select * from " . $wpdb->prefix . "project_pm where id='" . $_GET['in_reply_to'] . "'";
            $sspq = $wpdb->get_results($ssp);
            if (strpos($sspq[0]->subject, 'RE:') !== false) {
                $subject = $sspq[0]->subject;
            } else {
                $subject = "RE: " . substr($sspq[0]->subject, 0, 30);
            }
            //$sspq[0]->subject;
        }
        if (isset($_POST['send_a'])) {
            require_once ABSPATH . "wp-admin" . '/includes/file.php';
            require_once ABSPATH . "wp-admin" . '/includes/image.php';
            if (!empty($_FILES['file_instant']['name'])) {
                $pids = 0;
                $upload_overrides = array('test_form' => true);
                $uploaded_file = wp_handle_upload($_FILES['file_instant'], $upload_overrides);
                $file_name_and_location = $uploaded_file['file'];
                $file_title_for_media_library = $_FILES['file_instant']['name'];
                $arr_file_type = wp_check_filetype(basename($_FILES['file_instant']['name']));
                $uploaded_file_type = $arr_file_type['type'];
                if ($uploaded_file_type == "application/zip" or $uploaded_file_type == "application/pdf" or $uploaded_file_type == "application/msword" or $uploaded_file_type == "application/msexcel" or $uploaded_file_type == "application/doc" or $uploaded_file_type == "application/docx" or $uploaded_file_type == "application/xls" or $uploaded_file_type == "application/xlsx" or $uploaded_file_type == "application/csv" or $uploaded_file_type == "application/ppt" or $uploaded_file_type == "application/pptx" or $uploaded_file_type == "application/vnd.ms-excel" or $uploaded_file_type == "application/txt" or $uploaded_file_type == "text/plain" or $uploaded_file_type == "application/vnd.ms-powerpoint" or $uploaded_file_type == "application/vnd.openxmlformats-officedocument.presentationml.presentation" or $uploaded_file_type == "application/octet-stream" or $uploaded_file_type == "image/png" or $uploaded_file_type == "image/jpg" or $uploaded_file_type == "image/jpeg" or $uploaded_file_type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" or $uploaded_file_type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") {
                    $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => 'Uploaded ZIP ' . addslashes($file_title_for_media_library), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => 0, 'post_author' => $uid);
                    $attach_id = wp_insert_attachment($attachment, $file_name_and_location, $pids);
                    $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                    wp_update_attachment_metadata($attach_id, $attach_data);
                } else {
                    $error_mm = '1';
                }
            }
            $subject = $_POST['subject_a'];
            $message = $_POST['message_a'];
            $uids = $_POST['to_as'];
            if (empty($uids)) {
                $uids = $_GET['uid'];
            }
            if (!empty($_POST['send-to-all']) && $_POST['send-to-all'] == 'on') {
                global $current_user;
                get_currentuserinfo();
                $users = get_users();
                foreach ($users as $one) {
                    $uids = $one->ID;
                    ProjectTheme_send_priv_mess_to_person($uids, $uid, $error_mm, $subject, $message, $pid, $attach_id, $user, $post, $cant_send, true);
                }
                ?>
                
                <div class="my_box3">
            	<div class="padd10">
                 <?php 
                echo sprintf(__('Your message has been sent to all users.', 'ProjectTheme'));
                ?>
                </div>
                </div>
                
                <?php 
            } elseif (!empty($_POST['to_as']) || !empty($_POST['projectss'])) {
                global $current_user;
                get_currentuserinfo();
                if (is_array($_POST['to_as']) || is_array($_POST['projectss'])) {
                    for ($index = 0; $index < count($_POST['projectss']); $index++) {
                        if ($_POST['projectss'][$index] !== "") {
                            $to_as = get_user_by('id', $_POST['projectss'][$index]);
                        } else {
                            $to_as = get_user_by('email', $_POST['to_as'][$index]);
                        }
                        $uids = projectTheme_get_userid_from_username($to_as->user_login);
                        ProjectTheme_send_priv_mess_to_person($uids, $uid, $error_mm, $subject, $message, $pid, $attach_id, $user, $post, $cant_send);
                    }
                } else {
                    // it isn't array
                    if ($_POST['projectss'] !== '') {
                        $to_as = get_user_by('id', $_POST['projectss']);
                    } else {
                        $to_as = get_user_by('email', $_POST['to_as']);
                    }
                    $uids = projectTheme_get_userid_from_username($to_as->user_login);
                    ProjectTheme_send_priv_mess_to_person($uids, $uid, $error_mm, $subject, $message, $pid, $attach_id, $user, $post, $cant_send);
                    //if($uids == $current_user->ID) { $uids = false; $error_mm = 1; $cant_send = 1; }
                }
            }
        } else {
            ?>
   
         <script>
		 function getdataoftextarea()
		 {
		 	 alert($(".message_content").val());
		 }
		 function validate_form()
			 {
				 
		var to = document.form5.to_as.value;
        if (to == null || to == "")
		{
        alert("Please enter email id");
		document.form5.to_as.focus();
		
        return false;
				
       }
	   var to = document.form5.to_as.value;
	   var email= /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	   var em= email.test(to);
	   if(em==false)
		{
		alert("please enter valide email id");
		document.form5.to_as.focus();
		return false;
		}
       
				 
		var subj = document.form5.subject_a.value;
        if (subj == null || subj == "")
		{
        alert("Please fill the subject field");
		document.form5.subject_a.focus();
		
        return false;
				
       }
	 // var x1 = tinymce.get('jander').getContent();
	 // alert(x1);
	var x = tinymce.get('message_a').getContent();
    if (x == null || x == "")
		{
		alert("MESSAGE FIELD CANNOT BE BLANK");
		document.form5.message_a.focus();
		
        return false;
				
       }
	    
	   
}
		 </script>    
        <div class="my_box3">
            	
            
            	<div class="box_title"><?php 
            _e("Send Private Message to: ", "ProjectTheme");
            ?>
 <?php 
            echo $user->user_login;
            ?>
</div>
                <div class="box_content">  
                <form method="post" enctype="multipart/form-data" name="form5" id="form5" onsubmit="return validate_form();">
                <input type="hidden" name="tm" value="<?php 
            echo current_time('timestamp', 0);
            ?>
" />
                <table>
                <?php 
            if (empty($uid)) {
                $rtt = ProjectTheme_get_my_awarded_projects2($current_user->ID, true);
                ?>
                    <?php 
                if (current_user_can('manage_options')) {
                    ?>
                        
                    <tr>
                        <td width="140" class="no_wrap"><?php 
                    _e("Send To All", "ProjectTheme");
                    ?>
&nbsp;:</td>
                        <td>
                            <input type="checkbox" id="send-to-all" name="send-to-all" />
                            <span>Send message to ALL users on site</span>
                        </td>
                    </tr>
                    
                    <script>
                        jQuery(document).ready(function(){
                            
                            jQuery('#send-to-all').on('change', function(){
                                
                                var inputs = jQuery('.send-to-raw').children('td').children('input,select');

                                if ($(this).attr('checked')) {
                                    inputs.attr('disabled', true);
                                } else {
                                    inputs.removeAttr('disabled');
                                }
                            });
                        
                        });
                    </script>
                    
                    <?php 
                }
                ?>
                <tr class="send-to-raw">
                    <td width="140" class="no_wrap"><?php 
                _e("Send To (e-mail)", "ProjectTheme");
                ?>
<font style="color:red;">*</font>&nbsp;:</td>
                    <td width="200"><input size="20" name="to_as[]" class="to_as" type="text" value="" /> <?php 
                if ($rtt) {
                    _e('or', 'ProjectTheme');
                    echo " " . $rtt;
                }
                ?>
</td>
                    <td><input type="button" class="add_email" value="+" onclick="add_raw()"/></td>
                </tr>
                <?php 
            }
            ?>
                
                <tr>
                <td width="140" class="no_wrap"><?php 
            _e("Subject", "ProjectTheme");
            ?>
<font style="color:red;">*</font>&nbsp;:</td>
                <td><input size="50" name="subject_a" id="subject_a" type="text" value="<?php 
            echo $subject;
            ?>
" /></td>
                </tr>
                
                 <script>
                     
                     function add_raw(){
                         var html = jQuery('.send-to-raw:first').html();
                         var btn_remove = '<td><input type="button" class="remove_email" value="X" onclick="remove_raw(this)"/></td>'
                         html = '<tr class="send-to-raw">' + html +btn_remove  +'</tr>';
                         jQuery('.send-to-raw:last').after(html);
                     }
                     
                     function remove_raw(el){
                         jQuery(el).parent('td').parent('tr').remove();
                     }
                     
			
			jQuery(document).ready(function(){
			tinyMCE.init({
					mode : "specific_textareas",
					theme : "modern", 
					/*plugins : "autolink, lists, spellchecker, style, layer, table, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, media, searchreplace, print, contextmenu, paste, 

directionality, fullscreen, noneditable, visualchars, nonbreaking, xhtmlxtras, template",*/
					editor_selector :"tinymce-enabled"
				});
			});
						
			</script>
                
                <tr>
                <td valign="top" class="no_wrap"><?php 
            _e("Message", "ProjectTheme");
            ?>
<font style="color:red;">*</font>&nbsp;:</td>
                <td><textarea name="message_a" class="tinymce-enabled" id="message_a"  rows="6" cols="50" ></textarea></td>
                </tr>
                
                
                <tr>
                <td valign="top" class="no_wrap"><?php 
            _e("Attach File", "ProjectTheme");
            ?>
:</td>
                <td>
                	<div style="display: block;">
                		<span style="display:inline-block;"><input type="file" id="file_instant" name="file_instant" class="" multiple=""/></span>
                		<span class="del21" style="float:right;cursor:pointer;" value="clear" onclick="file_clear(); textarea_instant();">Delete</span>
                	</div>
                	<div style="display: block;">
                		<?php 
            _e('Only PDF, TXT, ZIP, Office files and Images.', 'ProjectTheme');
            ?>
                	</div>
                </td>
                </tr>
                
                
                 <tr>
                <td width="140">&nbsp;</td>
                <td></td>
                </tr>
                
                 <tr>
                <td width="140">&nbsp;</td>
                <td><input name="send_a" class="submit_bottom2" type="submit"  value="<?php 
            _e("Send Message", 'ProjectTheme');
            ?>
" /></td>
                </tr>
                
                </table>
      			</form>
                
                </div>
                </div>
             
        
        <?php 
        }
    }
    ?>
        
             
        </div> <!-- end dif content -->
        <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());
        		});
        	
});

         
        	function file_clear(){
       			$('#file_instant').val('');
    		}
			
		 
			
		  
   
   </script>
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Пример #9
0
function ProjectTheme_my_account_payments_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>

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

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

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

    		

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

            		$( 'input[name="amount"]' ).keypress(function( event ) {
            		  var kk = event.which;
            		  console.log(kk);
            		  
            		  if((kk>47 && kk<58) || kk==13 || kk==0 || kk==8 || kk==46){
            		  	return true;
            		  }
            		  else{
            		  	return false;
            		  }
            		  
            		});
            	});
        </script>
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Пример #10
0
function ProjectTheme_my_account_milestones_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        	<?php 
    if (ProjectTheme_is_user_business($uid) == true) {
        if (isset($_GET['release_id'])) {
            ?>
				
                <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
            _e("Releasing Milestone Payment", "ProjectTheme");
            ?>
</div>
                <div class="box_content"> 
                
                		<?php 
            $release_id = intval($_GET['release_id']);
            $s = "select * from " . $wpdb->prefix . "project_milestone where id='{$release_id}'";
            $r = $wpdb->get_results($s);
            if (count($r) > 0) {
                $row = $r[0];
                $am = projecttheme_get_show_price($row->amount);
                $prj = get_post($row->pid);
                $prj = $prj->post_title;
                $serv = get_userdata($row->uid);
                $serv = $serv->user_login;
                ?>
                                
                                <form method="post">
                                <input type="hidden" value="<?php 
                echo $_GET['release_id'];
                ?>
" name="release_id" />
                                	
                                    <?php 
                printf(__('Are you sure you want to release the payment of <b>%s</b> for the project <b>%s</b> to the service provider <b>%s</b> ?', 'ProjectTheme'), $am, $prj, $serv);
                ?>
                                	<br/><br/>
                                <?php 
                $cr = projectTheme_get_credits($current_user->ID);
                if ($cr < $row->amount) {
                    ?>
    
                                
                                	<div class="error">
                                    <?php 
                    printf(__('You do not have enough balance to pay this milestone. <a href="%s">Click here</a> to add more balance.', 'ProjectTheme'), ProjectTheme_get_payments_page_url('deposit'));
                    ?>
                                    </div>
                                
                               <?php 
                } else {
                    ?>
                                
                                    <input type="submit" name="submits1yes_me_ok_p" value="<?php 
                    _e('Yes, release', 'ProjectTheme');
                    ?>
" value="yes" />                                    
                                    <input type="submit" name="submits1no_me_thing_ok"  value="<?php 
                    _e('No, do not release', 'ProjectTheme');
                    ?>
" value="no" />
                               
                               <?php 
                }
                ?>
 
                                </form>
                                
                                <?php 
            } else {
                echo 'my_err_00';
            }
            ?>
                    
                    
                </div>
                </div>
                </div>
                
                
                
                <?php 
        } elseif ($_GET['submit_ok_p']) {
            echo '<div class="saved_thing">Your milestone payment has been released.</div>';
        }
        ?>
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
        _e("Create Milestone Payment", "ProjectTheme");
        ?>
</div>
                <div class="box_content"> 
            	<?php 
        if (isset($_POST['submit_milestone'])) {
            $nok = 0;
            $error1 = array();
            $projectss = $_POST['projectss'];
            $amount_text = trim($_POST['amount_text']);
            $completion_date = strtotime($_POST['completion_date']);
            $completion_date2 = $_POST['completion_date'];
            $tm = current_time('timestamp', 0);
            $description = nl2br($_POST['description']);
            $pid = $projectss;
            if (empty($projectss)) {
                $nok = 1;
                $error1[] = __('You need to select a project for your payment.', 'ProjectTheme');
            }
            if (empty($amount_text) or !is_numeric($amount_text)) {
                $nok = 1;
                $error1[] = __('Make sure you type in a payment amount for your milestone, and its numeric.', 'ProjectTheme');
            }
            if (empty($description)) {
                $nok = 1;
                $error1[] = __('Please provide a description for your milestone payment.', 'ProjectTheme');
            }
            if ($completion_date < $tm) {
                $nok = 1;
                $error1[] = __('The completion date must be a date in the future.', 'ProjectTheme');
            }
            if ($nok == 0) {
                /*$projectTheme_get_winner_bid 	= projectTheme_get_winner_bid($pid);
                		$uid_of_winner 					= $projectTheme_get_winner_bid->uid;*/
                $uid_of_winner = $_POST['uids'];
                //$s1 = "select * from ".$wpdb->prefix."project_milestone where pid='$pid' AND completion_date='$completion_date' ";
                //$r1 = $wpdb->get_results($s1);
                //mysql_query($s1) or die(mysql_error());
                //if(count($r1) == 0){
                $s1 = "insert into " . $wpdb->prefix . "project_milestone (owner, pid, uid, description_content, datemade, completion_date, amount) \n\t\t\t\t\t\t\t\tvalues('{$uid}','{$projectss}','{$uid_of_winner}','{$description}','{$tm}', '{$completion_date}', '{$amount_text}')";
                $wpdb->query($s1);
                //}
                echo '<div class="saved_thing">' . __('Your milestone payment has been created.', 'ProjectTheme') . '</div>';
                $amount_text = '';
                $completion_date2 = '';
                $description = '';
            } else {
                echo '<div class="error">';
                foreach ($error1 as $ee) {
                    echo '<li>' . $ee . '</li> ';
                }
                echo '</div> <div class="clear10"></div>';
            }
        }
        ?>
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
				<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
        		<script src="https://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
        		<script src="<?php 
        echo get_bloginfo('template_url');
        ?>
/js/jquery.iframe-transport.js"></script>
        		<script src="<?php 
        echo get_bloginfo('template_url');
        ?>
/js/jquery.fileupload.js"></script>
        		<script src="<?php 
        echo get_bloginfo('template_url');
        ?>
/js/jquery.fileupload-ui.js"></script>
        		<script src="<?php 
        echo get_bloginfo('template_url');
        ?>
/js/application.js"></script>  	
                <link rel="stylesheet" media="all" type="text/css" href="<?php 
        echo get_bloginfo('template_url');
        ?>
/css/ui_thing.css" />
				<script type="text/javascript" language="javascript" src="<?php 
        echo get_bloginfo('template_url');
        ?>
/js/timepicker.js"></script>
        
        	<script>
 
			
			jQuery(document).ready(function() {
				 jQuery('#completion_date').datetimepicker({
				showSecond: false,
				timeFormat: 'hh:mm:ss',
				
					currentText: '<?php 
        _e('Now', 'ProjectTheme');
        ?>
',
					closeText: '<?php 
        _e('Done', 'ProjectTheme');
        ?>
',
					ampm: false,
					dateFormat: 'mm/dd/yy',
					timeFormat: 'hh:mm tt',
					timeSuffix: '',
					 
					timeOnlyTitle: '<?php 
        _e('Choose Time', 'ProjectTheme');
        ?>
',
					timeText: '<?php 
        _e('Time', 'ProjectTheme');
        ?>
',
					hourText: '<?php 
        _e('Hour', 'ProjectTheme');
        ?>
',
					minuteText: '<?php 
        _e('Minute', 'ProjectTheme');
        ?>
',
					secondText: '<?php 
        _e('Second', 'ProjectTheme');
        ?>
',
					timezoneText: '<?php 
        _e('Time Zone', 'ProjectTheme');
        ?>
'
			
			});});
 
 		</script>

 		<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);
							
					
							
						}
					});*/
					
			 		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);
			 				
			 		
			 				
			 			}
			 		});
					
				}
				
				<?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>
        
        <form method="post" action="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_milestones_id'));
        ?>
">
                <table width="100%">
                <tr>
              		<td><?php 
        _e('Select Project:', 'ProjectTheme');
        ?>
 </td> 
                    <td><?php 
        $xx = ProjectTheme_get_my_awarded_projects($uid);
        echo $xx == false ? _e('There are no projects in progress.', 'ProjectTheme') : $xx;
        ?>
 </td> 
               </tr>

               <tr>
                    <td><?php 
        _e('For Provider', 'ProjectTheme');
        ?>
:</td><td id="win_providers"></td>
                </tr>
               
               
               <tr>
              		<td><?php 
        _e('Amount:', 'ProjectTheme');
        ?>
 </td> 
                    <td><input type="text" size="15" id="amount_text" name="amount_text" value="<?php 
        echo isset($amount_text) ? $amount_text : '';
        ?>
" /> <?php 
        echo projecttheme_get_currency();
        ?>
 </td> 
               </tr>
               
               
               <tr>
              		<td valign="top"><?php 
        _e('Description:', 'ProjectTheme');
        ?>
 </td> 
                    <td><textarea rows="5" cols="40" name="description" id="description"><?php 
        echo str_replace("<br />", "", $description);
        ?>
</textarea></td> 
               </tr>
               
               <tr>
              		<td><?php 
        _e('Completion Date:', 'ProjectTheme');
        ?>
 </td> 
                    <td><input type="text" size="25" id="completion_date" name="completion_date"  value="<?php 
        echo isset($completion_date2) ? $completion_date2 : '';
        ?>
" /></td> 
               </tr>
               
               
                <tr>
              		<td></td> 
                    <td><input type="submit" id="submit_milestone" value="<?php 
        _e('Create Milestone', 'ProjectTheme');
        ?>
" name="submit_milestone" /></td> 
               </tr>
               
               
               
              
              </table>
          </form>
                
                </div>
                </div>
                </div>
                
                <div class="clear10"></div>
                <?php 
    }
    ?>
                
            <?php 
    if (ProjectTheme_is_user_business($uid)) {
        ?>
    
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
        _e("Outgoing Milestone Payments", "ProjectTheme");
        ?>
</div>
                <div class="box_content"> 
            	
                <?php 
        $s = "select * from " . $wpdb->prefix . "project_milestone where owner='{$uid}' AND released='0' order by datemade desc";
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            ?>
                        <table class="bdd_bdd" width="100%">
                        	<tr>
                            	<td width="150"><?php 
            _e('Project', 'ProjectTheme');
            ?>
</td>
                                <td><?php 
            _e('Service Provider', 'ProjectTheme');
            ?>
</td>
                                <td><?php 
            _e('Amount', 'ProjectTheme');
            ?>
</td>
                                <td width="170"><?php 
            _e('Description', 'ProjectTheme');
            ?>
</td>                                
                                <td><?php 
            _e('Due Date', 'ProjectTheme');
            ?>
</td>
                                <td><?php 
            _e('Options', 'ProjectTheme');
            ?>
</td>
                            </tr>
                        
                        
                        <?php 
            foreach ($r as $row) {
                $post_p = get_post($row->pid);
                $project_title = $post_p->post_title;
                $user_of_milestone = get_userdata($row->uid);
                ?>
                				<tr>
                                	<td><?php 
                echo '<a href="' . get_permalink($row->pid) . '">' . $project_title . '</a>';
                ?>
</td>
                                    <td><?php 
                echo '<a href="' . ProjectTheme_get_user_profile_link($user_of_milestone->ID) . '">' . $user_of_milestone->user_login . '</a>';
                ?>
</td>
                                    <td><?php 
                echo projecttheme_get_show_price($row->amount);
                ?>
</td>
                                    <td><?php 
                echo $row->description_content;
                ?>
</td>
                                    <td><?php 
                echo date_i18n('d-M-Y', $row->completion_date);
                ?>
</td>
                                	<td><a href="<?php 
                echo projectTheme_release_milestone_link($row->id);
                ?>
" class="green_btn block"><?php 
                _e('Release Payment', 'ProjectTheme');
                ?>
</a></td>
                                </tr>
                
                		<?php 
            }
            ?>
                        
                        </table>
                
                <?php 
        } else {
            _e('There are no outgoing payments.', 'ProjectTheme');
        }
        ?>
                
                </div>
                </div>
                </div>
                 <div class="clear10"></div>
            <?php 
    }
    ?>
    
                
                
                
                  <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    _e("Incoming Milestone Payments", "ProjectTheme");
    ?>
</div>
                <div class="box_content"> 
            	
                
                
                <?php 
    $s = "select * from " . $wpdb->prefix . "project_milestone where uid='{$uid}' AND released='0' order by datemade desc";
    $r = $wpdb->get_results($s);
    if (count($r) > 0) {
        ?>
                        <table class="bdd_bdd" width="100%">
                        	<tr>
                            	<td width="150"><?php 
        _e('Project', 'ProjectTheme');
        ?>
</td>
                                <!--<td><?php 
        _e('Service Provider', 'ProjectTheme');
        ?>
</td>-->
                                <td><?php 
        _e('Service Owner', 'ProjectTheme');
        ?>
</td>
                                <td><?php 
        _e('Amount', 'ProjectTheme');
        ?>
</td>
                                <td width="170"><?php 
        _e('Description', 'ProjectTheme');
        ?>
</td>                                
                                <td><?php 
        _e('Due Date', 'ProjectTheme');
        ?>
</td>
                                 
                            </tr>
                        
                        
                        <?php 
        foreach ($r as $row) {
            $post_p = get_post($row->pid);
            $project_title = $post_p->post_title;
            //$user_of_milestone = get_userdata($row->uid);
            $user_of_milestone = get_userdata($row->owner);
            ?>
                				<tr>
                                	<td><?php 
            echo '<a href="' . get_permalink($row->pid) . '">' . $project_title . '</a>';
            ?>
</td>
                                    <td><?php 
            echo '<a href="' . ProjectTheme_get_user_profile_link($user_of_milestone->ID) . '">' . $user_of_milestone->user_login . '</a>';
            ?>
</td>
                                    <td><?php 
            echo projecttheme_get_show_price($row->amount);
            ?>
</td>
                                    <td><?php 
            echo $row->description_content;
            ?>
</td>
                                    <td><?php 
            echo date_i18n('d-M-Y', $row->completion_date);
            ?>
</td>
                                	 
                                </tr>
                
                		<?php 
        }
        ?>
                        
                        </table>
                
                <?php 
    } else {
        _e('There are no incoming payments.', 'ProjectTheme');
    }
    ?>
                
                </div>
                </div>
                </div>
           
                
                </div>   
<?php 
    ProjectTheme_get_users_links();
}
Пример #11
0
    function ProjectTheme_display_provider_search_page_disp()
    {
        ?>
	
	
    	<div id="content" >
        	
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
        _e("Service Provider Search", "ProjectTheme");
        ?>
</div>
                <div class="box_content"> 
<?php 
        $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
        $pg = $_GET['pg'];
        if (empty($pg)) {
            $pg = 1;
        }
        $nrRes = 15;
        //------------------
        $offset = ($pg - 1) * $nrRes;
        //------------------
        if (isset($_GET['username'])) {
            $args['search'] = "*" . trim($_GET['username']) . "*";
        }
        // prepare arguments
        $args['orderby'] = 'display_name';
        $arr_aray = array();
        if (!empty($_GET['rating_over'])) {
            $arr_sbg = array('key' => 'cool_user_rating', 'value' => $_GET['rating_over'], 'compare' => '>');
            array_push($arr_aray, $arr_sbg);
        }
        if ($ProjectTheme_enable_2_user_tp == "yes") {
            $arr_sbg = array('key' => 'user_tp', 'value' => 'service_provider', 'compare' => '=');
            array_push($arr_aray, $arr_sbg);
        }
        //-----------------------------------------------
        $args['meta_query'] = $arr_aray;
        $args['number'] = $nrRes;
        $args['offset'] = $offset;
        $args['count_total'] = true;
        //-----------------------------------------------
        $wp_user_query = new WP_User_Query($args);
        // Get the results
        $ttl = $wp_user_query->total_users;
        $nrPages = ceil($ttl / $nrRes);
        $authors = $wp_user_query->get_results();
        // Check for results
        if (!empty($authors)) {
            echo '<table width="100%">';
            // loop trough each author
            echo '<tr>';
            echo '<td><strong>' . __('Username', 'ProjectTheme') . '</strong></td>';
            echo '<td><strong>' . __('User Rating', 'ProjectTheme') . '</strong></td>';
            echo '<td><strong>' . __('Options', 'ProjectTheme') . '</strong></td>';
            echo '</tr>';
            foreach ($authors as $author) {
                // get all the user's data
                $author_info = get_userdata($author->ID);
                echo '<tr>';
                echo '<td><a href="' . ProjectTheme_get_user_profile_link($author->ID) . '">' . $author_info->user_login . '<a/></td>';
                echo '<td>' . ProjectTheme_project_get_star_rating($author->ID) . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('send', '', '&uid=' . $author_info->ID) . '">' . __('Contact Provider', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '</table>';
            echo '<div class="div_class_div">';
            $totalPages = $nrPages;
            $my_page = $pg;
            $page = $pg;
            $batch = 10;
            $nrpostsPage = $nrRes;
            $end = $batch * $nrpostsPage;
            if ($end > $pagess) {
                $end = $pagess;
            }
            $start = $end - $nrpostsPage + 1;
            if ($start < 1) {
                $start = 1;
            }
            $links = '';
            $raport = ceil($my_page / $batch) - 1;
            if ($raport < 0) {
                $raport = 0;
            }
            $start = $raport * $batch + 1;
            $end = $start + $batch - 1;
            $end_me = $end + 1;
            $start_me = $start - 1;
            if ($end > $totalPages) {
                $end = $totalPages;
            }
            if ($end_me > $totalPages) {
                $end_me = $totalPages;
            }
            if ($start_me <= 0) {
                $start_me = 1;
            }
            $previous_pg = $page - 1;
            if ($previous_pg <= 0) {
                $previous_pg = 1;
            }
            $next_pg = $pages_curent + 1;
            if ($next_pg > $totalPages) {
                $next_pg = 1;
            }
            if ($my_page > 1) {
                echo '<a href="' . projectTheme_provider_search_link() . 'pg=' . $previous_pg . '" class="bighi"><< ' . __('Previous', 'ProjectTheme') . '</a>';
                echo '<a href="' . projectTheme_provider_search_link() . 'pg=' . $start_me . '" class="bighi"><<</a>';
            }
            for ($i = $start; $i <= $end; $i++) {
                if ($i == $pg) {
                    echo '<a href="#" class="bighi" id="activees">' . $i . '</a>';
                } else {
                    echo '<a href="' . projectTheme_provider_search_link() . 'pg=' . $i . '" class="bighi">' . $i . '</a>';
                }
            }
            if ($totalPages > $my_page) {
                echo '<a href="' . projectTheme_provider_search_link() . 'pg=' . $end_me . '" class="bighi">>></a>';
            }
            if ($page < $totalPages) {
                echo '<a href="' . projectTheme_provider_search_link() . 'pg=' . $next_pg . '" class="bighi">' . __('Next', 'ProjectTheme') . ' >></a>';
            }
            echo '</div>';
        } else {
            echo 'No authors found';
        }
        ?>
    
    			</div>
                </div>
                </div>
                </div>
                
                <!-- ############## -->
                
                
                <div id="right-sidebar"> <ul class="xoxo">
	<li class="">
    	<h3 class="widget-title"><?php 
        _e('Filter Options', 'ProjectTheme');
        ?>
</h3>
    	
        <form method="get">
		<table width="100%">
        <tr>
        <td><?php 
        _e('Username Like', 'ProjectTheme');
        ?>
</td>
        <td><input type="text" size="20" value="<?php 
        echo $_GET['username'];
        ?>
" name="username" /></td>
        </tr>
        
        
        <tr>
        <td><?php 
        _e('Rating Over', 'ProjectTheme');
        ?>
</td>
        <td><input type="text" size="10" value="<?php 
        echo $_GET['rating_over'];
        ?>
" name="rating_over" /> [0-5]</td>
        </tr>
        
        
         <tr>
        <td></td>
        <td><input type="submit" value="<?php 
        _e('Search', 'ProjectTheme');
        ?>
" name="search_provider" /></td>
        </tr>
        
        
        </table>
    	</form>
        <div class="clear10"></div>
    </li>
    
	<?php 
        dynamic_sidebar('other-page-area');
        ?>
</ul>
</div>

                
                
   <?php 
    }
Пример #12
0
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 
}
Пример #13
0
     $show_this_around = 1;
 } else {
     if ($private_bids == 'yes' or $private_bids == '1' or $private_bids == 1) {
         if ($uid == $row->uid) {
             $show_this_around = 1;
         } else {
             $show_this_around = 0;
         }
     } else {
         $show_this_around = 1;
     }
 }
 if ($show_this_around == 1) {
     $user = get_userdata($row->uid);
     echo '<div class="myrow">';
     echo '<div><i class="bid-person"></i> <a href="' . ProjectTheme_get_user_profile_link($user->ID) . '">' . $user->user_login . '</a></div>';
     echo '<div><i class="bid-money"></i>  ' . ProjectTheme_get_show_price($row->bid) . '</div>';
     echo '<div><i class="bid-clock"></i> ' . date_i18n("d-M-Y H:i:s", $row->date_made) . '</div>';
     echo '<div><i class="bid-days"></i> ' . sprintf(__("%s days", "ProjectTheme"), $row->days_done) . '</div>';
     //if($owner == 1 && $closed == "0")
     //echo '<div><input name="bids" data-pid="' . get_the_ID() . '" data-bid="' . $row->id . '" type="checkbox"></div>';
     if ($owner == 1) {
         $nr = 7;
         if ($row->winner != 1 && $ending > current_time('timestamp', 0) && $closed == 0) {
             echo '<div><i class="bid-select"></i>  <a href="' . get_bloginfo('siteurl') . '/?p_action=choose_winner&pid=' . get_the_ID() . '&bid=' . $row->id . '">' . __('Select as Winner', 'ProjectTheme') . '</a></div>';
         }
         if ($ProjectTheme_enable_project_files != "no") {
             if (projecttheme_see_if_project_files_bid(get_the_ID(), $row->uid) == true) {
                 echo '<div> <i class="bid-days"></i> ';
                 echo '<a href="#" class="get_files" rel="' . get_the_ID() . '_' . $row->uid . '">' . __('See Bid Files', 'ProjectTheme') . '</a> ';
                 echo '</div>';
Пример #14
0
function ProjectTheme_post_new_area_function()
{
    global $wp_query, $projectOK, $current_user, $MYerror;
    get_currentuserinfo();
    $new_Project_step = $wp_query->query_vars['post_new_step'];
    if (empty($new_Project_step)) {
        $new_Project_step = 1;
    }
    $pid = $wp_query->query_vars['projectid'];
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="sonita">
        	
            <div class="my_box3">            
                <div class="box_content"> 
                
                <?php 
    $is_it_allowed = true;
    $is_it_allowed = apply_filters('ProjectTheme_is_it_allowed_place_bids', $is_it_allowed);
    if ($is_it_allowed != true) {
        do_action('ProjectTheme_is_it_not_allowed_place_bids_action');
    } else {
        ?>
                
            	
    			<?php 
        echo '<div id="steps">';
        echo '<ul>';
        echo '<li ' . ($new_Project_step == '1' ? "class='active_step' " : "") . '>' . __("Project Info", 'ProjectTheme') . '</li>';
        do_action('ProjectTheme_after_step1_show', $new_Project_step);
        echo '<li ' . ($new_Project_step == '2' ? "class='active_step' " : "") . '>' . __("Options", 'ProjectTheme') . '</li>';
        echo '<li ' . ($new_Project_step == '3' ? "class='active_step' " : "") . '>' . __("Preview", 'ProjectTheme') . '</li>';
        echo '<li ' . ($new_Project_step == '4' ? "class='active_step' " : "") . '>' . __("Payment & Finish", 'ProjectTheme') . '</li>';
        echo '</ul>';
        echo '</div>';
        //****************************************************************************************
        if ($new_Project_step == "1") {
            //-----------------
            $location = wp_get_object_terms($pid, 'project_location', array('order' => 'ASC', 'orderby' => 'term_id'));
            $cat = wp_get_object_terms($pid, 'project_cat', array('order' => 'ASC', 'orderby' => 'term_id'));
            if (!empty($pid)) {
                $post = get_post($pid);
            }
            if (is_array($MYerror)) {
                if ($projectOK == 0) {
                    echo '<div class="errrs">';
                    echo __('Your form has errors. Please check below, correct the errors, then submit again.', 'ProjectTheme');
                    echo '</div>';
                }
            }
            ?>
    <div class="sonita2">
 <form method="post" action="<?php 
            echo ProjectTheme_post_new_with_pid_stuff_thg($pid, '1');
            ?>
">  
    <ul class="post-new">
    <?php 
            do_action('ProjectTheme_step1_before_title');
            ?>
    	
        
        <li>
        	<h3><?php 
            _e('Project Main Information', 'ProjectTheme');
            ?>
</h3>
        </li>
        
        <li class="<?php 
            echo projecttheme_get_post_new_error_thing('project_title');
            ?>
">
        <?php 
            echo projecttheme_get_post_new_error_thing_display('project_title');
            ?>
        
        	<h2><?php 
            echo __('Your project title', 'ProjectTheme');
            ?>
</h2>
        	<p><input type="text" size="50" class="do_input_new full_wdth_me" name="project_title" placeholder="<?php 
            _e('eg: I need a website created very soon.', 'ProjectTheme');
            ?>
" value="<?php 
            echo empty($_POST['project_title']) ? $post->post_title == "Auto Draft" ? "" : $post->post_title : $_POST['project_title'];
            ?>
" /></p>
        </li>
        
         <?php 
            do_action('ProjectTheme_step1_before_description');
            ?>
        <?php 
            $pst = $post->post_content;
            $pst = str_replace("<br />", "", $pst);
            ?>
        <li class="<?php 
            echo projecttheme_get_post_new_error_thing('project_description');
            ?>
">
        <?php 
            echo projecttheme_get_post_new_error_thing_display('project_description');
            ?>
        
        	<h2><?php 
            echo __('Description', 'ProjectTheme');
            ?>
</h2>
        <p><textarea rows="6" cols="60" class="full_wdth_me do_input_new description_edit" placeholder="<?php 
            _e('Describe here your project scope.', 'ProjectTheme');
            ?>
"  name="project_description"><?php 
            echo trim($pst);
            ?>
</textarea></p>
        </li>

		
         <li>
        	<h3><?php 
            _e('Categories', 'ProjectTheme');
            ?>
</h3>
        </li>
       
     <?php 
            do_action('ProjectTheme_step1_before_category');
            ?>
  
        
            <script>
			
									function display_subcat(vals)
									{
										jQuery.post("<?php 
            bloginfo('siteurl');
            ?>
/?get_subcats_for_me=1", {queryString: ""+vals+""}, function(data){
											if(data.length >0) {
												 
												jQuery('#sub_cats').html(data);
												 
											}
										});
										
									}
									
									
									function display_subcat2(vals)
									{
										jQuery.post("<?php 
            bloginfo('siteurl');
            ?>
/?get_locscats_for_me=1", {queryString: ""+vals+""}, function(data){
											if(data.length >0) {
												 
												jQuery('#sub_locs').html(data);
												jQuery('#sub_locs2').html("&nbsp;");
												 
											}
											else
											{
												jQuery('#sub_locs').html("&nbsp;");
												jQuery('#sub_locs2').html("&nbsp;");	
											}
										});
										
									}
									
									function display_subcat3(vals)
									{
										jQuery.post("<?php 
            bloginfo('siteurl');
            ?>
/?get_locscats_for_me2=1", {queryString: ""+vals+""}, function(data){
											if(data.length >0) {
												 
												jQuery('#sub_locs2').html(data);
												 
											}
										});
										
									}
									
									</script>
        
        <li class="<?php 
            echo projecttheme_get_post_new_error_thing('project_category');
            ?>
">
        <?php 
            echo projecttheme_get_post_new_error_thing_display('project_category');
            ?>
        
        	 
        	<p class="strom_100">
			
            
            
            <?php 
            if (get_option('ProjectTheme_enable_multi_cats') == "yes") {
                ?>
			<div class="multi_cat_placeholder_thing">
            
            	<?php 
                $selected_arr = ProjectTheme_build_my_cat_arr($pid);
                echo projectTheme_get_categories_multiple('project_cat', $selected_arr);
                ?>
            
            </div>
            
            <?php 
            } else {
                ?>
            
			<?php 
                echo projectTheme_get_categories_clck("project_cat", !isset($_POST['project_cat_cat']) ? is_array($cat) ? $cat[0]->term_id : "" : htmlspecialchars($_POST['project_cat_cat']), __('Select Category', 'ProjectTheme'), "do_input_new", 'onchange="display_subcat(this.value)"');
                echo '<br/><span id="sub_cats">';
                if (!empty($cat[1]->term_id)) {
                    $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat[0]->term_id;
                    $sub_terms2 = get_terms('project_cat', $args2);
                    $ret = '<select class="do_input_new" name="subcat">';
                    $ret .= '<option value="">' . __('Select Subcategory', 'ProjectTheme') . '</option>';
                    $selected1 = $cat[1]->term_id;
                    foreach ($sub_terms2 as $sub_term2) {
                        $sub_id2 = $sub_term2->term_id;
                        $ret .= '<option ' . ($selected1 == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>';
                    }
                    $ret .= "</select>";
                    echo $ret;
                }
                echo '</span>';
                ?>
            <?php 
            }
            ?>
            
            
            </p>
        </li>
  
  	
        
        <?php 
            do_action('ProjectTheme_step1_before_tags');
            $project_tags = '';
            $t = wp_get_post_tags($post->ID);
            foreach ($t as $tags) {
                $project_tags .= $tags->name . ", ";
            }
            ?>
		<li>
        	<h2><?php 
            echo __('Tags', 'ProjectTheme');
            ?>
</h2>
        <p><input type="text" size="50" class="full_wdth_me do_input_new"  name="project_tags" placeholder="<?php 
            _e('eg: something, comma, separated.', 'ProjectTheme');
            ?>
" value="<?php 
            echo $project_tags;
            ?>
" /> </p>
        </li>
        
        
        <?php 
            do_action('ProjectTheme_step1_after_tags');
            ?>
        
        <li>
        	<h3><?php 
            _e('Skills', 'ProjectTheme');
            ?>
</h3>
        </li>
        
        
        <li>
        <div class="multi_cat_placeholder_thing">
            
            	<?php 
            $selected_arr = projectTheme_build_my_cat_arr2($pid);
            echo projectTheme_get_categories_multiple2('project_skill', $selected_arr);
            ?>
            
        </div>
        </li>
        
        
    
  <li>
        	<h3><?php 
            _e('Pricing and Budget', 'ProjectTheme');
            ?>
</h3>
        </li>
  
  <?php 
            do_action('ProjectTheme_step1_before_price');
            ?>
  
        <li><h2><?php 
            echo __('Project Budget', 'ProjectTheme');
            ?>
</h2>
        <p class="strom_100">
        
      <?php 
            $sel = get_post_meta($pid, 'budgets', true);
            echo ProjecTheme_get_budgets_dropdown($sel, 'do_input_new');
            ?>
      
      </p>
        </li>
       
        <?php 
            do_action('ProjectTheme_step1_before_ending');
            ?>
        
        <li>
        <h2>
         
        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
        	
        
        <link rel="stylesheet" media="all" type="text/css" href="<?php 
            echo get_bloginfo('template_url');
            ?>
/css/ui_thing.css" />
		<script type="text/javascript" language="javascript" src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/timepicker.js"></script>
          

       <?php 
            _e("Project Ending On", 'ProjectTheme');
            ?>
</h2>
       <?php 
            $dt = get_post_meta($pid, 'ending', true);
            if (!empty($dt)) {
                $dt = date_i18n('d-m-Y H:i', $dt);
            }
            ?>
       <p><input type="text" name="ending" id="ending" class="full_wdth_me do_input_new" value="<?php 
            echo $dt;
            ?>
"  /></p>
       </li>
        
 		<script>
		<?php 
            $dd = get_option('projectTheme_project_period');
            if (empty($dd)) {
                $dd = 7;
            }
            ?>
		
			var myDate=new Date();
			myDate.setDate(myDate.getDate()+<?php 
            echo $dd;
            ?>
);
			
			$(document).ready(function() {
				 $('#ending').datetimepicker({
				showSecond: false,
				timeFormat: 'hh:mm:ss',
				
					currentText: '<?php 
            _e('Now', 'ProjectTheme');
            ?>
',
					closeText: '<?php 
            _e('Done', 'ProjectTheme');
            ?>
',
					ampm: false,
					dateFormat: 'dd-mm-yy',
					timeFormat: 'hh:mm tt',
					timeSuffix: '',
					maxDateTime: myDate,
					timeOnlyTitle: '<?php 
            _e('Choose Time', 'ProjectTheme');
            ?>
',
					timeText: '<?php 
            _e('Time', 'ProjectTheme');
            ?>
',
					hourText: '<?php 
            _e('Hour', 'ProjectTheme');
            ?>
',
					minuteText: '<?php 
            _e('Minute', 'ProjectTheme');
            ?>
',
					secondText: '<?php 
            _e('Second', 'ProjectTheme');
            ?>
',
					timezoneText: '<?php 
            _e('Time Zone', 'ProjectTheme');
            ?>
'
			
			});});
 
 		</script>
        
        
            

        
        
        <?php 
            do_action('ProjectTheme_step1_before_location');
            ?>
        <?php 
            $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
            if ($ProjectTheme_enable_project_location == "yes") {
                ?>
        
          <li>
        	<h3><?php 
                _e('Location', 'ProjectTheme');
                ?>
</h3>
        </li>
        
        <li  class="<?php 
                echo projecttheme_get_post_new_error_thing('project_location');
                ?>
">
        <?php 
                echo projecttheme_get_post_new_error_thing_display('project_location');
                ?>
        
        	<h2><?php 
                echo __('Location', 'ProjectTheme');
                ?>
</h2>
        <p class="strom_100"> 
        
  
        
        <?php 
                echo projectTheme_get_categories_clck("project_location", !isset($_POST['project_location_cat']) ? is_array($location) ? $location[0]->term_id : "" : htmlspecialchars($_POST['project_location_cat']), __('Select Location', 'ProjectTheme'), "do_input_new", 'onchange="display_subcat2(this.value)"');
                echo '<br/><span id="sub_locs">';
                if (!empty($location[1]->term_id)) {
                    $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $location[0]->term_id;
                    $sub_terms2 = get_terms('project_location', $args2);
                    $ret = '<select class="do_input_new" name="subloc">';
                    $ret .= '<option value="">' . __('Select SubLocation', 'ProjectTheme') . '</option>';
                    $selected1 = $location[1]->term_id;
                    foreach ($sub_terms2 as $sub_term2) {
                        $sub_id2 = $sub_term2->term_id;
                        $ret .= '<option ' . ($selected1 == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>';
                    }
                    $ret .= "</select>";
                    echo $ret;
                }
                echo '</span>';
                echo '<br/><span id="sub_locs2">';
                if (!empty($location[2]->term_id)) {
                    $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $location[1]->term_id;
                    $sub_terms2 = get_terms('project_location', $args2);
                    $ret = '<select class="do_input_new" name="subloc2">';
                    $ret .= '<option value="">' . __('Select SubLocation', 'ProjectTheme') . '</option>';
                    $selected1 = $location[2]->term_id;
                    foreach ($sub_terms2 as $sub_term2) {
                        $sub_id2 = $sub_term2->term_id;
                        $ret .= '<option ' . ($selected1 == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>';
                    }
                    $ret .= "</select>";
                    echo $ret;
                }
                echo '</span>';
                ?>
        
        
        
        
        
        
        
        </p>
        </li>
       
       
       <?php 
                do_action('ProjectTheme_step1_before_address');
                ?>
    
       <?php 
                $show_address = true;
                $show_address = apply_filters('ProjectTheme_show_address_filter', $show_address);
                if ($show_address == true) {
                    ?>
 
        <li>
        	<h2><?php 
                    echo __('Address', 'ProjectTheme');
                    ?>
</h2>
        <p><input type="text" size="50" class="full_wdth_me do_input_new" placeholder="<?php 
                    _e('eg: New York, 13221', 'ProjectTheme');
                    ?>
"  name="project_location_addr" value="<?php 
                    echo !isset($_POST['project_location_addr']) ? get_post_meta($pid, 'Location', true) : $_POST['project_location_addr'];
                    ?>
" /> </p>
        </li>
        <?php 
                }
            }
            ?>
        
         <li>
        	<h3><?php 
            _e('Attach Images', 'ProjectTheme');
            ?>
</h3>
        </li>
        
         <li>
        <div class="cross_cross">

 
    
 
    
    
    <script>
 
	
	jQuery(function() {

Dropzone.autoDiscover = false; 	 
var myDropzoneOptions = {
  maxFilesize: 15,
    addRemoveLinks: true,
	acceptedFiles:'image/*',
    clickable: true,
	url: "<?php 
            bloginfo('siteurl');
            ?>
/?my_upload_of_project_files2=1",
};
 
var myDropzone = new Dropzone('div#myDropzoneElement2', myDropzoneOptions);

myDropzone.on("sending", function(file, xhr, formData) {
  formData.append("author", "<?php 
            echo $cid;
            ?>
"); // Will send the filesize along with the file as POST data.
  formData.append("ID", "<?php 
            echo $pid;
            ?>
"); // Will send the filesize along with the file as POST data.
});

   
    <?php 
            $args = array('order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'attachment', 'post_parent' => $pid, 'post_status' => null, 'post_mime_type' => 'image', 'numberposts' => -1);
            $attachments = get_posts($args);
            if ($pid > 0) {
                if ($attachments) {
                    foreach ($attachments as $attachment) {
                        $url = $attachment->guid;
                        $imggg = $attachment->post_mime_type;
                        $url = wp_get_attachment_url($attachment->ID);
                        ?>
	
						var mockFile = { name: "<?php 
                        echo $attachment->post_title;
                        ?>
", size: 12345, serverId: '<?php 
                        echo $attachment->ID;
                        ?>
' };
						myDropzone.options.addedfile.call(myDropzone, mockFile);
						myDropzone.options.thumbnail.call(myDropzone, mockFile, "<?php 
                        echo projectTheme_generate_thumb($attachment->ID, 100, 100);
                        ?>
");						 
				
				<?php 
                    }
                }
            }
            ?>
 
	myDropzone.on("success", function(file, response) {
    /* Maybe display some more file information on your page */
	 file.serverId = response;
	 file.thumbnail = "<?php 
            echo bloginfo('template_url');
            ?>
/images/file_icon.png";
	 
	   
  });
  
  
myDropzone.on("removedfile", function(file, response) {
    /* Maybe display some more file information on your page */
	  delete_this2(file.serverId);
	 
  });  	
	
	});
	
	</script>

    

	<?php 
            _e('Click the grey area below to add project images. Other files are not accepted. Use the form below.', 'ProjectTheme');
            ?>
    <div class="dropzone dropzone-previews" id="myDropzoneElement2" ></div>
 
    
	</div>
        </li>
   		
        <li>
        	<h3><?php 
            _e('Attach Files', 'ProjectTheme');
            ?>
</h3>
        </li>
        
        
        <li>
        <div class="cross_cross">



	<script type="text/javascript" src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/dropzone.js"></script>     
	<link rel="stylesheet" href="<?php 
            echo get_bloginfo('template_url');
            ?>
/css/dropzone.css" type="text/css" />
    
 
    
    
    <script>
 
	
	jQuery(function() {

Dropzone.autoDiscover = false; 	 
var myDropzoneOptions = {
  maxFilesize: 15,
    addRemoveLinks: true,
	acceptedFiles:'.zip,.pdf,.rar,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.psd,.ai',
    clickable: true,
	url: "<?php 
            bloginfo('siteurl');
            ?>
/?my_upload_of_project_files_proj=1",
};
 
var myDropzone = new Dropzone('div#myDropzoneElement', myDropzoneOptions);

myDropzone.on("sending", function(file, xhr, formData) {
  formData.append("author", "<?php 
            echo $cid;
            ?>
"); // Will send the filesize along with the file as POST data.
  formData.append("ID", "<?php 
            echo $pid;
            ?>
"); // Will send the filesize along with the file as POST data.
});

   
    <?php 
            $args = array('order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'attachment', 'meta_key' => 'is_prj_file', 'meta_value' => '1', 'post_parent' => $pid, 'post_status' => null, 'numberposts' => -1);
            $attachments = get_posts($args);
            if ($pid > 0) {
                if ($attachments) {
                    foreach ($attachments as $attachment) {
                        $url = $attachment->guid;
                        $imggg = $attachment->post_mime_type;
                        if ('image/png' != $imggg && 'image/jpeg' != $imggg) {
                            $url = wp_get_attachment_url($attachment->ID);
                            ?>

					var mockFile = { name: "<?php 
                            echo $attachment->post_title;
                            ?>
", size: 12345, serverId: '<?php 
                            echo $attachment->ID;
                            ?>
' };
					myDropzone.options.addedfile.call(myDropzone, mockFile);
					myDropzone.options.thumbnail.call(myDropzone, mockFile, "<?php 
                            echo bloginfo('template_url');
                            ?>
/images/file_icon.png");
					 
			
			<?php 
                        }
                    }
                }
            }
            ?>
   


myDropzone.on("success", function(file, response) {
    /* Maybe display some more file information on your page */
	 file.serverId = response;
	 file.thumbnail = "<?php 
            echo bloginfo('template_url');
            ?>
/images/file_icon.png";
	 
	   
  });
  
  
myDropzone.on("removedfile", function(file, response) {
    /* Maybe display some more file information on your page */
	  delete_this2(file.serverId);
	 
  });  	
	
	});
	
	</script>

    <script type="text/javascript">
	
	function delete_this2(id)
	{
		 jQuery.ajax({
						method: 'get',
						url : '<?php 
            echo get_bloginfo('siteurl');
            ?>
/index.php/?_ad_delete_pid='+id,
						dataType : 'text',
						success: function (text) {   jQuery('#image_ss'+id).remove();  }
					 });
		  //alert("a");
	
	}

	
 
	
	
	</script>

	<?php 
            _e('Click the grey area below to add project files. Images are not accepted.', 'ProjectTheme');
            ?>
    <div class="dropzone dropzone-previews" id="myDropzoneElement" ></div>
 
    
	</div>
        </li>
        
        <li>
        <h2>&nbsp;</h2>
        <p> 
        <input type="submit" name="project_submit1" value="<?php 
            _e("Next Step", 'ProjectTheme');
            ?>
 >>" class="submit_bottom" /></p>
        </li>
    	
        <?php 
            do_action('ProjectTheme_step1_after_submit');
            ?>
    
    </ul>
    </form>
    </div>
    <?php 
        }
        if ($new_Project_step == "2") {
            global $MYerror, $projectOK;
            $cid = $current_user->ID;
            do_action('ProjectTheme_post_new_step2_before_images');
            if (is_array($MYerror)) {
                if ($projectOK == 0) {
                    echo '<div class="errrs">';
                    echo __('Your form has errors. Please check below, correct the errors, then submit again.', 'ProjectTheme');
                    echo '</div>';
                }
            }
            ?>
    
    
    
   
 	<ul class="post-new">
    
     

 
      <form method="post" > 
      <?php 
            do_action('ProjectTheme_step2_before_project_files');
            ?>
      
      
      
      
      
      	<?php 
            /*-------  custom fields  -------- */
            ?>
        <?php 
            $show_fields_in_step2 = true;
            $show_fields_in_step2 = apply_filters('ProjectTheme_show_fields_in_step2', $show_fields_in_step2);
            if ($show_fields_in_step2 == true) {
                $catid = ProjectTheme_get_project_primary_cat($pid);
                $arr = ProjectTheme_get_project_category_fields($catid, $pid);
                for ($i = 0; $i < count($arr); $i++) {
                    echo '<li class="' . projecttheme_get_post_new_error_thing('custom_field_' . $arr[$i]['id']) . '"  >';
                    echo projecttheme_get_post_new_error_thing_display('custom_field_' . $arr[$i]['id']);
                    echo '<h2>' . $arr[$i]['field_name'] . $arr[$i]['id'] . '</h2>';
                    echo '<p>' . $arr[$i]['value'] . '</p>';
                    echo '</li>';
                }
            }
            $ProjectTheme_enable_featured_option = get_option('ProjectTheme_enable_featured_option');
            if ($ProjectTheme_enable_featured_option != "no") {
                ?>
		
	 
      
      
        <li>
        <h2><?php 
                _e("Feature project?", 'ProjectTheme');
                ?>
</h2>
        <p><input type="checkbox" class="do_input_new" name="featured" value="1" 
		<?php 
                $feature = get_post_meta($pid, 'featured', true);
                echo $feature == "1" ? "checked='checked'" : "";
                ?>
 /> 
        <?php 
                $projectTheme_featured_fee = get_option('projectTheme_featured_fee');
                $sl = __('Extra fee is applied', 'ProjectTheme');
                if (empty($projectTheme_featured_fee) or $projectTheme_featured_fee <= 0) {
                    $sl = '';
                }
                printf(__("By clicking this checkbox you mark your project as featured. %s", 'ProjectTheme'), $sl);
                ?>
</p>
        </li>
        
        <?php 
            }
            ?>
        
        <?php 
            do_action('ProjectTheme_step2_before_feature_project');
            ?>
        
        
        <?php 
            $ProjectTheme_enable_sealed_option = get_option('ProjectTheme_enable_sealed_option');
            if ($ProjectTheme_enable_sealed_option != "no") {
                ?>
        
        <li>
        <h2><?php 
                _e("Sealed Bidding?", 'ProjectTheme');
                ?>
</h2>
        <p><input type="checkbox" class="do_input_new" name="private_bids" value="1"
        <?php 
                $private_bids = get_post_meta($pid, 'private_bids', true);
                echo $private_bids == "1" ? "checked='checked'" : "";
                ?>
 /> 
        <?php 
                $projectTheme_sealed_bidding_fee = get_option('projectTheme_sealed_bidding_fee');
                $sl = __('Extra fee is applied', 'ProjectTheme');
                if (empty($projectTheme_sealed_bidding_fee) or $projectTheme_sealed_bidding_fee <= 0) {
                    $sl = '';
                }
                printf(__("By clicking this checkbox you hide your project's bids. %s", 'ProjectTheme'), $sl);
                ?>
</p>
        </li>
        <?php 
            }
            ?>
        
        <?php 
            do_action('ProjectTheme_step2_before_sealed_bidding');
            ?>
        
        <?php 
            $ProjectTheme_enable_hide_option = get_option('ProjectTheme_enable_hide_option');
            if ($ProjectTheme_enable_hide_option != "no") {
                ?>
        
        
        <li>
        <h2><?php 
                _e("Hide Project from search engines", 'ProjectTheme');
                ?>
</h2>
        <p><input type="checkbox" class="do_input_new" name="hide_project" value="1" 
        <?php 
                $hide_project = get_post_meta($pid, 'hide_project', true);
                echo $hide_project == "1" ? "checked='checked'" : "";
                ?>
/> 
        <?php 
                $projectTheme_hide_project_fee = get_option('projectTheme_hide_project_fee');
                $sl = __('Extra fee is applied', 'ProjectTheme');
                if (empty($projectTheme_hide_project_fee) or $projectTheme_hide_project_fee <= 0) {
                    $sl = '';
                }
                echo sprintf(__("By clicking this checkbox you hide your project from search engines. %s", 'ProjectTheme'), $sl);
                ?>
</p>
        </li>
        <?php 
            }
            ?>
        
		<?php 
            do_action('ProjectTheme_step2_before_hide_project');
            ?>
        
      

        
        <li>
        <h2>&nbsp;</h2>
        <?php 
            $stp = 1;
            $stp = apply_filters('ProjectTheme_filter_go_back_stp2', $stp);
            ?>
        <p><a href="<?php 
            echo ProjectTheme_post_new_with_pid_stuff_thg($pid, $stp);
            ?>
" class="go_back_btn" ><?php 
            _e('Go Back', 'ProjectTheme');
            ?>
</a> 
        <input type="submit" name="project_submit2" value="<?php 
            _e("Next Step", 'ProjectTheme');
            ?>
 >>" class="submit_bottom" /></p>
        </li>
    
    
    </ul>
    </form>
    
    
    
    <?php 
        }
        do_action('ProjectTheme_see_if_we_can_add_steps', $new_Project_step, $pid);
        if ($new_Project_step == "3") {
            ?>

<div class="padd10">

<a href="<?php 
            echo ProjectTheme_post_new_with_pid_stuff_thg($pid, 2);
            ?>
" class="go_back_btn" ><?php 
            _e('Go Back', 'ProjectTheme');
            ?>
</a> 
<a href="<?php 
            echo ProjectTheme_post_new_with_pid_stuff_thg($pid, 4);
            ?>
" class="go_back_btn" ><?php 
            _e('Next Step', 'ProjectTheme');
            ?>
 >></a> 

</div>
<div class="clear10"></div>

<hr color="efefef" />


</div></div>


<div><div>


<?php 
            global $current_user;
            get_currentuserinfo();
            $uid = $current_user->ID;
            global $wpdb;
            $post_AU = get_post($pid);
            $PID_PID = $pid;
            ?>

     
<link media="screen" rel="stylesheet" href="'.get_bloginfo('template_url').'/css/colorbox.css" /> 
<script src="'.get_bloginfo('template_url').'/js/jquery.colorbox.js"></script> 
<script>

		
			jQuery(document).ready(function(){
				
				jQuery("a[rel='image_gal1']").colorbox();
				jQuery("a[rel='image_gal2']").colorbox();
				
				
 
				
				jQuery('.get_files').click( function () {
					
					var myRel = jQuery(this).attr('rel');
					myRel = myRel.split("_");
					
					jQuery.colorbox({href: "<?php 
            bloginfo('siteurl');
            ?>
/?get_files_panel=" + myRel[0] +"&uid=" + myRel[1] });
					return false;
				});
				
				
				jQuery("#report-this-link").click( function() {
					
					if(jQuery("#report-this").css('display') == 'none')					
					jQuery("#report-this").show('slow');
					else
					jQuery("#report-this").hide('slow');
					
					return false;
				});
				
				
				jQuery("#contact_seller-link").click( function() {
					
					if(jQuery("#contact-seller").css('display') == 'none')					
					jQuery("#contact-seller").show('slow');
					else
					jQuery("#contact-seller").hide('slow');
					
					return false;
				});
				
		});
</script>   


 
 
  <?php 
            $location = get_post_meta($PID_PID, "Location", true);
            $ending = get_post_meta($PID_PID, "ending", true);
            $featured = get_post_meta($PID_PID, "featured", true);
            $private_bids = get_post_meta($PID_PID, "private_bids", true);
            //---- increase views
            $views = get_post_meta($PID_PID, "views", true);
            $views = $views + 1;
            update_post_meta($PID_PID, "views", $views);
            ?>
	   
    

 


<div class="content_dust">


	

<div id="report-this" style="display:none">
<div class="my_box3">
            <div class="padd10">
            
            	<div class="box_title"><?php 
            echo __("Report this project", 'ProjectTheme');
            ?>
</div>
                <div class="box_content">
                <?php 
            if (!is_user_logged_in()) {
                ?>
                
                <?php 
                echo sprintf(__('You need to be <a href="%s">logged</a> in to use this feature.', 'ProjectTheme'), get_bloginfo('siteurl') . "/wp-login.php");
                ?>
                <?php 
            } else {
                ?>
                
                
					<form method="post"><input type="hidden" value="<?php 
                echo $PID_PID;
                ?>
" name="pid_rep" />
                    <ul class="post-new3">

        
        <li>
        	<h2><?php 
                echo __('Reason for reporting', 'ProjectTheme');
                ?>
:</h2>
        <p><textarea rows="4" cols="40" class="do_input"  name="reason_report"></textarea></p>
        </li>
        
        
     
        
        <li>
        <h2>&nbsp;</h2>
        <p><input type="submit" name="report_this" value="<?php 
                _e('Submit Report', 'ProjectTheme');
                ?>
" /></p>
        </li>
    
    
    </ul>
    </form> <?php 
            }
            ?>
                    
                    
				</div>
			</div>
			</div>
            
            <div class="clear10"></div>

</div>


<!-- ######### -->






 			<div class="project-signle-content-main">
 
			 
				
                <?php 
            $closed = get_post_meta($PID_PID, 'closed', true);
            ?>
                
				<div class="project-page-details-holder">
                <?php 
            if ($closed == "0") {
                if ($bid_posted == "0") {
                    ?>
 
		
                        <div class="bid_panel_err">
                        <div class="padd10">
                        <?php 
                    _e("Your bid has not been posted. Please correct the errors and try again.", 'ProjectTheme');
                    echo '<br/>';
                    foreach ($errors as $err) {
                        echo $err . '<br/>';
                    }
                    ?>
                        </div>
                        </div>
                
                <?php 
                }
                ?>
                
                
                <?php 
                if ($_GET['bid_posted'] == 1) {
                    ?>
		
                        <div class="bid_panel_ok">
                        <div class="padd10">
                        <?php 
                    _e("Your bid has been posted.", 'ProjectTheme');
                    ?>
                        </div>
                        </div>
                
                <?php 
                }
                ?>

               
               
               	<div class="bid_panel_front">
                <div class="padd10">
                
                <div class="small_buttons_div_left">
                	<ul class="project-details">
							<li>
                            	<img src="<?php 
                bloginfo('template_url');
                ?>
/images/wallet_icon2.png" width="18" height="18" alt="budget" />
								<h3><?php 
                echo __("Project Budget", 'ProjectTheme');
                ?>
:</h3>
								<p><?php 
                echo ProjectTheme_get_budget_name_string_fromID(get_post_meta($PID_PID, 'budgets', true));
                ?>
</p>
							</li>
                            
                            
                            <li>
                            	<img src="<?php 
                bloginfo('template_url');
                ?>
/images/coins_icon.png" width="18" height="18" alt="coins" />
								<h3><?php 
                echo __("Average Bid", 'ProjectTheme');
                ?>
:</h3>
								<p><?php 
                echo ProjectTheme_average_bid($PID_PID);
                ?>
</p>
							</li>
                            
                            
                         
                            
            			<?php 
                $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
                if ($ProjectTheme_enable_project_location == "yes") {
                    ?>
   
                            <li>
								<img src="<?php 
                    echo get_bloginfo('template_url');
                    ?>
/images/loc_icon.png" width="18" height="18" alt="location" /> 
								<h3><?php 
                    echo __("Location", 'ProjectTheme');
                    ?>
:</h3>
								<p><?php 
                    echo get_the_term_list($PID_PID, 'project_location', '', ', ', '');
                    ?>
</p>
							</li>
                          
                        <?php 
                }
                ?>
  
                          
                             
                             <li>
								<img src="<?php 
                echo get_bloginfo('template_url');
                ?>
/images/cate_icon.png" width="18" height="18" alt="category" /> 
								<h3><?php 
                echo __("Category", 'ProjectTheme');
                ?>
:</h3>
								<p><?php 
                echo get_the_term_list($PID_PID, 'project_cat', '', ', ', '');
                ?>
</p>
							</li>
                               
          
							<li>
								<img src="<?php 
                echo get_bloginfo('template_url');
                ?>
/images/cal_icon.png" width="18" height="18" alt="calendar" /> 
								<h3><?php 
                echo __("Posted on", 'ProjectTheme');
                ?>
:</h3>
								<p><?php 
                echo get_the_time("jS F Y g:i A", $PID_PID);
                ?>
</p>
							</li>
                          
                          <li>
								<img src="<?php 
                echo get_bloginfo('template_url');
                ?>
/images/clock_icon.png" width="18" height="18" alt="clock" /> 
								<h3><?php 
                echo __("Time Left", 'ProjectTheme');
                ?>
:</h3>
								<p><?php 
                echo $closed == "0" ? ProjectTheme_prepare_seconds_to_words($ending - current_time('timestamp', 0)) : __("Expired/Closed", 'ProjectTheme');
                ?>
</p>
							</li>
                            
                          
                          <li>
                            	<img src="<?php 
                bloginfo('template_url');
                ?>
/images/prop_icon.png" width="18" height="18" alt="proposals" />
								<h3><?php 
                echo __("Proposals", 'ProjectTheme');
                ?>
:</h3>
								<p><?php 
                echo projectTheme_number_of_bid($PID_PID);
                ?>
</p>
							</li>
                            
                	</ul>
                    
                    <div class="clear10"></div>
                    
                    </div>
                    <!-- ########### -->
                    
                    <div class="small_buttons_div">
                    	<ul id="these-special-buttons">
                        	<li><a href="<?php 
                $post = get_post($PID_PID);
                if ($current_user->ID == $post_AU->post_author) {
                    echo '#';
                } else {
                    echo ProjectTheme_get_priv_mess_page_url('send', '', '&uid=' . $post_AU->post_author . '&pid=' . $PID_PID);
                }
                ?>
" class="project-owner-contact"><?php 
                _e('Contact Project Owner', 'ProjectTheme');
                ?>
</a></li>
                            <li><a href="#" class="message_brd_cls project-owner-contact"><?php 
                _e('Project Message Board', 'ProjectTheme');
                ?>
</a></li>
                        </ul>
                    </div>
                  
                </div>
                </div>
               
                
                <?php 
            } else {
                // project closed
                ?>
                
                <div class="bid_panel">
                <div class="padd10">
                
                	<?php 
                $pid = $PID_PID;
                $winner = get_post_meta($PID_PID, 'winner', true);
                if (!empty($winner)) {
                    global $wpdb;
                    $q = "select bid from " . $wpdb->prefix . "project_bids where pid='{$pid}' and winner='1'";
                    $r = $wpdb->get_results($q);
                    $r = $r[0];
                    _e("Project closed for price: ", 'ProjectTheme');
                    echo ProjectTheme_get_show_price($r->bid);
                }
                ?>
                
                </div>
                </div>
                
                <?php 
            }
            ?>
               
						
												
					</div>
				
				 
			</div>
			
			
			<div class="clear10"></div>
			
			<!-- ####################### -->
			
			<div class="my_box3">
           
            
            	<div class="box_title"><?php 
            echo __("Project Description", 'ProjectTheme');
            ?>
</div>
                <div class="box_content" id="project-single-page-content">
					<?php 
            echo $post_AU->post_content;
            do_action('ProjectTheme_after_description_in_single_proj_page');
            ?>
				</div>
			</div>
		
			
			<div class="clear10"></div>
            
            
            <!-- ####################### -->
			<?php 
            $private_bids = get_post_meta($PID_PID, 'private_bids', true);
            ?>
			<div class="my_box3">
            
            
            	<div class="box_title"><?php 
            echo __("Proposals", 'ProjectTheme');
            ?>
 <?php 
            if ($private_bids == 'yes' or $private_bids == '1' or $private_bids == 1) {
                _e('[project has private proposals]', 'ProjectTheme');
            }
            ?>
</div>
                <div class="box_content">
				<?php 
            $ProjectTheme_enable_project_files = get_option('ProjectTheme_enable_project_files');
            $winner = get_post_meta($PID_PID, 'winner', true);
            $post = get_post($PID_PID);
            global $wpdb;
            $pid = $PID_PID;
            $bids = "select * from " . $wpdb->prefix . "project_bids where pid='{$pid}' order by id DESC";
            $res = $wpdb->get_results($bids);
            if ($post_AU->post_author == $uid) {
                $owner = 1;
            } else {
                $owner = 0;
            }
            if (count($res) > 0) {
                if ($private_bids == 'yes' or $private_bids == '1' or $private_bids == 1) {
                    if ($owner == 1) {
                        $show_stuff = 1;
                    } else {
                        if (projectTheme_current_user_has_bid($uid, $res)) {
                            $show_stuff = 1;
                        } else {
                            $show_stuff = 0;
                        }
                    }
                } else {
                    $show_stuff = 1;
                }
                //------------
                if ($show_stuff == 1) {
                    echo '<table id="my_bids" width="100%">';
                    echo '<thead><tr>';
                    echo '<th>' . __('Username', 'ProjectTheme') . '</th>';
                    echo '<th>' . __('Bid', 'ProjectTheme') . '</th>';
                    echo '<th>' . __('Date Made', 'ProjectTheme') . '</th>';
                    echo '<th>' . __('Days to Complete', 'ProjectTheme') . '</th>';
                    if ($owner == 1) {
                        if (empty($winner)) {
                            echo '<th>' . __('Choose Winner', 'ProjectTheme') . '</th>';
                        }
                        if ($ProjectTheme_enable_project_files != "no") {
                            echo '<th>' . __('Bid Files', 'ProjectTheme') . '</th>';
                        }
                        echo '<th>' . __('Messaging', 'ProjectTheme') . '</th>';
                    }
                    if ($closed == "1") {
                        echo '<th>' . __('Winner', 'ProjectTheme') . '</th>';
                    }
                    echo '</tr></thead><tbody>';
                }
                //-------------
                foreach ($res as $row) {
                    if ($owner == 1) {
                        $show_this_around = 1;
                    } else {
                        if ($private_bids == 'yes' or $private_bids == '1' or $private_bids == 1) {
                            if ($uid == $row->uid) {
                                $show_this_around = 1;
                            } else {
                                $show_this_around = 0;
                            }
                        } else {
                            $show_this_around = 1;
                        }
                    }
                    if ($show_this_around == 1) {
                        $user = get_userdata($row->uid);
                        echo '<tr>';
                        echo '<th><a href="' . ProjectTheme_get_user_profile_link($user->ID) . '">' . $user->user_login . '</a></th>';
                        echo '<th>' . ProjectTheme_get_show_price($row->bid) . '</th>';
                        echo '<th>' . date("d-M-Y H:i:s", $row->date_made) . '</th>';
                        echo '<th>' . $row->days_done . '</th>';
                        if ($owner == 1) {
                            $nr = 7;
                            if (empty($winner)) {
                                // == 0)
                                echo '<th><a href="' . get_bloginfo('siteurl') . '/?p_action=choose_winner&pid=' . $PID_PID . '&bid=' . $row->id . '">' . __('Select', 'ProjectTheme') . '</a></th>';
                            }
                            if ($ProjectTheme_enable_project_files != "no") {
                                echo '<th>';
                                if (projecttheme_see_if_project_files_bid($PID_PID, $row->uid) == true) {
                                    echo '<a href="#" class="get_files" rel="' . $PID_PID . '_' . $row->uid . '">' . __('Bid Files', 'ProjectTheme') . '</a>';
                                } else {
                                    _e('None', 'ProjectTheme');
                                }
                                echo '</th>';
                            }
                            echo '<th><a href="' . ProjectTheme_get_priv_mess_page_url('send', '', '&uid=' . $row->uid . '&pid=' . $PID_PID) . '">' . __('Send Message', 'ProjectTheme') . '</a></th>';
                        } else {
                            $nr = 4;
                        }
                        if ($closed == "1") {
                            if ($row->winner == 1) {
                                echo '<th>' . __('Yes', 'ProjectTheme') . '</th>';
                            } else {
                                echo '<th>&nbsp;</th>';
                            }
                        }
                        echo '</tr>';
                        echo '<tr>';
                        echo '<th colspan="' . $nr . '" class="my_td_with_border">' . $row->description . '</th>';
                        echo '</tr>';
                    }
                }
                echo '</tbody></table>';
            } else {
                _e("No proposals placed yet.", 'ProjectTheme');
            }
            ?>
	
				</div>
			</div>
			
			
            <?php 
            $ProjectTheme_enable_images_in_projects = get_option('ProjectTheme_enable_images_in_projects');
            $ProjectTheme_enable_images_in_projects = apply_filters('ProjectTheme_enable_images_in_projects_hk', $ProjectTheme_enable_images_in_projects);
            if ($ProjectTheme_enable_images_in_projects == "yes") {
                ?>
			<div class="clear10"></div>
			
			<!-- ####################### -->
			
			<div class="my_box3">
           
            
            	<div class="box_title"><?php 
                echo __("Image Gallery", 'ProjectTheme');
                ?>
</div>
                <div class="box_content">
				<?php 
                $arr = ProjectTheme_get_post_images($PID_PID);
                $xx_w = 600;
                $projectTheme_width_of_project_images = get_option('projectTheme_width_of_project_images');
                if (!empty($projectTheme_width_of_project_images)) {
                    $xx_w = $projectTheme_width_of_project_images;
                }
                if (!is_numeric($xx_w)) {
                    $xx_w = 600;
                }
                if ($arr) {
                    echo '<ul class="image-gallery">';
                    foreach ($arr as $image) {
                        echo '<li><a href="' . ProjectTheme_generate_thumb($image, 900, $xx_w) . '" rel="image_gal2"><img src="' . ProjectTheme_generate_thumb($image, 100, 80) . '" width="100" class="img_class" /></a></li>';
                    }
                    echo '</ul>';
                } else {
                    echo __('No images.', 'ProjectTheme');
                }
                ?>
				
				
				</div>
			</div>
			<?php 
            }
            ?>
			
			<div class="clear10"></div>
			
			<!-- ####################### -->
			<?php 
            $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
            if ($ProjectTheme_enable_project_location == "yes") {
                ?>
        
			<div class="my_box3">
            
            
            	<div class="box_title"><?php 
                echo __("Map Location", 'ProjectTheme');
                ?>
</div>
                <div class="box_content">
	
				<div id="map" style="width: 655px; height: 300px;border:2px solid #ccc;float:left"></div>
				
                <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
            
            <script type="text/javascript"
            src="<?php 
                echo get_bloginfo('template_url');
                ?>
/js/mk.js"></script> 
                                                <script type="text/javascript"> 
   



	  var geocoder;
  var map;
  function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 13,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map"), myOptions);
  }

  function codeAddress(address) {
    
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker = new MarkerWithLabel({
            
            position: results[0].geometry.location,
			map: map,
       labelContent: address,
       labelAnchor: new google.maps.Point(22, 0),
       labelClass: "labels", // the CSS class for the label
       labelStyle: {opacity: 1.0}

        });
      } else {
        //alert("Geocode was not successful for the following reason: " + status);
      }
    });
  }

initialize();

codeAddress("<?php 
                global $post;
                $pid = $post_AU->ID;
                $terms = wp_get_post_terms($pid, 'project_location');
                foreach ($terms as $term) {
                    echo $term->name . " ";
                }
                $location = get_post_meta($pid, "Location", true);
                echo $location;
                ?>
");

    </script> 
				
			
			</div>
			</div> <?php 
            }
            ?>
			
			<!-- ####################### -->
			
 



</div>

<?php 
            echo '<div id="right-sidebar" class="page-sidebar">';
            echo '<ul class="xoxo">';
            //---------------------
            // build the exclude list
            //---------------------
            // build the exclude list
            $exclude = array();
            $args = array('order' => 'ASC', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $pid, 'numberposts' => -1, 'post_status' => null);
            $attachments = get_posts($args);
            foreach ($attachments as $att) {
                $exclude[] = $att->ID;
            }
            //-0------------------
            $args = array('order' => 'ASC', 'post_type' => 'attachment', 'meta_key' => 'is_bidding_file', 'meta_value' => '1', 'post_parent' => $pid, 'numberposts' => -1, 'post_status' => null);
            $attachments = get_posts($args);
            foreach ($attachments as $att) {
                $exclude[] = $att->ID;
            }
            //------------------
            $args = array('order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $pid, 'exclude' => $exclude, 'numberposts' => -1, 'post_status' => null);
            $attachments = get_posts($args);
            ?>
    <li class="widget-container widget_text" id="ad-other-details">
		<h3 class="widget-title"><?php 
            _e("Apply for this Project", 'ProjectTheme');
            ?>
</h3>
		<p>
        <?php 
            _e('You can use the button below to apply and submit a proposal for this project.', 'ProjectTheme');
            ?>
        </p>
        
        
       <p id='proposal_btn_p'>
         <?php 
            global $current_user;
            get_currentuserinfo();
            $uid = $current_user->ID;
            if ($closed == "0" && ProjectTheme_is_user_provider($uid) == true) {
                ?>
                            
								<a href="#" class="post_bid_btn_new" id='submit-proposal-id' rel="<?php 
                the_ID();
                ?>
"><?php 
                _e('Submit a Proposal', 'ProjectTheme');
                ?>
</a>
							 
                          	<?php 
            }
            ?>
       
       </p> 
    </li>
    
    
    
    	<li class="widget-container widget_text" id="ad-other-details">
		<h3 class="widget-title"><?php 
            _e("Project Posted By", 'ProjectTheme');
            ?>
</h3>
		
        <div class="avatar-op-wrap">
        	
            <div class="avatar-op-inner"><img width="60" height="60" border="0" class="project-single-avatar" src="<?php 
            echo ProjectTheme_get_avatar($post_AU->post_author, 60, 60);
            ?>
" /> </div>
        	<div class="avatar-op-list">
            		<ul>
                    	<li><a class="avatar-posted-by-username" href="<?php 
            bloginfo('siteurl');
            ?>
/?p_action=user_profile&post_author=<?php 
            echo $post_AU->post_author;
            ?>
"><?php 
            echo $post_AU->user_login;
            ?>
</a></li>
                    	<li><?php 
            echo ProjectTheme_project_get_star_rating2($post_AU->post_author);
            ?>
</li>
                        <li><a href="<?php 
            echo ProjectTheme_get_user_feedback_link($post_AU->post_author);
            ?>
"><?php 
            _e('View User Feedback', 'ProjectTheme');
            ?>
</a></li>
                    </ul>
            </div>
            
        </div>
        
        <p>
        <ul class="other-dets other-dets2">
				 
                <?php 
            $has_created = projectTheme_get_total_number_of_created_Projects($post_AU->post_author);
            $has_closed = projectTheme_get_total_number_of_closed_Projects($post_AU->post_author);
            $has_rated = projectTheme_get_total_number_of_rated_Projects($post_AU->post_author);
            ?>
                
                 
                 
                <li>
					<h3><?php 
            _e("Has created:", 'ProjectTheme');
            ?>
</h3>
					<p><?php 
            echo sprintf(__("%s project(s)", 'ProjectTheme'), $has_created);
            ?>
</p> 
				</li>
                
                
                <li>
					<h3><?php 
            _e("Has closed:", 'ProjectTheme');
            ?>
</h3>
					<p><?php 
            echo sprintf(__("%s project(s)", 'ProjectTheme'), $has_closed);
            ?>
</p> 
				</li>
            
            
            	<li>
					<h3><?php 
            _e("Has rated:", 'ProjectTheme');
            ?>
</h3>
					<p><?php 
            echo sprintf(__("%s provider(s)", 'ProjectTheme'), $has_rated);
            ?>
</p> 
				</li>
            
            
            	<br/><br/>
               <a href="<?php 
            bloginfo('siteurl');
            ?>
/?p_action=user_profile&post_author=<?php 
            echo $post_AU->post_author;
            ?>
"><?php 
            _e('See More Projects by this user', 'ProjectTheme');
            ?>
</a><br/>
               
                		
			</ul>
   		</p>
   </li>
       
       <?php 
            $ProjectTheme_enable_project_files = get_option('ProjectTheme_enable_project_files');
            if ($ProjectTheme_enable_project_files != "no") {
                ?>
       
     	<li class="widget-container widget_text" id="ad-other-details">
		<h3 class="widget-title"><?php 
                _e("Project Files", 'ProjectTheme');
                ?>
</h3>
		<p>
        
        <ul class="other-dets other-dets2">
				<?php 
                if (count($attachments) == 0) {
                    echo __('No project files.', 'ProjectTheme');
                }
                foreach ($attachments as $at) {
                    ?>
                
                <li> <a href="<?php 
                    echo wp_get_attachment_url($at->ID);
                    ?>
"><?php 
                    echo $at->post_title;
                    ?>
</a>
				</li> 
			<?php 
                }
                ?>
		
			</ul>
   		</p>
   </li>
  <?php 
            }
            ?>
  
    
    
	<li class="widget-container widget_text" id="ad-other-details">
		<h3 class="widget-title"><?php 
            _e("Other Options", 'ProjectTheme');
            ?>
</h3>
		<p>
        
        <div class="add-this">
						<!-- AddThis Button BEGIN -->
							<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
							<a class="addthis_button_preferred_1"></a>
							<a class="addthis_button_preferred_2"></a>
							<a class="addthis_button_preferred_3"></a>
							<a class="addthis_button_preferred_4"></a>
							<a class="addthis_button_compact"></a>
							<a class="addthis_counter addthis_bubble_style"></a>
							</div>
							<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4df68b4a2795dcd9"></script>
							<!-- AddThis Button END -->
						</div>	
        
   		</p>
   </li>
       
    
	<li class="widget-container widget_text" id="ad-other-details">
		<h3 class="widget-title"><?php 
            _e("Other Details", 'ProjectTheme');
            ?>
</h3>
		<p>
			<ul class="other-dets other-dets2">
	 
		 
				<?php 
            $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
            if ($ProjectTheme_enable_project_location == "yes") {
                ?>
				<li>
					<img src="<?php 
                echo get_bloginfo('template_url');
                ?>
/images/location.png" width="15" height="15" /> 
					<h3><?php 
                _e("Address", 'ProjectTheme');
                ?>
:</h3>
					<p><?php 
                echo $location;
                ?>
</p> 
				</li>
		
        
        <?php 
            }
            ?>
        
        		
                <?php 
            $rt = get_option('projectTheme_show_project_views');
            if ($rt != 'no') {
                ?>
				
				<li>
					<img src="<?php 
                echo get_bloginfo('template_url');
                ?>
/images/viewed.png" width="15" height="15" /> 
					<h3><?php 
                _e("Viewed", 'ProjectTheme');
                ?>
:</h3>
					<p><?php 
                echo $views;
                ?>
 <?php 
                _e("times", 'ProjectTheme');
                ?>
</p> 
				</li>
				<?php 
            }
            ?>
				
                
                <?php 
            $my_arrms = true;
            $my_arrms = apply_filters('ProjectTheme_show_fields_in_sidebar', $my_arrms);
            if ($my_arrms == true) {
                $arrms = ProjectTheme_get_project_fields_values($PID_PID);
                if (count($arrms) > 0) {
                    for ($i = 0; $i < count($arrms); $i++) {
                        ?>
                <li>
					<h3><?php 
                        echo $arrms[$i]['field_name'];
                        ?>
:</h3>
               	 	<p><?php 
                        echo $arrms[$i]['field_value'];
                        ?>
</p>
                </li>
				<?php 
                    }
                }
            }
            ?>
				
                
				
			</ul>
			<?php 
            if (ProjectTheme_is_owner_of_post()) {
                ?>
				
			<a href="<?php 
                echo get_bloginfo('siteurl');
                ?>
/?p_action=edit_project&pid=<?php 
                the_ID();
                ?>
" class="nice_link"><?php 
                _e("Edit", 'ProjectTheme');
                ?>
</a> 
			<a href="<?php 
                echo get_bloginfo('siteurl');
                ?>
/?p_action=repost_project&pid=<?php 
                the_ID();
                ?>
" class="nice_link"><?php 
                _e("Repost", 'ProjectTheme');
                ?>
</a> 
		<!--	<a href="<?php 
                echo get_bloginfo('siteurl');
                ?>
/?p_action=delete_project&pid=<?php 
                the_ID();
                ?>
" class="nice_link"><?php 
                _e("Delete", 'ProjectTheme');
                ?>
</a> -->
			
			<?php 
            } else {
                ?>
			
			<a href="#" id="report-this-link" class="nice_link"><?php 
                _e("Report", 'ProjectTheme');
                ?>
</a>
            <a href="<?php 
                $post = get_post($PID_PID);
                echo ProjectTheme_get_priv_mess_page_url('send', '', '&uid=' . $post_AU->post_author . '&pid=' . $PID_PID);
                ?>
" class="nice_link"><?php 
                _e("Contact Seller", 'ProjectTheme');
                ?>
</a>
				
                <?php 
            }
            ?>
		</p>
	</li>
	
	
	<?php 
            dynamic_sidebar('project-widget-area');
            echo '</ul>';
            echo '</div>';
            //===============================================================================================
            ?>
 




<?php 
        }
        if ($new_Project_step == "4") {
            $catid = ProjectTheme_get_project_primary_cat($pid);
            $ProjectTheme_get_images_cost_extra = ProjectTheme_get_images_cost_extra($pid);
            //--------------------------------------------------
            // hide project from search engines fee calculation
            $projectTheme_hide_project_fee = get_option('projectTheme_hide_project_fee');
            if (!empty($projectTheme_hide_project_fee)) {
                $opt = get_post_meta($pid, 'hide_project', true);
                if ($opt == "0") {
                    $projectTheme_hide_project_fee = 0;
                }
            } else {
                $projectTheme_hide_project_fee = 0;
            }
            //---------------------
            $made_me_date = get_post_meta($pid, 'made_me_date', true);
            $tms = current_time('timestamp', 0);
            $projectTheme_project_period = get_option('projectTheme_project_period');
            if (empty($projectTheme_project_period)) {
                $projectTheme_project_period = 30;
            }
            if (empty($made_me_date)) {
                $ee = $tms + 3600 * 24 * $projectTheme_project_period;
                update_post_meta($pid, 'ending', $ee);
            } else {
                $ee = get_post_meta($pid, 'ending', true) + $tms - $made_me_date;
                update_post_meta($pid, 'ending', $ee);
            }
            //-------------------------------------------------------------------------------
            // sealed bidding fee calculation
            $projectTheme_sealed_bidding_fee = get_option('projectTheme_sealed_bidding_fee');
            if (!empty($projectTheme_sealed_bidding_fee)) {
                $opt = get_post_meta($pid, 'private_bids', true);
                if ($opt == "0") {
                    $projectTheme_sealed_bidding_fee = 0;
                }
            } else {
                $projectTheme_sealed_bidding_fee = 0;
            }
            //-------
            $featured = get_post_meta($pid, 'featured', true);
            $feat_charge = get_option('projectTheme_featured_fee');
            if ($featured != "1") {
                $feat_charge = 0;
            }
            $custom_set = get_option('projectTheme_enable_custom_posting');
            if ($custom_set == 'yes') {
                $posting_fee = get_option('projectTheme_theme_custom_cat_' . $catid);
                if (empty($posting_fee)) {
                    $posting_fee = 0;
                }
            } else {
                $posting_fee = get_option('projectTheme_base_fee');
            }
            $total = $feat_charge + $posting_fee + $projectTheme_sealed_bidding_fee + $projectTheme_hide_project_fee + $ProjectTheme_get_images_cost_extra;
            //-----------------------------------------------
            $payment_arr = array();
            $base_fee_paid = get_post_meta($pid, 'base_fee_paid', true);
            if ($base_fee_paid != "1" and $posting_fee > 0) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'base_fee';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $posting_fee;
                $my_small_arr['description'] = __('Base Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
            }
            //-----------------------
            $my_small_arr = array();
            $my_small_arr['fee_code'] = 'extra_img';
            $my_small_arr['show_me'] = true;
            $my_small_arr['amount'] = $ProjectTheme_get_images_cost_extra;
            $my_small_arr['description'] = __('Extra Images Fee', 'ProjectTheme');
            array_push($payment_arr, $my_small_arr);
            //------------------------
            $featured_paid = get_post_meta($pid, 'featured_paid', true);
            $opt = get_post_meta($pid, 'featured', true);
            if ($feat_charge > 0 and $featured_paid != 1 and $opt == 1) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'feat_fee';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $feat_charge;
                $my_small_arr['description'] = __('Featured Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
                //------------------------
            }
            $private_bids_paid = get_post_meta($pid, 'private_bids_paid', true);
            $opt = get_post_meta($pid, 'private_bids', true);
            if ($projectTheme_sealed_bidding_fee > 0 and $private_bids_paid != 1 and ($opt == 1 or $opt == "yes")) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'sealed_project';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $projectTheme_sealed_bidding_fee;
                $my_small_arr['description'] = __('Sealed Bidding Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
                //------------------------
            }
            $hide_project_paid = get_post_meta($pid, 'hide_project_paid', true);
            $opt = get_post_meta($pid, 'hide_project', true);
            if ($projectTheme_hide_project_fee > 0 and $hide_project_paid != "1" and ($opt == "1" or $opt == "yes")) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'hide_project';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $projectTheme_hide_project_fee;
                $my_small_arr['description'] = __('Hide Project From Search Engines Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
            }
            $payment_arr = apply_filters('ProjectTheme_filter_payment_array', $payment_arr, $pid);
            $new_total = 0;
            foreach ($payment_arr as $payment_item) {
                if ($payment_item['amount'] > 0) {
                    $new_total += $payment_item['amount'];
                }
            }
            //-----------------------------------------------
            $post = get_post($pid);
            $admin_email = get_bloginfo('admin_email');
            $total = apply_filters('ProjectTheme_filter_payment_total', $new_total, $pid);
            //----------------------------------------
            $finalize = isset($_GET['finalize']) ? true : false;
            update_post_meta($pid, 'finalised_posted', '1');
            //-----------
            if ($total == 0) {
                echo '<div >';
                echo __('Thank you for posting your project with us.', 'ProjectTheme');
                update_post_meta($pid, "paid", "1");
                if (get_option('projectTheme_admin_approves_each_project') == 'yes') {
                    $my_post = array();
                    $my_post['ID'] = $pid;
                    $my_post['post_status'] = 'draft';
                    wp_update_post($my_post);
                    if ($finalize == true) {
                        ProjectTheme_send_email_posted_project_not_approved($pid);
                        ProjectTheme_send_email_posted_project_not_approved_admin($pid);
                    }
                    echo '<br/>' . __('Your project isn`t live yet, the admin needs to approve it.', 'ProjectTheme');
                } else {
                    $my_post = array();
                    $my_post['ID'] = $pid;
                    $my_post['post_status'] = 'publish';
                    if ($finalize == true) {
                        wp_update_post($my_post);
                        wp_publish_post($pid);
                        ProjectTheme_send_email_posted_project_approved($pid);
                        ProjectTheme_send_email_posted_project_approved_admin($pid);
                        ProjectTheme_send_email_subscription($pid);
                    }
                }
                echo '</div>';
            } else {
                update_post_meta($pid, "paid", "0");
                echo '<div >';
                echo __('Thank you for posting your project with us. Below is the total price that you need to pay in order to put your project live.<br/>
			Click the pay button and you will be redirected...', 'ProjectTheme');
                echo '</div>';
            }
            //----------------------------------------
            echo '<table style="margin-top:25px">';
            $show_payment_table = true;
            $show_payment_table = apply_filters('ProjectTheme_filter_payment_show_table', $show_payment_table, $pid);
            if ($show_payment_table == true and $total > 0) {
                foreach ($payment_arr as $payment_item) {
                    if ($payment_item['amount'] > 0) {
                        echo '<tr>';
                        echo '<td>' . $payment_item['description'] . '&nbsp; &nbsp;</td>';
                        echo '<td>' . ProjectTheme_get_show_price($payment_item['amount'], 2) . '</td>';
                        echo '</tr>';
                    }
                }
                echo '<tr>';
                echo '<td>&nbsp;</td>';
                echo '<td></td>';
                echo '</tr>';
                echo '<tr>';
                echo '<td><strong>' . __('Total to Pay', 'ProjectTheme') . '</strong></td>';
                echo '<td><strong>' . ProjectTheme_get_show_price($total, 2) . '</strong></td>';
                echo '</tr>';
                $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
                if ($ProjectTheme_enable_credits_wallet != 'no') {
                    echo '<tr>';
                    echo '<td><strong>' . __('Your Total Credits', 'ProjectTheme') . '</strong></td>';
                    echo '<td><strong>' . ProjectTheme_get_show_price(ProjectTheme_get_credits($uid), 2) . '</strong></td>';
                    echo '</tr>';
                }
                echo '<tr>';
                echo '<td>&nbsp;<br/>&nbsp;</td>';
                echo '<td></td>';
                echo '</tr>';
            }
            //endif show this table
            if ($total == 0 && $finalize == true) {
                if (get_option('projectTheme_admin_approves_each_project') != 'yes') {
                    echo '<tr>';
                    echo '<td></td>';
                    echo '<td><div class="clear100"></div><a href="' . get_permalink($pid) . '" class="go_back_btn">' . __('See your project', 'ProjectTheme') . '</a></td>';
                    echo '</tr>';
                } else {
                    echo '<tr>';
                    echo '<td></td>';
                    echo '<td><a href="' . get_permalink(get_option('ProjectTheme_my_account_page_id')) . '" class="go_back_btn">' . __('Go to your account', 'ProjectTheme') . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
            } elseif ($total > 0) {
                echo '</table>';
                update_post_meta($pid, 'unpaid', '1');
                $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
                if ($ProjectTheme_enable_credits_wallet != 'no') {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=credits_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by Credits', 'ProjectTheme') . '</a>';
                }
                global $project_ID;
                $project_ID = $pid;
                //-------------------
                $ProjectTheme_paypal_enable = get_option('ProjectTheme_paypal_enable');
                $ProjectTheme_alertpay_enable = get_option('ProjectTheme_alertpay_enable');
                $ProjectTheme_moneybookers_enable = get_option('ProjectTheme_moneybookers_enable');
                if ($ProjectTheme_paypal_enable == "yes") {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=paypal_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by PayPal', 'ProjectTheme') . '</a>';
                }
                if ($ProjectTheme_moneybookers_enable == "yes") {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=mb_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by MoneyBookers/Skrill', 'ProjectTheme') . '</a>';
                }
                if ($ProjectTheme_alertpay_enable == "yes") {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=payza_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by Payza', 'ProjectTheme') . '</a>';
                }
                do_action('ProjectTheme_add_payment_options_to_post_new_project', $pid);
            } else {
                echo '</table>';
            }
            echo '<div class="clear10"></div>';
            echo '<div class="clear10"></div>';
            echo '<div class="clear10"></div>';
            echo '<div class="padd10">';
            if ($finalize == false) {
                echo ' <a href="' . ProjectTheme_post_new_with_pid_stuff_thg($pid, '3') . '" class="go_back_btn" >' . __('Go Back', 'ProjectTheme') . '</a>';
            }
            if ($total == 0 && $finalize == false) {
                echo ' <a href="' . ProjectTheme_post_new_with_pid_stuff_thg($pid, '4', 'finalize') . '" 
	class="go_back_btn" >' . __('Finalize Project Posting', 'ProjectTheme') . '</a>';
            }
            echo '</div>';
        }
        ?>
                
            <?php 
    }
    ?>
                
                
              </div>
           </div>
                
        </div> <!-- end dif content -->
     
        
    
	
<?php 
}
Пример #15
0
function ProjectTheme_my_account_private_messages_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $myuid = $uid;
    ?>
    	 
       <?php 
    global $wpdb, $wp_rewrite, $wp_query;
    $third_page = $wp_query->query_vars['pg'];
    if (empty($third_page)) {
        $third_page = 'home';
    }
    ?>
        <div class="clear10"></div>
      <div id="content" class="account-main-area">
        
        <div class="my_box3"><div class="padd10">
          <div class="clear10"></div>
          
            
                <ul class="cms_cms"> 
                <li><a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url();
    ?>
" class="green_btn"><?php 
    _e("Messaging Home", "ProjectTheme");
    ?>
</a></li>
               <li> <a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url('send');
    ?>
" class="green_btn"><?php 
    _e("Send New Message", "ProjectTheme");
    ?>
</a></li>
                <li><a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url('inbox');
    ?>
" class="green_btn"><?php 
    _e("Inbox", "ProjectTheme");
    global $current_user;
    get_currentuserinfo();
    $rd = projectTheme_get_unread_number_messages($current_user->ID);
    if ($rd > 0) {
        echo ' (' . $rd . ')';
    }
    ?>
</a></li>
                <li><a href="<?php 
    echo ProjectTheme_get_priv_mess_page_url('sent-items');
    ?>
" class="green_btn"><?php 
    _e("Sent Items", "ProjectTheme");
    ?>
</a></li>
             	
                </ul>
                
        </div></div>
        <div class="clear10"></div>
        <?php 
    if ($third_page == 'home') {
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        ?>
        
        
		<!-- page content here -->	
			
            
            	
            	<div class="my_box3">
            	
            	<div class="box_title"><?php 
        _e("Latest Received Messages", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $uidsss = $current_user->ID;
        $s = "select * from " . $wpdb->prefix . "project_pm where user='******'  AND show_to_destination='1' and approved='1'  order by id desc limit 4";
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            echo '<table width="100%">';
            echo '<tr>';
            echo '<td>' . __('From User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                if ($row->rd == 0) {
                    $cls = 'bold_stuff';
                } else {
                    $cls = '';
                }
                $user = get_userdata($row->initiator);
                echo '<tr>';
                echo '<td class="' . $cls . '"><a href="' . get_bloginfo('siteurl') . '/?p_action=user_profile&post_author=' . $user->ID . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . $row->subject . '</td>';
                echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
            
                </div>
                </div>
            
            <!--#######-->
            
            <div class="clear10"></div>
            
            	<div class="my_box3">
            	
            
            	<div class="box_title"><?php 
        _e("Latest Sent Items", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $uidss = $current_user->ID;
        $s = "select * from " . $wpdb->prefix . "project_pm where initiator='{$uidss}'  AND show_to_source='1' order by id desc limit 4";
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            echo '<table width="100%">';
            echo '<tr>';
            echo '<td>' . __('To User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                //if($row->rd == 0) $cls = 'bold_stuff';
                //else
                $cls = '';
                $user = get_userdata($row->user);
                echo '<tr>';
                echo '<td class="' . $cls . '"><a href="' . ProjectTheme_get_user_profile_link($row->user) . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . $row->subject . '</td>';
                echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
               
                </div>
                </div>
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'inbox') {
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        //echo $myuid;
        ?>
        
        
		<!-- page content here -->	
			
            
            	<div class="my_box3">
           
            
            	<div class="box_title"><?php 
        _e("Private Messages: Inbox", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $page_rows = 20;
        $page_rows = apply_filters('ProjectTheme_nr_of_messages_priv_pagination', $page_rows);
        $pagenum = isset($_GET['pagenum']) ? $_GET['pagenum'] : 1;
        $max = ' limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows;
        $s = "select count(id) tots from " . $wpdb->prefix . "project_pm where user='******' AND show_to_destination='1' and approved='1'";
        $r = $wpdb->get_results($s);
        $total = $r[0]->tots;
        $last = ceil($total / $page_rows);
        //-------------------------
        $s = "select * from " . $wpdb->prefix . "project_pm where user='******' AND show_to_destination='1' and approved='1' order by id desc " . $max;
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            ?>
                    
                    <script>
					
					$(document).ready(function() {
						//set initial state.
					 
					
						$('#select_all_stuff').change(function() {
							if($(this).is(":checked")) {
								
								$('.message_select_bx').attr("checked", true);
							}
							else
							{
								$('.message_select_bx').attr("checked", false);	
							}
						});
					});
											
					
					</script>
                    
                    <?php 
            echo '<form method="post" action="' . ProjectTheme_get_priv_mess_page_url('delete-message', '', '&return=inbox') . '">';
            echo '<table width="100%">';
            echo '<tr>';
            echo '<td><input type="checkbox" name="" id="select_all_stuff" value="1" /> ' . __('Select All', 'ProjectTheme') . ' </td>';
            echo '<td>' . __('From User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                if ($row->rd == 0) {
                    $cls = 'bold_stuff';
                } else {
                    $cls = '';
                }
                $user = get_userdata($row->initiator);
                echo '<tr>';
                echo '<td><input type="checkbox" class="message_select_bx" name="message_ids[]" value="' . $row->id . '" /></td>';
                echo '<td class="' . $cls . '"><a href="' . get_bloginfo('siteurl') . '/?p_action=user_profile&post_author=' . $user->ID . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . substr($row->subject, 0, 30) . '</td>';
                echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '<tr><td colspan="5"><input type="submit" value="' . __('Delete Selected', 'ProjectTheme') . '" name="delete_sel" /></td></tr>';
            echo '<tr><td colspan="5">  ';
            echo ProjectTheme_get_my_pagination_main(get_bloginfo('siteurl') . "/?page_id=" . get_option('ProjectTheme_my_account_private_messages_id'), $pagenum, 'pagenum', $last, '&pg=inbox');
            echo ' </td></tr>';
            echo '</table></form>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
             
                </div>
                </div>
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'sent-items') {
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        ?>
        
        		<script>
					
					$(document).ready(function() {
						//set initial state.
					 
					
						$('#select_all_stuff').change(function() {
							if($(this).is(":checked")) {
								
								$('.message_select_bx').attr("checked", true);
							}
							else
							{
								$('.message_select_bx').attr("checked", false);	
							}
						});
					});
											
					
					</script>
		<!-- page content here -->	
			
            
            	<div class="my_box3">
            
            
            	<div class="box_title"><?php 
        _e("Private Messages: Sent Items", "ProjectTheme");
        ?>
</div>
                <div class="box_content">  
                <?php 
        global $wpdb;
        $page_rows = 20;
        $page_rows = apply_filters('ProjectTheme_nr_of_messages_priv_pagination', $page_rows);
        $pagenum = isset($_GET['pagenum']) ? $_GET['pagenum'] : 1;
        $max = ' limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows;
        //---------------------------------
        $s = "select count(id) tots from " . $wpdb->prefix . "project_pm where initiator='{$myuid}' AND show_to_source='1' and approved='1'";
        $r = $wpdb->get_results($s);
        $total = $r[0]->tots;
        $last = ceil($total / $page_rows);
        //---------------------------------
        $s = "select * from " . $wpdb->prefix . "project_pm where initiator='{$myuid}' AND show_to_source='1' and approved='1' order by id desc " . $max;
        $r = $wpdb->get_results($s);
        if (count($r) > 0) {
            echo '<form method="post" action="' . ProjectTheme_get_priv_mess_page_url('delete-message', '', '&return=outbox') . '">';
            echo '<table width="100%">';
            echo '<tr>';
            echo '<td><input type="checkbox" name="" id="select_all_stuff" value="1" /> ' . __('Select All', 'ProjectTheme') . ' </td>';
            echo '<td>' . __('To User', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Subject', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Date', 'ProjectTheme') . '</td>';
            echo '<td>' . __('Options', 'ProjectTheme') . '</td>';
            echo '</tr>';
            foreach ($r as $row) {
                //if($row->rd == 0) $cls = 'bold_stuff';
                //else
                $cls = '';
                $user = get_userdata($row->user);
                echo '<tr>';
                echo '<td><input type="checkbox" class="message_select_bx" name="message_ids[]" value="' . $row->id . '" /></td>';
                echo '<td class="' . $cls . '"><a href="' . ProjectTheme_get_user_profile_link($row->user) . '">' . $user->user_login . '</a></td>';
                echo '<td class="' . $cls . '">' . substr($row->subject, 0, 30) . '</td>';
                echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>';
                echo '<td><a href="' . ProjectTheme_get_priv_mess_page_url('read-message', $row->id) . '">' . __('Read', 'ProjectTheme') . '</a> | 
						<a href="' . ProjectTheme_get_priv_mess_page_url('delete-message', $row->id) . '">' . __('Delete', 'ProjectTheme') . '</a></td>';
                echo '</tr>';
            }
            echo '<tr><td colspan="5"><input type="submit" value="' . __('Delete Selected', 'ProjectTheme') . '" name="delete_sel" /></td></tr>';
            echo '<tr><td colspan="5">  ';
            echo ProjectTheme_get_my_pagination_main(get_bloginfo('siteurl') . "/?page_id=" . get_option('ProjectTheme_my_account_private_messages_id'), $pagenum, 'pagenum', $last, '&pg=sent-items');
            echo ' </td></tr>';
            echo '</table></form>';
        } else {
            _e('No messages here.', 'ProjectTheme');
        }
        ?>
      
                </div>
                </div>
        
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'delete-message') {
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_pm where id='{$id}' AND (user='******' OR initiator='{$myuid}')";
        $r = $wpdb->get_results($s);
        $row = $r[0];
        global $current_user;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        if ($myuid == $row->initiator) {
            $owner = true;
        } else {
            $owner = false;
        }
        //if(!$owner)
        //$wpdb->query("update_i18n ".$wpdb->prefix."auction_pm set rd='1' where id='{$row->id}'");
        ?>
        
        
		<!-- page content here -->	
			
            
            	<div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
        if (isset($_POST['delete_sel'])) {
            _e("Delete Multiple Messages: ", "ProjectTheme");
        } else {
            _e("Delete Message: ", "ProjectTheme");
            echo " " . $row->subject;
        }
        ?>
</div>
                <div class="box_content">  
                
                <?php 
        if (isset($_POST['message_ids'])) {
            $message_ids2 = $_POST['message_ids'];
            foreach ($message_ids2 as $message_id) {
                $ss1 = "select * from " . $wpdb->prefix . "project_pm where id='{$message_id}'";
                $rr1 = $wpdb->get_results($ss1);
                $rrow1 = $rr1[0];
                echo '#' . $rrow1->id . " " . $rrow1->subject . '<br/>';
            }
            echo '<br/>';
        }
        ?>
                
                <?php 
        //echo $row->content;
        ?>
      <br/> <br/>
      
      <?php 
        if (1) {
            //$owner == false):
            if (isset($_POST['delete_sel'])) {
                $message_ids = $_POST['message_ids'];
                if (count($message_ids) == 0) {
                    _e("No messsages selected.", "ProjectTheme");
                } else {
                    $attash = '';
                    foreach ($message_ids as $message_id) {
                        $attash .= '&message_id[]=' . $message_id;
                    }
                    ?>
					
                   <a href="<?php 
                    echo $_GET['rdr'];
                    ?>
" class="nice_link"><?php 
                    _e("Cancel", 'ProjectTheme');
                    ?>
</a>
                    
                    <a href="<?php 
                    echo ProjectTheme_get_priv_mess_page_url('delete-message', '', '&confirm_message_deletion=yes&return=' . urlencode($_GET['rdr'])) . $attash;
                    ?>
" 
       				class="nice_link"><?php 
                    _e("Confirm Deletion", 'ProjectTheme');
                    ?>
</a>
                
                <?php 
                }
            } else {
                ?>
      
      <a href="<?php 
                echo $_GET['rdr'];
                ?>
" class="nice_link"><?php 
                _e("Cancel", 'ProjectTheme');
                ?>
</a>
      
       <a href="<?php 
                echo ProjectTheme_get_priv_mess_page_url('delete-message', $row->id, '&confirm_message_deletion=yes&return=' . urlencode($_GET['rdr']));
                ?>
" 
       class="nice_link"><?php 
                _e("Confirm Deletion", 'ProjectTheme');
                ?>
</a> <?php 
            }
        }
        ?>
                </div>
                </div>
                </div>
            
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'read-message') {
        global $current_user, $wpdb;
        get_currentuserinfo();
        $myuid = $current_user->ID;
        $id = $_GET['id'];
        $s = "select * from " . $wpdb->prefix . "project_pm where id='{$id}'  AND (user='******' OR initiator='{$myuid}')";
        $r = $wpdb->get_results($s);
        $row = $r[0];
        if ($myuid == $row->initiator) {
            $owner = true;
        } else {
            $owner = false;
        }
        if (!$owner) {
            $wpdb->query("update " . $wpdb->prefix . "project_pm set rd='1' where id='{$row->id}'");
        }
        ?>
        
        
		<!-- page content here -->	
			
            
            	<div class="my_box3">
           
            
            	<div class="box_title"><?php 
        _e("Read Message: ", "ProjectTheme");
        echo " " . $row->subject;
        ?>
</div>
                <div class="box_content">  
                <?php 
        echo $row->content;
        ?>
      <br/> <br/>
      
      <?php 
        if (!empty($row->file_attached)) {
            echo sprintf(__('File Attached: %s', 'ProjectTheme'), '<a href="' . wp_get_attachment_url($row->file_attached) . '">' . wp_get_attachment_url($row->file_attached) . "</a>");
        }
        ?>
      
      
      <?php 
        if ($owner == false) {
            ?>
       <a href="<?php 
            echo ProjectTheme_get_priv_mess_page_url('send', '', '&pid=' . $row->pid . '&uid=' . $row->initiator . '&in_reply_to=' . $row->id);
            ?>
" class="nice_link"><?php 
            _e("Reply", 'ProjectTheme');
            ?>
</a> <?php 
        }
        ?>
                </div>
                </div>
             
            
		<!-- page content here -->	
			
        <?php 
    } elseif ($third_page == 'send') {
        ?>
        <?php 
        $pid = $_GET['pid'];
        $uid = $_GET['uid'];
        $user = get_userdata($uid);
        if (!empty($pid)) {
            $post = get_post($pid);
            $subject = "RE: " . $post->post_title;
        } elseif (!empty($_GET['in_reply_to'])) {
            global $wpdb;
            $ssp = "select * from " . $wpdb->prefix . "project_pm where id='" . $_GET['in_reply_to'] . "'";
            $sspq = $wpdb->get_results($ssp);
            if (strpos($sspq[0]->subject, 'RE:') !== false) {
                $subject = $sspq[0]->subject;
            } else {
                $subject = "RE: " . $sspq[0]->subject;
            }
        }
        if (isset($_POST['send_a'])) {
            require_once ABSPATH . "wp-admin" . '/includes/file.php';
            require_once ABSPATH . "wp-admin" . '/includes/image.php';
            if (!empty($_FILES['file_instant']['name'])) {
                $pids = 0;
                $upload_overrides = array('test_form' => false);
                $uploaded_file = wp_handle_upload($_FILES['file_instant'], $upload_overrides);
                $file_name_and_location = $uploaded_file['file'];
                $file_title_for_media_library = $_FILES['file_instant']['name'];
                $arr_file_type = wp_check_filetype(basename($_FILES['file_instant']['name']));
                $uploaded_file_type = $arr_file_type['type'];
                if ($uploaded_file_type == "application/zip" or $uploaded_file_type == "application/pdf" or $uploaded_file_type == "application/msword" or $uploaded_file_type == "application/msexcel" or $uploaded_file_type == "application/doc" or $uploaded_file_type == "application/docx" or $uploaded_file_type == "application/xls" or $uploaded_file_type == "application/xlsx" or $uploaded_file_type == "application/csv" or $uploaded_file_type == "application/ppt" or $uploaded_file_type == "application/pptx" or $uploaded_file_type == "application/vnd.ms-excel" or $uploaded_file_type == "application/vnd.ms-powerpoint" or $uploaded_file_type == "application/vnd.openxmlformats-officedocument.presentationml.presentation" or $uploaded_file_type == "application/octet-stream" or $uploaded_file_type == "image/png" or $uploaded_file_type == "image/jpg" or $uploaded_file_type == "image/jpeg" or $uploaded_file_type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" or $uploaded_file_type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") {
                    $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => 'Uploaded ZIP ' . addslashes($file_title_for_media_library), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => 0, 'post_author' => $uid);
                    $attach_id = wp_insert_attachment($attachment, $file_name_and_location, $pids);
                    $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                    wp_update_attachment_metadata($attach_id, $attach_data);
                } else {
                    $error_mm = '1';
                }
            }
            $subject = $_POST['subject_a'];
            $message = $_POST['message_a'];
            $uids = $_POST['to_a'];
            if (isset($_POST['projectss'])) {
                if (!empty($_POST['projectss'])) {
                    $uids = $_POST['projectss'];
                }
            }
            if (!empty($_POST['to_as'])) {
                global $current_user;
                get_currentuserinfo();
                $uids = projectTheme_get_userid_from_username($_POST['to_as']);
                if ($uids == $current_user->ID) {
                    $uids = false;
                    $error_mm = 1;
                    $cant_send = 1;
                }
            }
            if (empty($uids)) {
                $uids = $_GET['uid'];
            }
            if ($uids != false and $error_mm != "1") {
                global $current_user;
                get_currentuserinfo();
                $myuid = $current_user->ID;
                //echo $message;
                //*********************************************
                $ProjectTheme_moderate_private_messages = get_option('ProjectTheme_moderate_private_messages');
                if ($ProjectTheme_moderate_private_messages == "yes") {
                    $ProjectTheme_moderate_private_messages = true;
                } else {
                    $ProjectTheme_moderate_private_messages = false;
                }
                //--------------------------
                if ($ProjectTheme_moderate_private_messages == true) {
                    $approved = '0';
                    $show_to_destination = '0';
                } else {
                    $approved = '1';
                    $show_to_destination = '1';
                }
                //*********************************************
                global $wpdb;
                $wpdb->show_errors = true;
                $tm = $_POST['tm'];
                //current_time('timestamp',0);
                $sr = "select * from " . $wpdb->prefix . "project_pm where initiator='{$myuid}' and user='******' and datemade='{$tm}'";
                $rr = $wpdb->get_results($sr);
                if (count($rr) == 0) {
                    if (empty($pid)) {
                        $pid = 0;
                    }
                    $s = "insert into " . $wpdb->prefix . "project_pm \n\t\t\t\t\t(approved, subject, content, datemade, pid, initiator, user, file_attached, show_to_destination) \n\t\t\t\t\tvalues('{$approved}','{$subject}','{$message}','{$tm}','{$pid}','{$myuid}','{$uids}', '{$attach_id}', '{$show_to_destination}')";
                    $wpdb->query($s);
                    //echo $s;
                    //echo $wpdb->last_error;
                    //-----------------------
                    $user = get_userdata($uid);
                    $message = sprintf(__("You have just received a private message regarding your project: <a href='%s'>%s</a><br/>\n\t\t\t\t\t<a href='%s'>Click here to read the message</a>.", "ProjectTheme"), get_permalink($pid), $post->post_title, get_bloginfo('siteurl') . "/my-account/private-messages");
                    //sitemile_send_email($user->user_email, __('Private Message Received','ProjectTheme') , $message);
                    if ($ProjectTheme_moderate_private_messages == false) {
                        ProjectTheme_send_email_on_priv_mess_received($myuid, $uids);
                    } else {
                        //send message to admin to moderate
                    }
                }
                //-----------------------
                ?>
                
                <div class="my_box3">
            	<div class="padd10">
                 <?php 
                if ($ProjectTheme_moderate_private_messages == false) {
                    _e('Your message has been sent.', 'ProjectTheme');
                } else {
                    _e('Your message has been sent but the receiver will receive it only after moderation.', 'ProjectTheme');
                }
                ?>
                </div>
                </div>
                
                <?php 
            } else {
                if ($error_mm == "1") {
                    if ($cant_send == 1) {
                        echo __('You cannot send a message to yourself.', 'ProjectTheme');
                    } else {
                        echo sprintf(__('Wrong File format: %s', 'ProjectTheme'), $uploaded_file_type);
                    }
                } else {
                    _e('ERROR! wrong username provided.', 'ProjectTheme');
                }
            }
        } else {
            ?>
   
             
        <div class="my_box3">
            	
            
            	<div class="box_title"><?php 
            _e("Send Private Message to: ", "ProjectTheme");
            ?>
 <?php 
            echo $user->user_login;
            ?>
</div>
                <div class="box_content">  
                <form method="post" enctype="multipart/form-data">
                <input type="hidden" name="tm" value="<?php 
            echo current_time('timestamp', 0);
            ?>
" />
                <table>
                <?php 
            if (empty($uid)) {
                $rtt = ProjectTheme_get_my_awarded_projects2($current_user->ID);
                ?>
                <tr>
                <td width="140"><?php 
                _e("Send To", "ProjectTheme");
                ?>
:</td>
                <td><input size="20" name="to_as" type="text" value="" /> <?php 
                if ($rtt) {
                    _e('or', 'ProjectTheme');
                    echo " " . $rtt;
                }
                ?>
</td>
                </tr>
                <?php 
            }
            ?>
                
                <tr>
                <td width="140"><?php 
            _e("Subject", "ProjectTheme");
            ?>
:</td>
                <td><input size="50" name="subject_a" type="text" value="<?php 
            echo $subject;
            ?>
" /></td>
                </tr>
                
                 <script>
			
			jQuery(document).ready(function(){
			tinyMCE.init({
					mode : "specific_textareas",
					theme : "modern", 
					/*plugins : "autolink, lists, spellchecker, style, layer, table, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, media, searchreplace, print, contextmenu, paste, directionality, fullscreen, noneditable, visualchars, nonbreaking, xhtmlxtras, template",*/
					editor_selector :"tinymce-enabled"
				});
			});
						
			</script>
                
                <tr>
                <td valign="top"><?php 
            _e("Message", "ProjectTheme");
            ?>
:</td>
                <td><textarea name="message_a" class="tinymce-enabled" rows="6" cols="50"></textarea></td>
                </tr>
                
                
                <tr>
                <td valign="top"><?php 
            _e("Attach File", "ProjectTheme");
            ?>
:</td>
                <td><input type="file" name="file_instant" class="" /> <?php 
            _e('Only PDF, ZIP, Office files and Images.', 'ProjectTheme');
            ?>
</td>
                </tr>
                
                
                 <tr>
                <td width="140">&nbsp;</td>
                <td></td>
                </tr>
                
                 <tr>
                <td width="140">&nbsp;</td>
                <td><input name="send_a" class="submit_bottom2" type="submit" value="<?php 
            _e("Send Message", 'ProjectTheme');
            ?>
" /></td>
                </tr>
                
                </table>
      			</form>
                
                </div>
                </div>
             
        
        <?php 
        }
    }
    ?>
        
             
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}