PHPBB Login and iFrame is broken

User avatar
Ezrael
w3 User
w3 User
Posts: 102
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

PHPBB Login and iFrame is broken

Post by Ezrael »

I don't know why but I tested to integrate an option to use the email to login in phpbb.

I testet 2 Plugins which didn't work and I tested to integrate the following code:

Open /phpbb_root/phpbb/auth/provider/db.php and search for $username_clean = utf8_clean_string($username);. Just below that, make sure the SQL query looks like this instead:

Code: Select all

$sql = 'SELECT *
FROM ' . USERS_TABLE . "
WHERE user_email = '" . $this->db->sql_escape($username_clean) . "' OR username_clean = '" . $this->db->sql_escape($username_clean) . "'";
I tested it but it did work. Since this test, the iFrame plugin is absolutely broken. I have a never ending reload loading screen from the iFrame plugin.

I already restored the backup from a day before in WP and phpBB but the issue is still there.

As long as you don't login, everything is okay. Login on WP seems to be okay but the login at the phpbb is completely broken and cause the above mentioned issues.

side: https://photography.surferparadise.de/forum/
User avatar
Ezrael
w3 User
w3 User
Posts: 102
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: PHPBB Login and iFrame is broken

Post by Ezrael »

I figured out, that the issue is just there, if I login via page-forum.php on the phpbb.

Login on a wp iFrame shortcode Site is no issue, Login on WP and working in the Forum is no problem but as soon as I login on the phpbb iframe site, the forum is bouncing in the script animation forever. I don't know how to solve this issue because I didn´t changed the code.

I also recovered a full backup of database and files before this incident happened the first time. I'm more than happy, if someone has an idea.
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: PHPBB Login and iFrame is broken

Post by axew3 »

Just opened the page but the console return several errors of functions not defined, are you editing the code?
User avatar
Ezrael
w3 User
w3 User
Posts: 102
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: PHPBB Login and iFrame is broken

Post by Ezrael »

Don't know if this it related to the issue

Page-Forum.php

Code: Select all

<?php get_header(); ?>


<div class="content section-inner">		

<?php defined( 'ABSPATH' ) or die( 'forbidden' );
/*
 Template Name: Forum
 Template Post Type: page
 * The default wp_w3all template to display content for the embedded phpBB
 * @package WordPress
 * @subpackage wp_w3all
 * @V5 JS -> https://www.axew3.com/w3/2018/12/phpbb-wordpress-template-integration-iframe-v5/
 */
// @2023 axew3.com //

// START MAY DO NOT MODIFY

  if(defined("W3PHPBBCONFIG")){
    // detect if it is the uid2 in phpBB and avoid iframe loop
    $phpBBuid2 = (isset($_COOKIE[W3PHPBBCONFIG["cookie_name"].'_u']) && $_COOKIE[W3PHPBBCONFIG["cookie_name"].'_u'] == 2) ? 2 : 0;
   } else { $phpBBuid2 = 0; }
   // detect if running as no linked users mode and avoid iframe loop
  if(defined("WPW3ALL_NOT_ULINKED")) { $phpBBuid2 = 0; }

global $w3all_iframe_custom_w3fancyurl,$w3all_url_to_cms,$w3all_iframe_custom_top_gap,$w3cookie_domain,$wp_w3all_forum_folder_wp;
$w3allhomeurl = get_home_url();
$current_user = wp_get_current_user();
$w3all_url_to_cms_clean = $w3all_url_to_cms;
$w3all_url_to_cms_clean0 = strpos($w3all_url_to_cms_clean, 'https://') !== false ? str_replace('https://', 'http://', $w3all_url_to_cms_clean) : str_replace('http://', 'https://', $w3all_url_to_cms_clean);
// guess to get the domain.com to display into preloader // array order here is !important
if(!empty($w3all_url_to_cms)){
$w3guessdomaindisplay = str_replace(array("http://www.","https://www.","http://","https://"), array("","","",""), $w3all_url_to_cms);
$spos = strpos($w3guessdomaindisplay,'/');
if($spos !== false)
{
 $w3guessdomaindisplay = substr($w3guessdomaindisplay, 0, $spos);
}} else { $w3guessdomaindisplay = 'Did you setup the URL that point to phpBB into the integration plugin admin page<br /> and is it correct?'; }

if(!empty($w3cookie_domain)){
 if(substr($w3cookie_domain, 0, 1) == '.'){
    $document_domain = substr($w3cookie_domain, 1);
   } else {
      $document_domain = $w3cookie_domain;
     }
 } else { $document_domain = 'localhost'; }

// do not use wp is_ssl() because it fail on some server
$w3all_orig = strpos($w3all_url_to_cms,'https') !== false ? 'https://'. $document_domain : 'http://' . $document_domain;
$w3all_orig_www = strpos($w3all_url_to_cms,'https') !== false ? 'https://www.'. $document_domain : 'http://www.' . $document_domain;

// security switch
$w3all_url_to_cms0 = $w3all_url_to_cms;

if( isset($_GET["w3"]) ){ // default
 $phpbb_url = trim(base64_decode($_GET["w3"]));
 $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_cms0;
   }
} elseif ( isset($_GET[$w3all_iframe_custom_w3fancyurl]) ){ //fancy
 $phpbb_url = trim(base64_decode($_GET[$w3all_iframe_custom_w3fancyurl]));
 $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_cms0;
   }
}

 if(substr($w3all_url_to_cms, 0, 5) == 'https'){
  $w3all_url_to_cms_htt = substr($w3all_url_to_cms, 0, 5);
  $w3all_url_to_cms_htt = 'http' . substr($w3all_url_to_cms, 5);
 } else {
    $w3all_url_to_cms_htt = substr($w3all_url_to_cms, 0, 4);
    $w3all_url_to_cms_htt = 'https'.substr($w3all_url_to_cms, 4);
   }

// old way - to be removed
// assure that passed url is correctly all decoded // may something else need to be added in certain conditions
$w3all_url_to_cms = str_replace(array("%2F", "%23", "%2E"), array("/", "#", "."), $w3all_url_to_cms);

// bug -> https://wordpress.org/support/topic/problem-using-iframe-feature-with-https/
if( strlen($w3all_url_to_cms) == strlen(get_option( 'w3all_url_to_cms' )) OR strlen($w3all_url_to_cms) == strlen(get_option( 'w3all_url_to_cms' )) + 1 )
{
  // do not re-write value of the global $w3all_url_to_cms or index.php will be may appended into widgets avatars urls, so that will make it fail image loads
 $w3all_url_to_cms_sw = $w3all_url_to_cms;
 $w3all_url_to_cms_sw .= (substr($w3all_url_to_cms, -1) == '/' ? '' : '/');
} else {  $w3all_url_to_cms_sw = $w3all_url_to_cms; }

function w3all_enqueue_scripts() {
 wp_enqueue_script("jquery");
}

function wp_w3all_add_ajax() {
  global $w3all_url_to_cms,$w3all_url_to_cms_sw,$wp_w3all_forum_folder_wp,$w3allhomeurl;

  $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\">
// pre loader js code for iframe content
jQuery( document ).ready(function() {
 jQuery('#w3idwloader').attr( \"class\", \"w3_wrap_loader\" );
});
jQuery(window).load(function() {
 jQuery('#w3idwloader').css(\"display\",\"none\");
});

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();
 }
}
});
}
</script>
<style type=\"text/css\" media=\"screen\">
.w3preloadtext{
color:#DDD;
font-size:3.5em;
font-family:impact,arial, sans-serif;
font-style:italic;
text-shadow: rgba(0,0,0,0) -1px 0px;
}
.w3_wrap_loader{
position:fixed;
top:0%;
bottom:0%;
left:0%;
right:0%;
background: rgba(0,0,0,0.95);
z-index:99999;
opacity:90;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
width:100%;
text-align:center;
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
pointer-events:none;
height:100%;
}
.ww3_loader{
width:100%;
text-align:center;
}
.w3_loader {
height: 8px;
width: 30%;
align-items: center;
justify-content: center;
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: #333;
animation: loading 1s 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
get_header();
?>
<!-- noscript warning and simple preloader -->
<div id="w3idwloader" class="w3_wrap_loader">
  <noscript><h3 style="background-color:#333;color:#FFF;padding:15px;font-size:0.8em;pointer-events:auto;">Javascript disabled: can't load the forum page at this Url.<br />Enable Javascript on your browser or visit the forum here:<br /><br /><?php echo $w3all_url_to_cms;?><br /><a href="<?php echo $w3all_url_to_cms;?>">To be auto-redirected click here<br />(may this link will not work)</a></h3></noscript>
<div class="w3preloadtext"><?php echo $w3guessdomaindisplay ; ?></div>
<div class="ww3_loader"><div class="w3_loader"></div></div>
</div>
<!-- START iframe div -->
<div style="width:100%;min-width:100%" id="" class="">
<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>
    //document.domain = '".$document_domain."'; // NOTE: for domains like 'mysite.co.uk' remove this line, if you setup the next to match the correct document.domain
     //document.domain = '192.168.1.6'; // NOTE: reset/setup this with domain (like mysite.co.uk) 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, it need to match)
    var wp_u_logged = ".$current_user->ID.";
    var phpBBuid2 = ".$phpBBuid2.";
    var w3allhomeurl = '".$w3allhomeurl."';
    var wp_w3all_forum_folder_wp = '".$wp_w3all_forum_folder_wp."';
    var w3all_iframe_custom_w3fancyurl = '".$w3all_iframe_custom_w3fancyurl."';

 function w3all_phpbb_pushUrlToParentOnBackForward(w3ER){
   if(w3ER != ''){
   var rem = w3ER.slice(-1);
   if(rem == '#'){ w3ER = w3ER.substring(0, w3ER.length - 1); }
    w3ER = window.btoa(unescape(encodeURIComponent(w3ER)));
    var w3all_url_pushER = w3allhomeurl + '/' + wp_w3all_forum_folder_wp + '/?' + w3all_iframe_custom_w3fancyurl + '=' + w3ER;
    window.history.replaceState({}, \"\", w3all_url_pushER);
   }
  }


   window.addEventListener('message', function (event)
   {
    if (event.origin != '".$w3all_url_to_cms0."')
    {
     // console.error('The event origin do not match');
     // console.error(event);
     // return;
    }

     if(/#w3all/ig.exec(event.data.message)){
       w3all_ajaxup_from_phpbb(event.data.message);
      //console.log(event.data);
     }
   });


 function w3all_ajaxup_from_phpbb(res){
      var w3all_phpbb_u_logged  = /#w3all_phpbb_u_logged=1/ig.exec(res);
   if(phpBBuid2 != 2){ // if not phpBB uid 2 or get loop for this user
       if( w3all_phpbb_u_logged == null && wp_u_logged > 1 || wp_u_logged == 0 && w3all_phpbb_u_logged != null ){
        document.location.replace('".$w3allhomeurl."/".$wp_w3all_forum_folder_wp."/');
       }
    }
      jQuery('#w3idwloader').css(\"display\",\"none\");
      var w3all_phpbbpmcount = /.*(#w3all_phpbbpmcount)=([0-9]+).*/ig.exec(res);
      if(w3all_phpbbpmcount !== null){
         w3all_ajaxup_from_phpbb_do(w3all_phpbbpmcount[2]);
       }

      var w3all_lochash = /.*(#w3all_lochash)=([0-9]+).*/ig.exec(res);
      if(w3all_lochash !== null && w3all_lochash[2] != 0){
         jQuery('html, body').animate({ scrollTop: w3all_lochash[2]}, 400);
       } else {
         jQuery('html, body').animate({ scrollTop: ".$w3all_iframe_custom_top_gap."}, 400);
       }

 } // END w3all_ajaxup_from_phpbb(res){

   // array() of allowed domains

    var w3all_orig_domains = ['".$w3all_url_to_cms0."','".$w3all_orig."','".$w3all_orig_www."','".$w3all_url_to_cms_clean."','".$w3all_url_to_cms_clean0."','https://localhost','http://localhost'];

 iFrameResize({
        log         : false,
        inPageLinks : true,
        targetOrigin: '".$w3all_url_to_cms_sw."',
        checkOrigin : w3all_orig_domains,
heightCalculationMethod: 'taggedElement', // If iframe not resize correctly, un-comment (or change with one of others available resize methods) 
     // see: https://github.com/davidjbradshaw/iframe-resizer#heightcalculationmethod

  onMessage : 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);
     }
   }

  // do not pass to be encoded an url with sid or if it 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 //
   if(w3all_passed_url != ''){
    w3all_passed_url = window.btoa(unescape(encodeURIComponent(w3all_passed_url)));
    var w3all_passed_url_push = '".$w3allhomeurl."/".$wp_w3all_forum_folder_wp."/?".$w3all_iframe_custom_w3fancyurl."=' + w3all_passed_url;
    history.replaceState({}, \"\", w3all_passed_url_push);
   }
  } // end // onMessage
,
onScroll: function(x,y){
//return false;
}
});
</script>";
?>
</div>
<!-- END iframe div -->
<?php get_footer();
Overall_Header

Code: Select all

<!DOCTYPE html>
<html dir="{{ S_CONTENT_DIRECTION }}" lang="{{ S_USER_LANG }}">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#444547">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#444547">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-status-bar-style" content="#444547">
{{ META }}
<title>{% if UNREAD_NOTIFICATIONS_COUNT %}({{ UNREAD_NOTIFICATIONS_COUNT }}) {% endif %}{% if not S_VIEWTOPIC and not S_VIEWFORUM %}{{ SITENAME }} - {% endif %}{% if S_IN_MCP %}{{ lang('MCP') }} - {% elseif S_IN_UCP %}{{ lang('UCP') }} - {% endif %}{{ PAGE_TITLE }}{% if S_VIEWTOPIC or S_VIEWFORUM %} - {{ SITENAME }}{% endif %}</title>
<!-- IF not S_IS_BOT --><script>
// START MANDATORY CHANGES
var wordpress_url_page_f = 'https://photography.surferparadise.de/forum'; // MANDATORY! // (DO NOT ADD/INCLUDE final slash here) Url that point to your iframed wordpress forum page
var w3all_custom_wp_w3fancyurl = 'w3' // MANDATORY! If you changed w3 to have 'fancy URL' query string for the WP page forum, then change this value to match what your fancy URL setting is after you changed it on plugin admin page
// END MANDATORY CHANGES
 
function w3all0Normalize_phpBBUrl(u){
	var bu = "{BOARD_URL}";
	w3allappend = "{BOARD_URL}"; 
 if ( /^https?/ig.exec(u) !== null ){ 
   phpbburl = u.split(bu);
	 w3allappend = phpbburl[1];
 } 
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;
}
 
if ((window.self !== window.top) != true) {
  if(/adm\//ig.exec(window.location.href) === null){ // avoid x ACP 
  var w3all_r = window.location.href.replace(/sid=.+/gi, '');
 w3all_r = w3all0Normalize_phpBBUrl(w3all_r);
 if(/adm\/index\.php/ig.exec(w3all_r) == null){
  hrefEnc = window.btoa(unescape(encodeURIComponent(w3all_r)));
  href0 =  wordpress_url_page_f + '/?'+ w3all_custom_wp_w3fancyurl + '=' + hrefEnc;
  //document.location.replace(href0);
 }
}}
// END force w3all to iframe redirect
</script>
<!-- ENDIF -->

{% if S_ENABLE_FEEDS %}
	{% if S_ENABLE_FEEDS_OVERALL %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ SITENAME }}" href="{{ path('phpbb_feed_index') }}">{% endif %}
	{% if S_ENABLE_FEEDS_NEWS %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ lang('FEED_NEWS') }}" href="{{ path('phpbb_feed_news') }}">{% endif %}
	{% if S_ENABLE_FEEDS_FORUMS %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ lang('ALL_FORUMS') }}" href="{{ path('phpbb_feed_forums') }}">{% endif %}
	{% if S_ENABLE_FEEDS_TOPICS %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ lang('FEED_TOPICS_NEW') }}" href="{{ path('phpbb_feed_topics') }}">{% endif %}
	{% if S_ENABLE_FEEDS_TOPICS_ACTIVE %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ lang('FEED_TOPICS_ACTIVE') }}" href="{{ path('phpbb_feed_topics_active') }}">{% endif %}
	{% if S_ENABLE_FEEDS_FORUM and S_FORUM_ID %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ lang('FORUM') }} - {{ FORUM_NAME }}" href="{{ path('phpbb_feed_forum', { forum_id : S_FORUM_ID } ) }}">{% endif %}
	{% if S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID %}<link rel="alternate" type="application/atom+xml" title="{{ lang('FEED') }} - {{ lang('TOPIC') }} - {{ TOPIC_TITLE }}" href="{{ path('phpbb_feed_topic', { topic_id : S_TOPIC_ID } ) }}">{% endif %}
	{% EVENT overall_header_feeds %}
{% endif %}

{% if U_CANONICAL %}
	<link rel="canonical" href="{{ U_CANONICAL }}">
{% endif %}

<!--
	phpBB style name: myInvision
	Based on style:   prosilver (this is the default phpBB3 style)
	Original author:  Tom Beddard ( http://www.subBlue.com/ )
	Modified by:	  Brad Veryard ( http://www.bradleyv.com/ )
	Updated by:		  MannixMD @MannixMD
-->

{% if S_ALLOW_CDN %}
<script>
	WebFontConfig = {
		google: {
			families: ['Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese']
		}
	};

	(function(d) {
		var wf = d.createElement('script'), s = d.scripts[0];
		wf.src = 'https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.min.js';
		wf.async = true;
		s.parentNode.insertBefore(wf, s);
	})(document);
</script>


{% endif %}
<link href="{{ T_FONT_AWESOME_LINK }}" rel="stylesheet">
<link href="{{ T_STYLESHEET_LINK }}" rel="stylesheet">
<link href="{{ T_STYLESHEET_LANG_LINK }}" rel="stylesheet">

{% if S_CONTENT_DIRECTION eq 'rtl' %}
	<link href="{{ T_THEME_PATH }}/bidi.css?assets_version={{ T_ASSETS_VERSION }}" rel="stylesheet">
{% endif %}

{% if S_PLUPLOAD %}
	<link href="{{ T_THEME_PATH }}/plupload.css?assets_version={{ T_ASSETS_VERSION }}" rel="stylesheet">
{% endif %}

{% if S_COOKIE_NOTICE %}
	<link href="{{ T_ASSETS_PATH }}/cookieconsent/cookieconsent.min.css?assets_version={{ T_ASSETS_VERSION }}" rel="stylesheet">
{% endif %}

<!--[if lte IE 9]>
	<link href="{{ T_THEME_PATH }}/tweaks.css?assets_version={{ T_ASSETS_VERSION }}" rel="stylesheet">
<![endif]-->

{% EVENT overall_header_head_append %}

{{ definition.STYLESHEETS }}

{% EVENT overall_header_stylesheets_after %}
<link href="{{ T_THEME_PATH }}/myinvision.css?assets_version={{ T_ASSETS_VERSION }}" rel="stylesheet">
</head>
<body id="phpbb" class="nojs notouch section-{{ SCRIPT_NAME }} {{ S_CONTENT_DIRECTION }} {{ BODY_CLASS }}">

{% EVENT overall_header_body_before %}
{% INCLUDE 'options.html' %}
<div class="backhead">					  
<div class="headerbar" role="banner">
		{% EVENT overall_header_headerbar_before %}
			<div class="inner">

			<div id="site-description" class="site-description">
				<a id="logo" class="logo" href="{% if U_SITE_HOME %}{{ U_SITE_HOME }}{% else %}{{ U_INDEX }}{% endif %}" title="{% if U_SITE_HOME %}{{ L_SITE_HOME }}{% else %}{{ L_INDEX }}{% endif %}">
					<span class="site_logo"></span>
				</a>
				<h1>SURFERPARADISE.DE
					<br>{{ SITE_DESCRIPTION }}</h1>
				<p class="skiplink"><a href="#start_here">{{ lang('SKIP') }}</a></p>
			</div>

			{% EVENT overall_header_searchbox_before %}
			{% if definition.HEADSEARCH == 'yes'%}
			{% if S_DISPLAY_SEARCH and not S_IN_SEARCH %}
			<div id="search-box" class="search-box search-header searchback" role="search">
				<form action="{{ U_SEARCH }}" method="get" id="search">
				<fieldset>
					<input name="keywords" id="keywords" type="search" maxlength="128" title="{{ lang('SEARCH_KEYWORDS') }}" class="inputbox search tiny" size="20" value="{{ SEARCH_WORDS }}" placeholder="{{ lang('SEARCH_MINI') }}" />
					<button class="button button-search" type="submit" title="{{ lang('SEARCH') }}">
						<i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{{ lang('SEARCH') }}</span>
					</button>
					<a href="{{ U_SEARCH }}" class="button button-search-end" title="{{ lang('SEARCH_ADV') }}">
						<i class="icon fa-cog fa-fw" aria-hidden="true"></i><span class="sr-only">{{ lang('SEARCH_ADV') }}</span>
					</a>
					{{ S_SEARCH_HIDDEN_FIELDS }}
				</fieldset>
				</form>
			</div>
			{% endif %}
			{% endif %}
			{% EVENT overall_header_searchbox_after %}

			</div>
			{% EVENT overall_header_headerbar_after %}
		</div></div>
<div id="wrap" class="wrap">

	<a id="top" class="top-anchor" accesskey="t"></a>
			   
	

	{% INCLUDE 'navbar.html' %}
	<div id="content">
	<div id="page-header">
	
		{% EVENT overall_header_navbar_before %}
		{% INCLUDE 'breadcrumb.html' %}
	</div>

	{% EVENT overall_header_page_body_before %}

	<a id="start_here" class="anchor"></a>
	<div id="page-body" class="page-body" role="main">
	{% if definition.SIDEBAR == 'yes'%}
	<div class="page-body-inner">
	{% endif %}						 
		{% if S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) %}
		<div id="information" class="rules">
			<div class="inner">
				<strong>{{ lang('INFORMATION') }}{{ lang('COLON') }}</strong> {{ lang('BOARD_DISABLED') }}
			</div>
		</div></div></div>
		{% endif %}

		{% EVENT overall_header_content_before %}
Overall_footer

Code: Select all

		{% EVENT overall_footer_content_after %}
	</div>
		{% if definition.SIDEBAR == 'yes'%}
</div>
<div class="sidebar"> {% INCLUDE 'sidebar.html' %} </div>
{% endif %}  
{% EVENT overall_footer_page_body_after %}

<div id="page-footer" class="page-footer" role="contentinfo">
	{% INCLUDE 'navbar_footer.html' %}

	<div class="copyright">
		
		{% if TRANSLATION_INFO %}
		<p class="footer-row">
			<span class="footer-copyright">{{ TRANSLATION_INFO }}</span>
		</p>
		{% endif %}
		{% EVENT overall_footer_copyright_append %}
		
		{% if DEBUG_OUTPUT %}
		<p class="footer-row">
			<span class="footer-info">{{ DEBUG_OUTPUT }}</span>
		</p>
		{% endif %}
		{% if U_ACP %}
		<p class="footer-row">
			<a class="footer-link text-strong" href="{{ U_ACP }}">{{ lang('ACP') }}</a>
		</p>
		{% endif %}
	</div>

	<div id="darkenwrapper" class="darkenwrapper" data-ajax-error-title="{{ lang('AJAX_ERROR_TITLE') }}" data-ajax-error-text="{{ lang('AJAX_ERROR_TEXT') }}" data-ajax-error-text-abort="{{ lang('AJAX_ERROR_TEXT_ABORT') }}" data-ajax-error-text-timeout="{{ lang('AJAX_ERROR_TEXT_TIMEOUT') }}" data-ajax-error-text-parsererror="{{ lang('AJAX_ERROR_TEXT_PARSERERROR') }}">
		<div id="darken" class="darken">&nbsp;</div>
	</div>

	<div id="phpbb_alert" class="phpbb_alert" data-l-err="{{ lang('ERROR') }}" data-l-timeout-processing-req="{{ lang('TIMEOUT_PROCESSING_REQ') }}">
		<a href="#" class="alert_close">
			<i class="icon fa-times-circle fa-fw" aria-hidden="true"></i>
		</a>
		<h3 class="alert_title">&nbsp;</h3><p class="alert_text"></p>
	</div>
	<div id="phpbb_confirm" class="phpbb_alert">
		<a href="#" class="alert_close">
			<i class="icon fa-times-circle fa-fw" aria-hidden="true"></i>
		</a>
		<div class="alert_text"></div>
	</div>
</div>

</div>

<div>
	<a id="bottom" class="anchor" accesskey="z"></a>
	{% if not S_IS_BOT %}{{ RUN_CRON_TASK }}{% endif %}
</div>

<script src="{{ T_JQUERY_LINK }}"></script>
{% if S_ALLOW_CDN %}<script>window.jQuery || document.write('\x3Cscript src="{T_ASSETS_PATH}/javascript/jquery-3.6.0.min.js?assets_version={T_ASSETS_VERSION}">\x3C/script>');</script>{% endif %}
<script src="{{ T_ASSETS_PATH }}/javascript/core.js?assets_version={{ T_ASSETS_VERSION }}"></script>
{% INCLUDEJS 'forum_fn.js' %}
{% INCLUDEJS 'ajax.js' %}
{% if S_ALLOW_CDN %}
	<script>
		(function($){
			var $fa_cdn = $('head').find('link[rel="stylesheet"]').first(),
				$span = $('<span class="fa" style="display:none"></span>').appendTo('body');
			if ($span.css('fontFamily') !== 'FontAwesome' ) {
				$fa_cdn.after('<link href="{{ T_ASSETS_PATH }}/css/font-awesome.min.css" rel="stylesheet">');
				$fa_cdn.remove();
			}
			$span.remove();
		})(jQuery);
	</script>
{% endif %}

{% if S_COOKIE_NOTICE %}
	<script src="{{ T_ASSETS_PATH }}/cookieconsent/cookieconsent.min.js?assets_version={{ T_ASSETS_VERSION }}"></script>
	<script>
		if (typeof window.cookieconsent === "object") {
		window.addEventListener("load", function(){
			window.cookieconsent.initialise({
				"palette": {
					"popup": {
						"background": "#0F538A"
					},
					"button": {
						"background": "#E5E5E5"
					}
				},
				"theme": "classic",
				"content": {
					"message": "{{ lang('COOKIE_CONSENT_MSG')|escape('js') }}",
					"dismiss": "{{ lang('COOKIE_CONSENT_OK')|escape('js') }}",
					"link": "{{ lang('COOKIE_CONSENT_INFO')|escape('js') }}",
						"href": "{{ UA_PRIVACY }}"
					}
				});
			});
				}
	</script>
{% endif %}

{% EVENT overall_footer_after %}


{% if S_PLUPLOAD %}{% INCLUDE 'plupload.html' %}{% endif %}
{{ definition.SCRIPTS }}

{% EVENT overall_footer_body_after %}
</div>
<!-- IF not S_IS_BOT -->
<script type="text/javascript">
// START MANDATORY CHANGES
var w3allAllowDomain = '*'; // MANDATORY! // Set/Change this value with your WordPress URL (example: https://axew3.com)
var wordpress_url_page_forum = 'https://photography.surferparadise.de/forum'; // MANDATORY! // (DO NOT ADD/INCLUDE final slash here) Url that point to your iframed wordpress forum page
var w3all_custom_wp_w3fancyurl = 'w3'; // MANDATORY! If you changed the default w3 to have 'fancy URL' query string into the related WP plugin admin option, then change this value to match the same as it is the fancy URL setting
// END MANDATORY CHANGES
 
var w3allappend = false;
var boardU = "{BOARD_URL}";
 
// Lightbox scroll fix:
// 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");
  var w3all_onview_attach = (href.indexOf('file.php') > -1);
 
if( this.getAttribute('target') !== null ){
  e.preventDefault();
  window.open(href,'_blank');
return;
}
 
if ( href.charAt(0) == '#' || href.indexOf('\./download\/file\.php') > -1 ){ return; }
 
// external link?
if ((this.href.indexOf(boardU) > -1) != true){
 if(/^(f|ht)tps?:\/\//i.test(href))
 {
  e.preventDefault();
  parent.location.replace(href);
 return;
 }
}
 
if ( /\/adm\//ig.exec(href) !== null )
{
  e.preventDefault();
  parent.location.replace(href);
 return;
}
 
if ( href.indexOf('view=print') > -1 !== false )
{
 e.preventDefault();
 window.open(href,'_blank');
return;
}
 
if ( href.indexOf('quickmod') > -1 ) {
   w3allNOappend = true;
    return;
}
 
if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
  w3allNOappend = true;
}
 
// 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;
} */
 
w3allappend = w3allNormalize_phpBBUrl(href);
 
if ('parentIFrame' in window){
  if( typeof w3allNOappend == 'undefined' || w3allNOappend == false ){
    window.parentIFrame.sendMessage(w3allappend);
  }
 }
});
 
// w3all UPDATES for phpBB events
 
if(window.self !== window.top){
 
$("#quickmod,.bookmark-link").on("click", function(event) {
var pos = window.scrollY + document.querySelector('#quickmod').getBoundingClientRect().top;
  $(parent.window).scrollTop( 200 );
$("#darkenwrapper").on("click", function() {
  $(parent.window).scrollTop( pos );
});
 $("#darken").on("click", function() {
  $(parent.window).scrollTop( pos );
});
});
 
var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";
 
var hash = window.location.hash.substr(1);
 
if( hash == 'unread' ){
 var postN = 1;
 $( "h3 > a" ).each(function (e) {
  ns = this.href.split('#p');
  if( typeof ns != 'undefined' && /viewtopic.php\?p=/ig.exec(this.href) != null ){
   if(ns[1] > postN){
     w3lh = ns[1];
    }
  }
 })
 
 if( typeof w3lh != 'undefined' ){
  hash = "p" + w3lh;
 }
}
 
if( typeof w3allNOappend == 'undefined' || w3allNOappend == false )
{
 $( window ).on( "load", function()
 {
  location.hash = "#" + hash;
  if( location.hash.length < 2 ){
    var w3all_lochash = 0;
  } else {
    var w3all_lochash = $(location.hash).offset().top;
  }
  var w3append = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged + '#w3all_lochash=' + w3all_lochash;
 
   window.parent.postMessage({
    //'func': 'w3all_ajaxup_from_phpbb',
    'message': JSON.stringify(w3append)
   }, w3allAllowDomain);
 
 // fix vertical iframe centered in certain cases
  var w3iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
  if(w3iOS == false)
  {
   var bd = document.getElementsByTagName("body");
   var t = document.getElementById(bd[0].getAttribute("id"));
   if( typeof t != 'undefined' || t != false )
   {
    t.setAttribute("style", "position:fixed;top:0%;left:0%;width:100%;margin:0px;");
   }
  }
 });
}
/*if (window.performance){
 if( performance.getEntriesByType("navigation")[0].type == 'back_forward' )
 {
  var w3E = performance.getEntriesByType("navigation");
  var w3ER = w3allNormalize_phpBBUrl(w3E[0].name);
  parent.w3all_phpbb_pushUrlToParentOnBackForward(w3ER);
 }
}*/
} // END if(window.self !== window.top){
</script>
<script type="text/javascript" src="https://forum.surferparadise.de/iframeResizer.contentWindow.min.js" defer></script>
<!-- ENDIF -->
<div data-iframe-height=""></div>
</body>
</html>
Attachments
Screenshot 2023-11-23 at 00.12.41.png
Screenshot 2023-11-23 at 00.12.41.png (116.32 KiB) Viewed 7894 times
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: PHPBB Login and iFrame is broken

Post by axew3 »

Maybe post the original theme page.php in attach.
About the login using email in phpBB, maybe it require to edit or hook via a listener, the sql that retrieve the user's data. One though about this (i did not checked the code) is that phpBB allow email address reuse for different usernames, WP do not allow this.

The w3all integration used with phpBB having accounts sharing same email, consider, when the login is done in WP, the very FIRST email found, ignoring others. So that using the email as username to login in WP, lead to be logged in ever, with the first (oldest) account created in phpBB with same email.
So that doing the same in phpBB, the behavior, would be the same (you could change the code to get the latest created account, and not the first older maybe), allowing email reuse for different accounts.
User avatar
Ezrael
w3 User
w3 User
Posts: 102
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: PHPBB Login and iFrame is broken

Post by Ezrael »

My biggest issue now, the board ran perfect with your script til the moment i tested the email login possibility and now i don't understand, why it still has this issue after restored a full backup of all files and the database.

First instinct was a cache issue with my Macbook but user reported me the same. Login on WP and working in the forum, run perfect. Using the iFramed phpbb for the login is cause the issue of a never-ending loading screen of your script.

Before this issue showed up, did 3 things:
- installed email login extension (didn't work, deinstall and delete it)
- installed another email login extension (didn't work, deinstall and delete it)
- change site subdomain from community.surferparadise.de to forum.surferparadise.de and did all changes in the phpbb, wp and your script

I don't know if this can be a cookie issue. I already changed the name of the cookie without any effect.  
Post Reply