Exemplo n.º 1
0
$(document).ready(function() {
	 $('#ending').datetimepicker({
	showSecond: true,
	timeFormat: 'hh:mm:ss'
});});
 
 </script>
        
        
        <li>
        	<h2><?php 
echo __('Location:', 'ProjectTheme');
?>
</h2>
        <p><?php 
echo ProjectTheme_get_categories("project_location", empty($_POST['project_location_cat']) ? is_array($location) ? $location[0]->term_id : "" : $_POST['project_location_cat'], __('Select', 'ProjectTheme'), "do_input");
?>
</p>
        </li>
        
        
 
        
        
        
        <li>
        	<h2><?php 
echo __('Address:', 'ProjectTheme');
?>
</h2>
        <p><input type="text" size="50" class="do_input"  name="project_location_addr" value="<?php 
Exemplo n.º 2
0
function ProjectTheme_my_account_personal_info_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        	
           <?php 
    if (isset($_POST['save-info'])) {
        //if(file_exists('cimy_update_ExtraFields'))
        cimy_update_ExtraFields_new_me();
        if (!empty($_FILES['avatar']["tmp_name"])) {
            if (filesize($_FILES['avatar']['tmp_name']) > 1024 * 1024) {
                echo '<div class="error">' . __("Avatar was not updated. File is to big!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } else {
                //***********************************
                $pid = 0;
                $cid = $uid;
                require_once ABSPATH . "wp-admin" . '/includes/file.php';
                $upload_overrides = array('test_form' => false);
                $uploaded_file = wp_handle_upload($_FILES['avatar'], $upload_overrides);
                $file_name_and_location = $uploaded_file['file'];
                $file_title_for_media_library = $_FILES['file']['name'];
                $arr_file_type = wp_check_filetype(basename($_FILES['avatar']['name']));
                $uploaded_file_type = $arr_file_type['type'];
                $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => addslashes($file_title_for_media_library), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => $pid, 'post_author' => $cid);
                require_once ABSPATH . "wp-admin" . '/includes/image.php';
                $attach_id = wp_insert_attachment($attachment, $file_name_and_location, $pid);
                $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                wp_update_attachment_metadata($attach_id, $attach_data);
                update_user_meta($uid, 'avatar_' . 'project', $attach_id);
                //***********************************
            }
        }
        //---------------------
        $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}' ");
        $email_cats = $_POST['email_cats'];
        if (count($email_cats) > 0) {
            foreach ($email_cats as $em) {
                $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts (uid,catid) values('{$uid}','{$em}') ");
            }
        }
        //-------------------
        //email_locs
        //****************************************************************************************************
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}' ");
            $email_cats = $_POST['email_locs'];
            if (count($email_cats) > 0) {
                foreach ($email_cats as $em) {
                    $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts_locs (uid,catid) values('{$uid}','{$em}') ");
                }
            }
        }
        //****************************************************************************************************
        //-------------------
        $user_description = trim($_POST['user_description']);
        update_user_meta($uid, 'user_description', $user_description);
        $per_hour = trim($_POST['per_hour']);
        update_user_meta($uid, 'per_hour', $per_hour);
        $user_location = trim($_POST['project_location_cat']);
        update_user_meta($uid, 'user_location', $user_location);
        $user_city = trim($_POST['user_city']);
        update_user_meta($uid, 'user_city', $user_city);
        if (isset($_POST['paypal_email'])) {
            $paypalnum = trim($_POST['paypal_email']);
            if (is_email($paypalnum)) {
                $my_em = get_user_meta($uid, 'paypal_email', true);
                $s_em = get_users('meta_value=' . $paypalnum);
                $em_dom = strstr($paypalnum, '@');
                $em_dom = str_replace('@', '', $em_dom);
                if ($my_em != $paypalnum && !$s_em) {
                    function isDomainAvailible($domain)
                    {
                        $curlInit = curl_init($domain);
                        curl_setopt($curlInit, CURLOPT_CONNECTTIMEOUT, 10);
                        curl_setopt($curlInit, CURLOPT_HEADER, true);
                        curl_setopt($curlInit, CURLOPT_NOBODY, true);
                        curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true);
                        $response = curl_exec($curlInit);
                        curl_close($curlInit);
                        if ($response) {
                            return true;
                        }
                        return false;
                    }
                    if (isDomainAvailible($em_dom)) {
                        update_user_meta($uid, 'paypal_email', $paypalnum);
                    } else {
                        $xxp = 1;
                        echo '<div class="error">' . __('Incorrect PayPal Email', 'ProjectTheme') . '</div>';
                    }
                } else {
                    $xxp = 1;
                    echo '<div class="error">' . __('This PayPal Email already exists', 'ProjectTheme') . '</div>';
                }
            } else {
                $xxp = 1;
                echo '<div class="error">' . __('Incorrect PayPal Email', 'ProjectTheme') . '</div>';
            }
        } else {
            update_user_meta($uid, 'paypal_email', '');
        }
        $personal_info = trim($_POST['payza_email']);
        update_user_meta($uid, 'payza_email', $personal_info);
        $personal_info = trim($_POST['moneybookers_email']);
        update_user_meta($uid, 'moneybookers_email', $personal_info);
        $user_url = trim($_POST['user_url']);
        update_user_meta($uid, 'user_url', $user_url);
        do_action('ProjectTheme_pers_info_save_action');
        if (isset($_POST['new_user_name']) && !empty($_POST['new_user_name'])) {
            $new_user_name = trim($_POST['new_user_name']);
            $new_user_name = preg_replace('|\\s+|', '', $new_user_name);
            if (!validate_username($new_user_name) or $new_user_name == '' or !preg_match('/[0-9aA-zZ]/', $new_user_name)) {
                echo '<div class="error">' . __("Incorrect username!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } elseif (username_exists($new_user_name) && $new_user_name != $current_user->user_login) {
                echo '<div class="error">' . __("This Username already exists!", "ProjectTheme") . '</div>';
                $xxp = 1;
            } elseif ($new_user_name != $current_user->user_login) {
                global $wpdb;
                $sq = "UPDATE " . $wpdb->users . " SET user_login='******' WHERE ID='{$uid}'";
                $wpdb->query($sq);
                $inc = 2;
            }
        }
        if (isset($_POST['new_user_email']) && !empty($_POST['new_user_email'])) {
            $new_user_email = trim($_POST['new_user_email']);
            $new_user = get_user_by('email', $new_user_email);
            $new_uid = $new_user->ID;
            $user = get_userdata($uid);
            if ($new_user_email == $user->user_email) {
            } elseif (!$new_uid) {
                global $wpdb;
                $sq = "update " . $wpdb->users . " set user_email='{$new_user_email}' where ID='{$uid}'";
                $wpdb->query($sq);
            } else {
                echo '<div class="error">' . __("This Email already exists!", "ProjectTheme") . '</div>';
                $xxp = 1;
            }
        }
        if (isset($_POST['password']) && !empty($_POST['password'])) {
            $p1 = trim($_POST['password']);
            $p2 = trim($_POST['reppassword']);
            if (!empty($p1) && !empty($p2)) {
                if ($p1 == $p2) {
                    global $wpdb;
                    $newp = md5($p1);
                    $sq = "update " . $wpdb->users . " set user_pass='******' where ID='{$uid}'";
                    $wpdb->query($sq);
                    $inc = 1;
                } else {
                    echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                    $xxp = 1;
                }
            } else {
                echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                $xxp = 1;
            }
        }
        //---------------------------------------
        $arr = $_POST['custom_field_id'];
        for ($i = 0; $i < count($arr); $i++) {
            $ids = $arr[$i];
            $value = $_POST['custom_field_value_' . $ids];
            if (is_array($value)) {
                delete_user_meta($uid, "custom_field_ID_" . $ids);
                for ($j = 0; $j < count($value); $j++) {
                    add_user_meta($uid, "custom_field_ID_" . $ids, $value[$j]);
                }
            } else {
                update_user_meta($uid, "custom_field_ID_" . $ids, $value);
            }
        }
        //--------------------------------------------
        if ($xxp != 1) {
            echo '<div class="saved_thing">' . __('Info saved!', 'ProjectTheme');
            if ($inc == 1) {
                echo '<br/>' . __('Your password was changed. Redirecting to login page...', 'ProjectTheme');
                echo '<meta http-equiv="refresh" content="2; url=' . get_bloginfo('url') . '/wp-login.php">';
            } elseif ($inc == 2) {
                echo '<br/>' . __('Your Username was changed. Redirecting to login page...', 'ProjectTheme');
                echo '<meta http-equiv="refresh" content="2; url=' . get_bloginfo('url') . '/wp-login.php">';
            }
            echo '</div>';
        }
    }
    $user = get_userdata($uid);
    $user_location = get_user_meta($uid, 'user_location', true);
    ?>
         
       
    <script type="text/javascript">
	
	function delete_this2(id)
	{
		 jQuery.ajax({
						method: 'get',
						url : '<?php 
    echo get_bloginfo('siteurl');
    ?>
/index.php/?_ad_delete_pid='+id,
						dataType : 'text',
						success: function (text) {   jQuery('#image_ss'+id).remove();  }
					 });
		  //alert("a");
	
	}

	
 
	
	
	</script>     
            
             <form method="post"  enctype="multipart/form-data">
             
            <div class="my_box3">
            	
             
                <div class="box_content">    
	
         <ul class="post-new3">
        <li>
        	<h2><?php 
    echo __('Username', 'ProjectTheme');
    ?>
:</h2>
        	<p><input type="text" size="35" value="<?php 
    echo $user->user_login;
    ?>
" name="new_user_name" class="do_input" /></p>
        </li>

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

		<?php 
    $opt = get_option('ProjectTheme_enable_project_location');
    if ($opt != 'no') {
        ?>
        
		 <!-- <li>
        	<h2><?php 
        echo __('Location', 'ProjectTheme');
        ?>
:</h2>
        	<p>
            <?php 
        echo ProjectTheme_get_categories("project_location", $user_location, __("Select Location", "ProjectTheme"), "do_input");
        ?>
            </p>
        </li> -->
		
        
        <li>
        	<h2><?php 
        echo __('Country', 'ProjectTheme');
        ?>
:</h2>
        	<p>
        		<?php 
        $args = "orderby=name&order=ASC&hide_empty=0&parent=0";
        $terms = get_terms('project_location', $args);
        $cur_country = get_user_meta($uid, 'user_city');
        echo '<select name="user_city" class="do_input"><option value="">Select Country</option>';
        if ($terms) {
            foreach ($terms as $key => $term) {
                if ($cur_country[0] == $term->name) {
                    echo '<option value="' . $term->name . '" selected>' . $term->name . '</option>';
                } else {
                    echo '<option value="' . $term->name . '">' . $term->name . '</option>';
                }
            }
        }
        echo '</select>';
        ?>
        		<!-- <input type="text" size="35" name="user_city" value="<?php 
        echo get_user_meta($uid, 'user_city', true);
        ?>
" class="do_input" /> -->
        	</p>
        </li>
        
		<?php 
    }
    ?>
     
            <script>
			
			jQuery(document).ready(function(){
			tinyMCE.init({
					mode : "specific_textareas",
					theme : "modern", 
					/*statusbar: false,*/
					/*plugins : "autolink, lists, spellchecker, style, layer, table, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, media, searchreplace, print, contextmenu, paste, directionality, fullscreen, noneditable, visualchars, nonbreaking, xhtmlxtras, template",*/
					editor_selector :"tinymce-enabled"
				});
			});
						
			</script>    
        <li>
        	<h2><?php 
    echo __('Description', 'ProjectTheme');
    ?>
:</h2>
        	<p><textarea cols="40" rows="5"  name="user_description" class="tinymce-enabled do_input"><?php 
    echo get_usermeta($uid, 'user_description', true);
    ?>
</textarea></p>
        </li>
        
        <?php 
    $opt = get_option('ProjectTheme_paypal_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('PayPal Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="paypal_email" value="<?php 
        echo get_user_meta($uid, 'paypal_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_moneybookers_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('Moneybookers Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="moneybookers_email" value="<?php 
        echo get_user_meta($uid, 'moneybookers_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_alertpay_enable');
    if ($opt == "yes") {
        ?>
        
         <li>
        	<h2><?php 
        echo __('Payza Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="payza_email" value="<?php 
        echo get_user_meta($uid, 'payza_email', true);
        ?>
" class="do_input" /></p>
        </li>
       <?php 
    }
    ?>
 
        
         <li>
        	<h2><?php 
    echo __('New Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="password" size="35" /></p>
        </li>
        
        
        <li>
        	<h2><?php 
    echo __('Repeat Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="reppassword" size="35"  /></p>
        </li>
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_1');
    ?>

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



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

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

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

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

    

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

                
        </div> <!-- end dif content -->
        
        <?php 
    ProjectTheme_get_users_links();
    ?>
        
    
	
<?php 
}
Exemplo n.º 3
0
function ProjectTheme_post_new_area_function()
{
    global $wp_query, $projectOK, $current_user, $MYerror;
    get_currentuserinfo();
    $new_Project_step = $wp_query->query_vars['post_new_step'];
    if (empty($new_Project_step)) {
        $new_Project_step = 1;
    }
    $pid = $wp_query->query_vars['projectid'];
    $uid = $current_user->ID;
    ?>
    	<div id="content" style="width:100%">
        	
            <div class="my_box3">
            	<div class="padd10">
            
            	<div class="box_title"><?php 
    _e("Post New", "ProjectTheme");
    ?>
</div>
                <div class="box_content"> 
                
                <?php 
    $is_it_allowed = true;
    $is_it_allowed = apply_filters('ProjectTheme_is_it_allowed_place_bids', $is_it_allowed);
    if ($is_it_allowed != true) {
        do_action('ProjectTheme_is_it_not_allowed_place_bids_action');
    } else {
        ?>
                
            	
    			<?php 
        echo '<div id="steps">';
        echo '<ul>';
        echo '<li ' . ($new_Project_step == '1' ? "class='active_step' " : "") . '>' . __("STEP 1", 'ProjectTheme') . '</li>';
        do_action('ProjectTheme_after_step1_show', $new_Project_step);
        echo '<li ' . ($new_Project_step == '2' ? "class='active_step' " : "") . '>' . __("STEP 2", 'ProjectTheme') . '</li>';
        echo '<li ' . ($new_Project_step == '3' ? "class='active_step' " : "") . '>' . __("STEP 3", 'ProjectTheme') . '</li>';
        echo '</ul>';
        echo '</div>';
        //****************************************************************************************
        if ($new_Project_step == "1") {
            //-----------------
            $location = wp_get_object_terms($pid, 'project_location');
            $cat = wp_get_object_terms($pid, 'project_cat');
            if (!empty($pid)) {
                $post = get_post($pid);
            }
            if (is_array($MYerror)) {
                if ($projectOK == 0) {
                    echo '<div class="errrs">';
                    foreach ($MYerror as $e) {
                        echo '<div class="newad_error">' . $e . '</div>';
                    }
                    echo '</div>';
                }
            }
            ?>
 <form method="post" action="<?php 
            echo ProjectTheme_post_new_with_pid_stuff_thg($pid, '1');
            ?>
">  
    <ul class="post-new">
    <?php 
            do_action('ProjectTheme_step1_before_title');
            ?>
    
        <li>
        	<h2><?php 
            echo __('Your project title', 'ProjectTheme');
            ?>
:</h2>
        	<p><input type="text" size="50" class="do_input" name="project_title" 
            value="<?php 
            echo empty($_POST['project_title']) ? $post->post_title == "Auto Draft" ? "" : $post->post_title : $_POST['project_title'];
            ?>
" /></p>
        </li>
       
     <?php 
            do_action('ProjectTheme_step1_before_category');
            ?>
  
        
        <li><h2><?php 
            echo __('Category', 'ProjectTheme');
            ?>
:</h2>
        	<p><?php 
            echo ProjectTheme_get_categories("project_cat", !isset($_POST['project_cat_cat']) ? is_array($cat) ? $cat[0]->term_id : "" : $_POST['project_cat_cat'], __("Select Category", "ProjectTheme"), "do_input");
            ?>
</p>
        </li>
  
  <?php 
            do_action('ProjectTheme_step1_before_price');
            ?>
  
        <li><h2><?php 
            echo __('Price', 'ProjectTheme');
            ?>
:</h2>
        <p>
        
      <?php 
            $sel = get_post_meta($pid, 'budgets', true);
            echo ProjecTheme_get_budgets_dropdown($sel, 'do_input');
            ?>
      
      </p>
        </li>
       
        <?php 
            do_action('ProjectTheme_step1_before_ending');
            ?>
        
        <li>
        <h2>
        
        
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
		<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
        <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
        <script src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/jquery.iframe-transport.js"></script>
        <script src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/jquery.fileupload.js"></script>
        <script src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/jquery.fileupload-ui.js"></script>
        <script src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/application.js"></script>  	
        	
        
        <link rel="stylesheet" media="all" type="text/css" href="<?php 
            echo get_bloginfo('template_url');
            ?>
/css/ui_thing.css" />
		<script type="text/javascript" language="javascript" src="<?php 
            echo get_bloginfo('template_url');
            ?>
/js/timepicker.js"></script>
          

       <?php 
            _e("Project Ending On", 'ProjectTheme');
            ?>
:</h2>
       <?php 
            $dt = get_post_meta($pid, 'ending', true);
            if (!empty($dt)) {
                $dt = date_i18n('d-m-Y H:i', $dt);
            }
            ?>
       <p><input type="text" name="ending" id="ending" class="do_input" value="<?php 
            echo $dt;
            ?>
"  /></p>
       </li>
        
 		<script>
		<?php 
            $dd = get_option('projectTheme_project_period');
            if (empty($dd)) {
                $dd = 7;
            }
            ?>
		
			var myDate=new Date();
			myDate.setDate(myDate.getDate()+<?php 
            echo $dd;
            ?>
);
			
			$(document).ready(function() {
				 $('#ending').datetimepicker({
				showSecond: false,
				timeFormat: 'hh:mm:ss',
				
					currentText: '<?php 
            _e('Now', 'ProjectTheme');
            ?>
',
					closeText: '<?php 
            _e('Done', 'ProjectTheme');
            ?>
',
					ampm: false,
					dateFormat: 'dd-mm-yy',
					timeFormat: 'hh:mm tt',
					timeSuffix: '',
					maxDateTime: myDate,
					timeOnlyTitle: '<?php 
            _e('Choose Time', 'ProjectTheme');
            ?>
',
					timeText: '<?php 
            _e('Time', 'ProjectTheme');
            ?>
',
					hourText: '<?php 
            _e('Hour', 'ProjectTheme');
            ?>
',
					minuteText: '<?php 
            _e('Minute', 'ProjectTheme');
            ?>
',
					secondText: '<?php 
            _e('Second', 'ProjectTheme');
            ?>
',
					timezoneText: '<?php 
            _e('Time Zone', 'ProjectTheme');
            ?>
'
			
			});});
 
 		</script>
        
        <?php 
            do_action('ProjectTheme_step1_before_location');
            ?>
        <?php 
            $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
            if ($ProjectTheme_enable_project_location == "yes") {
                ?>
        <li>
        	<h2><?php 
                echo __('Location', 'ProjectTheme');
                ?>
:</h2>
        <p><?php 
                echo ProjectTheme_get_categories("project_location", empty($_POST['project_location_cat']) ? is_array($location) ? $location[0]->term_id : "" : $_POST['project_location_cat'], __("Select Location", "ProjectTheme"), "do_input");
                ?>
</p>
        </li>
       
       
       <?php 
                do_action('ProjectTheme_step1_before_address');
                ?>
    
       <?php 
                $show_address = true;
                $show_address = apply_filters('ProjectTheme_show_address_filter', $show_address);
                if ($show_address == true) {
                    ?>
 
        <li>
        	<h2><?php 
                    echo __('Address', 'ProjectTheme');
                    ?>
:</h2>
        <p><input type="text" size="50" class="do_input"  name="project_location_addr" value="<?php 
                    echo !isset($_POST['project_location_addr']) ? get_post_meta($pid, 'Location', true) : $_POST['project_location_addr'];
                    ?>
" /> </p>
        </li>
        <?php 
                }
            }
            ?>
        
        <?php 
            do_action('ProjectTheme_step1_before_description');
            ?>
        <li>
        	<h2><?php 
            echo __('Description', 'ProjectTheme');
            ?>
:</h2>
        <p><textarea rows="6" cols="60" class="do_input description_edit"  name="project_description"><?php 
            echo empty($_POST['project_description']) ? trim($post->post_content) : $_POST['project_description'];
            ?>
</textarea></p>
        </li>

		
        <?php 
            do_action('ProjectTheme_step1_before_tags');
            $project_tags = '';
            $t = wp_get_post_tags($post->ID);
            foreach ($t as $tags) {
                $project_tags .= $tags->name . ", ";
            }
            ?>
		<li>
        	<h2><?php 
            echo __('Tags', 'ProjectTheme');
            ?>
:</h2>
        <p><input type="text" size="50" class="do_input"  name="project_tags" value="<?php 
            echo $project_tags;
            ?>
" /> </p>
        </li>
        
        
        <?php 
            do_action('ProjectTheme_step1_after_tags');
            ?>
        
        <li>
        <h2>&nbsp;</h2>
        <p> 
        <input type="submit" name="project_submit1" value="<?php 
            _e("Next Step", 'ProjectTheme');
            ?>
 >>" /></p>
        </li>
    	
        <?php 
            do_action('ProjectTheme_step1_after_submit');
            ?>
    
    </ul>
    </form>
    <?php 
        }
        if ($new_Project_step == "2") {
            global $MYerror, $projectOK;
            $cid = $current_user->ID;
            do_action('ProjectTheme_post_new_step2_before_images');
            if (is_array($MYerror)) {
                if ($projectOK == 0) {
                    echo '<div class="errrs">';
                    foreach ($MYerror as $e) {
                        echo '<div class="newad_error">' . $e . '</div>';
                    }
                    echo '</div>';
                }
            }
            ?>
    
    
    
   
 	<ul class="post-new">
    
    <?php 
            $ProjectTheme_enable_images_in_projects = get_option('ProjectTheme_enable_images_in_projects');
            $ProjectTheme_enable_images_in_projects_filter = true;
            $ProjectTheme_enable_images_in_projects_filter = apply_filters('ProjectTheme_enable_images_in_projects_filter', $ProjectTheme_enable_images_in_projects_filter);
            if ($ProjectTheme_enable_images_in_projects_filter == true) {
                if ($ProjectTheme_enable_images_in_projects == "yes") {
                    ?>
    	
        
        <?php 
                    echo '<div class="images_sub_small_txt">';
                    $ProjectTheme_enable_max_images_limit = get_option('ProjectTheme_enable_max_images_limit');
                    if ($ProjectTheme_enable_max_images_limit == "yes") {
                        $projectTheme_nr_max_of_images = get_option('projectTheme_nr_max_of_images');
                        if (empty($projectTheme_nr_max_of_images)) {
                            $projectTheme_nr_max_of_images = 10;
                        }
                        echo sprintf(__('There is a limit for the uploaded images. The maximum number of images you can upload for this project is %s.', 'ProjectTheme'), $projectTheme_nr_max_of_images);
                    }
                    $ProjectTheme_charge_fees_for_images = get_option('ProjectTheme_charge_fees_for_images');
                    $projectTheme_extra_image_charge = get_option('projectTheme_extra_image_charge');
                    if ($ProjectTheme_charge_fees_for_images == "yes") {
                        $projectTheme_nr_of_free_images = get_option('projectTheme_nr_of_free_images');
                        if (empty($projectTheme_nr_of_free_images)) {
                            $projectTheme_nr_of_free_images = 1;
                        }
                        echo '<br/>';
                        echo sprintf(__('There are %s free images. After that each image will be charged %s.', 'ProjectTheme'), $projectTheme_nr_of_free_images, ProjectTheme_get_show_price($projectTheme_extra_image_charge));
                    }
                    echo '</div>';
                    ?>
        
        
        
        
    	<li>
        <h2><?php 
                    _e('Images', 'ProjectTheme');
                    ?>
:</h2>
        <p>	
                    
        <!-- ##################################################################### -->



    <form id="fileupload" action="<?php 
                    bloginfo('siteurl');
                    ?>
/?uploady_thing=1&pid=<?php 
                    echo $pid;
                    ?>
" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="pid" value="<?php 
                    echo $pid;
                    ?>
">
    <input type="hidden" name="cid" value="<?php 
                    echo $cid;
                    ?>
">
        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
        <div class="row fileupload-buttonbar">
            <div class="span7">
                <!-- The fileinput-button span is used to style the file input field as button -->
                <span class="btn btn-success fileinput-button">
                    <i class="icon-plus icon-white"></i>
                    <span><?php 
                    _e('Add Images', 'ProjectTheme');
                    ?>
</span>
                    <input type="file" name="files[]" multiple>
                </span>
             
                <button type="reset" class="btn btn-warning cancel">
                    <i class="icon-ban-circle icon-white"></i>
                    <span><?php 
                    _e('Cancel upload', 'ProjectTheme');
                    ?>
</span>
                </button>
                <button type="button" class="btn btn-danger delete">
                    <i class="icon-trash icon-white"></i>
                    <span><?php 
                    _e('Delete', 'ProjectTheme');
                    ?>
</span>
                </button>
                <input type="checkbox" class="toggle">
            </div>
            <!-- The global progress information -->
            <div class="span5 fileupload-progress fade">
                <!-- The global progress bar -->
                <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                    <div class="bar" style="width:0%;"></div>
                </div>
                <!-- The extended global progress information -->
                <div class="progress-extended">&nbsp;</div>
            </div>
        </div>
        <!-- The loading indicator is shown during file processing -->
        <div class="fileupload-loading"></div>
        <br>
        <!-- The table listing the files available for upload/download -->
        <table role="presentation" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
    </form>



<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td class="preview"><span class="fade"></span></td>
        <td class="name"><span>{%=file.name%}</span></td>
        <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
        {% if (file.error) { %}
            <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
        {% } else if (o.files.valid && !i) { %}
            <td>
                <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
            </td>
            <td class="start">{% if (!o.options.autoUpload) { %}
                <button class="btn btn-primary">
                    <i class="icon-upload icon-white"></i>
                    <span>{%=locale.fileupload.start%}</span>
                </button>
            {% } %}</td>
        {% } else { %}
            <td colspan="2"></td>
        {% } %}
        <td class="cancel">{% if (!i) { %}
            <button class="btn btn-warning">
                <i class="icon-ban-circle icon-white"></i>
                <span>{%=locale.fileupload.cancel%}</span>
            </button>
        {% } %}</td>
    </tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-download">
        {% if (file.error) { %}
            <td></td>
            <td class="name"><span>{%=file.name%}</span></td>
            <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
            <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
        {% } else { %}
            <td class="preview">{% if (file.thumbnail_url) { %}
                <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
            {% } %}</td>
            <td class="name">
                <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
            </td>
            <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
            <td colspan="2"></td>
        {% } %}
        <td class="delete">
            <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
                <i class="icon-trash icon-white"></i>
                <span>{%=locale.fileupload.destroy%}</span>
            </button>
            <input type="checkbox" name="delete" value="1">
        </td>
    </tr>
{% } %}
</script>
<script> var $ = jQuery; </script>




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


</li> <?php 
                }
            }
            ?>

<?php 
            $cid = $current_user->ID;
            $cwd = str_replace('wp-admin', '', getcwd());
            $cwd .= 'wp-content/uploads';
            //echo get_template_directory();
            do_action('ProjectTheme_step2_before_images');
            $ProjectTheme_enable_project_files = get_option('ProjectTheme_enable_project_files');
            if ($ProjectTheme_enable_project_files != "no") {
                ?>

		<li>
        <h2><?php 
                _e("Project Files", 'ProjectTheme');
                ?>
:</h2>
        <p>

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

	
	
	$(function() {
		
		$("#fileUpload3").uploadify({
			height        : 30,
			auto:			true,
			swf           : '<?php 
                echo get_bloginfo('template_url');
                ?>
/lib/uploadify/uploadify.swf',
			uploader      : '<?php 
                echo get_bloginfo('template_url');
                ?>
/lib/uploadify/uploady2.php',
			width         : 120,
			fileTypeExts  : '*.zip;*.pdf;*.doc;*.docx',
			fileTypeDesc : '<?php 
                _e('Select Project Files', 'ProjectTheme');
                ?>
',
			formData    : {'ID':<?php 
                echo $pid;
                ?>
,'author':<?php 
                echo $cid;
                ?>
},
			onUploadSuccess : function(file, data, response) {
			
			//alert(data);
			var bar = data.split("|");
			
$('#thumbnails').append('<div class="div_div" id="image_ss'+bar[1]+'" > ' + bar[0] + '" <a href="javascript: void(0)" onclick="delete_this('+ bar[1] +')"><img border="0" src="<?php 
                echo get_bloginfo('template_url');
                ?>
/images/delete_icon.png" border="0" /></a></div>');
}
	
			
			
    	});
		
		
	});
	
	
	</script>


	<div id="fileUpload3"><?php 
                _e('You have a problem with your javascript', 'ProjectTheme');
                ?>
</div>
	<div id="thumbnails" style="overflow:hidden;margin-top:20px">
    
    <?php 
                $args = array('order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'attachment', 'post_parent' => $pid, 'post_status' => null, 'numberposts' => -1);
                $attachments = get_posts($args);
                if ($pid > 0) {
                    if ($attachments) {
                        foreach ($attachments as $attachment) {
                            $url = $attachment->guid;
                            $imggg = $attachment->post_mime_type;
                            if ('image/png' != $imggg && 'image/jpeg' != $imggg) {
                                echo '<div class="div_div"  id="image_ss' . $attachment->ID . '">' . $attachment->post_title . '
			<a href="javascript: void(0)" onclick="delete_this(\'' . $attachment->ID . '\')"><img border="0" src="' . get_bloginfo('template_url') . '/images/delete_icon.png" /></a>
			</div>';
                            }
                        }
                    }
                }
                ?>
    
    </div>
    
    <!--####################################### -->
    
    
    
	</p>
	</li>
	<?php 
            }
            ?>

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

        
        <li>
        <h2>&nbsp;</h2>
        <?php 
            $stp = 1;
            $stp = apply_filters('ProjectTheme_filter_go_back_stp2', $stp);
            ?>
        <p><a href="<?php 
            echo ProjectTheme_post_new_with_pid_stuff_thg($pid, $stp);
            ?>
" class="go_back_btn" ><?php 
            _e('Go Back', 'ProjectTheme');
            ?>
</a> 
        <input type="submit" name="project_submit2" value="<?php 
            _e("Next Step", 'ProjectTheme');
            ?>
 >>" /></p>
        </li>
    
    
    </ul>
    </form>
    
    
    
    <?php 
        }
        do_action('ProjectTheme_see_if_we_can_add_steps', $new_Project_step, $pid);
        if ($new_Project_step == "3") {
            $catid = ProjectTheme_get_project_primary_cat($pid);
            $ProjectTheme_get_images_cost_extra = ProjectTheme_get_images_cost_extra($pid);
            //--------------------------------------------------
            // hide project from search engines fee calculation
            $projectTheme_hide_project_fee = get_option('projectTheme_hide_project_fee');
            if (!empty($projectTheme_hide_project_fee)) {
                $opt = get_post_meta($pid, 'hide_project', true);
                if ($opt == "0") {
                    $projectTheme_hide_project_fee = 0;
                }
            } else {
                $projectTheme_hide_project_fee = 0;
            }
            //---------------------
            $made_me_date = get_post_meta($pid, 'made_me_date', true);
            $tms = current_time('timestamp', 0);
            $projectTheme_project_period = get_option('projectTheme_project_period');
            if (empty($projectTheme_project_period)) {
                $projectTheme_project_period = 30;
            }
            if (empty($made_me_date)) {
                $ee = $tms + 3600 * 24 * $projectTheme_project_period;
                update_post_meta($pid, 'ending', $ee);
            } else {
                $ee = get_post_meta($pid, 'ending', true) + $tms - $made_me_date;
                update_post_meta($pid, 'ending', $ee);
            }
            //-------------------------------------------------------------------------------
            // sealed bidding fee calculation
            $projectTheme_sealed_bidding_fee = get_option('projectTheme_sealed_bidding_fee');
            if (!empty($projectTheme_sealed_bidding_fee)) {
                $opt = get_post_meta($pid, 'private_bids', true);
                if ($opt == "0") {
                    $projectTheme_sealed_bidding_fee = 0;
                }
            } else {
                $projectTheme_sealed_bidding_fee = 0;
            }
            //-------
            $featured = get_post_meta($pid, 'featured', true);
            $feat_charge = get_option('projectTheme_featured_fee');
            if ($featured != "1") {
                $feat_charge = 0;
            }
            $custom_set = get_option('projectTheme_enable_custom_posting');
            if ($custom_set == 'yes') {
                $posting_fee = get_option('projectTheme_theme_custom_cat_' . $catid);
                if (empty($posting_fee)) {
                    $posting_fee = 0;
                }
            } else {
                $posting_fee = get_option('projectTheme_base_fee');
            }
            $total = $feat_charge + $posting_fee + $projectTheme_sealed_bidding_fee + $projectTheme_hide_project_fee + $ProjectTheme_get_images_cost_extra;
            //-----------------------------------------------
            $payment_arr = array();
            $base_fee_paid = get_post_meta($pid, 'base_fee_paid', true);
            if ($base_fee_paid != "1" and $posting_fee > 0) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'base_fee';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $posting_fee;
                $my_small_arr['description'] = __('Base Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
            }
            //-----------------------
            $my_small_arr = array();
            $my_small_arr['fee_code'] = 'extra_img';
            $my_small_arr['show_me'] = true;
            $my_small_arr['amount'] = $ProjectTheme_get_images_cost_extra;
            $my_small_arr['description'] = __('Extra Images Fee', 'ProjectTheme');
            array_push($payment_arr, $my_small_arr);
            //------------------------
            $featured_paid = get_post_meta($pid, 'featured_paid', true);
            $opt = get_post_meta($pid, 'featured', true);
            if ($feat_charge > 0 and $featured_paid != 1 and $opt == 1) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'feat_fee';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $feat_charge;
                $my_small_arr['description'] = __('Featured Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
                //------------------------
            }
            $private_bids_paid = get_post_meta($pid, 'private_bids_paid', true);
            $opt = get_post_meta($pid, 'private_bids', true);
            if ($projectTheme_sealed_bidding_fee > 0 and $private_bids_paid != 1 and ($opt == 1 or $opt == "yes")) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'sealed_project';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $projectTheme_sealed_bidding_fee;
                $my_small_arr['description'] = __('Sealed Bidding Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
                //------------------------
            }
            $hide_project_paid = get_post_meta($pid, 'hide_project_paid', true);
            $opt = get_post_meta($pid, 'hide_project', true);
            if ($projectTheme_hide_project_fee > 0 and $hide_project_paid != "1" and ($opt == "1" or $opt == "yes")) {
                $my_small_arr = array();
                $my_small_arr['fee_code'] = 'hide_project';
                $my_small_arr['show_me'] = true;
                $my_small_arr['amount'] = $projectTheme_hide_project_fee;
                $my_small_arr['description'] = __('Hide Project From Search Engines Fee', 'ProjectTheme');
                array_push($payment_arr, $my_small_arr);
            }
            $payment_arr = apply_filters('ProjectTheme_filter_payment_array', $payment_arr, $pid);
            $new_total = 0;
            foreach ($payment_arr as $payment_item) {
                if ($payment_item['amount'] > 0) {
                    $new_total += $payment_item['amount'];
                }
            }
            //-----------------------------------------------
            $post = get_post($pid);
            $admin_email = get_bloginfo('admin_email');
            $total = apply_filters('ProjectTheme_filter_payment_total', $new_total, $pid);
            //----------------------------------------
            $finalize = isset($_GET['finalize']) ? true : false;
            update_post_meta($pid, 'finalised_posted', '1');
            //-----------
            if ($total == 0) {
                echo '<div >';
                echo __('Thank you for posting your project with us.', 'ProjectTheme');
                update_post_meta($pid, "paid", "1");
                if (get_option('projectTheme_admin_approves_each_project') == 'yes') {
                    $my_post = array();
                    $my_post['ID'] = $pid;
                    $my_post['post_status'] = 'draft';
                    wp_update_post($my_post);
                    if ($finalize == true) {
                        ProjectTheme_send_email_posted_project_not_approved($pid);
                        ProjectTheme_send_email_posted_project_not_approved_admin($pid);
                    }
                    echo '<br/>' . __('Your project isn`t live yet, the admin needs to approve it.', 'ProjectTheme');
                } else {
                    $my_post = array();
                    $my_post['ID'] = $pid;
                    $my_post['post_status'] = 'publish';
                    if ($finalize == true) {
                        wp_update_post($my_post);
                        wp_publish_post($pid);
                        ProjectTheme_send_email_posted_project_approved($pid);
                        ProjectTheme_send_email_posted_project_approved_admin($pid);
                        ProjectTheme_send_email_subscription($pid);
                    }
                }
                echo '</div>';
            } else {
                update_post_meta($pid, "paid", "0");
                echo '<div >';
                echo __('Thank you for posting your project with us. Below is the total price that you need to pay in order to put your project live.<br/>
			Click the pay button and you will be redirected...', 'ProjectTheme');
                echo '</div>';
            }
            //----------------------------------------
            echo '<table style="margin-top:25px">';
            $show_payment_table = true;
            $show_payment_table = apply_filters('ProjectTheme_filter_payment_show_table', $show_payment_table, $pid);
            if ($show_payment_table == true) {
                foreach ($payment_arr as $payment_item) {
                    if ($payment_item['amount'] > 0) {
                        echo '<tr>';
                        echo '<td>' . $payment_item['description'] . '&nbsp; &nbsp;</td>';
                        echo '<td>' . ProjectTheme_get_show_price($payment_item['amount'], 2) . '</td>';
                        echo '</tr>';
                    }
                }
                echo '<tr>';
                echo '<td>&nbsp;</td>';
                echo '<td></td>';
                echo '</tr>';
                echo '<tr>';
                echo '<td><strong>' . __('Total to Pay', 'ProjectTheme') . '</strong></td>';
                echo '<td><strong>' . ProjectTheme_get_show_price($total, 2) . '</strong></td>';
                echo '</tr>';
                echo '<tr>';
                echo '<td><strong>' . __('Your Total Credits', 'ProjectTheme') . '</strong></td>';
                echo '<td><strong>' . ProjectTheme_get_show_price(ProjectTheme_get_credits($uid), 2) . '</strong></td>';
                echo '</tr>';
                echo '<tr>';
                echo '<td>&nbsp;<br/>&nbsp;</td>';
                echo '<td></td>';
                echo '</tr>';
            }
            //endif show this table
            if ($total == 0 && $finalize == true) {
                if (get_option('projectTheme_admin_approves_each_project') != 'yes') {
                    echo '<tr>';
                    echo '<td></td>';
                    echo '<td><a href="' . get_permalink($pid) . '" class="go_back_btn">' . __('See your project', 'ProjectTheme') . '</a></td>';
                    echo '</tr>';
                } else {
                    echo '<tr>';
                    echo '<td></td>';
                    echo '<td><a href="' . get_permalink(get_option('ProjectTheme_my_account_page_id')) . '" class="go_back_btn">' . __('Go to your account', 'ProjectTheme') . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
            } elseif ($total > 0) {
                echo '</table>';
                update_post_meta($pid, 'unpaid', '1');
                echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=credits_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by Credits', 'ProjectTheme') . '</a>';
                global $project_ID;
                $project_ID = $pid;
                //-------------------
                $ProjectTheme_paypal_enable = get_option('ProjectTheme_paypal_enable');
                $ProjectTheme_alertpay_enable = get_option('ProjectTheme_alertpay_enable');
                $ProjectTheme_moneybookers_enable = get_option('ProjectTheme_moneybookers_enable');
                if ($ProjectTheme_paypal_enable == "yes") {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=paypal_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by PayPal', 'ProjectTheme') . '</a>';
                }
                if ($ProjectTheme_moneybookers_enable == "yes") {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=mb_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by MoneyBookers/Skrill', 'ProjectTheme') . '</a>';
                }
                if ($ProjectTheme_alertpay_enable == "yes") {
                    echo '<a href="' . get_bloginfo('siteurl') . '/?p_action=payza_listing&pid=' . $pid . '" class="edit_project_pay_cls">' . __('Pay by Payza', 'ProjectTheme') . '</a>';
                }
                do_action('ProjectTheme_add_payment_options_to_post_new_project', $pid);
            } else {
                echo '</table>';
            }
            echo '<div class="clear10"></div>';
            echo '<div class="clear10"></div>';
            echo '<div class="clear10"></div>';
            if ($finalize == false) {
                echo '<a href="' . ProjectTheme_post_new_with_pid_stuff_thg($pid, '2') . '" class="go_back_btn" >' . __('Go Back', 'ProjectTheme') . '</a>';
            }
            if ($total == 0 && $finalize == false) {
                echo '<a href="' . ProjectTheme_post_new_with_pid_stuff_thg($pid, '3', 'finalize') . '" 
	class="go_back_btn" >' . __('Finalize Project Posting', 'ProjectTheme') . '</a>';
            }
        }
        ?>
                
            <?php 
    }
    ?>
                
                </div>
              </div>
           </div>
                
        </div> <!-- end dif content -->
     
        
    
	
<?php 
}
Exemplo n.º 4
0
function ProjectTheme_my_account_personal_info_function()
{
    global $current_user, $wpdb, $wp_query;
    get_currentuserinfo();
    $uid = $current_user->ID;
    ?>
    	<div id="content" class="account-main-area">
        	
           <?php 
    if (isset($_POST['save-info'])) {
        //if(file_exists('cimy_update_ExtraFields'))
        cimy_update_ExtraFields_new_me();
        require_once ABSPATH . "wp-admin" . '/includes/file.php';
        require_once ABSPATH . "wp-admin" . '/includes/image.php';
        if (!empty($_FILES['avatar']["name"])) {
            $upload_overrides = array('test_form' => false);
            $uploaded_file = wp_handle_upload($_FILES['avatar'], $upload_overrides);
            $file_name_and_location = $uploaded_file['file'];
            $file_title_for_media_library = $_FILES['avatar']['name'];
            $file_name_and_location = $uploaded_file['file'];
            $file_title_for_media_library = $_FILES['avatar']['name'];
            $arr_file_type = wp_check_filetype(basename($_FILES['avatar']['name']));
            $uploaded_file_type = $arr_file_type['type'];
            $urls = $uploaded_file['url'];
            if ($uploaded_file_type == "image/png" or $uploaded_file_type == "image/jpg" or $uploaded_file_type == "image/jpeg" or $uploaded_file_type == "image/gif") {
                $attachment = array('post_mime_type' => $uploaded_file_type, 'post_title' => 'User Avatar', 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => 0, 'post_author' => $uid);
                $attach_id = wp_insert_attachment($attachment, $file_name_and_location, 0);
                $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
                wp_update_attachment_metadata($attach_id, $attach_data);
                $_wp_attached_file = get_post_meta($attach_id, '_wp_attached_file', true);
                if (!empty($_wp_attached_file)) {
                    update_user_meta($uid, 'avatar_project', $attach_id);
                }
            }
        }
        //---------------------
        $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts where uid='{$uid}' ");
        $email_cats = $_POST['email_cats'];
        if (count($email_cats) > 0) {
            foreach ($email_cats as $em) {
                $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts (uid,catid) values('{$uid}','{$em}') ");
            }
        }
        //-------------------
        //email_locs
        //****************************************************************************************************
        $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
        if ($ProjectTheme_enable_project_location != "no") {
            $wpdb->query("delete from " . $wpdb->prefix . "project_email_alerts_locs where uid='{$uid}' ");
            $email_cats = $_POST['email_locs'];
            if (count($email_cats) > 0) {
                foreach ($email_cats as $em) {
                    $wpdb->query("insert into " . $wpdb->prefix . "project_email_alerts_locs (uid,catid) values('{$uid}','{$em}') ");
                }
            }
        }
        //****************************************************************************************************
        //-------------------
        $user_description = trim($_POST['user_description']);
        update_user_meta($uid, 'user_description', $user_description);
        $per_hour = trim($_POST['per_hour']);
        update_user_meta($uid, 'per_hour', $per_hour);
        $user_location = trim($_POST['project_location_cat']);
        update_user_meta($uid, 'user_location', $user_location);
        $user_city = trim($_POST['user_city']);
        update_user_meta($uid, 'user_city', $user_city);
        $personal_info = trim($_POST['paypal_email']);
        update_user_meta($uid, 'paypal_email', $personal_info);
        $personal_info = trim($_POST['payza_email']);
        update_user_meta($uid, 'payza_email', $personal_info);
        $personal_info = trim($_POST['moneybookers_email']);
        update_user_meta($uid, 'moneybookers_email', $personal_info);
        $user_url = trim($_POST['user_url']);
        update_user_meta($uid, 'user_url', $user_url);
        do_action('ProjectTheme_pers_info_save_action');
        if (isset($_POST['password']) && !empty($_POST['password'])) {
            $p1 = trim($_POST['password']);
            $p2 = trim($_POST['reppassword']);
            if (!empty($p1) && !empty($p2)) {
                if ($p1 == $p2) {
                    global $wpdb;
                    $newp = md5($p1);
                    $sq = "update " . $wpdb->users . " set user_pass='******' where ID='{$uid}'";
                    $wpdb->query($sq);
                    $inc = 1;
                } else {
                    echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                    $xxp = 1;
                }
            } else {
                echo '<div class="error">' . __("Password was not updated. Passwords do not match!", "ProjectTheme") . '</div>';
                $xxp = 1;
            }
        }
        //---------------------------------------
        $arr = $_POST['custom_field_id'];
        for ($i = 0; $i < count($arr); $i++) {
            $ids = $arr[$i];
            $value = $_POST['custom_field_value_' . $ids];
            if (is_array($value)) {
                delete_user_meta($uid, "custom_field_ID_" . $ids);
                for ($j = 0; $j < count($value); $j++) {
                    add_user_meta($uid, "custom_field_ID_" . $ids, $value[$j]);
                }
            } else {
                update_user_meta($uid, "custom_field_ID_" . $ids, $value);
            }
        }
        //--------------------------------------------
        if ($xxp != 1) {
            echo '<div class="saved_thing">' . __('Info saved!', 'ProjectTheme');
            if ($inc == 1) {
                echo '<br/>' . __('Your password was changed. Redirecting to login page...', 'ProjectTheme');
                echo '<meta http-equiv="refresh" content="2; url=' . get_bloginfo('url') . '/wp-login.php">';
            }
            echo '</div>';
        }
    }
    $user = get_userdata($uid);
    $user_location = get_user_meta($uid, 'user_location', true);
    ?>
         
       
    <script type="text/javascript">
	
	function delete_this2(id)
	{
		 jQuery.ajax({
						method: 'get',
						url : '<?php 
    echo get_bloginfo('siteurl');
    ?>
/index.php/?_ad_delete_pid='+id,
						dataType : 'text',
						success: function (text) {   jQuery('#image_ss'+id).remove();  }
					 });
		  //alert("a");
	
	}

	
 
	
	
	</script>     
            
             <form method="post"  enctype="multipart/form-data">
             
            <div class="my_box3">
            	
             
                <div class="box_content">    
	
         <ul class="post-new3">
        <li>
        	<h2><?php 
    echo __('Username', 'ProjectTheme');
    ?>
:</h2>
        	<p><input type="text" size="35" value="<?php 
    echo $user->user_login;
    ?>
" disabled="disabled" class="do_input" /></p>
        </li>

		<?php 
    $opt = get_option('ProjectTheme_enable_project_location');
    if ($opt != 'no') {
        ?>
        
		 <li>
        	<h2><?php 
        echo __('Location', 'ProjectTheme');
        ?>
:</h2>
        	<p>
            <?php 
        echo ProjectTheme_get_categories("project_location", $user_location, __("Select Location", "ProjectTheme"), "do_input");
        ?>
            </p>
        </li>
		
        
        <li>
        	<h2><?php 
        echo __('City', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="user_city" value="<?php 
        echo get_user_meta($uid, 'user_city', true);
        ?>
" class="do_input" /></p>
        </li>
        
		<?php 
    }
    ?>
     
            <script>
			
			jQuery(document).ready(function(){
			tinyMCE.init({
					mode : "specific_textareas",
					theme : "modern", 
					/*plugins : "autolink, lists, spellchecker, style, layer, table, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, media, searchreplace, print, contextmenu, paste, directionality, fullscreen, noneditable, visualchars, nonbreaking, xhtmlxtras, template",*/
					editor_selector :"tinymce-enabled"
				});
			});
						
			</script>    
        <li>
        	<h2><?php 
    echo __('Description', 'ProjectTheme');
    ?>
:</h2>
        	<p><textarea cols="40" rows="5"  name="user_description" class="tinymce-enabled do_input"><?php 
    echo get_usermeta($uid, 'user_description', true);
    ?>
</textarea></p>
        </li>
        
        <?php 
    $opt = get_option('ProjectTheme_paypal_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('PayPal Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="paypal_email" value="<?php 
        echo get_user_meta($uid, 'paypal_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_moneybookers_enable');
    if ($opt == "yes") {
        ?>
        
        <li>
        	<h2><?php 
        echo __('Moneybookers Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="moneybookers_email" value="<?php 
        echo get_user_meta($uid, 'moneybookers_email', true);
        ?>
" class="do_input" /></p>
        </li>
        
        <?php 
    }
    $opt = get_option('ProjectTheme_alertpay_enable');
    if ($opt == "yes") {
        ?>
        
         <li>
        	<h2><?php 
        echo __('Payza Email', 'ProjectTheme');
        ?>
:</h2>
        	<p><input type="text" size="35" name="payza_email" value="<?php 
        echo get_user_meta($uid, 'payza_email', true);
        ?>
" class="do_input" /></p>
        </li>
       <?php 
    }
    ?>
 
        
         <li>
        	<h2><?php 
    echo __('New Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="password" size="35" /></p>
        </li>
        
        
        <li>
        	<h2><?php 
    echo __('Repeat Password', "ProjectTheme");
    ?>
:</h2>
        	<p><input type="password" value="" class="do_input" name="reppassword" size="35"  /></p>
        </li>
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_1');
    ?>
        
   		  <li>
        	<h2><?php 
    echo __('Profile Avatar', 'ProjectTheme');
    ?>
:</h2>
        	<p> <input type="file" name="avatar" /> <br/>
           <?php 
    _e('max file size: 1mb. Formats: jpeg, jpg, png, gif', 'ProjectTheme');
    ?>
            <br/>
            <img width="50" height="50" border="0" src="<?php 
    echo ProjectTheme_get_avatar($uid, 50, 50);
    ?>
" /> 
            </p>
        </li>
   
   
   <li>
   <?php 
    if (function_exists('cimy_extract_ExtraFields')) {
        cimy_extract_ExtraFields();
    }
    ?>
   </li> 
        
        
        <li>
        <h2>&nbsp;</h2>
        <p><input type="submit" name="save-info" class="my-buttons" value="<?php 
    _e("Save", 'ProjectTheme');
    ?>
" /></p>
        </li>
        
       </ul> 
        
               
        
           </div>
           </div>     
            
            <div class="clear10"></div>
            
            <div class="my_box3" >
           
            
            	<div class="box_title" id="other_infs_mm"><?php 
    _e("Other Information", 'ProjectTheme');
    ?>
</div>
                <div class="box_content">  
                
        <ul class="post-new3">
        
        
        <?php 
    do_action('ProjectTheme_pers_info_fields_2');
    ?>
        
        <?php 
    $user_tp = get_user_meta($uid, 'user_tp', true);
    if (empty($user_tp)) {
        $user_tp = 'all';
    }
    if ($user_tp == "all") {
        $catid = array('all', 'service_buyer', 'service_provider');
    } else {
        $catid = array($user_tp);
    }
    if (current_user_can('manage_options')) {
        $catid = array('all', 'service_buyer', 'service_provider');
    }
    $k = 0;
    $arr = ProjectTheme_get_users_category_fields($catid, $uid);
    $exf = '';
    for ($i = 0; $i < count($arr); $i++) {
        $exf .= '<li>';
        $exf .= '<h2>' . $arr[$i]['field_name'] . $arr[$i]['id'] . ':</h2>';
        $exf .= '<p>' . $arr[$i]['value'] . '</p>';
        $exf .= '</li>';
        $k++;
    }
    echo $exf;
    if (ProjectTheme_is_user_provider($uid)) {
        $k++;
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Hourly Rate', 'ProjectTheme');
        ?>
:</h2>
        	<p><?php 
        echo projectTheme_currency();
        ?>
<input type="text" size="7" name="per_hour" value="<?php 
        echo get_user_meta($uid, 'per_hour', true);
        ?>
" class="do_input" /> 
             *<?php 
        _e('your estimated hourly rate', 'ProjectTheme');
        ?>
</p>
        </li>
        
        <?php 
    }
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    $cid = $uid;
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
           
                            
        <li>
        	<h2><?php 
        echo __('Portfolio Pictures', 'ProjectTheme');
        ?>
:</h2>
        	<p>
			
             <div class="cross_cross">



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

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

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

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

    

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

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

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

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

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