wp_redirect(get_bloginfo('siteurl') . "/wp-login.php"); exit; } get_currentuserinfo; $post = get_post($pid); $uid = $current_user->ID; $title = $post->post_title; $cid = $current_user->ID; if ($uid != $post->post_author) { echo 'Not your post. Sorry!'; exit; } //------------------------------------- $cid = $uid; //---autodrafting $new_pid = ProjectTheme_get_auto_draft($uid); $itwas_reposted = get_post_meta($new_pid, 'itwas_reposted_', true); if (empty($itwas_reposted)) { update_post_meta($new_pid, 'itwas_reposted_', "done"); $args = array('order' => 'ASC', 'orderby' => 'post_date', 'post_type' => 'attachment', 'post_parent' => $pid, 'post_status' => null, 'numberposts' => -1); $attachments = get_posts($args); $uploads = wp_upload_dir(); foreach ($attachments as $att) { $img_url = wp_get_attachment_url($att->ID); $basedir = $uploads['basedir'] . '/'; $exp = explode('/', $img_url); $nr = count($exp); $pic = $exp[$nr - 1]; $year = $exp[$nr - 3]; $month = $exp[$nr - 2]; if ($uploads['basedir'] == $uploads['path']) {
function projectTheme_template_redirect() { global $wp; global $wp_query, $post, $wp_rewrite; if (isset($_GET['_ad_delete_pid'])) { if (is_user_logged_in()) { $pid = $_GET['_ad_delete_pid']; $pstpst = get_post($pid); global $current_user; get_currentuserinfo(); if ($pstpst->post_author == $current_user->ID or current_user_can('manage_options')) { wp_delete_post($_GET['_ad_delete_pid']); echo "done"; } } exit; } if (isset($_GET['my_upload_of_project_files'])) { get_template_part('lib/upload_main/uploady2'); die; } if (isset($_GET['my_upload_of_project_files_proj'])) { get_template_part('lib/upload_main/uploady5'); die; } if (isset($_GET['my_upload_of_project_files2'])) { get_template_part('lib/upload_main/uploady'); die; } if (isset($_GET['alert_ipn'])) { projectTheme_alert_pay_IPN(); die; } if (isset($_GET['my_upload_of_project_files8'])) { get_template_part('lib/upload_main/uploady8'); die; } if (isset($_GET['complete_paypal_escrow'])) { get_template_part('lib/gateways/complete_paypal_escrow'); die; } if (isset($_GET['get_subcats_for_me'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('project_cat', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="do_input_new" name="subcat">'; $ret .= '<option value="">' . __('Select Subcategory', 'ProjectTheme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } if (isset($_GET['get_locscats_for_me'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('project_location', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="do_input_new" name="subloc" onchange="display_subcat3(this.value)">'; $ret .= '<option value="">' . __('Select Sublocation', 'ProjectTheme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } if (isset($_GET['set_image_for_term'])) { if (is_user_logged_in()) { $term_id = $_GET['term_id']; $attachment_id = $_GET['attachment_id']; update_post_meta($attachment_id, 'category_image', $term_id); } die; } //--------------------------- if (isset($_GET['get_locscats_for_me2'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('project_location', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="do_input_new" name="subloc2" >'; $ret .= '<option value="">' . __('Select Sublocation', 'ProjectTheme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } //--------------------------------------------------- if (isset($_GET['redirect_search'])) { if ($_POST['redirect_search'] == "freelancers") { $_SESSION['tt_ss'] = 'freelancers'; $string = "username="******"?" . $string); } else { wp_redirect($ProjectTheme_provider_search_page_id . "&" . $string); } } else { $_SESSION['tt_ss'] = 'projects'; $string = "term=" . urlencode($_POST['input_text_serch']); $ProjectTheme_advanced_search_page_id = get_permalink(get_option('ProjectTheme_advanced_search_page_id')); $perm = ProjectTheme_using_permalinks(); if ($perm == true) { wp_redirect($ProjectTheme_advanced_search_page_id . "?" . $string); } else { wp_redirect($ProjectTheme_advanced_search_page_id . "&" . $string); } } exit; } if (isset($_GET['get_my_project_vl_thing'])) { $pids = $_POST['queryString']; if ($pids == 0) { echo 0; die; } $ar = 1; $bids = Bid::get_by_pid_uid($pids, $uid = '', $single = false, $filters = array("winner='1'", "paid='0'", "outstanding='0'", "delivered='1'")); echo '<select name="uids" onchange="on_winner_sel();" required="">'; foreach ($bids as $key => $bid) { $escrow = Escrow::get_by_field('bid', $bid->id); if (!isset($escrow)) { $user = get_userdata($bid->uid); echo '<option value="' . $bid->uid . '" bid="' . $bid->id . '">' . $user->user_login . '</option>'; } } echo "</select>"; //echo $bid->bid; die; } $my_pid = $post->ID; $parent = $post->post_parent; $paagee = $wp_query->query_vars['my_custom_page_type']; $p_action = $wp_query->query_vars['p_action']; $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id'); $ProjectTheme_post_new_page_id = get_option('ProjectTheme_post_new_page_id'); $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id'); //------------- if (isset($_GET['redir1'])) { $_SESSION['redir1'] = $_GET['redir1']; } if (($parent == $ProjectTheme_my_account_page_id or $my_pid == get_option('ProjectTheme_my_account_milestones_id')) and !empty($my_pid)) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } } //------------- $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp'); if ($ProjectTheme_enable_2_user_tp == "yes" && $p_action != 'choose_user_tp') { if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); $user_tp = get_user_meta($current_user->ID, 'user_tp', true); if (empty($user_tp) && !current_user_can('level_10')) { wp_redirect(get_bloginfo('siteurl') . "/?p_action=choose_user_tp"); exit; } } } if ($p_action == "payza_listing") { get_template_part('lib/gateways/payza_listing'); die; } if (isset($_GET['notify_chained'])) { if ($_POST['status'] == "INCOMPLETE") { $trID = $_POST['tracking_id']; $trID = explode("_", $trID); $pid = $trID[0]; update_post_meta($pid, 'outstanding', "1"); //update_post_meta($pid, 'paid_user',"1"); //update_post_meta($pid, "paid_user_date", current_time('timestamp',0)); update_post_meta($pid, "adaptive_done", "started"); $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid); ProjectTheme_send_email_on_escrow_project_to_bidder($pid, $projectTheme_get_winner_bid->uid, $_POST['amount']); ProjectTheme_send_email_on_escrow_project_to_owner($pid, $_POST['amount']); //$projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid); //ProjectTheme_send_email_when_on_completed_project($pid, $projectTheme_get_winner_bid->uid, $projectTheme_get_winner_bid->bid); } } if (isset($_GET['return_chained'])) { $ret_id = $_GET['return_chained']; $pid_d = get_option('adaptive_payment_ID_thing_' . $ret_id); wp_redirect(get_permalink(get_option('ProjectTheme_my_account_awaiting_completion_id'))); exit; } //------------ if ($my_pid == $ProjectTheme_post_new_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url() . '?redirect_to=' . urlencode(get_permalink($ProjectTheme_post_new_page_id))); exit; } global $current_user; get_currentuserinfo(); if (!ProjectTheme_is_user_business($current_user->ID)) { wp_redirect(get_bloginfo('siteurl') . '?contr_error=1'); /*wp_redirect(get_bloginfo('siteurl'));*/ exit; } if (!isset($_GET['projectid'])) { $set_ad = 1; } else { $set_ad = 0; } if (!empty($_GET['projectid'])) { $my_main_post = get_post($_GET['projectid']); if ($my_main_post->post_author != $current_user->ID) { wp_redirect(get_bloginfo('siteurl')); exit; } } if ($set_ad == 1) { $pid = ProjectTheme_get_auto_draft($current_user->ID); wp_redirect(ProjectTheme_post_new_with_pid_stuff_thg($pid)); } get_template_part('lib/post_new_post'); } //------------- if ($my_pid == $ProjectTheme_my_account_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } } //---------------------------------------------------- if ($p_action == "choose_user_tp") { get_template_part('lib/choose_user_tp'); die; } if (isset($_GET['autosuggest'])) { get_template_part('autosuggest'); } if ($p_action == "mark_delivered") { get_template_part('lib/my_account/mark_delivered'); die; } if ($p_action == "work_timer") { get_template_part('lib/my_account/work_timer'); die; } if ($p_action == "mark_completed") { get_template_part('lib/my_account/mark_completed'); die; } if ($p_action == "mark_in_progress") { get_template_part('lib/my_account/mark_in_progress'); die; } if ($p_action == "credits_listing") { get_template_part('lib/gateways/credits_listing'); die; } if ($p_action == "relist_this_done") { get_template_part('lib/my_account/relist_this_done'); die; } if ($p_action == "mb_listing_response") { get_template_part('lib/gateways/moneybookers_listing_response'); die; } if ($p_action == "mb_listing") { get_template_part('lib/gateways/moneybookers_listing'); die; } if ($p_action == "paypal_listing") { get_template_part('lib/gateways/paypal_listing'); die; } if ($p_action == "pay_for_project_paypal") { get_template_part('lib/gateways/pay_for_project_paypal'); die; } if ($p_action == "edit_project") { get_template_part('lib/my_account/edit_project'); die; } if ($p_action == "rate_user") { get_template_part('lib/my_account/rate_user'); die; } if ($p_action == "choose_winner") { get_template_part('lib/choose_winner'); die; } if ($p_action == "group_winner") { get_template_part('lib/group_winner'); die; } if ($p_action == "remove_provider") { get_template_part('lib/remove_provider'); die; } if ($p_action == "user_profile") { get_template_part('lib/user-profile'); die; } if ($p_action == "user_feedback") { get_template_part('lib/user-feedback'); die; } if ($p_action == "delete_project") { get_template_part('lib/my_account/delete_project'); die; } if ($p_action == "close_project") { get_template_part('lib/my_account/close_project'); die; } if ($p_action == "repost_project") { get_template_part('lib/my_account/repost_project'); die; } if ($p_action == "paypal_deposit_pay") { get_template_part('lib/gateways/paypal_deposit_pay'); die; } if ($p_action == "payza_deposit_pay") { get_template_part('lib/gateways/payza_deposit_pay'); die; } if ($p_action == "mb_deposit_response") { get_template_part('lib/gateways/mb_deposit_response'); die; } if ($p_action == "mb_deposit_pay") { get_template_part('lib/gateways/mb_deposit_pay'); die; } if ($paagee == "pay_projects_by_credits") { get_template_part('lib/pay-projects-by-credits'); die; } if ($paagee == "show-all-categories") { get_template_part('lib/show-all-categories'); die; } if ($paagee == "show-all-locations") { get_template_part('lib/show-all-locations'); die; } if ($paagee == "post-new") { get_template_part('post-new'); die; } if ($paagee == "pay_paypal") { get_template_part('lib/gateways/paypal'); die; } if ($paagee == "advanced_search") { get_template_part('lib/advanced-search'); die; } if ($paagee == "alert-pay-return") { get_template_part('lib/gateways/alert-pay-return'); die; } if (isset($_GET['get_files_panel'])) { get_template_part('lib/get_files_panel'); die; } if (isset($_GET['get_bidding_panel'])) { get_template_part('lib/bidding-panel'); die; } if (isset($_GET['get_message_board'])) { get_template_part('lib/message-board'); die; } if ($paagee == "all-blog-posts") { get_template_part('lib/blog'); die; } if ($paagee == "all_featured_projects") { get_template_part('lib/all_featured_projects'); die; } if ($paagee == "user_feedback") { get_template_part('lib/user-feedback'); die; } if ($paagee == "buy_now") { get_template_part('lib/buy-now'); die; } if ($paagee == "pay-for-project") { get_template_part('lib/gateways/paypal-project'); die; } if ($paagee == "deposit_pay") { get_template_part('lib/gateways/deposit-pay'); die; } }
function projectTheme_template_redirect() { global $wp; global $wp_query, $post, $wp_rewrite; $my_pid = $post->ID; $parent = $post->post_parent; $paagee = $wp_query->query_vars['my_custom_page_type']; $p_action = $wp_query->query_vars['p_action']; $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id'); $ProjectTheme_post_new_page_id = get_option('ProjectTheme_post_new_page_id'); $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id'); //------------- if ($parent == $ProjectTheme_my_account_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } } //------------- $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp'); if ($ProjectTheme_enable_2_user_tp == "yes" && $p_action != 'choose_user_tp') { if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); $user_tp = get_user_meta($current_user->ID, 'user_tp', true); if (empty($user_tp) && !current_user_can('level_10')) { wp_redirect(get_bloginfo('siteurl') . "/?p_action=choose_user_tp"); exit; } } } if (isset($_GET['notify_chained'])) { if ($_POST['status'] == "COMPLETED") { $trID = $_POST['tracking_id']; $trID = explode("_", $trID); $pid = $trID[0]; update_post_meta($pid, 'paid_user', "1"); update_post_meta($pid, "paid_user_date", current_time('timestamp', 0)); $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid); ProjectTheme_send_email_when_on_completed_project($pid, $projectTheme_get_winner_bid->uid, $projectTheme_get_winner_bid->bid); } } if (isset($_GET['return_chained'])) { $ret_id = $_GET['return_chained']; $pid_d = get_option('adaptive_payment_ID_thing_' . $ret_id); wp_redirect(projectTheme_my_account_link()); exit; } //------------ if ($my_pid == $ProjectTheme_post_new_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } global $current_user; get_currentuserinfo(); if (!ProjectTheme_is_user_business($current_user->ID)) { wp_redirect(get_bloginfo('siteurl')); exit; } if (!isset($_GET['projectid'])) { $set_ad = 1; } else { $set_ad = 0; } if (!empty($_GET['projectid'])) { $my_main_post = get_post($_GET['projectid']); if ($my_main_post->post_author != $current_user->ID) { wp_redirect(get_bloginfo('siteurl')); exit; } } if ($set_ad == 1) { $pid = ProjectTheme_get_auto_draft($current_user->ID); wp_redirect(ProjectTheme_post_new_with_pid_stuff_thg($pid)); } include 'lib/post_new_post.php'; } //------------- if ($my_pid == $ProjectTheme_my_account_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } } //---------------------------------------------------- if ($p_action == "choose_user_tp") { include 'lib/choose_user_tp.php'; die; } if (isset($_GET['autosuggest'])) { include 'autosuggest.php'; } if ($p_action == "mark_delivered") { include 'lib/my_account/mark_delivered.php'; die; } if ($p_action == "mark_completed") { include 'lib/my_account/mark_completed.php'; die; } if ($p_action == "credits_listing") { include 'lib/gateways/credits_listing.php'; die; } if ($p_action == "relist_this_done") { include 'lib/my_account/relist_this_done.php'; die; } if ($p_action == "mb_listing_response") { include 'lib/gateways/moneybookers_listing_response.php'; die; } if ($p_action == "mb_listing") { include 'lib/gateways/moneybookers_listing.php'; die; } if ($p_action == "paypal_listing") { include 'lib/gateways/paypal_listing.php'; die; } if ($p_action == "pay_for_project_paypal") { include 'lib/gateways/pay_for_project_paypal.php'; die; } if ($p_action == "edit_project") { include 'lib/my_account/edit_project.php'; die; } if ($p_action == "rate_user") { include 'lib/my_account/rate_user.php'; die; } if ($p_action == "choose_winner") { include 'lib/choose_winner.php'; die; } if ($p_action == "user_profile") { include 'lib/user-profile.php'; die; } if ($p_action == "user_feedback") { include 'lib/user-feedback.php'; die; } if ($p_action == "delete_project") { include 'lib/my_account/delete_project.php'; die; } if ($p_action == "repost_project") { include 'lib/my_account/repost_project.php'; die; } if ($p_action == "paypal_deposit_pay") { include 'lib/gateways/paypal_deposit_pay.php'; die; } if ($p_action == "mb_deposit_response") { include 'lib/gateways/mb_deposit_response.php'; die; } if ($p_action == "mb_deposit_pay") { include 'lib/gateways/mb_deposit_pay.php'; die; } if ($paagee == "pay_projects_by_credits") { include 'lib/pay-projects-by-credits.php'; die; } if ($paagee == "show-all-categories") { include 'lib/show-all-categories.php'; die; } if ($paagee == "show-all-locations") { include 'lib/show-all-locations.php'; die; } if ($paagee == "post-new") { include 'post-new.php'; die; } if ($paagee == "pay_paypal") { include 'lib/gateways/paypal.php'; die; } if ($paagee == "advanced_search") { include 'lib/advanced-search.php'; die; } if ($paagee == "alert-pay-return") { include 'lib/gateways/alert-pay-return.php'; die; } if (isset($_GET['get_files_panel'])) { include 'lib/get_files_panel.php'; die; } if (isset($_GET['get_bidding_panel'])) { include 'lib/bidding-panel.php'; die; } if (isset($_GET['get_message_board'])) { include 'lib/message-board.php'; die; } if ($paagee == "all-blog-posts") { include 'lib/blog.php'; die; } if ($paagee == "all_featured_projects") { include 'lib/all_featured_projects.php'; die; } if ($paagee == "user_feedback") { include 'lib/user-feedback.php'; die; } if ($paagee == "buy_now") { include 'lib/buy-now.php'; die; } if ($paagee == "pay-for-project") { include 'lib/gateways/paypal-project.php'; die; } if ($paagee == "deposit_pay") { include 'lib/gateways/deposit-pay.php'; die; } }