function ProjectTheme_my_account_completed_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        
        
         
				
                
                <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query, $wpdb;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    $querystr = "\n                        SELECT p.ID \n                        FROM {$wpdb->posts} AS p\n                        LEFT JOIN {$wpdb->prefix}project_bids AS pb ON p.ID = pb.pid\n                        WHERE   p.post_author = '{$uid}'\n                            AND pb.winner = '1'\n                            AND pb.paid = '1'\n                            AND p.post_type = 'project' ";
    $pageposts = $wpdb->get_col($querystr);
    if (empty($pageposts)) {
        echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
        _e("There are no completed projects yet.", 'ProjectTheme');
        echo '</div>  </div> ';
    } else {
        //				$paid = array(
        //						'key' => 'paid_user',
        //						'value' => "1",
        //						'compare' => '='
        //					);
        //
        //				$args = array('post_type' => 'project','author' => $uid, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page,
        //				'paged' => $query_vars['paged'], 'meta_query' => array($paid));
        $args = array('post_type' => 'project', 'author' => $uid, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => $query_vars['paged'], 'post__in' => $pageposts);
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_paid();
            }
            if (function_exists('wp_pagenavi')) {
                wp_pagenavi();
            }
        } else {
            echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
            _e("There are no completed projects yet.", 'ProjectTheme');
            echo '</div>  </div> ';
        }
        wp_reset_query();
    }
    ?>
        
   
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #2
0
function ProjectTheme_my_account_bid_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
 

                <?php 
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    /*$winner = 	array(
    			'key' => 'bid',
    			'value' => $uid,
    			'compare' => '='
    		);*/
    global $wpdb;
    $s = "select * from " . $wpdb->prefix . "project_bids where uid='{$uid}'";
    $r = $wpdb->get_results($s);
    foreach ($r as $k => $rr) {
        $pids[] = $rr->pid;
    }
    /*$str_pids = implode(',', $pids);
    
    				var_dump($str_pids);*/
    $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => $query_vars['paged'], 'post__in' => $pids);
    query_posts($args);
    $a = 0;
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $a += projectTheme_get_post_my_proposal();
        }
        if (function_exists('wp_pagenavi') && !$a) {
            wp_pagenavi();
        }
    } else {
        echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
        _e("You have not submitted any proposals yet.", 'ProjectTheme');
        echo '</div>  </div> ';
    }
    if ($a) {
        echo '<div class="my_box3"><div class="box_content">';
        _e("There are no projects yet.", 'ProjectTheme');
        echo '</div></div>';
    }
    wp_reset_query();
    ?>
                
         
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
function ProjectTheme_my_account_delivered_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content">
        
        
        	<div class="my_box3 border_bottom_0">
            	
            
            	<div class="box_title"><?php 
    _e("Delivered Projects", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">    
				
                
  <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    $outstanding = array('key' => 'delivered', 'value' => "1", 'compare' => '=');
    $paid_user = array('key' => 'paid_user', 'value' => "1", 'compare' => '=');
    $winner = array('key' => 'winner', 'value' => $uid, 'compare' => '=');
    $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => $query_vars['paged'], 'meta_query' => array($outstanding, $winner, $paid_user));
    query_posts($args);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            projectTheme_get_post();
        }
        if (function_exists('wp_pagenavi')) {
            wp_pagenavi();
        }
    } else {
        _e("There are no delivered projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
                
                
               
           </div>
           </div>    
        
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
function ProjectTheme_my_account_unpublished_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content">
        
        
        	<div class="my_box3 border_bottom_0">
            	
            
            	<div class="box_title"><?php 
    _e("Unpublished Projects", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">    
				
                
                <?php 
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    $paids = array('key' => 'paid', 'value' => "0", 'compare' => '=');
    $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'draft', 'author' => $uid, 'posts_per_page' => $post_per_page, 'paged' => $query_vars['paged'], 'meta_query' => array($paids));
    query_posts($args);
    //query_posts( "post_status=draft&meta_key=paid&meta_value=0&post_type=project&order=DESC&orderby=id&author=".$uid.
    //"&posts_per_page=".$post_per_page."&paged=".$query_vars['paged'] );
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            projectTheme_get_post(array('unpaid'));
        }
        if (function_exists('wp_pagenavi')) {
            wp_pagenavi();
        }
    } else {
        _e("There are no projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
                
                
               
           </div>
           </div>    
        
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
function ProjectTheme_my_account_active_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content">
        
        
        
                <div class="my_box3 border_bottom_0">
            	
            
            	<div class="box_title"><?php 
    _e("My Active Projects", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">    
				
                
                <?php 
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 5;
    query_posts("meta_key=closed&meta_value=0&post_type=project&order=DESC&orderby=id&author=" . $uid . "&posts_per_page=" . $post_per_page . "&paged=" . $query_vars['paged']);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            projectTheme_get_post_active();
        }
        if (function_exists('wp_pagenavi')) {
            wp_pagenavi();
        }
    } else {
        _e("There are no projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
                
                
               
           </div>
           </div>    
		
        
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
function ProjectTheme_my_account_area_awaiting_completion_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        
        
          
				
                
                <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    $outstanding = array('key' => 'outstanding', 'value' => "1", 'compare' => '=');
    $args = array('post_type' => 'project', 'author' => $uid, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => $query_vars['paged'], 'meta_query' => array($outstanding));
    query_posts($args);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            projectTheme_get_post_awaiting_compl();
        }
        if (function_exists('wp_pagenavi')) {
            wp_pagenavi();
        }
    } else {
        echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
        _e("There are no projects yet.", 'ProjectTheme');
        echo '</div>  </div> ';
    }
    wp_reset_query();
    ?>
                
      
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #7
0
function ProjectTheme_my_account_bid_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
 

                <?php 
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    $winner = array('key' => 'bid', 'value' => $uid, 'compare' => '=');
    $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'pages' => $query_vars['paged'], 'meta_query' => array($winner));
    query_posts($args);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            projectTheme_get_post_my_proposal();
        }
        if (function_exists('wp_pagenavi')) {
            wp_pagenavi();
        }
    } else {
        echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
        _e("You have not submitted any proposals yet.", 'ProjectTheme');
        echo '</div>  </div> ';
    }
    wp_reset_query();
    ?>
                
         
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #8
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 
}
Beispiel #9
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 
}
Beispiel #10
0
function ProjectTheme_my_account_disputes_area_function()
{
    $no_comment_admin = 0;
    $no_comment = 0;
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    if ($_POST) {
        if ($_POST['disp_id']) {
            $disp_id = $_POST['disp_id'];
            $closedon = current_time('timestamp', 0);
            $admin_comment = trim($_POST['admin_comment']);
            if (!$admin_comment) {
                $no_comment_admin = 1;
            } else {
                $no_comment_admin = 0;
                $winner = $_POST['winner'];
                if (!$winner) {
                    $s = "update " . $wpdb->prefix . "project_disputes SET `solution`=1, `closedon`={$closedon}, `admin_comment`='{$admin_comment}' WHERE `id`={$disp_id}";
                    $wpdb->query($s);
                } else {
                    $s = "update " . $wpdb->prefix . "project_disputes SET `solution`=1, `winner`={$winner}, `closedon`={$closedon}, `admin_comment`='{$admin_comment}' WHERE `id`={$disp_id}";
                    $wpdb->query($s);
                }
            }
        } else {
            $initiator = $_POST['initiator'];
            $datemade = current_time('timestamp', 0);
            $comment = trim($_POST['comment']);
            $pid_defendant = explode('/', $_POST['defendant']);
            $pid = $pid_defendant[0];
            $defendant = $pid_defendant[1];
            if ($comment) {
                $no_comment = 0;
                $s = "insert into " . $wpdb->prefix . "project_disputes (initiator,pid,datemade,solution,winner,closedon,comment,defendant,admin_comment)\n                    values('{$initiator}','{$pid}','{$datemade}',0,0,0,'{$comment}','{$defendant}','')";
                if ($wpdb->query($s)) {
                    $created_success = 1;
                } else {
                    $created_success = 0;
                }
            } else {
                $no_comment = 1;
            }
        }
    }
    ?>
<div id="content" class="account-main-area">
            <?php 
    if ($created_success) {
        echo '<div class="saved_thing">Dispute created.</div>';
    }
    ?>
            <?php 
    if ($no_comment) {
        echo '<div class="errrs">You cannot leave the dispute comment blank!</div>';
    }
    ?>
            
            <?php 
    if ($no_comment_admin) {
        echo '<div class="errrs">You cannot leave the Comment for closing dispute blank!</div>';
    }
    ?>

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

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

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

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

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

                <div class="clear10"></div>
                
                
                
                
                </div>  
                 <script type="text/javascript">
            $(document).ready(function(){
                
                $('.conv_time').each(function(){
                    var tm = parseInt($(this).text())*1000;
                    console.log(tm);
                    var time = new Date(tm);
                    $(this).text(time.toLocaleString());
                });
            });
        </script> 
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #11
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();
}
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 
}
Beispiel #13
0
function ProjectTheme_my_account_pay_with_credits_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $pid = $_GET['pid'];
    $post_ar = get_post($pid);
    ?>
    	
        
        <div id="content" class="account-main-area">      
        
        	<div class="my_box3 border_bottom_0">
            	
            
            	<div class="box_title"><?php 
    _e("Pay with virtual currency", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">    
				
                
           
           <div class="post no_border_btm" id="post-<?php 
    the_ID();
    ?>
">
                
                <div class="image_holder">
                <a href="<?php 
    echo get_permalink($pid);
    ?>
"><img width="45" height="45" class="image_class" 
                src="<?php 
    echo ProjectTheme_get_first_post_image($pid, 45, 45);
    ?>
" /></a>
                </div>
                <div  class="title_holder" > 
                     <h2><a href="<?php 
    echo get_permalink($pid);
    ?>
" rel="bookmark" title="Permanent Link to <?php 
    echo $post_ar->post_title;
    ?>
">
                        <?php 
    echo $post_ar->post_title;
    ?>
</a></h2>
      			</div>
                <?php 
    if (isset($_GET['pay'])) {
        echo '<div class="details_holder sk_sk_class">';
        $post_ar = get_post($pid);
        $cr = projectTheme_get_credits($uid);
        $bid = projectTheme_get_winner_bid($pid);
        $amount = $bid->bid;
        if ($cr < $amount) {
            echo '<div class="error2">';
            echo __('You do not have enough credits to pay for this project.', 'ProjectTheme');
            echo '</div><div class="clear10 flt_lft"></div>';
            ?>
                            
							<div class="tripp">
							<a class="post_bid_btn" href="<?php 
            echo ProjectTheme_get_payments_page_url('deposit');
            ?>
"><?php 
            echo __('Add More Credits', 'ProjectTheme');
            ?>
</a>
							</div>
                    
							<?php 
        } else {
            projectTheme_send_email_to_project_payer($pid, $uid, $bid->uid, $amount, '1');
            echo __('Your payment has been sent.', 'ProjectTheme');
        }
        echo '</div>';
        ?>
           
                
                <?php 
    } else {
        ?>
                <div class="details_holder sk_sk_class mm11">  
           
                <b>
                 <?php 
        echo __('The price for the project is', 'ProjectTheme');
        ?>
: <?php 
        $bid = projectTheme_get_winner_bid($pid);
        echo projectTheme_get_show_price($bid->bid);
        ?>
</b>
                <br/><br/>
                
               <?php 
        _e("Your credits amount", 'ProjectTheme');
        ?>
: <?php 
        echo projectTheme_get_credits($uid);
        ?>
 <?php 
        echo projectTheme_currency();
        ?>
 <br/><br/>
               <a class="post_bid_btn" href="<?php 
        echo ProjectTheme_get_pay_with_credits_page_url($pid, '&pay=yes');
        ?>
"><?php 
        echo __('Pay Now', 'ProjectTheme');
        ?>
</a> 
               
               <a class="post_bid_btn" href="<?php 
        echo ProjectTheme_get_payments_page_url('deposit');
        ?>
"><?php 
        echo __('Add More Credits', 'ProjectTheme');
        ?>
</a>
                </div><?php 
    }
    ?>
                
               
           </div></div>
           </div>    
        
        
  		</div>      
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #14
0
function ProjectTheme_my_account_area_main_function()
{
    global $current_user, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content">
        	<?php 
    if (ProjectTheme_is_user_business($uid)) {
        ?>
            <div class="my_box3">            
            	<div class="box_title"><?php 
        _e("Your Latest Posted Projects", "ProjectTheme");
        ?>
</div>
                <div class="box_content "> 
            	
                 <?php 
        $query_vars = $wp_query->query_vars;
        $post_per_page = 3;
        global $wp_query;
        $query_vars = $wp_query->query_vars;
        $post_per_page = 5;
        $closed = array('key' => 'closed', 'value' => "0", 'compare' => '=');
        $paid = array('key' => 'paid', 'value' => "1", 'compare' => '=');
        $args = array('post_type' => 'project', 'author' => $uid, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => 1, 'meta_query' => array($paid, $closed), 'post_status' => array('draft', 'publish'));
        query_posts($args);
        //	query_posts( "meta_key=closed&meta_value=0&post_status=publish,draft&post_type=project&order=DESC&orderby=date&author=".$uid.
        //	"&posts_per_page=".$post_per_page."&paged=".$query_vars['paged'] );
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post();
            }
            //if(function_exists('wp_pagenavi')):
            //wp_pagenavi(); endif;
        } else {
            _e("There are no projects yet.", 'ProjectTheme');
        }
        wp_reset_query();
        ?>

              </div>
           </div>
           
           
           <div class="my_box3">
          
            
            	<div class="box_title"><?php 
        _e("My Unpublished &amp; Unpaid Projects", 'ProjectTheme');
        ?>
</div>
                <div class="box_content">    
			
			
				<?php 
        query_posts("post_status=draft&meta_key=paid&meta_value=0&post_type=project&order=DESC&orderby=id&author=" . $uid . "&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post(array('unpaid'));
            }
        } else {
            _e("There are no projects yet.", 'ProjectTheme');
        }
        wp_reset_query();
        ?>
			
			</div>
			</div>
	
			
			
			<div class="clear10"></div>
			
			
			<div class="my_box3">
        
            
            	<div class="box_title"><?php 
        _e("My Latest Closed Projects", 'ProjectTheme');
        ?>
</div>
                <div class="box_content">    
			
			
				<?php 
        query_posts("meta_key=closed&meta_value=1&post_type=project&order=DESC&orderby=id&author=" . $uid . "&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post();
            }
        } else {
            _e("There are no projects yet.", 'ProjectTheme');
        }
        wp_reset_query();
        ?>

			</div>
			</div>
		
        <?php 
    }
    ?>
        
        <?php 
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
	
           
           
        <div class="my_box3">
        
            
            	<div class="box_title"><?php 
        _e("Outstanding Projects", 'ProjectTheme');
        ?>
</div>
                <div class="box_content">    
			
			
				<?php 
        global $wp_query;
        $query_vars = $wp_query->query_vars;
        $post_per_page = 3;
        $outstanding = array('key' => 'outstanding', 'value' => "1", 'compare' => '=');
        $winner = array('key' => 'winner', 'value' => $uid, 'compare' => '=');
        $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => 1, 'meta_query' => array($outstanding, $winner));
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_outstanding_project();
            }
        } else {
            _e("There are no projects yet.", 'ProjectTheme');
        }
        wp_reset_query();
        ?>

			</div>
			</div>   
           
           
           
           
           
        <div class="my_box3">
        
            
            	<div class="box_title"><?php 
        _e("My Latest Bids", 'ProjectTheme');
        ?>
</div>
                <div class="box_content">    
			
			
				<?php 
        query_posts("meta_key=bid&meta_value=" . $uid . "&post_type=project&order=DESC&orderby=id&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post();
            }
        } else {
            _e("There are no projects yet.", 'ProjectTheme');
        }
        wp_reset_query();
        ?>

			</div>
			</div>
            
            
            
            <div class="my_box3">
        
            
            	<div class="box_title"><?php 
        _e("My Latest Won Projects", 'ProjectTheme');
        ?>
</div>
                <div class="box_content">    
			
			
				<?php 
        query_posts("meta_key=winner&meta_value=" . $uid . "&post_type=project&order=DESC&orderby=id&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post();
            }
        } else {
            _e("There are no projects yet.", 'ProjectTheme');
        }
        wp_reset_query();
        ?>

			</div>
			</div>
            
        
        <?php 
    }
    ?>
   
                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
function ProjectTheme_my_account_personal_info_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        	
           <?php 
    if (isset($_POST['save-info'])) {
        //if(file_exists('cimy_update_ExtraFields'))
        cimy_update_ExtraFields_new_me();
        if (!empty($_FILES['avatar']["tmp_name"])) {
            if (filesize($_FILES['avatar']['tmp_name']) > 1024 * 1024) {
                echo '<div class="error">' . __("Avatar was not updated. File is to big!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } else {
                //***********************************
                $pid = 0;
                $cid = $uid;
                require_once ABSPATH . "wp-admin" . '/includes/file.php';
                $upload_overrides = array('test_form' => false);
                $uploaded_file = wp_handle_upload($_FILES['avatar'], $upload_overrides);
                $file_name_and_location = $uploaded_file['file'];
                $file_title_for_media_library = $_FILES['file']['name'];
                $arr_file_type = wp_check_filetype(basename($_FILES['avatar']['name']));
                $uploaded_file_type = $arr_file_type['type'];
                $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => addslashes($file_title_for_media_library), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => $pid, 'post_author' => $cid);
                require_once ABSPATH . "wp-admin" . '/includes/image.php';
                $attach_id = wp_insert_attachment($attachment, $file_name_and_location, $pid);
                $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                wp_update_attachment_metadata($attach_id, $attach_data);
                update_user_meta($uid, 'avatar_' . 'project', $attach_id);
                //***********************************
            }
        }
        //---------------------
        $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}' ");
        $email_cats = $_POST['email_cats'];
        if (count($email_cats) > 0) {
            foreach ($email_cats as $em) {
                $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts (uid,catid) values('{$uid}','{$em}') ");
            }
        }
        //-------------------
        //email_locs
        //****************************************************************************************************
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}' ");
            $email_cats = $_POST['email_locs'];
            if (count($email_cats) > 0) {
                foreach ($email_cats as $em) {
                    $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts_locs (uid,catid) values('{$uid}','{$em}') ");
                }
            }
        }
        //****************************************************************************************************
        //-------------------
        $user_description = trim($_POST['user_description']);
        update_user_meta($uid, 'user_description', $user_description);
        $per_hour = trim($_POST['per_hour']);
        update_user_meta($uid, 'per_hour', $per_hour);
        $user_location = trim($_POST['project_location_cat']);
        update_user_meta($uid, 'user_location', $user_location);
        $user_city = trim($_POST['user_city']);
        update_user_meta($uid, 'user_city', $user_city);
        if (isset($_POST['paypal_email'])) {
            $paypalnum = trim($_POST['paypal_email']);
            if (is_email($paypalnum)) {
                $my_em = get_user_meta($uid, 'paypal_email', true);
                $s_em = get_users('meta_value=' . $paypalnum);
                $em_dom = strstr($paypalnum, '@');
                $em_dom = str_replace('@', '', $em_dom);
                if ($my_em != $paypalnum && !$s_em) {
                    function isDomainAvailible($domain)
                    {
                        $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;
                    }
                    if (isDomainAvailible($em_dom)) {
                        update_user_meta($uid, 'paypal_email', $paypalnum);
                    } else {
                        $xxp = 1;
                        echo '<div class="error">' . __('Incorrect PayPal Email', 'ProjectTheme') . '</div>';
                    }
                } else {
                    $xxp = 1;
                    echo '<div class="error">' . __('This PayPal Email already exists', 'ProjectTheme') . '</div>';
                }
            } else {
                $xxp = 1;
                echo '<div class="error">' . __('Incorrect PayPal Email', 'ProjectTheme') . '</div>';
            }
        } else {
            update_user_meta($uid, 'paypal_email', '');
        }
        $personal_info = trim($_POST['payza_email']);
        update_user_meta($uid, 'payza_email', $personal_info);
        $personal_info = trim($_POST['moneybookers_email']);
        update_user_meta($uid, 'moneybookers_email', $personal_info);
        $user_url = trim($_POST['user_url']);
        update_user_meta($uid, 'user_url', $user_url);
        do_action('ProjectTheme_pers_info_save_action');
        if (isset($_POST['new_user_name']) && !empty($_POST['new_user_name'])) {
            $new_user_name = trim($_POST['new_user_name']);
            $new_user_name = preg_replace('|\\s+|', '', $new_user_name);
            if (!validate_username($new_user_name) or $new_user_name == '' or !preg_match('/[0-9aA-zZ]/', $new_user_name)) {
                echo '<div class="error">' . __("Incorrect username!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } elseif (username_exists($new_user_name) && $new_user_name != $current_user->user_login) {
                echo '<div class="error">' . __("This Username already exists!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } elseif ($new_user_name != $current_user->user_login) {
                global $wpdb;
                $sq = "UPDATE " . $wpdb->users . " SET user_login='******' WHERE ID='{$uid}'";
                $wpdb->query($sq);
                $inc = 2;
            }
        }
        if (isset($_POST['new_user_email']) && !empty($_POST['new_user_email'])) {
            $new_user_email = trim($_POST['new_user_email']);
            $new_user = get_user_by('email', $new_user_email);
            $new_uid = $new_user->ID;
            $user = get_userdata($uid);
            if ($new_user_email == $user->user_email) {
            } elseif (!$new_uid) {
                global $wpdb;
                $sq = "update " . $wpdb->users . " set user_email='{$new_user_email}' where ID='{$uid}'";
                $wpdb->query($sq);
            } else {
                echo '<div class="error">' . __("This Email already exists!", "ProjectTheme") . '</div>';
                $xxp = 1;
            }
        }
        if (isset($_POST['password']) && !empty($_POST['password'])) {
            $p1 = trim($_POST['password']);
            $p2 = trim($_POST['reppassword']);
            if (!empty($p1) && !empty($p2)) {
                if ($p1 == $p2) {
                    global $wpdb;
                    $newp = md5($p1);
                    $sq = "update " . $wpdb->users . " set user_pass='******' where ID='{$uid}'";
                    $wpdb->query($sq);
                    $inc = 1;
                } else {
                    echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                    $xxp = 1;
                }
            } else {
                echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                $xxp = 1;
            }
        }
        //---------------------------------------
        $arr = $_POST['custom_field_id'];
        for ($i = 0; $i < count($arr); $i++) {
            $ids = $arr[$i];
            $value = $_POST['custom_field_value_' . $ids];
            if (is_array($value)) {
                delete_user_meta($uid, "custom_field_ID_" . $ids);
                for ($j = 0; $j < count($value); $j++) {
                    add_user_meta($uid, "custom_field_ID_" . $ids, $value[$j]);
                }
            } else {
                update_user_meta($uid, "custom_field_ID_" . $ids, $value);
            }
        }
        //--------------------------------------------
        if ($xxp != 1) {
            echo '<div class="saved_thing">' . __('Info saved!', 'ProjectTheme');
            if ($inc == 1) {
                echo '<br/>' . __('Your password was changed. Redirecting to login page...', 'ProjectTheme');
                echo '<meta http-equiv="refresh" content="2; url=' . get_bloginfo('url') . '/wp-login.php">';
            } elseif ($inc == 2) {
                echo '<br/>' . __('Your Username was changed. Redirecting to login page...', 'ProjectTheme');
                echo '<meta http-equiv="refresh" content="2; url=' . get_bloginfo('url') . '/wp-login.php">';
            }
            echo '</div>';
        }
    }
    $user = get_userdata($uid);
    $user_location = get_user_meta($uid, 'user_location', true);
    ?>
         
       
    <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>     
            
             <form method="post"  enctype="multipart/form-data">
             
            <div class="my_box3">
            	
             
                <div class="box_content">    
	
         <ul class="post-new3">
        <li>
        	<h2><?php 
    echo __('Username', 'ProjectTheme');
    ?>
:</h2>
        	<p><input type="text" size="35" value="<?php 
    echo $user->user_login;
    ?>
" name="new_user_name" class="do_input" /></p>
        </li>

        <li>
        	<h2><?php 
    echo __('Email', 'ProjectTheme');
    ?>
:</h2>
        	<p><input type="text" size="35" value="<?php 
    echo $user->user_email;
    ?>
" name="new_user_email" class="do_input" /></p>
        </li>

		<?php 
    $opt = get_option('ProjectTheme_enable_project_location');
    if ($opt != 'no') {
        ?>
        
		 <!-- <li>
        	<h2><?php 
        echo __('Location', 'ProjectTheme');
        ?>
:</h2>
        	<p>
            <?php 
        echo ProjectTheme_get_categories("project_location", $user_location, __("Select Location", "ProjectTheme"), "do_input");
        ?>
            </p>
        </li> -->
		
        
        <li>
        	<h2><?php 
        echo __('Country', 'ProjectTheme');
        ?>
:</h2>
        	<p>
        		<?php 
        $args = "orderby=name&order=ASC&hide_empty=0&parent=0";
        $terms = get_terms('project_location', $args);
        $cur_country = get_user_meta($uid, 'user_city');
        echo '<select name="user_city" class="do_input"><option value="">Select Country</option>';
        if ($terms) {
            foreach ($terms as $key => $term) {
                if ($cur_country[0] == $term->name) {
                    echo '<option value="' . $term->name . '" selected>' . $term->name . '</option>';
                } else {
                    echo '<option value="' . $term->name . '">' . $term->name . '</option>';
                }
            }
        }
        echo '</select>';
        ?>
        		<!-- <input type="text" size="35" name="user_city" value="<?php 
        echo get_user_meta($uid, 'user_city', true);
        ?>
" class="do_input" /> -->
        	</p>
        </li>
        
		<?php 
    }
    ?>
     
            <script>
			
			jQuery(document).ready(function(){
			tinyMCE.init({
					mode : "specific_textareas",
					theme : "modern", 
					/*statusbar: false,*/
					/*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>    
        <li>
        	<h2><?php 
    echo __('Description', 'ProjectTheme');
    ?>
:</h2>
        	<p><textarea cols="40" rows="5"  name="user_description" class="tinymce-enabled do_input"><?php 
    echo get_usermeta($uid, 'user_description', true);
    ?>
</textarea></p>
        </li>
        
        <?php 
    $opt = get_option('ProjectTheme_paypal_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('PayPal Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="paypal_email" value="<?php 
        echo get_user_meta($uid, 'paypal_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_moneybookers_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('Moneybookers Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="moneybookers_email" value="<?php 
        echo get_user_meta($uid, 'moneybookers_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_alertpay_enable');
    if ($opt == "yes") {
        ?>
        
         <li>
        	<h2><?php 
        echo __('Payza Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="payza_email" value="<?php 
        echo get_user_meta($uid, 'payza_email', true);
        ?>
" class="do_input" /></p>
        </li>
       <?php 
    }
    ?>
 
        
         <li>
        	<h2><?php 
    echo __('New Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="password" size="35" /></p>
        </li>
        
        
        <li>
        	<h2><?php 
    echo __('Repeat Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="reppassword" size="35"  /></p>
        </li>
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_1');
    ?>

   		  <li>
        	<h2><?php 
    echo __('Profile Avatar', 'ProjectTheme');
    ?>
:</h2>
        	<style type="text/css">
        		.video-delete {
				    display: none;
				    color: #FF0000;
				    border: 1px solid #FF0000;
				    padding: 0 5px;
				    border-radius: 50%;
				    cursor: pointer;
				}
        		.sp-inline {
        			display: inline-block;
        		}
        	</style>
        		<p>
        			<span class="sp-inline">
        				<input type="file" name="avatar" class="new-file-style" />
        			</span>
        			<span class="video-delete" onclick="delete_choose();">X</span>
        		</p>
        		<script>
        			function delete_choose(){
       					$('.new-file-style').val('').show();
       					$('#new_name_file').remove();
       					$('.video-delete').hide();
    				}
    				$( document ).ready(function() {
    					$('.new-file-style').on("change", function(){
      						var file = $('.new-file-style')[0].files[0];
        					if(file){
        						$('.new-file-style').hide();
        						$('.video-delete').css('display','inline-block');
        						$( '<span id="new_name_file">'+file.name+'</span>' ).insertAfter( ".new-file-style" );
        					}
      					});
    				});
        		</script>
        	<p>
           		<?php 
    _e('max file size: 1mb. Formats: jpeg, jpg, png, gif', 'ProjectTheme');
    ?>
<br/>
            	<img width="50" height="50" border="0" src="<?php 
    echo ProjectTheme_get_avatar($uid, 50, 50);
    ?>
" /> 
            </p>
        </li>
   
   
   <li>
   <?php 
    if (function_exists('cimy_extract_ExtraFields')) {
        cimy_extract_ExtraFields();
    }
    ?>
   <?php 
    if (isset($_POST['delet-pic'])) {
        if (!empty($_FILES['avatar']["tmp_name"])) {
            if (filesize($_FILES['avatar']['tmp_name']) > 1024 * 1024) {
                echo '<div class="error">' . __("Avatar was not updated. File is to big!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } else {
                //***********************************
                $pid = 0;
                $cid = $uid;
                require_once ABSPATH . "wp-admin" . '/includes/file.php';
                $upload_overrides = array('test_form' => false);
                $uploaded_file = wp_handle_upload($_FILES['avatar'], $upload_overrides);
                $file_name_and_location = $uploaded_file['http://bidqa.com/wp-content/themes/ProjectTheme/images/noav.jpg'];
                $file_title_for_media_library = $_FILES['http://bidqa.com/wp-content/themes/ProjectTheme/images/noav.jpg']['http://bidqa.com/wp-content/themes/ProjectTheme/images/noav.jpg'];
                $arr_file_type = wp_check_filetype(basename($_FILES['avatar']['name']));
                $uploaded_file_type = $arr_file_type['type'];
                $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => addslashes($file_title_for_media_library), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => $pid, 'post_author' => $cid);
                require_once ABSPATH . "wp-admin" . '/includes/image.php';
                $attach_id = wp_insert_attachment($attachment, $file_name_and_location, $pid);
                $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                wp_update_attachment_metadata($attach_id, $attach_data);
                update_user_meta($uid, 'avatar_' . 'project', $attach_id);
                //***********************************
            }
        }
    }
    ?>
   
   </li> http://bidqa.com/wp-content/themes/ProjectTheme/images/noav.jpg
        <li>
        <p><input type="submit" name="delet-pic" class="my-buttons" value="<?php 
    _e("Delete profile pic.", 'ProjectTheme');
    ?>
" /></p>
       &nbsp;&nbsp;&nbsp;
        <p><input type="submit" name="save-info" class="my-buttons" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
        
       </ul> 
        
               
        
           </div>
           </div>     
            
            <div class="clear10"></div>
            
            <div class="my_box3" id="other_infs_mm1">
           
            
            	<div class="box_title" id="other_infs_mm"><?php 
    _e("Other Information", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">  
                
        <ul class="post-new3">
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_2');
    ?>
        
        <?php 
    $user_tp = get_user_meta($uid, 'user_tp', true);
    if (empty($user_tp)) {
        $user_tp = 'all';
    }
    if ($user_tp == "all") {
        $catid = array('all', 'service_buyer', 'service_provider');
    } else {
        $catid = array($user_tp);
    }
    if (current_user_can('manage_options')) {
        $catid = array('all', 'service_buyer', 'service_provider');
    }
    $k = 0;
    $arr = ProjectTheme_get_users_category_fields($catid, $uid);
    $exf = '';
    for ($i = 0; $i < count($arr); $i++) {
        $exf .= '<li>';
        $exf .= '<h2>' . $arr[$i]['field_name'] . $arr[$i]['id'] . ':</h2>';
        $exf .= '<p>' . $arr[$i]['value'] . '</p>';
        $exf .= '</li>';
        $k++;
    }
    echo $exf;
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Hourly Rate', 'ProjectTheme');
        ?>
:</h2>
        	<p><?php 
        echo projectTheme_currency();
        ?>
<input type="text" size="7" name="per_hour" value="<?php 
        echo get_user_meta($uid, 'per_hour', true);
        ?>
" class="do_input" /> 
             *<?php 
        _e('your estimated hourly rate', 'ProjectTheme');
        ?>
</p>
        </li>
        <script type="text/javascript">
        	$( 'input[name="per_hour"]' ).keypress(function( event ) {
        	  var kkk = event.which;     		  
        	  console.log(kkk);
        	  if(((kkk>47 && kkk<58) || (kkk>64 && kkk<91) || kkk==8 || kkk==0 || kkk==46)){    		  
        	  	return true;
        	  }
        	  else{
        	  	return false;
        	  }
        	  
        	});
        </script>
        <?php 
    }
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $cid = $uid;
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Portfolio Pictures', 'ProjectTheme');
        ?>
:</h2>
        	<p>
			
             <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:'image/*',
    clickable: true,
	url: "<?php 
        bloginfo('siteurl');
        ?>
/?my_upload_of_project_files8=1",
};
 
var myDropzone = new Dropzone('div#myDropzoneElement2', myDropzoneOptions);

myDropzone.on("sending", function(file, xhr, formData) {
  formData.append("author", "<?php 
        echo $current_user->ID;
        ?>
"); // 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' => 'post_date', 'post_type' => 'attachment', 'author' => $current_user->ID, 'meta_key' => 'is_portfolio', 'meta_value' => '1', 'numberposts' => -1);
        $attachments = get_posts($args);
        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.', 'ProjectTheme');
        ?>
    <div class="dropzone dropzone-previews" id="myDropzoneElement2" ></div>
 
    
	</div>
            
            
            
     
            
            
            </p>
        </li>
        
        <?php 
    }
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
                    
                    <li>
                        <h2><?php 
        echo __('Emails Alerts', 'ProjectTheme');
        ?>
:</h2>
                        <p>
						*<?php 
        _e('you will get an email notification when a project is posted in the selected categories', 'ProjectTheme');
        ?>
						<div style="border:1px solid #ccc;background:#f2f2f2; overflow:auto; width:350px; border-radius:5px; height:160px;">
                        
                        <?php 
        global $wpdb;
        $ss = "select * from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}'";
        $rr = $wpdb->get_results($ss);
        $terms = get_terms('project_cat', 'parent=0&orderby=name&hide_empty=0');
        foreach ($terms as $term) {
            $chk = projectTheme_check_list_emails($term->term_id, $rr) == true ? "checked='checked'" : "";
            echo '<input type="checkbox" name="email_cats[]" ' . $chk . ' value="' . $term->term_id . '" /> ' . $term->name . "<br/>";
            $terms2 = get_terms('project_cat', 'parent=' . $term->term_id . '&orderby=name&hide_empty=0');
            foreach ($terms2 as $term2) {
                $chk = projectTheme_check_list_emails($term2->term_id, $rr) == 1 ? "checked='checked'" : "";
                echo '&nbsp;&nbsp; &nbsp; <input type="checkbox" name="email_cats[]" ' . $chk . ' value="' . $term2->term_id . '" /> ' . $term2->name . "<br/>";
                $terms3 = get_terms('project_cat', 'parent=' . $term2->term_id . '&orderby=name&hide_empty=0');
                foreach ($terms3 as $term3) {
                    $chk = projectTheme_check_list_emails($term3->term_id, $rr) == 1 ? "checked='checked'" : "";
                    echo '&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="checkbox" ' . $chk . ' name="email_cats[]" 
										value="' . $term3->term_id . '" /> ' . $term3->name . "<br/>";
                }
            }
        }
        ?>
                        
                        </div>
                        <br/>
                        </p>
                    </li>
        
        <?php 
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            ?>
        	   <li>
                        <h2>&nbsp;</h2>
                        <p>
						*<?php 
            _e('you will get an email notification when a project is posted in the selected locations', 'ProjectTheme');
            ?>
						<div style="border:1px solid #ccc;background:#f2f2f2; overflow:auto; width:350px; border-radius:5px; height:160px;">
                        
                        <?php 
            global $wpdb;
            $ss = "select * from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}'";
            $rr = $wpdb->get_results($ss);
            $terms = get_terms('project_location', 'parent=0&orderby=name&hide_empty=0');
            foreach ($terms as $term) {
                $chk = projectTheme_check_list_emails($term->term_id, $rr) == true ? "checked='checked'" : "";
                echo '<input type="checkbox" name="email_locs[]" ' . $chk . ' value="' . $term->term_id . '" /> ' . $term->name . "<br/>";
                $terms2 = get_terms('project_location', 'parent=' . $term->term_id . '&orderby=name&hide_empty=0');
                foreach ($terms2 as $term2) {
                    $chk = projectTheme_check_list_emails($term2->term_id, $rr) == 1 ? "checked='checked'" : "";
                    echo '&nbsp;&nbsp; &nbsp; <input type="checkbox" name="email_locs[]" ' . $chk . ' value="' . $term2->term_id . '" /> ' . $term2->name . "<br/>";
                    $terms3 = get_terms('project_location', 'parent=' . $term2->term_id . '&orderby=name&hide_empty=0');
                    foreach ($terms3 as $term3) {
                        $chk = projectTheme_check_list_emails($term3->term_id, $rr) == 1 ? "checked='checked'" : "";
                        echo '&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="checkbox" ' . $chk . ' name="email_locs[]" 
										value="' . $term3->term_id . '" /> ' . $term3->name . "<br/>";
                    }
                }
            }
            ?>
                        
                        </div>
                        <br/>
                        </p>
                    </li>
        
        
        <?php 
        }
    }
    if ($k == 0) {
        echo '<style>#other_infs_mm, #bk_save_not, #other_infs_mm1 { display:none; } </style>';
    }
    ?>
		 
        
        			
                    <li id="bk_save_not">
        <h2>&nbsp;</h2> <input type="hidden" value="<?php 
    echo $uid;
    ?>
" name="user_id" />
        <p><input type="submit" class="my-buttons" name="save-info" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
                    
        </ul>
                
                
              
                </div>
                </div>
                
                
             
            
            
            
            
		</form>

                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Beispiel #16
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 
}
Beispiel #17
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();
}
function ProjectTheme_my_account_personal_info_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        	
           <?php 
    if (isset($_POST['save-info'])) {
        //if(file_exists('cimy_update_ExtraFields'))
        cimy_update_ExtraFields_new_me();
        require_once ABSPATH . "wp-admin" . '/includes/file.php';
        require_once ABSPATH . "wp-admin" . '/includes/image.php';
        if (!empty($_FILES['avatar']["name"])) {
            $upload_overrides = array('test_form' => false);
            $uploaded_file = wp_handle_upload($_FILES['avatar'], $upload_overrides);
            $file_name_and_location = $uploaded_file['file'];
            $file_title_for_media_library = $_FILES['avatar']['name'];
            $file_name_and_location = $uploaded_file['file'];
            $file_title_for_media_library = $_FILES['avatar']['name'];
            $arr_file_type = wp_check_filetype(basename($_FILES['avatar']['name']));
            $uploaded_file_type = $arr_file_type['type'];
            $urls = $uploaded_file['url'];
            if ($uploaded_file_type == "image/png" or $uploaded_file_type == "image/jpg" or $uploaded_file_type == "image/jpeg" or $uploaded_file_type == "image/gif") {
                $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => 'User Avatar', 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => 0, 'post_author' => $uid);
                $attach_id = wp_insert_attachment($attachment, $file_name_and_location, 0);
                $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                wp_update_attachment_metadata($attach_id, $attach_data);
                $_wp_attached_file = get_post_meta($attach_id, '_wp_attached_file', true);
                if (!empty($_wp_attached_file)) {
                    update_user_meta($uid, 'avatar_project', $attach_id);
                }
            }
        }
        //---------------------
        $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}' ");
        $email_cats = $_POST['email_cats'];
        if (count($email_cats) > 0) {
            foreach ($email_cats as $em) {
                $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts (uid,catid) values('{$uid}','{$em}') ");
            }
        }
        //-------------------
        //email_locs
        //****************************************************************************************************
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}' ");
            $email_cats = $_POST['email_locs'];
            if (count($email_cats) > 0) {
                foreach ($email_cats as $em) {
                    $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts_locs (uid,catid) values('{$uid}','{$em}') ");
                }
            }
        }
        //****************************************************************************************************
        //-------------------
        $user_description = trim($_POST['user_description']);
        update_user_meta($uid, 'user_description', $user_description);
        $per_hour = trim($_POST['per_hour']);
        update_user_meta($uid, 'per_hour', $per_hour);
        $user_location = trim($_POST['project_location_cat']);
        update_user_meta($uid, 'user_location', $user_location);
        $user_city = trim($_POST['user_city']);
        update_user_meta($uid, 'user_city', $user_city);
        $personal_info = trim($_POST['paypal_email']);
        update_user_meta($uid, 'paypal_email', $personal_info);
        $personal_info = trim($_POST['payza_email']);
        update_user_meta($uid, 'payza_email', $personal_info);
        $personal_info = trim($_POST['moneybookers_email']);
        update_user_meta($uid, 'moneybookers_email', $personal_info);
        $user_url = trim($_POST['user_url']);
        update_user_meta($uid, 'user_url', $user_url);
        do_action('ProjectTheme_pers_info_save_action');
        if (isset($_POST['password']) && !empty($_POST['password'])) {
            $p1 = trim($_POST['password']);
            $p2 = trim($_POST['reppassword']);
            if (!empty($p1) && !empty($p2)) {
                if ($p1 == $p2) {
                    global $wpdb;
                    $newp = md5($p1);
                    $sq = "update " . $wpdb->users . " set user_pass='******' where ID='{$uid}'";
                    $wpdb->query($sq);
                    $inc = 1;
                } else {
                    echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                    $xxp = 1;
                }
            } else {
                echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                $xxp = 1;
            }
        }
        //---------------------------------------
        $arr = $_POST['custom_field_id'];
        for ($i = 0; $i < count($arr); $i++) {
            $ids = $arr[$i];
            $value = $_POST['custom_field_value_' . $ids];
            if (is_array($value)) {
                delete_user_meta($uid, "custom_field_ID_" . $ids);
                for ($j = 0; $j < count($value); $j++) {
                    add_user_meta($uid, "custom_field_ID_" . $ids, $value[$j]);
                }
            } else {
                update_user_meta($uid, "custom_field_ID_" . $ids, $value);
            }
        }
        //--------------------------------------------
        if ($xxp != 1) {
            echo '<div class="saved_thing">' . __('Info saved!', 'ProjectTheme');
            if ($inc == 1) {
                echo '<br/>' . __('Your password was changed. Redirecting to login page...', 'ProjectTheme');
                echo '<meta http-equiv="refresh" content="2; url=' . get_bloginfo('url') . '/wp-login.php">';
            }
            echo '</div>';
        }
    }
    $user = get_userdata($uid);
    $user_location = get_user_meta($uid, 'user_location', true);
    ?>
         
       
    <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>     
            
             <form method="post"  enctype="multipart/form-data">
             
            <div class="my_box3">
            	
             
                <div class="box_content">    
	
         <ul class="post-new3">
        <li>
        	<h2><?php 
    echo __('Username', 'ProjectTheme');
    ?>
:</h2>
        	<p><input type="text" size="35" value="<?php 
    echo $user->user_login;
    ?>
" disabled="disabled" class="do_input" /></p>
        </li>

		<?php 
    $opt = get_option('ProjectTheme_enable_project_location');
    if ($opt != 'no') {
        ?>
        
		 <li>
        	<h2><?php 
        echo __('Location', 'ProjectTheme');
        ?>
:</h2>
        	<p>
            <?php 
        echo ProjectTheme_get_categories("project_location", $user_location, __("Select Location", "ProjectTheme"), "do_input");
        ?>
            </p>
        </li>
		
        
        <li>
        	<h2><?php 
        echo __('City', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="user_city" value="<?php 
        echo get_user_meta($uid, 'user_city', true);
        ?>
" class="do_input" /></p>
        </li>
        
		<?php 
    }
    ?>
     
            <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>    
        <li>
        	<h2><?php 
    echo __('Description', 'ProjectTheme');
    ?>
:</h2>
        	<p><textarea cols="40" rows="5"  name="user_description" class="tinymce-enabled do_input"><?php 
    echo get_usermeta($uid, 'user_description', true);
    ?>
</textarea></p>
        </li>
        
        <?php 
    $opt = get_option('ProjectTheme_paypal_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('PayPal Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="paypal_email" value="<?php 
        echo get_user_meta($uid, 'paypal_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_moneybookers_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('Moneybookers Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="moneybookers_email" value="<?php 
        echo get_user_meta($uid, 'moneybookers_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_alertpay_enable');
    if ($opt == "yes") {
        ?>
        
         <li>
        	<h2><?php 
        echo __('Payza Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="payza_email" value="<?php 
        echo get_user_meta($uid, 'payza_email', true);
        ?>
" class="do_input" /></p>
        </li>
       <?php 
    }
    ?>
 
        
         <li>
        	<h2><?php 
    echo __('New Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="password" size="35" /></p>
        </li>
        
        
        <li>
        	<h2><?php 
    echo __('Repeat Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="reppassword" size="35"  /></p>
        </li>
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_1');
    ?>
        
   		  <li>
        	<h2><?php 
    echo __('Profile Avatar', 'ProjectTheme');
    ?>
:</h2>
        	<p> <input type="file" name="avatar" /> <br/>
           <?php 
    _e('max file size: 1mb. Formats: jpeg, jpg, png, gif', 'ProjectTheme');
    ?>
            <br/>
            <img width="50" height="50" border="0" src="<?php 
    echo ProjectTheme_get_avatar($uid, 50, 50);
    ?>
" /> 
            </p>
        </li>
   
   
   <li>
   <?php 
    if (function_exists('cimy_extract_ExtraFields')) {
        cimy_extract_ExtraFields();
    }
    ?>
   </li> 
        
        
        <li>
        <h2>&nbsp;</h2>
        <p><input type="submit" name="save-info" class="my-buttons" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
        
       </ul> 
        
               
        
           </div>
           </div>     
            
            <div class="clear10"></div>
            
            <div class="my_box3" >
           
            
            	<div class="box_title" id="other_infs_mm"><?php 
    _e("Other Information", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">  
                
        <ul class="post-new3">
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_2');
    ?>
        
        <?php 
    $user_tp = get_user_meta($uid, 'user_tp', true);
    if (empty($user_tp)) {
        $user_tp = 'all';
    }
    if ($user_tp == "all") {
        $catid = array('all', 'service_buyer', 'service_provider');
    } else {
        $catid = array($user_tp);
    }
    if (current_user_can('manage_options')) {
        $catid = array('all', 'service_buyer', 'service_provider');
    }
    $k = 0;
    $arr = ProjectTheme_get_users_category_fields($catid, $uid);
    $exf = '';
    for ($i = 0; $i < count($arr); $i++) {
        $exf .= '<li>';
        $exf .= '<h2>' . $arr[$i]['field_name'] . $arr[$i]['id'] . ':</h2>';
        $exf .= '<p>' . $arr[$i]['value'] . '</p>';
        $exf .= '</li>';
        $k++;
    }
    echo $exf;
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Hourly Rate', 'ProjectTheme');
        ?>
:</h2>
        	<p><?php 
        echo projectTheme_currency();
        ?>
<input type="text" size="7" name="per_hour" value="<?php 
        echo get_user_meta($uid, 'per_hour', true);
        ?>
" class="do_input" /> 
             *<?php 
        _e('your estimated hourly rate', 'ProjectTheme');
        ?>
</p>
        </li>
        
        <?php 
    }
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $cid = $uid;
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Portfolio Pictures', 'ProjectTheme');
        ?>
:</h2>
        	<p>
			
             <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:'image/*',
    clickable: true,
	url: "<?php 
        bloginfo('siteurl');
        ?>
/?my_upload_of_project_files8=1",
};
 
var myDropzone = new Dropzone('div#myDropzoneElement2', myDropzoneOptions);

myDropzone.on("sending", function(file, xhr, formData) {
  formData.append("author", "<?php 
        echo $current_user->ID;
        ?>
"); // 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' => 'post_date', 'post_type' => 'attachment', 'author' => $current_user->ID, 'meta_key' => 'is_portfolio', 'meta_value' => '1', 'numberposts' => -1);
        $attachments = get_posts($args);
        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.', 'ProjectTheme');
        ?>
    <div class="dropzone dropzone-previews" id="myDropzoneElement2" ></div>
 
    
	</div>
            
            
            
     
            
            
            </p>
        </li>
        
        <?php 
    }
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
                    
                    <li>
                        <h2><?php 
        echo __('Emails Alerts', 'ProjectTheme');
        ?>
:</h2>
                        <p><div style="border:1px solid #ccc;background:#f2f2f2; overflow:auto; width:350px; border-radius:5px; height:160px;">
                        
                        <?php 
        global $wpdb;
        $ss = "select * from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}'";
        $rr = $wpdb->get_results($ss);
        $terms = get_terms('project_cat', 'parent=0&orderby=name&hide_empty=0');
        foreach ($terms as $term) {
            $chk = projectTheme_check_list_emails($term->term_id, $rr) == true ? "checked='checked'" : "";
            echo '<input type="checkbox" name="email_cats[]" ' . $chk . ' value="' . $term->term_id . '" /> ' . $term->name . "<br/>";
            $terms2 = get_terms('project_cat', 'parent=' . $term->term_id . '&orderby=name&hide_empty=0');
            foreach ($terms2 as $term2) {
                $chk = projectTheme_check_list_emails($term2->term_id, $rr) == 1 ? "checked='checked'" : "";
                echo '&nbsp;&nbsp; &nbsp; <input type="checkbox" name="email_cats[]" ' . $chk . ' value="' . $term2->term_id . '" /> ' . $term2->name . "<br/>";
                $terms3 = get_terms('project_cat', 'parent=' . $term2->term_id . '&orderby=name&hide_empty=0');
                foreach ($terms3 as $term3) {
                    $chk = projectTheme_check_list_emails($term3->term_id, $rr) == 1 ? "checked='checked'" : "";
                    echo '&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="checkbox" ' . $chk . ' name="email_cats[]" 
										value="' . $term3->term_id . '" /> ' . $term3->name . "<br/>";
                }
            }
        }
        ?>
                        
                        </div>
                        <br/>
                        *<?php 
        _e('you will get an email notification when a project is posted in the selected categories', 'ProjectTheme');
        ?>
</p>
                    </li>
        
        <?php 
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            ?>
        	   <li>
                        <h2>&nbsp;</h2>
                        <p><div style="border:1px solid #ccc;background:#f2f2f2; overflow:auto; width:350px; border-radius:5px; height:160px;">
                        
                        <?php 
            global $wpdb;
            $ss = "select * from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}'";
            $rr = $wpdb->get_results($ss);
            $terms = get_terms('project_location', 'parent=0&orderby=name&hide_empty=0');
            foreach ($terms as $term) {
                $chk = projectTheme_check_list_emails($term->term_id, $rr) == true ? "checked='checked'" : "";
                echo '<input type="checkbox" name="email_locs[]" ' . $chk . ' value="' . $term->term_id . '" /> ' . $term->name . "<br/>";
                $terms2 = get_terms('project_location', 'parent=' . $term->term_id . '&orderby=name&hide_empty=0');
                foreach ($terms2 as $term2) {
                    $chk = projectTheme_check_list_emails($term2->term_id, $rr) == 1 ? "checked='checked'" : "";
                    echo '&nbsp;&nbsp; &nbsp; <input type="checkbox" name="email_locs[]" ' . $chk . ' value="' . $term2->term_id . '" /> ' . $term2->name . "<br/>";
                    $terms3 = get_terms('project_location', 'parent=' . $term2->term_id . '&orderby=name&hide_empty=0');
                    foreach ($terms3 as $term3) {
                        $chk = projectTheme_check_list_emails($term3->term_id, $rr) == 1 ? "checked='checked'" : "";
                        echo '&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="checkbox" ' . $chk . ' name="email_locs[]" 
										value="' . $term3->term_id . '" /> ' . $term3->name . "<br/>";
                    }
                }
            }
            ?>
                        
                        </div>
                        <br/>
                        *<?php 
            _e('you will get an email notification when a project is posted in the selected locations', 'ProjectTheme');
            ?>
</p>
                    </li>
        
        
        <?php 
        }
    }
    if ($k == 0) {
        echo '<style>#other_infs_mm, #bk_save_not { display:none; } </style>';
    }
    ?>
        
        			
                    <li id="bk_save_not">
        <h2>&nbsp;</h2> <input type="hidden" value="<?php 
    echo $uid;
    ?>
" name="user_id" />
        <p><input type="submit" class="my-buttons" name="save-info" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
                    
        </ul>
                
                
              
                </div>
                </div>
                
                
             
            
            
            
            
		</form>

                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Beispiel #19
0
function ProjectTheme_my_account_affiliates_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        	
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    _e("Affiliates Panel", "ProjectTheme");
    ?>
</div>
                <div class="box_content"> 
            	
                    <div class="aff_id_thing">
                    <?php 
    $aff_url = get_bloginfo('siteurl') . "/?ref_id_usr="******"aff_id_thing2">
                    	<?php 
    _e('Share this link with all your friends, when they join to the website through your link you get a percent (%) of all their money spent on our website. 
						Additionally you can share your affiliate link through social networks like facebook and twitter.', 'ProjectTheme');
    ?>
                    </div>
                
                
                </div>
                </div>
                </div>
                
                <div class="clear10"></div>
                
                
                <div class="my_box3"> 
            	<div class="padd10"> 
            
            	<div class="box_title"><?php 
    _e("Your Affiliate Users", "ProjectTheme");
    ?>
</div>
                <div class="box_content">  
            	
                <?php 
    global $wpdb;
    $s = "select * from " . $wpdb->prefix . "project_affiliate_users where owner_id='{$uid}' order by id desc";
    $r = $wpdb->get_results($s);
    if (count($r) > 0) {
        ?>
                        
                        <table width="100%">
                        <tr>
                        <td><strong><?php 
        _e('Username', 'ProjectTheme');
        ?>
</strong></td>
                        <td><strong><?php 
        _e('Joined On', 'ProjectTheme');
        ?>
</strong></td>
                        </tr>
                        
                        
                        
                        <?php 
        foreach ($r as $row) {
            $usr = get_userdata($row->affiliate_id);
            echo '<tr>';
            echo '<td><a href="' . get_bloginfo('siteurl') . '/?p_action=user_profile&post_author=' . $usr->ID . '">' . $usr->user_login . '</a></td>';
            echo '<td>' . date_i18n('d-m-Y H:i:s', $row->datemade) . '</td>';
            echo '</tr>';
        }
        ?>
 </table> <?php 
    } else {
        _e('Sorry you do not have any affiliate users right now.', 'ProjectTheme');
    }
    ?>
                
                 
                
                </div> 
                </div>
                </div>
                
                
                <div class="clear10"></div>
                
                
                <div class="my_box3"> 
            	<div class="padd10"> 
            
            	<div class="box_title"><?php 
    _e("Your Affiliate Earnings", "ProjectTheme");
    ?>
</div>
                <div class="box_content">  
            	
                <?php 
    global $wpdb;
    $s = "select * from " . $wpdb->prefix . "project_affiliate_payouts where uid='{$uid}' order by id desc";
    $r = $wpdb->get_results($s);
    if (count($r) > 0) {
        ?>
                        
                        <table width="100%">
                        <tr>
                        <td><strong><?php 
        _e('Project', 'ProjectTheme');
        ?>
</strong></td>
                        <td><strong><?php 
        _e('Amount', 'ProjectTheme');
        ?>
</strong></td>
                        <td><strong><?php 
        _e('DateMade', 'ProjectTheme');
        ?>
</strong></td>
                        <td><strong><?php 
        _e('Paid?', 'ProjectTheme');
        ?>
</strong></td>
                        </tr>
                        
                        
                        
                        <?php 
        foreach ($r as $row) {
            $usr = get_userdata($row->affiliate_id);
            $prj = get_post($row->pid);
            echo '<tr>';
            echo '<td><a href="' . get_permalink($row->pid) . '">' . $prj->post_title . '</a></td>';
            echo '<td>' . projecttheme_get_show_price($row->moneymade) . '</td>';
            echo '<td>' . date_i18n('d-m-Y H:i:s', $row->datemade) . '</td>';
            echo '<td>' . ($row->paid == 0 ? __('No', 'ProjectTheme') : __('Yes', 'ProjectTheme')) . '</td>';
            echo '</tr>';
        }
        ?>
 </table> <?php 
    } else {
        _e('Sorry you do not have any earnings now.', 'ProjectTheme');
    }
    ?>
                
                 
                
                </div> 
                </div>
                </div>
                
                
                </div>   
<?php 
    ProjectTheme_get_users_links();
}
function ProjectTheme_my_account_outstanding_projects_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
<div id="content" class="account-main-area">
        
       
                
                <?php 
    global $current_user, $wpdb;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 10;
    //                $querystr = "
    //					SELECT distinct wposts.ID
    //					FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta2, $wpdb->postmeta wpostmeta3
    //                    LEFT JOIN {$wpdb->prefix}project_bids AS b ON wposts.ID = b.pid
    //					WHERE
    //                    b.uid = '$uid' AND b.outstanding = '1'
    //                    AND wposts.ID = wpostmeta2.post_id AND
    //					wpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='$uid' AND
    //					wposts.ID = wpostmeta3.post_id AND
    //					wpostmeta3.meta_key='outstanding' AND wpostmeta3.meta_value='1'
    //					AND wposts.post_type = 'project' AND wposts.post_status = 'publish' ";
    $querystr = "\n\t\t\t\t\tSELECT p.ID\n                    FROM {$wpdb->posts} AS p\n                    LEFT JOIN {$wpdb->prefix}project_bids AS b ON p.ID = b.pid\n                    LEFT JOIN {$wpdb->prefix}postmeta AS wpostmeta2 ON p.ID = wpostmeta2.post_id\n                    LEFT JOIN {$wpdb->prefix}postmeta AS wpostmeta3 ON p.ID = wpostmeta3.post_id\n                    WHERE \n                    b.uid = '916' AND b.outstanding = '1'\n                    AND wpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='916'\n                    AND wpostmeta3.meta_key='outstanding' AND wpostmeta3.meta_value='1' \n                    AND p.post_type = 'project' AND p.post_status = 'publish' ";
    $pageposts = $wpdb->get_col($querystr);
    if (empty($pageposts)) {
        echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
        _e("There are no outstanding projects yet.", 'ProjectTheme');
        echo '</div>  </div> ';
    } else {
        //				$outstanding = array(
        //						'key' => 'outstanding',
        //						'value' => "1",
        //						'compare' => '='
        //					);
        //
        //				$winner = array(
        //						'key' => 'winner',
        //						'value' => $uid,
        //						'compare' => '='
        //					);
        //				$args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page,
        //				'paged' => $query_vars['paged'], 'meta_query' => array($outstanding, $winner));
        $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => $query_vars['paged'], 'post__in' => $pageposts);
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_outstanding_project();
            }
            if (function_exists('wp_pagenavi')) {
                wp_pagenavi();
            }
        } else {
            echo '<div class="my_box3 border_bottom_0"> <div class="box_content">   ';
            _e("There are no outstanding projects yet.", 'ProjectTheme');
            echo '</div>  </div> ';
        }
    }
    wp_reset_query();
    ?>
                
    
        
        
  		</div>      
  		
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #21
0
function ProjectTheme_my_account_area_main_function()
{
    global $current_user, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        
        <?php 
    if (isset($_GET['prj_not_approved'])) {
        $psts = get_post($_GET['prj_not_approved']);
        ?>
        
        <div class="saved_thing">
        <?php 
        echo sprintf(__('Your payment was received for the item: <b>%s</b> but your project needs to be approved. 
		You will be notified when your project will be approved and live on our website', 'ProjectTheme'), $psts->post_title);
        ?>
        </div>
        
        	<?php 
    }
    if (ProjectTheme_is_user_business($uid)) {
        ?>
                       
            	<div class="box_title"><?php 
        _e("My Latest Posted Projects", "ProjectTheme");
        ?>
</div>
                 
            	
                 <?php 
        global $wp_query;
        $query_vars = $wp_query->query_vars;
        $post_per_page = 5;
        $closed = array('key' => 'closed', 'value' => "0", 'compare' => '=');
        $paid = array('key' => 'paid', 'value' => "1", 'compare' => '=');
        $args = array('post_type' => 'project', 'author' => $uid, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => 1, 'meta_query' => array($paid, $closed), 'post_status' => array('draft', 'publish'));
        query_posts($args);
        //	query_posts( "meta_key=closed&meta_value=0&post_status=publish,draft&post_type=project&order=DESC&orderby=date&author=".$uid.
        //	"&posts_per_page=".$post_per_page."&paged=".$query_vars['paged'] );
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_acc();
            }
            //if(function_exists('wp_pagenavi')):
            //wp_pagenavi(); endif;
        } else {
            echo '<div class="my_box3"> <div class="box_content"> ';
            _e("There are no projects yet.", 'ProjectTheme');
            echo '</div></div>';
        }
        wp_reset_query();
        ?>

          
           
           
           
          
            
            	<div class="box_title"><?php 
        _e("My Unpublished &amp; Unpaid Projects", 'ProjectTheme');
        ?>
</div>
                
			
			
				<?php 
        query_posts("post_status=draft&meta_key=paid&meta_value=0&post_type=project&order=DESC&orderby=id&author=" . $uid . "&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_acc(array('unpaid'));
            }
        } else {
            echo '<div class="my_box3"><div class="box_content">';
            _e("There are no projects yet.", 'ProjectTheme');
            echo '</div></div>';
        }
        wp_reset_query();
        ?>
			
 
			<div class="clear10"></div>
			
			
			
        
            
            	<div class="box_title"><?php 
        _e("My Latest Closed Projects", 'ProjectTheme');
        ?>
</div>
                    
			
			
				<?php 
        query_posts("meta_key=closed&meta_value=1&post_type=project&order=DESC&orderby=id&author=" . $uid . "&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_acc();
            }
        } else {
            echo '<div class="my_box3"><div class="box_content">';
            _e("There are no projects yet.", 'ProjectTheme');
            echo '</div></div>';
        }
        wp_reset_query();
        ?>
 
		
        <?php 
    }
    ?>
        
        <?php 
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
	
           
           
 
        
            
            	<div class="box_title"><?php 
        _e("Outstanding Projects", 'ProjectTheme');
        ?>
</div>
                 
			
			
				<?php 
        global $wp_query;
        $query_vars = $wp_query->query_vars;
        $post_per_page = 3;
        $outstanding = array('key' => 'outstanding', 'value' => "1", 'compare' => '=');
        $winner = array('key' => 'winner', 'value' => $uid, 'compare' => '=');
        $args = array('post_type' => 'project', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => $post_per_page, 'paged' => 1, 'meta_query' => array($outstanding, $winner));
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_outstanding_project();
            }
        } else {
            echo '<div class="my_box3"><div class="box_content">';
            _e("There are no projects yet.", 'ProjectTheme');
            echo '</div></div>';
        }
        wp_reset_query();
        ?>

	 
 
        
            
            	<div class="box_title"><?php 
        _e("My Latest Posted Proposals", 'ProjectTheme');
        ?>
</div>
                 
			
			
				<?php 
        query_posts("meta_key=bid&meta_value=" . $uid . "&post_type=project&order=DESC&orderby=id&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post_my_proposal();
            }
        } else {
            echo '<div class="my_box3"><div class="box_content">';
            _e("There are no projects yet.", 'ProjectTheme');
            echo '</div></div>';
        }
        wp_reset_query();
        ?>

			 
            
     
        
            
            	<div class="box_title"><?php 
        _e("My Latest Won Projects", 'ProjectTheme');
        ?>
</div>
            
			
			
				<?php 
        query_posts("meta_key=winner&meta_value=" . $uid . "&post_type=project&order=DESC&orderby=id&posts_per_page=3");
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                projectTheme_get_post();
            }
        } else {
            echo '<div class="my_box3"><div class="box_content">';
            _e("There are no projects yet.", 'ProjectTheme');
            echo '</div></div>';
        }
        wp_reset_query();
        ?>
 
            
        
        <?php 
    }
    ?>
   
                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
function ProjectTheme_my_account_pay4project_area_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $pid = $wp_query->query_vars['pid'];
    $post = get_post($pid);
    ?>
    	<div id="content">
        	
            <div class="my_box3 ">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    echo sprintf(__("Pay for project - %s", "ProjectTheme"), $post->post_title);
    ?>
</div>
                <div class="box_content"> 
            	
                

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

                
                </div>
                </div>
                </div>
                </div>   
<?php 
    ProjectTheme_get_users_links();
}
Beispiel #23
0
echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=credits_listing_mem" class="edit_project_pay_cls">' . __('Pay by Credits', 'ProjectTheme') . '</a>';
//-------------------
$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_membership_mem" class="edit_project_pay_cls">' . __('Pay by PayPal', 'ProjectTheme') . '</a>';
}
if ($ProjectTheme_moneybookers_enable == "yes") {
    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=mb_membership_mem" 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_membership_mem" class="edit_project_pay_cls">' . __('Pay by Payza', 'ProjectTheme') . '</a>';
}
do_action('ProjectTheme_add_payment_options_to_membership', $pid);
?>
                         
                
                </div>
                </div>
                </div>
                </div>
                
	<?php 
ProjectTheme_get_users_links();
?>

</div></div></div>

<?php 
get_footer();
function ProjectTheme_my_account_personal_info_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content">
        	
           <?php 
    if (isset($_POST['save-info'])) {
        //if(file_exists('cimy_update_ExtraFields'))
        cimy_update_ExtraFields_new_me();
        if (!empty($_FILES['avatar']["tmp_name"])) {
            $avatar = $_FILES['avatar'];
            $tmp_name = $avatar["tmp_name"];
            $name = $avatar["name"];
            $upldir = wp_upload_dir();
            $path = $upldir['path'];
            $url = $upldir['url'];
            $name = str_replace(" ", "", $name);
            if (getimagesize($tmp_name) > 0) {
                move_uploaded_file($tmp_name, $path . "/" . $name);
                update_user_meta($uid, 'avatar', $url . "/" . $name);
            }
        }
        //---------------------
        $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}' ");
        $email_cats = $_POST['email_cats'];
        if (count($email_cats) > 0) {
            foreach ($email_cats as $em) {
                $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts (uid,catid) values('{$uid}','{$em}') ");
            }
        }
        //-------------------
        //email_locs
        //****************************************************************************************************
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}' ");
            $email_cats = $_POST['email_locs'];
            if (count($email_cats) > 0) {
                foreach ($email_cats as $em) {
                    $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts_locs (uid,catid) values('{$uid}','{$em}') ");
                }
            }
        }
        //****************************************************************************************************
        //-------------------
        $user_description = trim($_POST['user_description']);
        update_user_meta($uid, 'user_description', $user_description);
        $per_hour = trim($_POST['per_hour']);
        update_user_meta($uid, 'per_hour', $per_hour);
        $user_location = trim($_POST['project_location_cat']);
        update_user_meta($uid, 'user_location', $user_location);
        $user_city = trim($_POST['user_city']);
        update_user_meta($uid, 'user_city', $user_city);
        $personal_info = trim($_POST['paypal_email']);
        update_user_meta($uid, 'paypal_email', $personal_info);
        $personal_info = trim($_POST['payza_email']);
        update_user_meta($uid, 'payza_email', $personal_info);
        $personal_info = trim($_POST['moneybookers_email']);
        update_user_meta($uid, 'moneybookers_email', $personal_info);
        $user_url = trim($_POST['user_url']);
        update_user_meta($uid, 'user_url', $user_url);
        do_action('ProjectTheme_pers_info_save_action');
        if (isset($_POST['password']) && !empty($_POST['password'])) {
            $p1 = trim($_POST['password']);
            $p2 = trim($_POST['reppassword']);
            if (!empty($p1) && !empty($p2)) {
                if ($p1 == $p2) {
                    global $wpdb;
                    $newp = md5($p1);
                    $sq = "update " . $wpdb->prefix . "users set user_pass='******' where ID='{$uid}'";
                    $wpdb->query($sq);
                } else {
                    echo __("Passwords do not match!", "ProjectTheme");
                }
            }
        }
        //---------------------------------------
        $arr = $_POST['custom_field_id'];
        for ($i = 0; $i < count($arr); $i++) {
            $ids = $arr[$i];
            $value = $_POST['custom_field_value_' . $ids];
            if (is_array($value)) {
                delete_user_meta($uid, "custom_field_ID_" . $ids);
                for ($j = 0; $j < count($value); $j++) {
                    add_user_meta($uid, "custom_field_ID_" . $ids, $value[$j]);
                }
            } else {
                update_user_meta($uid, "custom_field_ID_" . $ids, $value);
            }
        }
        //--------------------------------------------
        echo '<div class="saved_thing">' . __('Info saved!', 'ProjectTheme') . '</div>';
    }
    $user = get_userdata($uid);
    $user_location = get_user_meta($uid, 'user_location', true);
    ?>
         
            
            
             <form method="post"  enctype="multipart/form-data">
             
            <div class="my_box3">
            	
            
            	<div class="box_title"><?php 
    _e("Personal Information", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">    
	
         <ul class="post-new3">
        <li>
        	<h2><?php 
    echo __('Username', 'ProjectTheme');
    ?>
:</h2>
        	<p><input type="text" size="35" value="<?php 
    echo $user->user_login;
    ?>
" disabled="disabled" class="do_input" /></p>
        </li>

		<?php 
    $opt = get_option('ProjectTheme_enable_project_location');
    if ($opt != 'no') {
        ?>
        
		 <li>
        	<h2><?php 
        echo __('Location', 'ProjectTheme');
        ?>
:</h2>
        	<p>
            <?php 
        echo ProjectTheme_get_categories("project_location", $user_location, __("Select Location", "ProjectTheme"), "do_input");
        ?>
            </p>
        </li>
		
        
        <li>
        	<h2><?php 
        echo __('City', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="user_city" value="<?php 
        echo get_user_meta($uid, 'user_city', true);
        ?>
" class="do_input" /></p>
        </li>
        
		<?php 
    }
    ?>
     
            <script>
			
			jQuery(document).ready(function(){
			tinyMCE.init({
					mode : "specific_textareas",
					theme : "advanced", 
					/*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>    
        <li>
        	<h2><?php 
    echo __('Description', 'ProjectTheme');
    ?>
:</h2>
        	<p><textarea cols="40" rows="5"  name="user_description" class="tinymce-enabled do_input"><?php 
    echo get_usermeta($uid, 'user_description', true);
    ?>
</textarea></p>
        </li>
        
        <?php 
    $opt = get_option('ProjectTheme_paypal_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('PayPal Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="paypal_email" value="<?php 
        echo get_user_meta($uid, 'paypal_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_moneybookers_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('Moneybookers Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="moneybookers_email" value="<?php 
        echo get_user_meta($uid, 'moneybookers_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_alertpay_enable');
    if ($opt == "yes") {
        ?>
        
         <li>
        	<h2><?php 
        echo __('Payza Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="payza_email" value="<?php 
        echo get_user_meta($uid, 'payza_email', true);
        ?>
" class="do_input" /></p>
        </li>
       <?php 
    }
    ?>
 
        
         <li>
        	<h2><?php 
    echo __('New Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="password" size="35" /></p>
        </li>
        
        
        <li>
        	<h2><?php 
    echo __('Repeat Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="reppassword" size="35"  /></p>
        </li>
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_1');
    ?>
        
   		  <li>
        	<h2><?php 
    echo __('Profile Avatar', 'ProjectTheme');
    ?>
:</h2>
        	<p> <input type="file" name="avatar" /> <br/>
           <?php 
    _e('max file size: 1mb. Formats: jpeg, jpg, png, gif', 'ProjectTheme');
    ?>
            <br/>
            <img width="50" height="50" border="0" src="<?php 
    echo ProjectTheme_get_avatar($uid, 50, 50);
    ?>
" /> 
            </p>
        </li>
   
   
   <li>
   <?php 
    if (function_exists('cimy_extract_ExtraFields')) {
        cimy_extract_ExtraFields();
    }
    ?>
   </li> 
        
        
        <li>
        <h2>&nbsp;</h2>
        <p><input type="submit" name="save-info" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
        
       </ul> 
        
               
        
           </div>
           </div>     
            
            <div class="clear10"></div>
            
            <div class="my_box3" >
           
            
            	<div class="box_title" id="other_infs_mm"><?php 
    _e("Other Information", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">  
                
        <ul class="post-new3">
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_2');
    ?>
        
        <?php 
    $user_tp = get_user_meta($uid, 'user_tp', true);
    if (empty($user_tp)) {
        $user_tp = 'all';
    }
    if ($user_tp == "all") {
        $catid = array('all', 'service_buyer', 'service_provider');
    } else {
        $catid = array($user_tp);
    }
    if (current_user_can('manage_options')) {
        $catid = array('all', 'service_buyer', 'service_provider');
    }
    $k = 0;
    $arr = ProjectTheme_get_users_category_fields($catid, $uid);
    $exf = '';
    for ($i = 0; $i < count($arr); $i++) {
        $exf .= '<li>';
        $exf .= '<h2>' . $arr[$i]['field_name'] . $arr[$i]['id'] . ':</h2>';
        $exf .= '<p>' . $arr[$i]['value'] . '</p>';
        $exf .= '</li>';
        $k++;
    }
    echo $exf;
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Hourly Rate', 'ProjectTheme');
        ?>
:</h2>
        	<p><?php 
        echo projectTheme_currency();
        ?>
<input type="text" size="7" name="per_hour" value="<?php 
        echo get_user_meta($uid, 'per_hour', true);
        ?>
" class="do_input" /> 
             *<?php 
        _e('your estimated hourly rate', 'ProjectTheme');
        ?>
</p>
        </li>
        
        <?php 
    }
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Portfolio Pictures', 'ProjectTheme');
        ?>
:</h2>
        	<p>
			
     <?php 
        ?>
       
    <script type="text/javascript">
	
	function delete_this(id)
	{
		 $.ajax({
						method: 'get',
						url : '<?php 
        echo get_bloginfo('siteurl');
        ?>
/index.php/?_ad_delete_pid='+id,
						dataType : 'text',
						success: function (text) {   $('#image_ss'+id).remove();  }
					 });
		  //alert("a");
	
	}

	
	
	$(function() {
		
		$("#fileUpload4").uploadify({
			height        : 30,
			auto:			true,
			swf           : '<?php 
        echo get_bloginfo('template_url');
        ?>
/lib/uploadify/uploadify.swf',
			uploader      : '<?php 
        echo get_bloginfo('template_url');
        ?>
/lib/uploadify/uploady8.php',
			width         : 180,
			buttonText	: 'Add Portfolio Images',
			fileTypeExts  : '*.jpg;*.jpeg;*.gif;*.png',
			formData    : {'ID':<?php 
        echo 0;
        ?>
,'author':<?php 
        echo $uid;
        ?>
},
			onUploadSuccess : function(file, data, response) {
			
			//alert(data);
			var bar = data.split("|");
			
$('#thumbnails').append('<div class="div_div" id="image_ss'+bar[1]+'" ><img width="70" class="image_class" height="70" src="' + bar[0] + '" /><a href="javascript: void(0)" onclick="delete_this('+ bar[1] +')"><img border="0" src="<?php 
        echo get_bloginfo('template_url');
        ?>
/images/delete_icon.png" border="0" /></a></div>');
}
	
			
			
    	});
		
		
	});
	
	
	</script>
	
    <style type="text/css">
	.div_div
	{
		margin-left:5px; float:left; 
		width:110px;margin-top:10px;
	}
	
	</style>
    
    <div id="fileUpload4" style="width:100%">You have a problem with your javascript</div>
    <div id="thumbnails" style="overflow:hidden;margin-top:20px">
    
    <?php 
        $args = array('order' => 'ASC', 'orderby' => 'post_date', 'post_type' => 'attachment', 'author' => $current_user->ID, 'meta_key' => 'is_portfolio', 'meta_value' => '1', 'post_mime_type' => 'image', 'numberposts' => -1);
        $i = 0;
        $attachments = get_posts($args);
        if ($attachments) {
            foreach ($attachments as $attachment) {
                $url = wp_get_attachment_url($attachment->ID);
                echo '<div class="div_div"  id="image_ss' . $attachment->ID . '"><img width="70" class="image_class" height="70" src="' . ProjectTheme_generate_thumb($url, 70, 70) . '" />
			<a href="javascript: void(0)" onclick="delete_this(\'' . $attachment->ID . '\')"><img border="0" src="' . get_bloginfo('template_url') . '/images/delete_icon.png" /></a>
			</div>';
            }
        }
        ?>
    
    </div>
            
            
            </p>
        </li>
        
        <?php 
    }
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
                    
                    <li>
                        <h2><?php 
        echo __('Emails Alerts', 'ProjectTheme');
        ?>
:</h2>
                        <p><div style="border:1px solid #ccc;background:#f2f2f2; overflow:auto; width:350px; border-radius:5px; height:160px;">
                        
                        <?php 
        global $wpdb;
        $ss = "select * from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}'";
        $rr = $wpdb->get_results($ss);
        $terms = get_terms('project_cat', 'parent=0&orderby=name&hide_empty=0');
        foreach ($terms as $term) {
            $chk = projectTheme_check_list_emails($term->term_id, $rr) == true ? "checked='checked'" : "";
            echo '<input type="checkbox" name="email_cats[]" ' . $chk . ' value="' . $term->term_id . '" /> ' . $term->name . "<br/>";
            $terms2 = get_terms('project_cat', 'parent=' . $term->term_id . '&orderby=name&hide_empty=0');
            foreach ($terms2 as $term2) {
                $chk = projectTheme_check_list_emails($term2->term_id, $rr) == 1 ? "checked='checked'" : "";
                echo '&nbsp;&nbsp; &nbsp; <input type="checkbox" name="email_cats[]" ' . $chk . ' value="' . $term2->term_id . '" /> ' . $term2->name . "<br/>";
                $terms3 = get_terms('project_cat', 'parent=' . $term2->term_id . '&orderby=name&hide_empty=0');
                foreach ($terms3 as $term3) {
                    $chk = projectTheme_check_list_emails($term3->term_id, $rr) == 1 ? "checked='checked'" : "";
                    echo '&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="checkbox" ' . $chk . ' name="email_cats[]" 
										value="' . $term3->term_id . '" /> ' . $term3->name . "<br/>";
                }
            }
        }
        ?>
                        
                        </div>
                        <br/>
                        *<?php 
        _e('you will get an email notification when a project is posted in the selected categories', 'ProjectTheme');
        ?>
</p>
                    </li>
        
        <?php 
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            ?>
        	   <li>
                        <h2>&nbsp;</h2>
                        <p><div style="border:1px solid #ccc;background:#f2f2f2; overflow:auto; width:350px; border-radius:5px; height:160px;">
                        
                        <?php 
            global $wpdb;
            $ss = "select * from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}'";
            $rr = $wpdb->get_results($ss);
            $terms = get_terms('project_location', 'parent=0&orderby=name&hide_empty=0');
            foreach ($terms as $term) {
                $chk = projectTheme_check_list_emails($term->term_id, $rr) == true ? "checked='checked'" : "";
                echo '<input type="checkbox" name="email_locs[]" ' . $chk . ' value="' . $term->term_id . '" /> ' . $term->name . "<br/>";
                $terms2 = get_terms('project_location', 'parent=' . $term->term_id . '&orderby=name&hide_empty=0');
                foreach ($terms2 as $term2) {
                    $chk = projectTheme_check_list_emails($term2->term_id, $rr) == 1 ? "checked='checked'" : "";
                    echo '&nbsp;&nbsp; &nbsp; <input type="checkbox" name="email_locs[]" ' . $chk . ' value="' . $term2->term_id . '" /> ' . $term2->name . "<br/>";
                    $terms3 = get_terms('project_location', 'parent=' . $term2->term_id . '&orderby=name&hide_empty=0');
                    foreach ($terms3 as $term3) {
                        $chk = projectTheme_check_list_emails($term3->term_id, $rr) == 1 ? "checked='checked'" : "";
                        echo '&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <input type="checkbox" ' . $chk . ' name="email_locs[]" 
										value="' . $term3->term_id . '" /> ' . $term3->name . "<br/>";
                    }
                }
            }
            ?>
                        
                        </div>
                        <br/>
                        *<?php 
            _e('you will get an email notification when a project is posted in the selected locations', 'ProjectTheme');
            ?>
</p>
                    </li>
        
        
        <?php 
        }
    }
    if ($k == 0) {
        echo '<style>#other_infs_mm, #bk_save_not { display:none; } </style>';
    }
    ?>
        
        			
                    <li id="bk_save_not">
        <h2>&nbsp;</h2> <input type="hidden" value="<?php 
    echo $uid;
    ?>
" name="user_id" />
        <p><input type="submit" name="save-info" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
                    
        </ul>
                
                
              
                </div>
                </div>
                
                
             
            
            
            
            
		</form>

                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}