i have a new installed page with your plugin 1.9.4
the iframe will not work.
my settings:
/var/www/vhosts/deutschland-stirbt.de/esc-commerce/wordpress/wp-content/
your script for overall_footer.html
Code: Select all
<script type="text/javascript">
document.domain = 'esc-commerce.de'; // MANDATORY! // Set/Change this value to your domain (example: axew3.com (or leave localhost if on localhost))
var wordpress_url_page_forum = 'https://esc-commerce.de/forum'; // MANDATORY! // (DO NOT ADD/INCLUDE final slash here) Url that point to your iframed wordpress forum page
var w3all_doc_domain = document.domain;
var w3allappend = false;
var boardU = "{BOARD_URL}";
// Lightbox correct scroll fix:
// https://www.axew3.com/w3/forums/viewtopic.php?f=13&t=885
// remove /* and */ to activate, also more below to complete ...
/*
$(".postimage").on("click", function(event) {
var pos = event.pageY - 100;
$(parent.window).scrollTop( 200 );
var el = document.getElementById("lightbox");
$("#lightboxOverlay").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lb-close").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lightbox").on("click", function() {
$(parent.window).scrollTop( pos );
});
});
*/
function w3allNormalize_phpBBUrl(href){
// try to 'normalize' passed relative links: needed all after last slash /
// exception are kind of passed urls like: /phpbb323/app.php/help/faq
// and if SEO mods that may assign some different kind of links values
// by the way, SEO absolute urls http(s) should be (all?) already considered here ...
var phpbbRUrl = href.split(/^.+?(\w+.+)$/);
if( href.indexOf('app.php') > -1 ){ // since the previous not 'normalize' this type of passed value (and may miss something else)
phpbburl = href.split(/^.+?(app\.php.+)$/);
w3allappend = phpbburl[1];
} else if ( /^https?/ig.exec(href) !== null ){ // absolute http(s) passed: try to 'normalize' a possible seo mod
phpbburl = href.split(boardU);
w3allappend = phpbburl[1];
} else if ( phpbbRUrl[1] && phpbbRUrl[1].length > 1 ){ // 'normalize' any other
w3allappend = phpbbRUrl[1];
} else if ( phpbbRUrl[0].length > 1 ){
w3allappend = phpbbRUrl[0];
}
// ... if still not normalized
if(/^\W/ig.exec(w3allappend) !== null){
w3allappend = w3allappend.split(/^.+?(\w+.+)$/);
if(w3allappend[1]){
w3allappend = w3allappend[1];
}
if ( w3allappend[1] && w3allappend[1].charAt(0) == '/' ){
w3allappend = w3allappend[1].substr(1);
}
}
return w3allappend;
}
$(document).on("click", "a", function(e) {
var href = $(this).attr("href");
if( /[^-0-9A-Za-z\._#\:\?\/=&%]/ig.exec(href) !== null ){
return;
}
// check if link point to external resource
if ((this.href.indexOf(boardU) > -1) != true){
if(/^(f|ht)tps?:\/\//i.test(href)){
e.preventDefault(); // prevent load as we are inside
parent.location.replace(href);
return;
}
}
// check for single # or links like on FAQ page, so like #f4r6 or #f0r0 default phpBB, with a chance of lenght 8 whenever exists something custom more long(??)
if ( href.charAt(0) == '#' && href.length == 1 || /^#[a-z0-9]+$/ig.exec(href) !== null && href.length < 8 ){
return;
}
w3allappend = w3allNormalize_phpBBUrl(href);
var w3all_parent_element_id = $(this).parent().get( 0 ).id; // detect click x ... (ex: return ID smiley-box, onclick post smiles) ... // detect and avoid/allow certain behaviors
var w3all_onclick_smile = (w3all_parent_element_id.indexOf('smiley-box') > -1);
var w3all_onview_topic = (href.indexOf('viewtopic.php') > -1);
var w3all_onview_attach = (href.indexOf('file.php') > -1);
var w3all_onreview_post = /#[review]+/ig.exec(href);
var w3all_ck_quickmod = (href.indexOf('quickmod') > -1);
var w3all_onreply_topic = (href.indexOf('mode=reply') > -1);
var w3all_ck_onindex = (href.indexOf('index.php') > -1);
// complete Lightbox correct attachment display // activate removing /* and */
// or used to open on new tab attachments
/*
if(w3all_onview_attach !== false){
e.preventDefault();
window.open(href,'_blank');
return;
} */
if ( w3all_onclick_smile == false && w3all_onview_attach == false && w3all_onreview_post == null ) {
if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,50); // change 50 to another value may 0 or 100 or 500. Top distance gap in px when page scroll top
}
if ('parentIFrame' in window) window.parentIFrame.sendMessage(w3allappend);
});
///////////////////////////////////////////////////////////////////////////
// w3all Ajax UPDATES for phpBB events
//if (window.frameElement) { // if in iframe
if (window.self !== window.top) {
window.onload = function() {
var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";
// to send to wp at once here
var w3appendevents = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged;
parent.w3all_ajaxup_from_phpbb(w3appendevents);
}
// fix vertical iframe centered on viewtopic.php, preview or where # anchor etc (but skip on iOS)
var w3iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
if(w3iOS == false){
$(window).load(function() {
var bd = document.getElementsByTagName("body");
for (var i = 0; i < bd.length; i++) {
var bdID = bd[i].getAttribute("id");
}
var elt = document.getElementById(bdID);
elt.setAttribute("style", "position:fixed;top:0%;left:0%;width:100%;margin:0px;");
});
}
$( "a" ).contextmenu(function() {
var ohref = $(this).attr("href");
var href = this.href; // treath like an external because only open New tab or New window
d = w3allNormalize_phpBBUrl(href);
hrefEnc = window.btoa(unescape(encodeURIComponent(d)));
href1 = wordpress_url_page_forum + '/?w3=' + hrefEnc;
$(this).attr("href", href1); // send out encoded
$(this).mouseleave(function() { // reset (replaced 'mouseup')
$(this).attr("href", ohref);
});
});
} // END if (window.frameElement) {
</script>
<script type="text/javascript" src="https://esc-commerce.de/forum/iframeResizer.contentWindow.min.js" defer></script>
Code: Select all
<?php
/**
* The default template to display content for WP_w3all embedded phpBB (or anything else)
* @package WordPress
* @subpackage wp_w3all
* @V3 JS -> https://www.axew3.com/w3/2018/12/phpbb-wordpress-template-integration-iframe-v3/
*/
// axew3.com //
// NOTE FOR CUSTOM phpBB iframe embedded PAGES (two columns etc)
// If you want to create a custom page forum you just need:
// Copy all the code from here until the call to get_header(); more below and paste into same place on template page you want
// Than copy/paste all the code inside the <!-- START iframe div --> and <!-- END iframe div -->
// inside whatever element the iframe need to display into (for example may inside <div id="primary" class="content-area"> on default WP twentysixteen theme)
// START MAY DO NOT MODIFY
// for compatibility with all the rest if the case switch these vars
if( isset($_GET["f"]) ){
$_GET["forum_id"] = $_GET["f"];
}
if( isset($_GET["t"]) ){
$_GET["topic_id"] = $_GET["t"];
}
$w3forum_id = isset($_GET["forum_id"]) ? $_GET["forum_id"] : '';
$w3topic_id = isset($_GET["topic_id"]) ? $_GET["topic_id"] : '';
$w3post_id = isset($_GET["post_id"]) ? $_GET["post_id"] : ''; // p reserved // may used for htaccess "strong" and consistent, V1 code redirect trick
$w3mode = isset($_GET["mode"]) ? $_GET["mode"] : '';
$w3phpbbuid = isset($_GET["u"]) ? $_GET["u"] : '';
$w3phpbbsid = isset($_GET["sid"]) ? $_GET["sid"] : '';
$w3phpbbwatch = isset($_GET["watch"]) ? $_GET["watch"] : '';
$w3phpbbunwatch = isset($_GET["unwatch"]) ? $_GET["unwatch"] : '';
$w3phpbb_start = isset($_GET["start"]) ? $_GET["start"] : '';
$w3iu = isset($_GET["i"]) ? $_GET["i"] : '';
$w3iu_folder = isset($_GET["folder"]) ? $_GET["folder"] : '';
$w3allhomeurl = get_home_url();
$current_user = wp_get_current_user();
$dd = get_option('w3all_phpbb_cookie');
$phpbb_on_template_iframe = get_option( 'w3all_iframe_phpbb_link_yn' );
$wp_w3all_forum_folder_wp = get_option('w3all_forum_template_wppage');
$w3all_url_to_cms = get_option( 'w3all_url_to_cms' );
if( preg_match('/[^0-9]/',$w3phpbbuid) OR preg_match('/[^a-z]/',$w3phpbbwatch) OR preg_match('/[^a-z]/',$w3phpbbunwatch) OR preg_match('/[^A-Za-z]/',$w3iu_folder) OR preg_match('/[^A-Za-z]/',$w3iu) OR preg_match('/[^0-9]/',$w3phpbb_start) OR preg_match('/[^0-9]/',$w3topic_id) OR preg_match('/[^0-9]/',$w3forum_id) OR preg_match('/[^0-9]/',$w3post_id) OR preg_match('/[^0-9A-Za-z]/',$w3mode) OR preg_match('/[^0-9A-Za-z]/',$w3phpbbsid) ){
die("Something goes wrong with your URL request, <a href=\"$w3allhomeurl\">please leave this page</a>.");
}
if(!empty($dd)){
$p = strpos($dd, '.');
if($p !== false && $p === 0){
$document_domain = substr($dd, 1);
} else {
$document_domain = $dd;
}
} else {
$document_domain = 'localhost';
}
// build and pass links x iframe //
// This following from 1.9.4 substantially execute only when links from widgets in WP
// On the new easy way, passed URL's from iframe are encoded and passed via $_GET["w3"]
if ( !empty($w3forum_id) && empty($w3topic_id) && empty($w3phpbb_start) && empty($w3post_id) ){
$w3all_url_to_cms = $w3all_url_to_cms . "/viewforum.php?f=". $w3forum_id ."";
} elseif ( !empty($w3forum_id) && !empty($w3phpbb_start) && empty($w3topic_id) ) {
$w3all_url_to_cms = $w3all_url_to_cms . "/viewforum.php?f=". $w3forum_id ."&start=".$w3phpbb_start."";
} elseif ( !empty($w3forum_id) && !empty($w3topic_id) && empty($w3post_id) && empty($w3phpbb_start) ) {
$w3all_url_to_cms = $w3all_url_to_cms . "/viewtopic.php?f=". $w3forum_id ."&t=".$w3topic_id."";
} elseif ( !empty($w3forum_id) && !empty($w3topic_id) && !empty($w3post_id) ) {
$w3all_url_to_cms = $w3all_url_to_cms . "/viewtopic.php?f=". $w3forum_id ."&t=".$w3topic_id."&p=".$w3post_id."#p".$w3post_id."";
} elseif ( !empty($w3forum_id) && empty($w3topic_id) && !empty($w3post_id) ) {
$w3all_url_to_cms = $w3all_url_to_cms . "/viewtopic.php?f=". $w3forum_id ."&p=".$w3post_id."#p".$w3post_id."";
} elseif ( !empty($w3forum_id) && !empty($w3topic_id) && !empty($w3phpbb_start) ) {
$w3all_url_to_cms = $w3all_url_to_cms . "/viewtopic.php?f=". $w3forum_id ."&t=".$w3topic_id."&start=".$w3phpbb_start."";
} elseif ( empty($w3forum_id) && !empty($w3post_id) && empty($w3iu) ) {
$w3all_url_to_cms = $w3all_url_to_cms . "/viewtopic.php?p=".$w3post_id."#p".$w3post_id."";
} elseif (stristr($w3mode, "ucp")) { // custom to ucp
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php";
} elseif (stristr($w3mode, "register")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?mode=register";
} elseif (stristr($w3mode, "sendpassword")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?mode=sendpassword";
} elseif (stristr($w3mode, "login")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?mode=login";
} elseif (stristr($w3mode, "logout")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?mode=logout&sid=". $w3phpbbsid ."";
} elseif (stristr($w3mode, "memberlist")) { // custom to memberlist
$w3all_url_to_cms = $w3all_url_to_cms . "/memberlist.php";
} elseif (stristr($w3mode, "viewprofile")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/memberlist.php?mode=viewprofile&u=". $w3phpbbuid ."";
} elseif (stristr($w3mode, "contactadmin")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/memberlist.php?mode=contactadmin";
} elseif (stristr($w3mode, "team")) {
$w3all_url_to_cms = $w3all_url_to_cms . "/memberlist.php?mode=team";
} elseif (stristr($w3iu, "pm") && $w3iu_folder == 'inbox') {
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?i=pm&folder=inbox";
} elseif (stristr($w3mode, "view") && $w3iu == 'pm') {
$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?i=pm&mode=view&f=0&p=".$w3post_id."";
} else {
$w3all_url_to_cms = $w3all_url_to_cms;
}
if( isset($_GET["w3"]) ){
$phpbb_url = base64_decode($_GET["w3"]);
$phpbb_url = trim(utf8_encode($phpbb_url));
$w3all_url_to_cms = $w3all_url_to_cms . '/' . $phpbb_url;
if( preg_match('/[^-0-9A-Za-z\._#\:\?\/=&%]/ui',$phpbb_url) ){
$w3all_url_to_cms = $w3all_url_to_cms;
}
}
function w3all_enqueue_scripts() {
wp_enqueue_script("jquery");
}
function wp_w3all_add_ajax() {
global $w3all_url_to_cms, $wp_w3all_forum_folder_wp,$phpbb_on_template_iframe, $w3allhomeurl;
if ($phpbb_on_template_iframe > 0){
$w3all_url_to_phpbb_ib = $w3allhomeurl . "/" . $wp_w3all_forum_folder_wp . "/?i=pm&folder=inbox";
} else {
$w3all_url_to_phpbb_ib = $w3all_url_to_cms . "/ucp.php?i=pm&folder=inbox";
}
$s = "<script type=\"text/javascript\" src=\"".plugins_url()."/wp-w3all-phpbb-integration/addons/resizer/iframeResizer.min.js\"></script>
<script type=\"text/javascript\">
function w3all_ajaxup_from_phpbb_do(res){
jQuery(document).ready(function($) {
if ( parseInt(res,10) > 0 && null == (document.getElementById('wp-admin-bar-w3all_phpbb_pm')) ){
var resp = '".__( 'You have ', 'wp-w3all-phpbb-integration' )."' + parseInt(res,10) + '".__( ' unread forum PM', 'wp-w3all-phpbb-integration' )."';
jQuery('#wp-admin-bar-root-default').append('<li id=\"wp-admin-bar-w3all_phpbb_pm\"><a class=\"ab-item\" href=\"".$w3all_url_to_phpbb_ib."\">' + resp + '</li>');
// window.location.reload(true);// this could be a work around for different themes, but lead to loop in this way
} else if (parseInt(res,10) > 0){
var r = '".__( 'You have ', 'wp-w3all-phpbb-integration' )."' + parseInt(res,10) + '".__( ' unread forum PM', 'wp-w3all-phpbb-integration' )."';
jQuery( 'li.w3all_phpbb_pmn' ).children().text( r );
} else {
if( parseInt(res,10) == 0 && null !== (document.getElementById('wp-admin-bar-w3all_phpbb_pm'))){
jQuery('li[id=wp-admin-bar-w3all_phpbb_pm]').remove();
}
}
});
}
// pre loader js code for iframe content
jQuery( document ).ready(function() {
jQuery('#w3_toogle_wrap_loader').attr( \"class\", \"w3_wrap_loader\" );
});
jQuery(window).load(function() {
jQuery('#w3_toogle_wrap_loader').attr( \"class\", \"w3_no_wrap_loader\" );
});
</script>
<style type=\"text/css\" media=\"screen\">
.w3_no_wrap_loader{
display:none;
}
.w3_wrap_loader{
position:fixed;
top:0%;
bottom:0%;
left:0%;
right:0%;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:90;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
width:100%;
display:flex;
align-items: center;
text-align:center;
pointer-events: none;
}
.w3_loader {
height: 8px;
width: 30%;
position: relative; left: 50%;
transform: translateX(-50%);
overflow: hidden;
background-color: #ddd;
border-radius: 20px;
margin:0px;padding:0px;
}
.w3_loader:before{
height: 8px;
border-radius: 20px;
display: block;
position: absolute;
content: \"\";
left: -200px;
width: 200px;
background-color: #2980b9;
animation: loading 2s linear infinite;
}
@keyframes loading {
from {left: -200px; width: 30%;}
50% {width: 30%;}
70% {width: 70%;}
80% { left: 50%;}
95% {left: 120%;}
to {left: 100%;}
}
</style>";
echo $s;
}
add_action('wp_enqueue_scripts', 'w3all_enqueue_scripts');
add_action('wp_head','wp_w3all_add_ajax');
// END MAY DO NOT MODIFY
// START a default WordPress page
// NOTE FOR CUSTOM phpBB iframe embedded PAGES (two columns etc)
// If you want to create a custom page forum you just need:
// Copy all the above until here (before the call to get_header();)
// Than copy/paste all the code inside the following <!-- START iframe div --> and <!-- END iframe div -->
// inside whatever element the iframe need to display into (for example into <div id="primary" class="content-area"> on default WP twentysixteen theme)
get_header();
?>
<!-- START iframe div -->
<div id="w3_toogle_wrap_loader" class="w3_no_wrap_loader"><div class="w3_loader"></div></div>
<div class="">
<noscript><h3>It seem that your browser have Javascript disabled: you can't load the forum page at this Url. Please enable Javascript on your browser or <a href="<?php echo $w3all_url_to_cms;?>">visit the forum here</a>.<br /><br /></h3></noscript>
<iframe id="w3all_phpbb_iframe" style="width:1px;min-width:100%;*width:100%;border:0;" scrolling="no" src="<?php echo $w3all_url_to_cms; ?>"></iframe>
<?php
echo "<script type=\"text/javascript\">
document.domain = '".$document_domain."';
// document.domain = 'mydomain.com'; // NOTE: reset/setup this with domain if js error when WP is installed like on mysite.domain.com and phpBB on domain.com: js origin error can come out for example when WordPress is on subdomain install and phpBB on domain. The origin fix is needed: (do this also on phpBB overall_footer.html added code)
var wp_u_logged = ".$current_user->ID.";
function w3all_ajaxup_from_phpbb(res){
var w3all_phpbb_u_logged = /#w3all_phpbb_u_logged=1/ig.exec(res);
if( w3all_phpbb_u_logged == null && wp_u_logged > 0 ){
document.location.replace('".$w3allhomeurl."/index.php/".$wp_w3all_forum_folder_wp."/');
}
if(wp_u_logged == 0 && res.indexOf('#w3all_phpbb_u_logged=1') > -1){
document.location.replace('".$w3allhomeurl."/index.php/".$wp_w3all_forum_folder_wp."/');
}
var w3all_phpbbpmcount = /.*(#w3all_phpbbpmcount)=([0-9]+).*/ig.exec(res);
if(w3all_phpbbpmcount !== null){
w3all_ajaxup_from_phpbb_do(w3all_phpbbpmcount[2]);
}
} // END function w3all_ajaxup_from_phpbb(res){
iFrameResize({
log : false,
inPageLinks : true,
targetOrigin: '".$w3all_url_to_cms."',
checkOrigin : '".$document_domain."', // if js error: 'Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin. Need to fit YOUR domain, ex: mydomain.com
// heightCalculationMethod: 'documentElementOffset', // If iframe not resize correctly, un-comment (or change with one of others available resize methods)
// see: https://github.com/davidjbradshaw/iframe-resizer#heightcalculationmethod
messageCallback : function(messageData){ // Callback fn when message is received
// w3all simple js check and redirects
var w3all_passed_url = messageData.message.toString();
var w3all_ck = \"".$_SERVER['SERVER_NAME']."\";
var w3all_pass_ext = (w3all_passed_url.indexOf(w3all_ck) > -1);
var w3all_ck_preview = (w3all_passed_url.indexOf('preview') > -1);
if (w3all_ck_preview == false) { // or the phpBB passed preview link, will be recognized as external, and preview will redirect to full forum url instead
// so these are maybe, external iframe redirects
if (w3all_pass_ext == true) {
window.location.replace(w3all_passed_url);
}
if (/^(f|ht)tps?:\/\//i.test(w3all_passed_url)) {
window.location.replace(w3all_passed_url);
}
}
// security: do not pass to be encoded an url with sid or if point to phpBB admin ACP via iframe
if( /[^-0-9A-Za-z\._#\:\?\/=&%]/ig.exec(w3all_passed_url) !== null || /adm\//ig.exec(w3all_passed_url) !== null || /sid=/ig.exec(w3all_passed_url) !== null ){
w3all_passed_url = '';
}
// PUSH phpBB URLs //
w3all_passed_url = window.btoa(unescape(encodeURIComponent(w3all_passed_url)));
w3all_passed_url_push = '".$w3allhomeurl."/".$wp_w3all_forum_folder_wp."/?w3=' + w3all_passed_url;
history.pushState({w3all_passed_url: w3all_passed_url}, \"Forum\", w3all_passed_url_push);
}
});
</script>";
?>
</div>
<!-- END iframe div -->
<?php get_footer(); ?>
Code: Select all
/var/www/vhosts/deutschland-stirbt.de/esc-commerce/wordpress/forum (REQUIRED) Path - Absolute path to Custom OR phpBB root folder config.php file - NOTE: do NOT add final slash
https://esc-commerce.de/forum (REQUIRED) URL - Real phpBB URL - NOTE: do NOT add final slash '/' Example: https://www.axew3.com/forum