예제 #1
0
function ProjectTheme_new_user_notification_admin($user_id)
{
    $user = new WP_User($user_id);
    $subject = get_option('ProjectTheme_new_user_email_admin_subject');
    $message = get_option('ProjectTheme_new_user_email_admin_message');
    $user_login = stripslashes($user->user_login);
    $user_email = stripslashes($user->user_email);
    $site_login_url = ProjectTheme_login_url();
    $site_name = get_bloginfo('name');
    $account_url = get_permalink(get_option('ProjectTheme_my_account_page_id'));
    $find = array('##username##', '##user_email##', '##site_login_url##', '##your_site_name##', '##your_site_url##', '##my_account_url##', '##user_password##');
    $replace = array($user_login, $user_email, $site_login_url, $site_name, get_bloginfo('siteurl'), $account_url, $plaintext_pass);
    $message = ProjectTheme_replace_stuff_for_me($find, $replace, $message);
    $subject = ProjectTheme_replace_stuff_for_me($find, $replace, $subject);
    //---------------------------------------------
    $email = get_bloginfo('admin_email');
    ProjectTheme_send_email($email, $subject, $message);
}
예제 #2
0
          } else {
              $rep_ok = 0;
          }
      } else {
          $_SESSION['contact_soon'] = current_time('timestamp', 0) + 60;
          $rep_ok = 1;
      }
      if ($rep_ok == 1) {
          $subject = $_POST['subject'];
          $email = $_POST['email'];
          $message = nl2br($_POST['message']);
          //---- send email to admin
          $p = get_post(get_the_ID());
          $a = $p->post_author;
          $a = get_userdata($a);
          ProjectTheme_send_email($a->user_email, $subject, $message . "<br/>From Email: " . $email);
          //------------------------
          ?>
  <div class="my_box3">
      <div class="padd10">
  		<div class="box_content">
          
          	<?php 
          _e('Thank you! Your message has been sent.', 'ProjectTheme');
          ?>
          
 			</div>
  	</div>
  </div>
  
  <div class="clear10"></div>
예제 #3
0
function ProjectTheme_send_email_posted_project_approved($pid)
{
    $enable = get_option('ProjectTheme_new_project_email_approved_enable');
    $subject = get_option('ProjectTheme_new_project_email_approved_subject');
    $message = get_option('ProjectTheme_new_project_email_approved_message');
    $opt = get_post_meta($pid, 'ProjectTheme_send_email_posted_project_approved', true);
    if ($enable != "no" and empty($opt)) {
        update_post_meta($pid, 'ProjectTheme_send_email_posted_project_approved', '1');
        $post = get_post($pid);
        $user = get_userdata($post->post_author);
        $site_login_url = ProjectTheme_login_url();
        $site_name = get_bloginfo('name');
        $account_url = get_permalink(get_option('ProjectTheme_my_account_page_id'));
        $post = get_post($pid);
        $project_name = $post->post_title;
        $project_link = get_permalink($pid);
        $find = array('##username##', '##username_email##', '##site_login_url##', '##your_site_name##', '##your_site_url##', '##my_account_url##', '##project_name##', '##project_link##');
        $replace = array($user->user_login, $user->user_email, $site_login_url, $site_name, get_bloginfo('siteurl'), $account_url, $project_name, $project_link);
        $tag = 'ProjectTheme_send_email_posted_project_approved';
        $find = apply_filters($tag . '_find', $find);
        $replace = apply_filters($tag . '_replace', $replace);
        $message = ProjectTheme_replace_stuff_for_me($find, $replace, $message);
        $subject = ProjectTheme_replace_stuff_for_me($find, $replace, $subject);
        //---------------------------------------------
        $email = $user->user_email;
        ProjectTheme_send_email($email, $subject, $message);
    }
}
예제 #4
0
    function ProjectTheme_do_login_scr()
    {
        /*do_action( 'login_enqueue_scripts' );
        		do_action( 'login_head' );
        	  	do_action('login_footer');
        	  */
        global $wpdb, $error, $wp_query, $current_theme_locale_name;
        if (!is_array($wp_query->query_vars)) {
            $wp_query->query_vars = array();
        }
        $action = $_REQUEST['action'];
        $error = '';
        nocache_headers();
        header('Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset'));
        if (defined('RELOCATE')) {
            // Move flag is set
            if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
                $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
            }
            $schema = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://';
            if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl')) {
                update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
            }
        }
        do_action('login_init');
        do_action('login_form_' . $action);
        switch ($_REQUEST["action"]) {
            //logout
            case "logout":
                wp_clearcookie();
                session_start();
                $sessions->destroy_all();
                /*session_start();
                	 if(isset($vstrsnln_blog_id))
                	 {
                		 unset( $vstrsnln_blog_id);
                		 session_destroy();
                	 } */
                if (get_option("jk_logout_redirect_to")) {
                    $redirect_to = get_option("jk_logout_redirect_to");
                } else {
                    $redirect_to = "wp-login.php";
                }
                do_action('wp_logout');
                nocache_headers();
                if (isset($_REQUEST['redirect_to'])) {
                    $redirect_to = $_REQUEST['redirect_to'];
                }
                wp_redirect(get_bloginfo('siteurl'));
                exit;
                break;
                //lost lost password
            //lost lost password
            case 'lostpassword':
            case 'retrievepassword':
                $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
                if ($http_post) {
                    $errors = my_retrieve_password();
                    if (!is_wp_error($errors)) {
                        $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
                        wp_safe_redirect($redirect_to);
                        exit;
                    }
                }
                if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
                    $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
                }
                $redirect_to = apply_filters('lostpassword_redirect', !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
                do_action('lost_password');
                $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
                get_header();
                ?>
                  
                <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                printf(__("Retrieve Password - %s", $current_theme_locale_name), get_bloginfo('name'));
                ?>
     </div>                  	            
                                        
                        </div>                    
                    </div>
         

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

<div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
        
        
        
        
				<div class="my_box3">
            	<div class="padd10">
            
            	 
                <div class="box_content">
                

                
                <div class="login-submit-form"> 
				<form name="lostpass" action="<?php 
                echo esc_url(site_url('wp-login.php?action=lostpassword', 'login_post'));
                ?>
" method="post" id="loginform">
					
               
					<p><?php 
                _e('Please enter your information here. We will send you a new password.', $current_theme_locale_name);
                ?>
</p>
					<?php 
                if ($errors) {
                    echo "<div class='errrs'>" . $errors->get_error_message() . "</div>";
                }
                ?>
					<input type="hidden" name="action" value="retrievepassword" />
					  
					  
					<p>
					<label><?php 
                _e('Username or Email:', $current_theme_locale_name);
                ?>
</label>
                    <input type="text" class="do_input" name="user_login" id="user_login" value="" size="30" tabindex="1" />
                    </p>
                 
                  
                  	<?php 
                do_action('lostpassword_form');
                ?>
                  
					<p><label>&nbsp;</label>
					<input type="submit" name="submit" id="submit" value="<?php 
                _e('Retrieve Password', $current_theme_locale_name);
                ?>
"  class="submit_bottom" tabindex="3" />
                    </p>
                   
				</form>
                    <script type="text/javascript">
                    	$(function() {
                    	    // gather all inputs of selected types
                    	    var inputs = $('#user_tp, #user_email, #user_login, #log, #login_password, #rememberme, #submits, .green_btn'), inputTo;

                    	    // bind on keydown
                    	    inputs.on('keydown', function(e) {
                    	        
                    	        // if we pressed the tab
                    	        if (e.keyCode == 9 || e.which == 9) {
                    	        	alert('tab');
                    	            // prevent default tab action
                    	            e.preventDefault();

                    	            if (e.shiftKey) {
                    	                // get previous input based on the current input
                    	                inputTo = inputs.get(inputs.index(this) - 1);
                    	            } else {
                    	                // get next input based on the current input
                    	                inputTo = inputs.get(inputs.index(this) + 1);
                    	            }
                    	            
                    	            // move focus to inputTo, otherwise focus first input
                    	            if (inputTo) {
                    	                inputTo.focus();
                    	            } else {
                    	                inputs[0].focus();
                    	            }
                    	        }
                    	    });
                    	});
                    </script>
                </div>
                    
                    
					<ul id="logins">
					<li><a href="<?php 
                bloginfo('home');
                ?>
/" title="<?php 
                _e('Are you lost?', $current_theme_locale_name);
                ?>
">&laquo; <?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a></li>
					<?php 
                if (get_settings('users_can_register')) {
                    ?>
					<li><a href="<?php 
                    bloginfo('wpurl');
                    ?>
/wp-login.php?action=register"><?php 
                    _e('Register', $current_theme_locale_name);
                    ?>
</a></li>
					<?php 
                }
                ?>
					<li><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php"><?php 
                _e('Login', $current_theme_locale_name);
                ?>
</a></li>
					</ul>
				
                
               
                </div>
                </div>
                </div>
                
                
                </div></div></div>
                
		<?php 
                get_footer();
                die;
                break;
            case 'retrievepassword2':
                get_header();
                $user_data = get_userdatabylogin($_POST['user_login']);
                // redefining user_login ensures we return the right case in the email
                $user_login = $user_data->user_login;
                $user_email = $user_data->user_email;
                if (!$user_email || $user_email != $_POST['email']) {
                    ?>
                    
                <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
                    _e("Retrieve Error", $current_theme_locale_name);
                    ?>
 - <?php 
                    echo get_bloginfo('name');
                    ?>
</div>
                <div class="box_content">
                    
                    <br/><br/>
                    <?php 
                    echo sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.', $current_theme_locale_name), 'wp-login.php?action=lostpassword');
                    ?>
					
					<br/><br/>
					&nbsp;
					
					</div></div></div>
					<?php 
                    get_footer();
                    die;
                }
                do_action('retreive_password', $user_login);
                // Misspelled and deprecated.
                do_action('retrieve_password', $user_login);
                // Generate something random for a password... md5'ing current time with a rand salt
                $key = substr(md5(uniqid(current_time('timestamp', 0))), 0, 50);
                // now insert the new pass md5'd into the db
                $wpdb->query("UPDATE {$wpdb->users} SET user_activation_key = '{$key}' WHERE user_login = '******'");
                $message = __('Someone has asked to reset the password for the following site and username.', $current_theme_locale_name) . "\r\n\r\n";
                $message .= get_option('siteurl') . "\r\n\r\n";
                $message .= sprintf(__('Username: %s', $current_theme_locale_name), $user_login) . "\r\n\r\n";
                $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.', $current_theme_locale_name) . "\r\n\r\n";
                $message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key={$key}\r\n";
                $m = ProjectTheme_send_email($user_email, sprintf(__('[%s] Password Reset', $current_theme_locale_name), get_settings('blogname')), $message);
                echo get_option("jk_login_after_head_html");
                echo "          <div id=\"login\">\n";
                if ($m == false) {
                    echo "<h1>" . __("There Was a Problem", $current_theme_locale_name) . "</h1>";
                    echo '<p>' . __('The e-mail could not be sent.', $current_theme_locale_name) . "<br />\n";
                    echo __('Possible reason: your host may have disabled the mail() function...', $current_theme_locale_name) . "</p>";
                } else {
                    echo "<h1>Success!</h1>";
                    echo '<p>' . sprintf(__("The e-mail was sent successfully to %s's e-mail address.", $current_theme_locale_name), $user_login) . '<br />';
                    echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course', $current_theme_locale_name) . "'>" . __('Click here to login!', $current_theme_locale_name) . '</a></p>';
                }
                echo "          </div>\n";
                echo '</div></div></div>';
                get_footer();
                die;
                break;
                //reset password
            //reset password
            case 'rp':
                get_header();
                //_get_whole_menu();
                echo '<div class="my_box3">
            	<div class="padd10">';
                echo "          <div id=\"login\">\n";
                // Generate something random for a password... md5'ing current time with a rand salt
                $key = preg_replace('/a-z0-9/i', '', $_GET['key']);
                if (empty($key)) {
                    _e('<h1>Problem</h1>', $current_theme_locale_name);
                    _e('Sorry, that key does not appear to be valid.', $current_theme_locale_name);
                    echo "          </div>\n";
                    echo '</div></td></tr></table></div></div>';
                    get_footer();
                    die;
                }
                $user = $wpdb->get_row("SELECT * FROM {$wpdb->users} WHERE user_activation_key = '{$key}'");
                if (!$user) {
                    _e('<h1>Problem</h1>', $current_theme_locale_name);
                    _e('Sorry, that key does not appear to be valid.', $current_theme_locale_name);
                    echo "          </div>\n";
                    echo '</div></div>';
                    get_footer();
                    die;
                }
                do_action('password_reset');
                $new_pass = substr(md5(uniqid(current_time('timestamp', 0))), 0, 7);
                $wpdb->query("UPDATE {$wpdb->users} SET user_pass = MD5('{$new_pass}'), user_activation_key = '' WHERE user_login = '******'");
                wp_cache_delete($user->ID, 'users');
                wp_cache_delete($user->user_login, 'userlogins');
                $message = '<img id="logo" alt="BidQA" src="bidqa.com/wp-content/themes/ProjectTheme/images/logo/imgo.jpeg"><br>We have reset the password for the following account. Please find the new temporary password below (we recommend that you change it once you log in).<br>';
                $message .= sprintf(__('Username: %s', $current_theme_locale_name), $user->user_login) . "\r\n<br>";
                $message .= sprintf(__('Password: %s', $current_theme_locale_name), $new_pass) . "\r\n<br>";
                $message .= get_bloginfo('siteurl') . "/wp-login.php\r\n<br>";
                $m = wp_mail($user->user_email, sprintf(__('Your new password', $current_theme_locale_name)), $message);
                //ProjectTheme_send_email($user->user_email, sprintf(__('Your new password',$current_theme_locale_name) ), $message);
                if ($m == false) {
                    echo __('<h1>Problem</h1>', $current_theme_locale_name);
                    echo '<p>' . __('The e-mail could not be sent.', $current_theme_locale_name) . "<br />\n";
                    echo __('Possible reason: your host may have disabled the mail() function...', $current_theme_locale_name) . '</p>';
                } else {
                    echo __('<h1>Success!</h1>', $current_theme_locale_name);
                    echo '<p>' . sprintf(__('Your new password is in the mail.', $current_theme_locale_name), $user_login) . '<br />';
                    echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course', $current_theme_locale_name) . "'>" . __('Click here to login!', $current_theme_locale_name) . '</a></p>';
                    // send a copy of password change notification to the admin
                    $message = sprintf(__('Password Lost and Changed for user: %s', $current_theme_locale_name), $user->user_login) . "\r\n";
                    ProjectTheme_send_email(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change', $current_theme_locale_name), get_settings('blogname')), $message);
                }
                echo "          </div>\n";
                echo '</div></div></div>';
                get_footer();
                die;
                break;
                //login and default action
            //login and default action
            case 'login':
            default:
                //check credentials - 99% of this is identical to the normal wordpress login sequence as of 2.0.4
                //Any differences will be noted with end of line comments.
                $user_login = '';
                $user_pass = '';
                $using_cookie = false;
                /**
                 * this is what the code was
                 * if ( !isset( $_REQUEST['redirect_to'] ) )
                 * 	$redirect_to = 'wp-admin/';
                 * else
                 * 	$redirect_to = $_REQUEST['redirect_to'];
                 */
                if (!isset($_REQUEST['redirect_to'])) {
                    $redirect_to = get_permalink(get_option('ProjectTheme_my_account_page_id'));
                } else {
                    $redirect_to = $_REQUEST['redirect_to'];
                }
                if (isset($_SESSION['redirect_me_back'])) {
                    $redirect_to = $_SESSION['redirect_me_back'];
                }
                if ($_POST) {
                    $user_login = $_POST['log'];
                    $user_login = sanitize_user($user_login);
                    $user_pass = $_POST['pwd'];
                    $rememberme = $_POST['rememberme'];
                } else {
                    if (function_exists('wp_get_cookie_login')) {
                        $cookie_login = wp_get_cookie_login();
                        if (!empty($cookie_login)) {
                            $using_cookie = true;
                            $user_login = $cookie_login['login'];
                            $user_pass = $cookie_login['password'];
                        }
                    } elseif (!empty($_COOKIE)) {
                        if (!empty($_COOKIE[USER_COOKIE])) {
                            $user_login = $_COOKIE[USER_COOKIE];
                        }
                        if (!empty($_COOKIE[PASS_COOKIE])) {
                            $user_pass = $_COOKIE[PASS_COOKIE];
                            $using_cookie = true;
                        }
                    }
                }
                do_action('wp_authenticate', $user_login, $user_pass);
                if ($user_login && $user_pass) {
                    $user = new WP_User(0, $user_login);
                    // If the user can't edit posts, send them to their profile.
                    //if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
                    //	$redirect_to = get_settings('siteurl') . '/' . 'my-account';
                    if (wp_login($user_login, $user_pass, $using_cookie)) {
                        if (!$using_cookie) {
                            wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
                        }
                        do_action('wp_login', $user_login);
                        wp_redirect($redirect_to);
                        exit;
                    } else {
                        if ($using_cookie) {
                            $error = __('Your session has expired.', $current_theme_locale_name);
                        }
                    }
                } else {
                    if ($_POST && !$user_login) {
                        $error = __('<strong>Error</strong>: The Username field is empty.', $current_theme_locale_name);
                    } else {
                        if ($_POST && !$user_pass) {
                            $error = __('<strong>Error</strong>: The password field is empty.', $current_theme_locale_name);
                        }
                    }
                }
                get_header();
                ?>
        
          
                <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                printf(__("Login - %s", $current_theme_locale_name), get_bloginfo('name'));
                ?>
     </div>                  	            
                                        
                        </div>                    
                    </div>
         

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

<div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
        
					
            <div class="my_box3">
            <div class="padd10">
            
            	 
                <div class="box_content">
                
           		<?php 
                if (isset($_GET['checkemail']) && $_GET['checkemail'] == "confirm") {
                    ?>
					
                    <div class="check-email-div"><div class="padd10">
                    <?php 
                    _e('We have sent a confirmation message to your email address.<br/>
					Please follow the instructions in the email and get back to this page.', $current_theme_locale_name);
                    ?>
                    
                    </div></div>
                
				
				<?php 
                }
                ?>
						  
						  <?php 
                if (!empty($error)) {
                    ?>
						  <div class="error"><ul>
							<?php 
                    echo "<li>{$error}</li>";
                    ?>
							</ul>
						  </div>
						  <?php 
                }
                ?>
                 
                <div class="login-submit-form"> 
                          
				<form name="loginform" id="loginform" action="<?php 
                echo esc_url(site_url('wp-login.php', 'login_post'));
                ?>
" method="post">
				<p><label><?php 
                _e('Username:'******'Password:'******'Keep me logged in', $current_theme_locale_name);
                ?>
                </p>
							
							 
                <?php 
                do_action('login_form');
                ?>
                             
                             
				<p><label>&nbsp;</label>
				<input type="submit" class="submit_bottom" name="submits" id="submits" value="<?php 
                _e('Sign in', $current_theme_locale_name);
                ?>
" tabindex="4" />
				<input type="hidden" name="redirect_to" value="<?php 
                echo wp_specialchars($redirect_to);
                ?>
" />
				</p>
							
                </form>
                <script type="text/javascript">
                	$(function() {
                	    // gather all inputs of selected types
                	    var inputs = $('#user_tp, #user_email, #user_login, #log, #login_password, #rememberme, #submits, .green_btn'), inputTo;
console.log(inputs);
                	    // bind on keydown
                	    inputs.on('keydown', function(e) {
                	        
                	        // if we pressed the tab
                	        if (e.keyCode == 9 || e.which == 9) {
                	            // prevent default tab action
                	            e.preventDefault();


                	            if (e.shiftKey) {
                	                // get previous input based on the current input
                	                inputTo = inputs.get(inputs.index(this) - 1);
                	            } else {
                	                // get next input based on the current input
                	                inputTo = inputs.get(inputs.index(this) + 1);
                	            }
                	            
                	            // move focus to inputTo, otherwise focus first input
                	            if (inputTo) {
                	                inputTo.focus();
                	            } else {
                	                inputs[0].focus();
                	            }
                	        }
                	    });
                	});
                </script>
				
                <ul id="logins">
							<li><a class="green_btn" href="<?php 
                bloginfo('home');
                ?>
/" 
                            title="<?php 
                _e('Are you lost?', $current_theme_locale_name);
                ?>
">&laquo; <?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a></li>
						  <?php 
                if (get_settings('users_can_register')) {
                    ?>
							<li><a class="green_btn" href="<?php 
                    bloginfo('wpurl');
                    ?>
/wp-login.php?action=register"><?php 
                    _e('Register', $current_theme_locale_name);
                    ?>
</a></li>
						  <?php 
                }
                ?>
							<li><a class="green_btn" href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php?action=lostpassword" 
                            title="<?php 
                _e('Password Lost and Found', $current_theme_locale_name);
                ?>
"><?php 
                _e('Lost your password?', $current_theme_locale_name);
                ?>
</a></li>
              	</ul>
						
		
				</div>
		                
            
            </div>
            </div>
            </div>
            
            
             </div> </div> </div>
		
		
		<?php 
                get_footer();
                die;
                break;
        }
    }
예제 #5
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 
}
예제 #6
0
    function ProjectTheme_do_login_scr()
    {
        global $wpdb, $error, $wp_query, $current_theme_locale_name;
        if (!is_array($wp_query->query_vars)) {
            $wp_query->query_vars = array();
        }
        $action = $_REQUEST['action'];
        $error = '';
        nocache_headers();
        header('Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset'));
        if (defined('RELOCATE')) {
            // Move flag is set
            if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
                $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
            }
            $schema = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://';
            if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl')) {
                update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
            }
        }
        $secure = 'https' === parse_url(site_url(), PHP_URL_SCHEME) && 'https' === parse_url(home_url(), PHP_URL_SCHEME);
        setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure);
        if (SITECOOKIEPATH != COOKIEPATH) {
            setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure);
        }
        $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
        $interim_login = isset($_REQUEST['interim-login']);
        do_action('login_init');
        do_action('login_form_' . $action);
        switch ($_REQUEST["action"]) {
            //logout
            case "logout":
                wp_clearcookie();
                if (get_option("jk_logout_redirect_to")) {
                    $redirect_to = get_option("jk_logout_redirect_to");
                } else {
                    $redirect_to = "wp-login.php";
                }
                do_action('wp_logout');
                nocache_headers();
                if (isset($_REQUEST['redirect_to'])) {
                    $redirect_to = $_REQUEST['redirect_to'];
                }
                wp_redirect(get_bloginfo('siteurl'));
                exit;
                break;
                //lost lost password
            //lost lost password
            case 'lostpassword':
            case 'retrievepassword':
                $http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
                if ($http_post) {
                    $errors = my_retrieve_password();
                    if (!is_wp_error($errors)) {
                        $redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
                        wp_safe_redirect($redirect_to);
                        exit;
                    }
                }
                if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
                    $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
                }
                $redirect_to = apply_filters('lostpassword_redirect', !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
                do_action('lost_password');
                $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
                get_header();
                ?>
                  
                <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                printf(__("Retrieve Password - %s", $current_theme_locale_name), get_bloginfo('name'));
                ?>
     </div>                  	            
                                        
                        </div>                    
                    </div>
         

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

<div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
        
        
        
        
				<div class="my_box3">
            	<div class="padd10">
            
            	 
                <div class="box_content">
                

                
                <div class="login-submit-form"> 
				<form name="lostpass" action="<?php 
                echo esc_url(site_url('wp-login.php?action=lostpassword', 'login_post'));
                ?>
" method="post" id="loginform">
					
               
					<p><?php 
                _e('Please enter your information here. We will send you a new password.', $current_theme_locale_name);
                ?>
</p>
					<?php 
                if ($errors) {
                    echo "<div class='errrs'>" . $errors->get_error_message() . "</div>";
                }
                ?>
					<input type="hidden" name="action" value="retrievepassword" />
					  
					  
					<p>
					<label><?php 
                _e('Username or Email:', $current_theme_locale_name);
                ?>
</label>
                    <input type="text" class="do_input" name="user_login" id="user_login" value="" size="30" tabindex="1" />
                    </p>
                 
                  
                  	<?php 
                do_action('lostpassword_form');
                ?>
                  
					<p><label>&nbsp;</label>
					<input type="submit" name="submit" id="submit" value="<?php 
                _e('Retrieve Password', $current_theme_locale_name);
                ?>
"  class="submit_bottom" tabindex="3" />
                    </p>
                   
				</form>
                    
                </div>
                    
                    
					<ul id="logins">
					<li><a href="<?php 
                bloginfo('home');
                ?>
/" title="<?php 
                _e('Are you lost?', $current_theme_locale_name);
                ?>
">&laquo; <?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a></li>
					<?php 
                if (get_settings('users_can_register')) {
                    ?>
					<li><a href="<?php 
                    bloginfo('wpurl');
                    ?>
/wp-login.php?action=register"><?php 
                    _e('Register', $current_theme_locale_name);
                    ?>
</a></li>
					<?php 
                }
                ?>
					<li><a href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php"><?php 
                _e('Login', $current_theme_locale_name);
                ?>
</a></li>
					</ul>
				
                
               
                </div>
                </div>
                </div>
                
                
                </div></div></div>
                
		<?php 
                get_footer();
                die;
                break;
            case 'retrievepassword2':
                get_header();
                $user_data = get_userdatabylogin($_POST['user_login']);
                // redefining user_login ensures we return the right case in the email
                $user_login = $user_data->user_login;
                $user_email = $user_data->user_email;
                if (!$user_email || $user_email != $_POST['email']) {
                    ?>
                    
                <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
                    _e("Retrieve Error", $current_theme_locale_name);
                    ?>
 - <?php 
                    echo get_bloginfo('name');
                    ?>
</div>
                <div class="box_content">
                    
                    <br/><br/>
                    <?php 
                    echo sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.', $current_theme_locale_name), 'wp-login.php?action=lostpassword');
                    ?>
					
					<br/><br/>
					&nbsp;
					
					</div></div></div>
					<?php 
                    get_footer();
                    die;
                }
                do_action('retreive_password', $user_login);
                // Misspelled and deprecated.
                do_action('retrieve_password', $user_login);
                // Generate something random for a password... md5'ing current time with a rand salt
                $key = substr(md5(uniqid(current_time('timestamp', 0))), 0, 50);
                // now insert the new pass md5'd into the db
                $wpdb->query("UPDATE {$wpdb->users} SET user_activation_key = '{$key}' WHERE user_login = '******'");
                $message = __('Someone has asked to reset the password for the following site and username.', $current_theme_locale_name) . "\r\n\r\n";
                $message .= get_option('siteurl') . "\r\n\r\n";
                $message .= sprintf(__('Username: %s', $current_theme_locale_name), $user_login) . "\r\n\r\n";
                $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.', $current_theme_locale_name) . "\r\n\r\n";
                $message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key={$key}\r\n";
                $m = ProjectTheme_send_email($user_email, sprintf(__('[%s] Password Reset', $current_theme_locale_name), get_settings('blogname')), $message);
                echo get_option("jk_login_after_head_html");
                echo "          <div id=\"login\">\n";
                if ($m == false) {
                    echo "<h1>" . __("There Was a Problem", $current_theme_locale_name) . "</h1>";
                    echo '<p>' . __('The e-mail could not be sent.', $current_theme_locale_name) . "<br />\n";
                    echo __('Possible reason: your host may have disabled the mail() function...', $current_theme_locale_name) . "</p>";
                } else {
                    echo "<h1>Success!</h1>";
                    echo '<p>' . sprintf(__("The e-mail was sent successfully to %s's e-mail address.", $current_theme_locale_name), $user_login) . '<br />';
                    echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course', $current_theme_locale_name) . "'>" . __('Click here to login!', $current_theme_locale_name) . '</a></p>';
                }
                echo "          </div>\n";
                echo '</div></div></div>';
                get_footer();
                die;
                break;
                //reset password
            //reset password
            case 'rp':
                get_header();
                //_get_whole_menu();
                echo '<div class="my_box3">
            	<div class="padd10">';
                echo "          <div id=\"login\">\n";
                // Generate something random for a password... md5'ing current time with a rand salt
                $key = preg_replace('/a-z0-9/i', '', $_GET['key']);
                if (empty($key)) {
                    _e('<h1>Problem</h1>', $current_theme_locale_name);
                    _e('Sorry, that key does not appear to be valid.', $current_theme_locale_name);
                    echo "          </div>\n";
                    echo '</div></td></tr></table></div></div>';
                    get_footer();
                    die;
                }
                $user = $wpdb->get_row("SELECT * FROM {$wpdb->users} WHERE user_activation_key = '{$key}'");
                if (!$user) {
                    _e('<h1>Problem</h1>', $current_theme_locale_name);
                    _e('Sorry, that key does not appear to be valid.', $current_theme_locale_name);
                    echo "          </div>\n";
                    echo '</div></div>';
                    get_footer();
                    die;
                }
                do_action('password_reset');
                $new_pass = substr(md5(uniqid(current_time('timestamp', 0))), 0, 7);
                $wpdb->query("UPDATE {$wpdb->users} SET user_pass = MD5('{$new_pass}'), user_activation_key = '' WHERE user_login = '******'");
                wp_cache_delete($user->ID, 'users');
                wp_cache_delete($user->user_login, 'userlogins');
                $message = sprintf(__('Username: %s', $current_theme_locale_name), $user->user_login) . "\r\n";
                $message .= sprintf(__('Password: %s', $current_theme_locale_name), $new_pass) . "\r\n";
                $message .= get_bloginfo('siteurl') . "/wp-login.php\r\n";
                $m = wp_mail($user->user_email, sprintf(__('Your new password', $current_theme_locale_name)), $message);
                //ProjectTheme_send_email($user->user_email, sprintf(__('Your new password',$current_theme_locale_name) ), $message);
                if ($m == false) {
                    echo __('<h1>Problem</h1>', $current_theme_locale_name);
                    echo '<p>' . __('The e-mail could not be sent.', $current_theme_locale_name) . "<br />\n";
                    echo __('Possible reason: your host may have disabled the mail() function...', $current_theme_locale_name) . '</p>';
                } else {
                    echo __('<h1>Success!</h1>', $current_theme_locale_name);
                    echo '<p>' . sprintf(__('Your new password is in the mail.', $current_theme_locale_name), $user_login) . '<br />';
                    echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course', $current_theme_locale_name) . "'>" . __('Click here to login!', $current_theme_locale_name) . '</a></p>';
                    // send a copy of password change notification to the admin
                    $message = sprintf(__('Password Lost and Changed for user: %s', $current_theme_locale_name), $user->user_login) . "\r\n";
                    ProjectTheme_send_email(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change', $current_theme_locale_name), get_settings('blogname')), $message);
                }
                echo "          </div>\n";
                echo '</div></div></div>';
                get_footer();
                die;
                break;
                //login and default action
            //login and default action
            case 'login':
            default:
                //check credentials - 99% of this is identical to the normal wordpress login sequence as of 2.0.4
                //Any differences will be noted with end of line comments.
                $user_login = '';
                $user_pass = '';
                $using_cookie = false;
                $secure_cookie = '';
                if (!empty($_POST['log']) && !force_ssl_admin()) {
                    $user_name = sanitize_user($_POST['log']);
                    if ($user = get_user_by('login', $user_name)) {
                        if (get_user_option('use_ssl', $user->ID)) {
                            $secure_cookie = true;
                            force_ssl_admin(true);
                        }
                    }
                }
                //------------------------------
                if (empty($_GET['redirect_to'])) {
                    $redirect_to = get_permalink(get_option('ProjectTheme_my_account_page_id'));
                    if (empty($redirect_to)) {
                        $redirect_to = admin_url();
                    }
                } else {
                    $redirect_to = $_GET['redirect_to'];
                }
                if (isset($_SESSION['redirect_me_back'])) {
                    $redirect_to = $_SESSION['redirect_me_back'];
                }
                //------------------------------------------
                $reauth = empty($_REQUEST['reauth']) ? false : true;
                $user = wp_signon('', $secure_cookie);
                if (empty($_COOKIE[LOGGED_IN_COOKIE])) {
                    if (headers_sent()) {
                        $user = new WP_Error('test_cookie', sprintf(__('<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.'), __('https://codex.wordpress.org/Cookies'), __('https://wordpress.org/support/')));
                    } elseif (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
                        // If cookies are disabled we can't log in even with a valid user+pass
                        $user = new WP_Error('test_cookie', sprintf(__('<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.'), __('https://codex.wordpress.org/Cookies')));
                    }
                }
                //--------------------------------------------
                $requested_redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
                $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
                if (!is_wp_error($user) && !$reauth) {
                    wp_safe_redirect($redirect_to);
                }
                get_header();
                ?>
        
          
                <div class="page_heading_me">
                        <div class="page_heading_me_inner">
                            <div class="mm_inn"><?php 
                printf(__("Login - %s", $current_theme_locale_name), get_bloginfo('name'));
                ?>
     </div>                  	            
                                        
                        </div>                    
                    </div>
         

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

<div id="main_wrapper">
		<div id="main" class="wrapper"><div class="padd10">
        
					
            <div class="my_box3">
            <div class="padd10">
            
            	 
                <div class="box_content">
                
           		<?php 
                if (isset($_GET['checkemail']) && $_GET['checkemail'] == "confirm") {
                    ?>
					
                    <div class="check-email-div"><div class="padd10">
                    <?php 
                    _e('We have sent a confirmation message to your email address.<br/>
					Please follow the instructions in the email and get back to this page.', $current_theme_locale_name);
                    ?>
                    
                    </div></div>
                
				
				<?php 
                }
                $errors = $user;
                $errors = apply_filters('wp_login_errors', $errors, $redirect_to);
                if (empty($errors)) {
                    $errors = new WP_Error();
                }
                ?>
						  
						<?php 
                global $error;
                $wp_error = $errors;
                if (!empty($error)) {
                    $wp_error->add('error', $error);
                    unset($error);
                }
                if ($wp_error->get_error_code()) {
                    $errors = '';
                    $messages = '';
                    foreach ($wp_error->get_error_codes() as $code) {
                        $severity = $wp_error->get_error_data($code);
                        foreach ($wp_error->get_error_messages($code) as $error_message) {
                            if ('message' == $severity) {
                                $messages .= '	' . $error_message . "<br />\n";
                            } else {
                                $errors .= '	' . $error_message . "<br />\n";
                            }
                        }
                    }
                    if (!empty($errors)) {
                        /**
                         * Filter the error messages displayed above the login form.
                         *
                         * @since 2.1.0
                         *
                         * @param string $errors Login error message.
                         */
                        echo '<div class="error">' . apply_filters('login_errors', $errors) . "</div>\n";
                    }
                    if (!empty($messages)) {
                        /**
                         * Filter instructional messages displayed above the login form.
                         *
                         * @since 2.5.0
                         *
                         * @param string $messages Login messages.
                         */
                        echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
                    }
                }
                ?>
                 
                <div class="login-submit-form"> 
                          
				<form name="loginform" id="loginform" action="<?php 
                echo esc_url(site_url('wp-login.php', 'login_post'));
                ?>
" method="post">
				<p><label><?php 
                _e('Username:'******'Password:'******'Keep me logged in', $current_theme_locale_name);
                ?>
                </p>
							
							 
                <?php 
                do_action('login_form');
                ?>
                             
                             
				<p><label>&nbsp;</label>
				<input type="submit" class="submit_bottom" name="submits" id="submits" value="<?php 
                _e('Sign in', $current_theme_locale_name);
                ?>
" tabindex="4" />
				<input type="hidden" name="redirect_to" value="<?php 
                echo wp_specialchars($redirect_to);
                ?>
" />
				</p>
							
                </form>
				
                <ul id="logins">
							<li><a class="green_btn" href="<?php 
                bloginfo('home');
                ?>
/" 
                            title="<?php 
                _e('Are you lost?', $current_theme_locale_name);
                ?>
">&laquo; <?php 
                _e('Home', $current_theme_locale_name);
                ?>
</a></li>
						  <?php 
                if (get_settings('users_can_register')) {
                    ?>
							<li><a class="green_btn" href="<?php 
                    bloginfo('wpurl');
                    ?>
/wp-login.php?action=register"><?php 
                    _e('Register', $current_theme_locale_name);
                    ?>
</a></li>
						  <?php 
                }
                ?>
							<li><a class="green_btn" href="<?php 
                bloginfo('wpurl');
                ?>
/wp-login.php?action=lostpassword" 
                            title="<?php 
                _e('Password Lost and Found', $current_theme_locale_name);
                ?>
"><?php 
                _e('Lost your password?', $current_theme_locale_name);
                ?>
</a></li>
              	</ul>
						
		
				</div>
		                
            
            </div>
            </div>
            </div>
            
            
             </div> </div> </div>
		
		
		<?php 
                get_footer();
                die;
                break;
        }
    }