Changeset 3269139
- Timestamp:
- 04/08/2025 07:01:04 PM (11 months ago)
- Location:
- privatecontent-free/trunk
- Files:
-
- 7 edited
-
js/frontend.js (modified) (2 diffs)
-
js/frontend.min.js (modified) (1 diff)
-
main_includes/front_ajax.php (modified) (4 diffs)
-
main_includes/user_auth.php (modified) (2 diffs)
-
privatecontent-free.php (modified) (2 diffs)
-
readme.txt (modified) (6 diffs)
-
settings/custom_fields.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
privatecontent-free/trunk/js/frontend.js
r3267439 r3269139 380 380 } 381 381 ) 382 .then(async response => {382 .then(async response => { 383 383 if(!response.ok) {return Promise.reject(response);} 384 const resp = (await response.text()); 384 const resp = (await response.text()).trim(); 385 386 // be sure there are no errors 387 if(resp && !(function(str) {try {new URL(str); return true;} catch(e) {return false;}})(str)) { 388 alert(resp); 389 return false; 390 } 391 385 392 386 393 $(document).trigger('pc_user_logout'); … … 391 398 } 392 399 393 if(typeof(forced_redirect) == 'undefined' ) {400 if(typeof(forced_redirect) == 'undefined' || !forced_redirect) { 394 401 window.location.href = (!resp) ? pc_set_pcac_param() : resp; 395 402 } -
privatecontent-free/trunk/js/frontend.min.js
r3267439 r3269139 1 !function(e){"use strict";let t=!1,n=!1,c=!1,i=!1;window.pc_set_pcac_param=function(e=!1,t=!1){if(e||(e=window.location.href),!pc_vars.use_pcac&&!t)return e;const n=new URL(e);return n.searchParams.set("pcac",(new Date).getTime()),n.toString()};const s=".pc_field_container input";if(e(document).on("focus",s,(function(t){e(this).parents(".pc_field_container").addClass("pc_focused_field")})).on("blur",s,(function(t){e(this).parents(".pc_field_container").removeClass("pc_focused_field")})),window.pc_honeypot_is_valid=function(e){return!!(e.find('[name="pc_hnpt_1"]').length&&e.find('[name="pc_hnpt_2"]').length&&e.find('[name="pc_hnpt_3"]').length)&&(""===e.find('[name="pc_hnpt_1"]').val()&&(null!=e.find('[name="pc_hnpt_2"]').val().match(/^[0-9]+$/)&&null!=e.find('[name="pc_hnpt_3"]').val().match(/^[0-9]+$/)))},window.location.href.indexOf("?pcac=")||window.location.href.indexOf("&pcac=")){const e=window.location.href.split("?");let t=e.length>1?e[1].split("&"):[];t.some(((e,n)=>{-1!==e.indexOf("pcac=")&&t.splice(n,1)}));let n=e[0];t.length&&(n+="?"+t.join("&")),window.history.replaceState(null,null,n)}e(document).on("submit",".pc_login_form",(function(t){t.preventDefault();const n=e(this),c=new FormData(n[0]);if(n.find(".pc_spinner_btn").length)return!1;c.append("pvtcont_nonce",pc_vars.nonce),a(n,c)}));const a=async function(t,n,i){if(c)return!1;if(!t.find('input[name="pc_auth_username"]').val()||!t.find('input[name="pc_auth_psw"]').val())return!1;if(pc_vars.abfa_blocked)return t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>'+pc_vars.abfa_error_mess+"</span></div>"),!1;const s=t.data("pc_redirect");return t.find("#pc_auth_message").empty(),t.find(".pc_hnpt_code").length&&!window.pc_honeypot_is_valid(t)?(t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>Bot test not passed</span></div>'),!1):(c=!0,t.find(".pc_auth_btn").addClass("pc_spinner_btn"),t.addClass("pc_login_form_acting"),n.append("action","pc_login_form_submit"),void 0!==i&&n.append("grecaptcha_token",i),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:n}).then((async n=>{if(!n.ok)return Promise.reject(n);const c=await n.json().catch((e=>(e.status=500,Promise.reject(e))));if("success"==c.resp){let n;t.find("#pc_auth_message").append('<div class="pc_success_mess"><span>'+c.mess+"<span></div>"),void 0===s||"refresh"==s?(n=c.redirect,c.redirect&&"refresh"!=s||(n=pc_set_pcac_param())):n=s,pc_vars.uid=c.uid,e(document).trigger("pc_user_login",[c.uid]),"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_login",{},c.uid),setTimeout((function(){window.location.href=n}),1e3)}else t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>'+c.mess+"</span></div>"),c.abfa&&(pc_vars.abfa_blocked=!0),t.removeClass("pc_login_form_acting")})).catch((e=>(e.status&&(console.error(e),t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>'+pc_vars.ajax_failed_mess+"</span></div>")),!1))).finally((()=>{c=!1,setTimeout((function(){t.find(".pc_auth_btn").removeClass("pc_spinner_btn")}),370)})))};let _;e(document).on("click",".pc_login_remember_me small",(function(){e(this).parents(".pc_login_remember_me").find(".pc_checkbox").trigger("click")})),window.pc_lf_labels_h_check=function(){document.querySelectorAll(".pc_login_form:not(.pc_forced_lf_long_labels)").forEach((function(e){if(!e.querySelector(".pc_lf_username label"))return!1;const t=e.querySelector(".pc_lf_username label").getBoundingClientRect().height,n=e.querySelector('input[name="pc_auth_username"]').getBoundingClientRect().height,c=e.querySelector(".pc_lf_psw label").getBoundingClientRect().height,i=e.querySelector('input[name="pc_auth_psw"]').getBoundingClientRect().height;(t>n||c>i)&&window.innerWidth>=440?e.classList.add("pc_lf_long_labels"):e.classList.remove("pc_lf_long_labels")}))},window.pc_lf_overlapping_smalls_check=function(){document.querySelectorAll(".pc_login_form:not(.pc_fullw_login_btns)").forEach((function(e){if(!e.querySelectorAll(".pc_login_smalls")[0].children.length||e.querySelectorAll(".pc_login_smalls")[0].children.length>1)return!1;const t=e.getBoundingClientRect().width;e.querySelector(".pc_auth_btn").getBoundingClientRect().width+(e.querySelectorAll(".pc_login_smalls")[0].children.length?e.querySelectorAll(".pc_login_smalls")[0].children[0].getBoundingClientRect().width:0)+300>t?e.classList.add("pc_long_smalls_fix"):e.classList.remove("pc_long_smalls_fix")}))},e(window).resize((function(){_&&clearTimeout(_),_=setTimeout((function(){pc_lf_labels_h_check(),window.pc_lf_overlapping_smalls_check()}),50)})),e(document).on("submit",".pc_del_user_form",(async function(t){t.preventDefault();const n=e(this),c=n.data("pc_redirect"),s=n.find("input[name=pc_del_user_psw]").val();if(!s.trim()||i)return!1;i=!0,n.find(".pc_del_user_btn").addClass("pc_spinner_btn"),n.find(".pc_user_del_message").empty();let a=new FormData;a.append("action","pc_user_del_ajax"),a.append("pc_ud_psw",s),a.append("pvtcont_nonce",pc_vars.nonce),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:a}).then((async t=>{if(!t.ok)return Promise.reject(t);const s=await t.json().catch((e=>(e.status=500,Promise.reject(e))));"success"==s.resp?(n.find(".pc_user_del_message").append('<div class="pc_success_mess"><span>'+s.mess+"<span></div>"),e(document).trigger("pc_user_profile_deletion"),"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_profile_deletion"),setTimeout((function(){window.location.href=c}),1e3)):(n.find(".pc_user_del_message").empty().append('<div class="pc_error_mess"><span>'+s.mess+"</span></div>"),i=!1)})).catch((e=>(e.status&&(console.error(e),n.find(".pc_user_del_message").empty().append('<div class="pc_error_mess"><span>'+pc_vars.ajax_failed_mess+"</span></div>")),!1))).finally((()=>{setTimeout((function(){n.find(".pc_del_user_btn").removeClass("pc_spinner_btn")}),370)}))})),e(document).on("click",".pc_logout_btn",(async function(){const t=e(this).data("pc_redirect"),n=e(this);n.addClass("pc_spinner_btn");let c=new FormData;return c.append("action","pc_logout_btn_handler"),c.append("pvtcont_nonce",pc_vars.nonce),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:c}).then((async n=>{if(!n.ok)return Promise.reject(n);const c= await n.text();e(document).trigger("pc_user_logout"),"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_logout"),window.location.href=void 0===t?c||pc_set_pcac_param():"refresh"==t?pc_set_pcac_param():t})).catch((e=>(e.status&&(console.error(e),alert(pc_vars.ajax_failed_mess)),!1))).finally((()=>{n.removeClass("pc_spinner_btn")}))})),e(document).on("submit",".pc_registration_form",(function(t){t.preventDefault();const n=e(this),c=new FormData(n[0]);c.append("pvtcont_nonce",pc_vars.nonce),p(n,c)}));const p=async function(t,c,i){if(n)return!1;if(!t.pc_validate_form_fieldset())return!1;if(t.find(".pc_pag_next:not(.pc_pag_btn_hidden)").length)return t.find(".pc_pag_next:not(.pc_pag_btn_hidden)").click(),!1;t.attr("id");const s=void 0===t.data("pc_cc")?"":t.data("pc_cc"),a=t.data("pc_redirect");return t.find(".pc_form_response").empty(),t.find(".pc_hnpt_code").length&&!window.pc_honeypot_is_valid(t)?(t.find(".pc_form_response").empty().append('<div class="pc_error_mess"><span>Bot test not passed</span></div>'),!1):(n=!0,e(window).trigger("pc_pre_form_submit",[t]),t.find(".pc_reg_btn").addClass("pc_spinner_btn"),c.append("action","pc_reg_form_submit"),c.append("form_id",t.data("form-id")),c.append("pc_cc",s),void 0!==i&&c.append("grecaptcha_token",i),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:c}).then((async n=>{if(!n.ok)return Promise.reject(n);const c=await n.json().catch((e=>(e.status=500,Promise.reject(e))));if("success"==c.resp){const n=pc_vars.uid;let i;pc_vars.uid=c.new_uid,e(document).trigger("pc_successful_registr",[t,c.new_uid,c.fid]),pc_vars.uid=n,"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_registration",{},c.new_uid),t.find(".pc_form_response").append('<div class="pc_success_mess"><span>'+c.mess+"<span></div>"),pc_vars.hide_reg_btn_on_succ&&t.find(".pc_reg_btn").remove(),void 0!==a&&"f-"!=a.substr(0,2)&&c.redirect&&-1!==c.redirect.indexOf("pay_for_order=true")?i=c.redirect:(i=void 0!==a?"f-"==a.substr(0,2)?a.substr(2):a:c.redirect,"refresh"==i&&(i=window.location.href)),i&&setTimeout((function(){window.location.href=i}),1e3)}else t.find(".pc_form_response").append('<div class="pc_error_mess">'+c.mess+"</div>"),e("#recaptcha_response_field").length&&Recaptcha.reload()})).catch((e=>(e.status&&(console.error(e),t.find(".pc_form_response").append('<div class="pc_error_mess">'+pc_vars.ajax_failed_mess+"</div>")),!1))).finally((()=>{n=!1,setTimeout((function(){t.find(".pc_reg_btn").removeClass("pc_spinner_btn")}),370)})))};let r;e(document).ready((function(e){e(document).on("keyup input",".pc_onlymail_reg .pc_f_email input",(function(){e(this).parents(".pc_registration_form").find(".pc_f_username input").val(e(this).val())}))})),window.pc_lc_select_setup=function(){return!e(".pc_multiselect, .pc_singleselect").length||("undefined"==typeof lc_select?(console.error("pvtContent: LC select script not found"),!1):void new lc_select(".pc_multiselect select, .pc_singleselect select",{wrap_width:"100%",addit_classes:["lcslt-pc-skin"],pre_placeh_opt:!0,labels:[pc_vars.lcslt_search,pc_vars.lcslt_add_opt,pc_vars.lcslt_select_opts+" ..",".. "+pc_vars.lcslt_no_match+" .."]}))},e(document).ready((function(){pc_lc_select_setup()})),window.pc_checkboxes_setup=function(){lc_switch(".pc_single_check input[type=checkbox], .pc_disclaimer_f input[type=checkbox]",{on_txt:"YES",off_txt:"NO",compact_mode:!0}),e(".pc_login_form input[type=checkbox], .pc_check_wrap input[type=checkbox], .pc_check_wrap input[type=radio], .pc_manag_check input[type=checkbox], .pc_manag_check input[type=radio]").each((function(){if(e(this).hasClass("pc_checkboxed"))return!0;const t=e(this),n=t.is(":checked")?"pc_checked":"",c="radio"==t.attr("type")?"pc_radio_cb":"",i=c?"•":"✓";t.addClass("pc_checkboxed").after('<div class="pc_checkbox '+c+" "+n+'" data-name="'+t.attr("name")+'" data-val="'+t.val()+'"><span>'+i+"</span></div>")}))},e(document).ready((function(){pc_checkboxes_setup()})),e(document).on("click","div.pc_checkbox",(function(){const t=e(this),n=t.hasClass("pc_radio_cb")?"radio":"checkbox",c=t.prev('input[type="'+n+'"][name="'+t.data("name")+'"][value="'+t.data("val")+'"]');if(!c.length)return!0;if(t.hasClass("pc_checked")){if("radio"==n)return!1;t.removeClass("pc_checked")}else"radio"==n&&(t.parents(".pc_check_wrap").find(".pc_checkbox").removeClass("pc_checked"),t.parents(".pc_check_wrap").find(".pc_checkboxed").each((function(){this.checked=!1}))),t.addClass("pc_checked");c[0].checked=!c[0].checked,c.trigger("input")})),e(document).on("click",".pc_check_label",(function(){e(this).prev(".pc_checkbox").trigger("click")})),window.pc_fluid_form_columnizer=function(){const e="object"==typeof pc_vars&&void 0!==pc_vars.fluid_form_thresh?parseInt(pc_vars.fluid_form_thresh,10):370;document.querySelectorAll(".pc_fluid_form").forEach((t=>{const n=getComputedStyle(t),c=t.clientWidth-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight);let i=1;for(;Math.ceil(c/i)>e&&Math.ceil(c/(i+1))>120;)i++;t.querySelectorAll("fieldset").forEach((e=>{e.style.gridTemplateColumns="repeat("+i+", 1fr)"})),t.querySelectorAll(".pc_fullw_field").forEach((e=>{e.style.gridColumn="1 / span "+i})),t.classList.add("pc_fluid_form_columnized"),t.setAttribute("data-col",i);const s=new CustomEvent("pc_form_columnized",{detail:{form:t,cols:i}});document.dispatchEvent(s)}))},pc_fluid_form_columnizer(),e(window).resize((function(){r&&clearTimeout(r),r=setTimeout((function(){pc_fluid_form_columnizer()}),50)})),(void 0===pc_vars.revealable_psw||pc_vars.revealable_psw)&&e(document).on("click",".pc_f_psw .pc_field_icon, .pc_lf_psw .pc_field_icon, .pc_del_user_form .pc_field_icon",(function(){const t="pc_visible_psw",n=e(this).parents(".pc_field_container").find("input"),c=e(this).find("i");n.hasClass(t)?(n.removeClass(t),n.attr("type","password"),c.attr("class","far fa-eye")):(n.addClass(t),n.attr("type","text"),c.attr("class","far fa-eye-slash"))})),e(document).on("click",".pc_pag_btn",(function(t){const n=e(this).parents("form").first();let c=parseInt(n.data("form-pag"),10),i=e(t.target).hasClass("pc_pag_next")?c+1:c-1;o(n,i)})),e(document).on("click",".pc_form_pag_progress span:not(.pc_fpp_current)",(function(t){const n=e(this).parents("form").first();parseInt(n.data("form-pag"),10);let c=parseInt(e(this).data("pag"),10);o(n,c)}));const o=function(c,i){if(t||n)return!0;let s=parseInt(c.data("form-pag"),10);const a=c.find("fieldset").length;if(i<0||i>a)return!1;const _=c.find("fieldset.pc_f_pag_"+i),p=c.find("fieldset.pc_f_pag_"+s);if(!c.pc_validate_form_fieldset())return e("body, html").animate({scrollTop:c.find("fieldset").not(".pc_hidden_fieldset").find(".pc_field_error").first().offset().top-50},500),!0;if(t=!0,c.css("height",c.outerHeight()),c.data("form-pag",i),c.find("> *").not("script, .pc_form_pag_progress").animate({opacity:0},150),c.find(".pc_form_pag_progress").length){c.find(".pc_form_pag_progress span").removeClass("pc_fpp_current pc_fpp_active");for(let e=1;e<=i;e++)c.find('.pc_form_pag_progress span[data-pag="'+e+'"]').addClass("pc_fpp_active");c.find('.pc_form_pag_progress span[data-pag="'+i+'"]').addClass("pc_fpp_current");const e=100/(a-1)*(i-1);c.find(".pc_form_pag_progress i").css("width",e+"%")}setTimeout((function(){_.removeClass("pc_hidden_fieldset");const e=c.outerHeight()-p.outerHeight(!0)+_.outerHeight(!0);c.animate({height:e},300),p.addClass("pc_hidden_fieldset"),i==a?c.find(".pc_pag_submit").show():c.find(".pc_pag_submit").hide(),setTimeout((function(){c.find("fieldset, .pc_pag_submit, .pc_pag_btn, .pc_form_response").animate({opacity:1},150),i==a?c.find(".pc_pag_next").addClass("pc_pag_btn_hidden"):c.find(".pc_pag_next").removeClass("pc_pag_btn_hidden"),i<2?c.find(".pc_pag_prev").addClass("pc_pag_btn_hidden"):c.find(".pc_pag_prev").removeClass("pc_pag_btn_hidden"),c.css("height","auto"),t=!1}),350)}),300)};e.fn.pc_validate_fields=function(){if(void 0===pc_vars.html5_validation||!pc_vars.html5_validation)return!0;if("function"!=typeof document.createElement("input").checkValidity)return!0;let t=!0,n={};return e(this).each((function(){if(!e(this).parents("section").first().is(":visible"))return!0;if(e(this).parents(".pc_check_wrap").length&&e(this).parents("section").find(".pc_req_field").length)return n[e(this).attr("name")]=e(this).parents("section.pc_form_field"),!0;if(e(this).is("input")&&void 0===e(this).attr("name"))return!0;if(e(this).parents("section.pc_form_field, section.pc_disclaimer_f").find(".pc_field_error").remove(),!e(this)[0].checkValidity()){t=!1;let n=e(this)[0].validationMessage;"."==n.substr(n.length-1)&&(n=n.substr(0,n.length-1)),e(this).parents("section.pc_form_field, section.pc_disclaimer_f").prepend('<div class="pc_field_error">'+n+"</div>")}})),e.each(n,(function(n,c){var i=!0;if(c.find(".pc_field_error").remove(),c.find("input[type=checkbox], input[type=radio]").each((function(){if(this.checked)return i=!1,!1})),i){var s=e('<input type="checkbox" name="" required="required" />')[0].validationMessage;"."==s.substr(s.length-1)&&(s=s.substr(0,s.length-1)),c.prepend('<div class="pc_field_error">'+s+"</div>"),t=!1}})),t},e.fn.pc_validate_form_fieldset=function(){return e(this).find("fieldset").not(".pc_hidden_fieldset").find("input, select, textarea").pc_validate_fields()},e(document).ready((function(e){e("body, form").on("change keyup input",".pc_form_field input, .pc_form_field select, .pc_form_field textarea, .pc_disclaimer_f input",(function(){e(this).pc_validate_fields()&&e(this).parents(".pc_form_field").find(".pc_field_error").pc_close_tooltip()}))})),e.fn.pc_close_tooltip=function(){var t=e(this);t.addClass("pc_fe_closing"),setTimeout((function(){t.remove()}),310)},e(document).ready((function(e){e("body, form").on("click",".pc_field_error",(function(){e(this).parents("form").find(".pc_field_error").each((function(){e(this).pc_close_tooltip()}))}))}));const d=window.location.href.replace(window.location.hash,"");if(-1!==d.indexOf("pc_wp_login_status_err")||-1!==d.indexOf("pc_wp_login_cust_err")){let e=d.split("?");const t=e[0],n=e[1].split("&");let c=[];n.forEach((e=>{-1===e.indexOf("pc_wp_login_status_err")&&-1===e.indexOf("pc_wp_login_cust_err")&&c.push(e)}));let i=c.length?t+"?"+c.join("?"):t;window.location.hash&&(i+=window.location.hash),history.replaceState(null,null,i)}}(jQuery);1 !function(e){"use strict";let t=!1,n=!1,c=!1,i=!1;window.pc_set_pcac_param=function(e=!1,t=!1){if(e||(e=window.location.href),!pc_vars.use_pcac&&!t)return e;const n=new URL(e);return n.searchParams.set("pcac",(new Date).getTime()),n.toString()};const s=".pc_field_container input";if(e(document).on("focus",s,(function(t){e(this).parents(".pc_field_container").addClass("pc_focused_field")})).on("blur",s,(function(t){e(this).parents(".pc_field_container").removeClass("pc_focused_field")})),window.pc_honeypot_is_valid=function(e){return!!(e.find('[name="pc_hnpt_1"]').length&&e.find('[name="pc_hnpt_2"]').length&&e.find('[name="pc_hnpt_3"]').length)&&(""===e.find('[name="pc_hnpt_1"]').val()&&(null!=e.find('[name="pc_hnpt_2"]').val().match(/^[0-9]+$/)&&null!=e.find('[name="pc_hnpt_3"]').val().match(/^[0-9]+$/)))},window.location.href.indexOf("?pcac=")||window.location.href.indexOf("&pcac=")){const e=window.location.href.split("?");let t=e.length>1?e[1].split("&"):[];t.some(((e,n)=>{-1!==e.indexOf("pcac=")&&t.splice(n,1)}));let n=e[0];t.length&&(n+="?"+t.join("&")),window.history.replaceState(null,null,n)}e(document).on("submit",".pc_login_form",(function(t){t.preventDefault();const n=e(this),c=new FormData(n[0]);if(n.find(".pc_spinner_btn").length)return!1;c.append("pvtcont_nonce",pc_vars.nonce),a(n,c)}));const a=async function(t,n,i){if(c)return!1;if(!t.find('input[name="pc_auth_username"]').val()||!t.find('input[name="pc_auth_psw"]').val())return!1;if(pc_vars.abfa_blocked)return t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>'+pc_vars.abfa_error_mess+"</span></div>"),!1;const s=t.data("pc_redirect");return t.find("#pc_auth_message").empty(),t.find(".pc_hnpt_code").length&&!window.pc_honeypot_is_valid(t)?(t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>Bot test not passed</span></div>'),!1):(c=!0,t.find(".pc_auth_btn").addClass("pc_spinner_btn"),t.addClass("pc_login_form_acting"),n.append("action","pc_login_form_submit"),void 0!==i&&n.append("grecaptcha_token",i),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:n}).then((async n=>{if(!n.ok)return Promise.reject(n);const c=await n.json().catch((e=>(e.status=500,Promise.reject(e))));if("success"==c.resp){let n;t.find("#pc_auth_message").append('<div class="pc_success_mess"><span>'+c.mess+"<span></div>"),void 0===s||"refresh"==s?(n=c.redirect,c.redirect&&"refresh"!=s||(n=pc_set_pcac_param())):n=s,pc_vars.uid=c.uid,e(document).trigger("pc_user_login",[c.uid]),"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_login",{},c.uid),setTimeout((function(){window.location.href=n}),1e3)}else t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>'+c.mess+"</span></div>"),c.abfa&&(pc_vars.abfa_blocked=!0),t.removeClass("pc_login_form_acting")})).catch((e=>(e.status&&(console.error(e),t.find("#pc_auth_message").empty().append('<div class="pc_error_mess"><span>'+pc_vars.ajax_failed_mess+"</span></div>")),!1))).finally((()=>{c=!1,setTimeout((function(){t.find(".pc_auth_btn").removeClass("pc_spinner_btn")}),370)})))};let _;e(document).on("click",".pc_login_remember_me small",(function(){e(this).parents(".pc_login_remember_me").find(".pc_checkbox").trigger("click")})),window.pc_lf_labels_h_check=function(){document.querySelectorAll(".pc_login_form:not(.pc_forced_lf_long_labels)").forEach((function(e){if(!e.querySelector(".pc_lf_username label"))return!1;const t=e.querySelector(".pc_lf_username label").getBoundingClientRect().height,n=e.querySelector('input[name="pc_auth_username"]').getBoundingClientRect().height,c=e.querySelector(".pc_lf_psw label").getBoundingClientRect().height,i=e.querySelector('input[name="pc_auth_psw"]').getBoundingClientRect().height;(t>n||c>i)&&window.innerWidth>=440?e.classList.add("pc_lf_long_labels"):e.classList.remove("pc_lf_long_labels")}))},window.pc_lf_overlapping_smalls_check=function(){document.querySelectorAll(".pc_login_form:not(.pc_fullw_login_btns)").forEach((function(e){if(!e.querySelectorAll(".pc_login_smalls")[0].children.length||e.querySelectorAll(".pc_login_smalls")[0].children.length>1)return!1;const t=e.getBoundingClientRect().width;e.querySelector(".pc_auth_btn").getBoundingClientRect().width+(e.querySelectorAll(".pc_login_smalls")[0].children.length?e.querySelectorAll(".pc_login_smalls")[0].children[0].getBoundingClientRect().width:0)+300>t?e.classList.add("pc_long_smalls_fix"):e.classList.remove("pc_long_smalls_fix")}))},e(window).resize((function(){_&&clearTimeout(_),_=setTimeout((function(){pc_lf_labels_h_check(),window.pc_lf_overlapping_smalls_check()}),50)})),e(document).on("submit",".pc_del_user_form",(async function(t){t.preventDefault();const n=e(this),c=n.data("pc_redirect"),s=n.find("input[name=pc_del_user_psw]").val();if(!s.trim()||i)return!1;i=!0,n.find(".pc_del_user_btn").addClass("pc_spinner_btn"),n.find(".pc_user_del_message").empty();let a=new FormData;a.append("action","pc_user_del_ajax"),a.append("pc_ud_psw",s),a.append("pvtcont_nonce",pc_vars.nonce),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:a}).then((async t=>{if(!t.ok)return Promise.reject(t);const s=await t.json().catch((e=>(e.status=500,Promise.reject(e))));"success"==s.resp?(n.find(".pc_user_del_message").append('<div class="pc_success_mess"><span>'+s.mess+"<span></div>"),e(document).trigger("pc_user_profile_deletion"),"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_profile_deletion"),setTimeout((function(){window.location.href=c}),1e3)):(n.find(".pc_user_del_message").empty().append('<div class="pc_error_mess"><span>'+s.mess+"</span></div>"),i=!1)})).catch((e=>(e.status&&(console.error(e),n.find(".pc_user_del_message").empty().append('<div class="pc_error_mess"><span>'+pc_vars.ajax_failed_mess+"</span></div>")),!1))).finally((()=>{setTimeout((function(){n.find(".pc_del_user_btn").removeClass("pc_spinner_btn")}),370)}))})),e(document).on("click",".pc_logout_btn",(async function(){const t=e(this).data("pc_redirect"),n=e(this);n.addClass("pc_spinner_btn");let c=new FormData;return c.append("action","pc_logout_btn_handler"),c.append("pvtcont_nonce",pc_vars.nonce),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:c}).then((async n=>{if(!n.ok)return Promise.reject(n);const c=(await n.text()).trim();if(c&&!function(e){try{return new URL(e),!0}catch(e){return!1}}(str))return alert(c),!1;e(document).trigger("pc_user_logout"),"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_logout"),window.location.href=void 0!==t&&t?"refresh"==t?pc_set_pcac_param():t:c||pc_set_pcac_param()})).catch((e=>(e.status&&(console.error(e),alert(pc_vars.ajax_failed_mess)),!1))).finally((()=>{n.removeClass("pc_spinner_btn")}))})),e(document).on("submit",".pc_registration_form",(function(t){t.preventDefault();const n=e(this),c=new FormData(n[0]);c.append("pvtcont_nonce",pc_vars.nonce),p(n,c)}));const p=async function(t,c,i){if(n)return!1;if(!t.pc_validate_form_fieldset())return!1;if(t.find(".pc_pag_next:not(.pc_pag_btn_hidden)").length)return t.find(".pc_pag_next:not(.pc_pag_btn_hidden)").click(),!1;t.attr("id");const s=void 0===t.data("pc_cc")?"":t.data("pc_cc"),a=t.data("pc_redirect");return t.find(".pc_form_response").empty(),t.find(".pc_hnpt_code").length&&!window.pc_honeypot_is_valid(t)?(t.find(".pc_form_response").empty().append('<div class="pc_error_mess"><span>Bot test not passed</span></div>'),!1):(n=!0,e(window).trigger("pc_pre_form_submit",[t]),t.find(".pc_reg_btn").addClass("pc_spinner_btn"),c.append("action","pc_reg_form_submit"),c.append("form_id",t.data("form-id")),c.append("pc_cc",s),void 0!==i&&c.append("grecaptcha_token",i),await fetch(pc_vars.ajax_url,{method:"POST",credentials:"same-origin",keepalive:!1,body:c}).then((async n=>{if(!n.ok)return Promise.reject(n);const c=await n.json().catch((e=>(e.status=500,Promise.reject(e))));if("success"==c.resp){const n=pc_vars.uid;let i;pc_vars.uid=c.new_uid,e(document).trigger("pc_successful_registr",[t,c.new_uid,c.fid]),pc_vars.uid=n,"function"==typeof window.pc_ga4_event&&window.pc_ga4_event("pc_user_registration",{},c.new_uid),t.find(".pc_form_response").append('<div class="pc_success_mess"><span>'+c.mess+"<span></div>"),pc_vars.hide_reg_btn_on_succ&&t.find(".pc_reg_btn").remove(),void 0!==a&&"f-"!=a.substr(0,2)&&c.redirect&&-1!==c.redirect.indexOf("pay_for_order=true")?i=c.redirect:(i=void 0!==a?"f-"==a.substr(0,2)?a.substr(2):a:c.redirect,"refresh"==i&&(i=window.location.href)),i&&setTimeout((function(){window.location.href=i}),1e3)}else t.find(".pc_form_response").append('<div class="pc_error_mess">'+c.mess+"</div>"),e("#recaptcha_response_field").length&&Recaptcha.reload()})).catch((e=>(e.status&&(console.error(e),t.find(".pc_form_response").append('<div class="pc_error_mess">'+pc_vars.ajax_failed_mess+"</div>")),!1))).finally((()=>{n=!1,setTimeout((function(){t.find(".pc_reg_btn").removeClass("pc_spinner_btn")}),370)})))};let r;e(document).ready((function(e){e(document).on("keyup input",".pc_onlymail_reg .pc_f_email input",(function(){e(this).parents(".pc_registration_form").find(".pc_f_username input").val(e(this).val())}))})),window.pc_lc_select_setup=function(){return!e(".pc_multiselect, .pc_singleselect").length||("undefined"==typeof lc_select?(console.error("pvtContent: LC select script not found"),!1):void new lc_select(".pc_multiselect select, .pc_singleselect select",{wrap_width:"100%",addit_classes:["lcslt-pc-skin"],pre_placeh_opt:!0,labels:[pc_vars.lcslt_search,pc_vars.lcslt_add_opt,pc_vars.lcslt_select_opts+" ..",".. "+pc_vars.lcslt_no_match+" .."]}))},e(document).ready((function(){pc_lc_select_setup()})),window.pc_checkboxes_setup=function(){lc_switch(".pc_single_check input[type=checkbox], .pc_disclaimer_f input[type=checkbox]",{on_txt:"YES",off_txt:"NO",compact_mode:!0}),e(".pc_login_form input[type=checkbox], .pc_check_wrap input[type=checkbox], .pc_check_wrap input[type=radio], .pc_manag_check input[type=checkbox], .pc_manag_check input[type=radio]").each((function(){if(e(this).hasClass("pc_checkboxed"))return!0;const t=e(this),n=t.is(":checked")?"pc_checked":"",c="radio"==t.attr("type")?"pc_radio_cb":"",i=c?"•":"✓";t.addClass("pc_checkboxed").after('<div class="pc_checkbox '+c+" "+n+'" data-name="'+t.attr("name")+'" data-val="'+t.val()+'"><span>'+i+"</span></div>")}))},e(document).ready((function(){pc_checkboxes_setup()})),e(document).on("click","div.pc_checkbox",(function(){const t=e(this),n=t.hasClass("pc_radio_cb")?"radio":"checkbox",c=t.prev('input[type="'+n+'"][name="'+t.data("name")+'"][value="'+t.data("val")+'"]');if(!c.length)return!0;if(t.hasClass("pc_checked")){if("radio"==n)return!1;t.removeClass("pc_checked")}else"radio"==n&&(t.parents(".pc_check_wrap").find(".pc_checkbox").removeClass("pc_checked"),t.parents(".pc_check_wrap").find(".pc_checkboxed").each((function(){this.checked=!1}))),t.addClass("pc_checked");c[0].checked=!c[0].checked,c.trigger("input")})),e(document).on("click",".pc_check_label",(function(){e(this).prev(".pc_checkbox").trigger("click")})),window.pc_fluid_form_columnizer=function(){const e="object"==typeof pc_vars&&void 0!==pc_vars.fluid_form_thresh?parseInt(pc_vars.fluid_form_thresh,10):370;document.querySelectorAll(".pc_fluid_form").forEach((t=>{const n=getComputedStyle(t),c=t.clientWidth-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight);let i=1;for(;Math.ceil(c/i)>e&&Math.ceil(c/(i+1))>120;)i++;t.querySelectorAll("fieldset").forEach((e=>{e.style.gridTemplateColumns="repeat("+i+", 1fr)"})),t.querySelectorAll(".pc_fullw_field").forEach((e=>{e.style.gridColumn="1 / span "+i})),t.classList.add("pc_fluid_form_columnized"),t.setAttribute("data-col",i);const s=new CustomEvent("pc_form_columnized",{detail:{form:t,cols:i}});document.dispatchEvent(s)}))},pc_fluid_form_columnizer(),e(window).resize((function(){r&&clearTimeout(r),r=setTimeout((function(){pc_fluid_form_columnizer()}),50)})),(void 0===pc_vars.revealable_psw||pc_vars.revealable_psw)&&e(document).on("click",".pc_f_psw .pc_field_icon, .pc_lf_psw .pc_field_icon, .pc_del_user_form .pc_field_icon",(function(){const t="pc_visible_psw",n=e(this).parents(".pc_field_container").find("input"),c=e(this).find("i");n.hasClass(t)?(n.removeClass(t),n.attr("type","password"),c.attr("class","far fa-eye")):(n.addClass(t),n.attr("type","text"),c.attr("class","far fa-eye-slash"))})),e(document).on("click",".pc_pag_btn",(function(t){const n=e(this).parents("form").first();let c=parseInt(n.data("form-pag"),10),i=e(t.target).hasClass("pc_pag_next")?c+1:c-1;o(n,i)})),e(document).on("click",".pc_form_pag_progress span:not(.pc_fpp_current)",(function(t){const n=e(this).parents("form").first();parseInt(n.data("form-pag"),10);let c=parseInt(e(this).data("pag"),10);o(n,c)}));const o=function(c,i){if(t||n)return!0;let s=parseInt(c.data("form-pag"),10);const a=c.find("fieldset").length;if(i<0||i>a)return!1;const _=c.find("fieldset.pc_f_pag_"+i),p=c.find("fieldset.pc_f_pag_"+s);if(!c.pc_validate_form_fieldset())return e("body, html").animate({scrollTop:c.find("fieldset").not(".pc_hidden_fieldset").find(".pc_field_error").first().offset().top-50},500),!0;if(t=!0,c.css("height",c.outerHeight()),c.data("form-pag",i),c.find("> *").not("script, .pc_form_pag_progress").animate({opacity:0},150),c.find(".pc_form_pag_progress").length){c.find(".pc_form_pag_progress span").removeClass("pc_fpp_current pc_fpp_active");for(let e=1;e<=i;e++)c.find('.pc_form_pag_progress span[data-pag="'+e+'"]').addClass("pc_fpp_active");c.find('.pc_form_pag_progress span[data-pag="'+i+'"]').addClass("pc_fpp_current");const e=100/(a-1)*(i-1);c.find(".pc_form_pag_progress i").css("width",e+"%")}setTimeout((function(){_.removeClass("pc_hidden_fieldset");const e=c.outerHeight()-p.outerHeight(!0)+_.outerHeight(!0);c.animate({height:e},300),p.addClass("pc_hidden_fieldset"),i==a?c.find(".pc_pag_submit").show():c.find(".pc_pag_submit").hide(),setTimeout((function(){c.find("fieldset, .pc_pag_submit, .pc_pag_btn, .pc_form_response").animate({opacity:1},150),i==a?c.find(".pc_pag_next").addClass("pc_pag_btn_hidden"):c.find(".pc_pag_next").removeClass("pc_pag_btn_hidden"),i<2?c.find(".pc_pag_prev").addClass("pc_pag_btn_hidden"):c.find(".pc_pag_prev").removeClass("pc_pag_btn_hidden"),c.css("height","auto"),t=!1}),350)}),300)};e.fn.pc_validate_fields=function(){if(void 0===pc_vars.html5_validation||!pc_vars.html5_validation)return!0;if("function"!=typeof document.createElement("input").checkValidity)return!0;let t=!0,n={};return e(this).each((function(){if(!e(this).parents("section").first().is(":visible"))return!0;if(e(this).parents(".pc_check_wrap").length&&e(this).parents("section").find(".pc_req_field").length)return n[e(this).attr("name")]=e(this).parents("section.pc_form_field"),!0;if(e(this).is("input")&&void 0===e(this).attr("name"))return!0;if(e(this).parents("section.pc_form_field, section.pc_disclaimer_f").find(".pc_field_error").remove(),!e(this)[0].checkValidity()){t=!1;let n=e(this)[0].validationMessage;"."==n.substr(n.length-1)&&(n=n.substr(0,n.length-1)),e(this).parents("section.pc_form_field, section.pc_disclaimer_f").prepend('<div class="pc_field_error">'+n+"</div>")}})),e.each(n,(function(n,c){var i=!0;if(c.find(".pc_field_error").remove(),c.find("input[type=checkbox], input[type=radio]").each((function(){if(this.checked)return i=!1,!1})),i){var s=e('<input type="checkbox" name="" required="required" />')[0].validationMessage;"."==s.substr(s.length-1)&&(s=s.substr(0,s.length-1)),c.prepend('<div class="pc_field_error">'+s+"</div>"),t=!1}})),t},e.fn.pc_validate_form_fieldset=function(){return e(this).find("fieldset").not(".pc_hidden_fieldset").find("input, select, textarea").pc_validate_fields()},e(document).ready((function(e){e("body, form").on("change keyup input",".pc_form_field input, .pc_form_field select, .pc_form_field textarea, .pc_disclaimer_f input",(function(){e(this).pc_validate_fields()&&e(this).parents(".pc_form_field").find(".pc_field_error").pc_close_tooltip()}))})),e.fn.pc_close_tooltip=function(){var t=e(this);t.addClass("pc_fe_closing"),setTimeout((function(){t.remove()}),310)},e(document).ready((function(e){e("body, form").on("click",".pc_field_error",(function(){e(this).parents("form").find(".pc_field_error").each((function(){e(this).pc_close_tooltip()}))}))}));const l=window.location.href.replace(window.location.hash,"");if(-1!==l.indexOf("pc_wp_login_status_err")||-1!==l.indexOf("pc_wp_login_cust_err")){let e=l.split("?");const t=e[0],n=e[1].split("&");let c=[];n.forEach((e=>{-1===e.indexOf("pc_wp_login_status_err")&&-1===e.indexOf("pc_wp_login_cust_err")&&c.push(e)}));let i=c.length?t+"?"+c.join("?"):t;window.location.hash&&(i+=window.location.hash),history.replaceState(null,null,i)}}(jQuery); -
privatecontent-free/trunk/main_includes/front_ajax.php
r3267439 r3269139 17 17 wp_die(json_encode(array( 18 18 'resp' => 'error', 19 'mess' => 'Missing or wrong nonce '19 'mess' => 'Missing or wrong nonce, please refresh the page and try again' 20 20 ))); 21 21 } … … 157 157 wp_die(json_encode(array( 158 158 'resp' => 'error', 159 'mess' => 'Missing or wrong nonce '159 'mess' => 'Missing or wrong nonce, please refresh the page and try again' 160 160 ))); 161 161 } … … 286 286 function pc_logout_btn_handler() { 287 287 if(!isset($_POST['pvtcont_nonce']) || !pc_static::verify_nonce($_POST['pvtcont_nonce'], 'pvtcont_ajax')) { 288 wp_die('Missing or wrong nonce ');288 wp_die('Missing or wrong nonce, please refresh the page and try again'); 289 289 } 290 290 … … 322 322 wp_die(json_encode(array( 323 323 'resp' => 'error', 324 'mess' => 'Missing or wrong nonce '324 'mess' => 'Missing or wrong nonce, please refresh the page and try again' 325 325 ))); 326 326 } -
privatecontent-free/trunk/main_includes/user_auth.php
r3267439 r3269139 149 149 150 150 151 151 152 //////////////////////////////////////////////////////////////// 153 154 155 156 157 // WP 6.8+ disable speculative loading for logged users 158 add_action('pc_user_session_checked', function($user_id) { 159 if(!$user_id) { 160 return false; 161 } 162 163 add_filter('wp_speculation_rules_href_exclude_paths', function($exclude_paths, $mode) { 164 $exclude_paths[] = '/*'; 165 return $exclude_paths; 166 }, 9999999, 2); 167 }); 168 169 170 171 172 //////////////////////////////////////////////////////////////// 173 152 174 153 175 … … 174 196 }, 9999); // be sure also WP user session is set up 175 197 198 -
privatecontent-free/trunk/privatecontent-free.php
r3267439 r3269139 2 2 /* 3 3 Plugin Name: PrivateContent Free 4 Plugin URI: https:// lcweb.it/privatecontent-multilevel-content-plugin/4 Plugin URI: https://wordpress.org/plugins/privatecontent-free/ 5 5 Description: Your first step in the top WordPress multilevel contents restriction solution 6 6 Author: Luca Montanari (LCweb) 7 7 Author URI: https://lcweb.it 8 Version: 1.0. 08 Version: 1.0.1 9 9 License: GPLv2 or later 10 10 Requires at least: 5.0 … … 32 32 33 33 // plugin version 34 define('PC_VERS', ' 9.3.0');34 define('PC_VERS', '1.0.1'); 35 35 36 36 // indovina indovinello -
privatecontent-free/trunk/readme.txt
r3267444 r3269139 4 4 Tags: permissions, memberships, registration, restriction, access 5 5 Requires at least: 5.0 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 7.0 8 Stable tag: 1.0. 08 Stable tag: 1.0.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 22 22 23 23 24 = 🌟 Main Features=24 == 🌟 Main Features == 25 25 26 26 * **User levels:** unlimited. Each user can have one or multiple levels … … 40 40 41 41 42 = ⌚ Get started in minutes=42 == 🕒 Get started in minutes == 43 43 44 44 Whether you have a large site or creating a new project, PrivateContent is **ready to operate out of the box**. With **6 preset styles** and eventually importing existing WordPress users, your multilevel-proteced website will be ready in a flash! 45 45 46 46 47 = 🌎 100% translatable=47 == 🌎 100% translatable == 48 48 49 49 Each section is translatable: the plugin has already been (fully or partially) **translated into 27 languages!** … … 51 51 52 52 53 = 📑 GDPR Compliant=53 == 📑 GDPR Compliant == 54 54 55 55 The plugin fully satisfies the most recent law requirements in terms of data protection and users management. For example, there is a dedicated module to let users **delete their profiles autonomously**. 56 56 57 57 58 = ⌨️ Dev oriented API and hooks=58 == ⌨️ Dev oriented API and hooks == 59 59 60 60 PrivateContent is extremely flexible and **ready to be extended** almost in any way you could imagine. The [official premium add-ons](https://lcweb.it/products-overview/#pc_suite) offers incredible features for specific needs, but if you are a developer there's a [dedicated documentation](https://lcweb.it/privatecontent/public-api) guiding you step-by-step to build your systems on top of the PrivateContent engine! 61 61 62 62 63 = 🚀 PrivateContent Free version is just the beginning=63 == 🚀 PrivateContent Free version is just the beginning == 64 64 65 65 Since 2012, the plugin has been constantly improved and extended, becoming a real reference in the WordPress world when it comes to protect WordPress website contents. Here's a summary of what you get with the [premium version](https://lcweb.it/privatecontent-multilevel-content-plugin/): 66 66 67 ** Additional core systems ** 67 **Additional core systems** 68 68 69 * Lightbox engine 69 70 * Native [Elementor](https://be.elementor.com/visit/?bta=1930&brand=elementor), Divi, WPBakery Builder widgets integration 70 71 * Google reCaptcha anti-spam integration 71 72 72 ** Users membership ** 73 **Users membership** 74 73 75 * Multiple registration forms 74 76 * Advanced users search with direct search-to-export … … 78 80 * Preset/fixed contents for Users reserved page with advanced themes/builders integrations 79 81 80 ** Contents restriction ** 82 **Contents restriction** 83 81 84 * Private block shortcode with optional warning box containing login/register buttons 82 85 * Restrict any public custom post type or taxonomy … … 103 106 104 107 108 == Screenshots == 109 110 1. Users list 111 2. Live restrictions preview 112 3. Backend user Dashboard 113 114 115 105 116 == Changelog == 117 118 = 1.0.2 = 119 * added: anti-cache system for logged users (WP 6.8) 120 * new: better returned string handling for AJAX logout button 121 * fixed: registration error if "no registration categories" are used as custom assignment in registration form 106 122 107 123 = 1.0 = -
privatecontent-free/trunk/settings/custom_fields.php
r3267439 r3269139 41 41 // options 42 42 $opts = array( 43 '' => ($field_id == 'pg_logged_user_redirect') ? '- '. esc_html__('Refresh the page', 'privatecontent-free') : '- '. esc_html__('Do not redirect users', 'privatecontent-free'), 43 '' => (in_array($field_id, array('pg_logged_user_redirect', 'pg_logout_user_redirect'))) ? 44 '- '. esc_html__('Refresh the page', 'privatecontent-free') : '- '. esc_html__('Do not redirect users', 'privatecontent-free'), 45 44 46 'use_main' => '- '. esc_html__('Use main redirect target', 'privatecontent-free'), 45 47 'custom' => '- '. esc_html__('Custom redirect', 'privatecontent-free')
Note: See TracChangeset
for help on using the changeset viewer.