Get custom page link (and email activation) rewrite to redirect to iframed phpBB?

mLgz0rn
User ww
User ww
Posts: 42
Joined: Fri Jan 20, 2017 5:23 pm

Re: Get custom page link?

Post by mLgz0rn »

axew3 wrote: Sun Apr 29, 2018 5:00 pm about the email link coming without "iframe" on url:
https://www.axew3.com/w3/2017/04/wp-w3a ... me-how-to/
you need to apply this into yours files as indicated, there are 3 ready on zip, edit all others you need should be easy but
let me know if any problem, i will help on preparing edited files for all others instances.

About my question, Yes it was what to me necessary to start fast!
I already did the 3 files.
I tried changing so it worked when you register, but it did not work.
the language file for the welcome email message uses {U_BOARD} for linking the board

so
Subject: Welcome to "{SITENAME}"

{WELCOME_MSG}

Please keep this email for your records. Your account information is as follows:

----------------------------
Username: {USERNAME}

Board URL: {U_BOARD}
----------------------------

Please visit the following link in order to activate your account:

{U_ACTIVATE}

Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account.

Thank you for registering.

{EMAIL_SIG}
And I assume the file needs editing is /includes/ucp_register.php

this is the part that needs editing

Code: Select all

					$messenger->assign_vars(array(
						'WELCOME_MSG'	=> htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
						'USERNAME'		=> htmlspecialchars_decode($data['username']),
						'PASSWORD'		=> htmlspecialchars_decode($data['new_password']),
						'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
					);
I tried changing

Code: Select all

'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
to

Code: Select all

'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?iframe=true&?mode=activate&u=$user_id&k=$user_actkey")
but that dosnt work, it just takes me to the index page of my iframed wp forum.
I does not activate
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Get custom page link?

Post by axew3 »

ok, let me check the thing because here the URL to edit is clearly this:

Code: Select all

'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
need to be changed into:

Code: Select all

'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?iframe=true&mode=activate&u=$user_id&k=$user_actkey")
but after, the wp page-forum.php need to redirect correctly to this url so it is necessary to add as above explained, into the elseif of page-forum.php the code that recognize this kind of url, passing it for the value of the attribute src, of the html iframe tag.
Checking to fix all the above as finished my dinner, it is "Sunday pizza" time!
mLgz0rn
User ww
User ww
Posts: 42
Joined: Fri Jan 20, 2017 5:23 pm

Re: Get custom page link?

Post by mLgz0rn »

axew3 wrote: Sun Apr 29, 2018 6:45 pm ok, let me check the thing because here the URL to edit is clearly this:

Code: Select all

'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
need to be changed into:

Code: Select all

'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?iframe=true&mode=activate&u=$user_id&k=$user_actkey")
but after, the wp page-forum.php need to redirect correctly to this url so it is necessary to add as above explained, into the elseif of page-forum.php the code that recognize this kind of url, passing it for the value of the attribute src, of the html iframe tag.
Checking to fix all the above as finished my dinner, it is "Sunday pizza" time!
ooooh pizza :D:D
Love your work mate <3 thanks alot
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Get custom page link?

Post by axew3 »

Yeah pizza pizza! I make pizza also! And it's so good ... who try my pizza say it is good, i suppose (hope) not just to make me happy, but because it is really true!

On wordpress page-forum.php where line:

Code: Select all

$w3iu_folder = isset($_GET["folder"]) ? $_GET["folder"] : '';
add just after this line:

Code: Select all

$w3act_key = isset($_GET["k"]) ? $_GET["k"] : '';
so change the line:

Code: Select all

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]/',$w3phpbb_viewtopic) OR preg_match('/[^0-9]/',$w3phpbb_viewforum) 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) ){
into this, to add the sanitization of this new value:

Code: Select all

if( preg_match('/[^0-9A-Za-z]/',$w3act_key) OR 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]/',$w3phpbb_viewtopic) OR preg_match('/[^0-9]/',$w3phpbb_viewforum) 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) ){
now after the long list of elseif, where code:

Code: Select all

} else {
	$w3all_url_to_cms = $w3all_url_to_cms;
}
just after add the follow:

Code: Select all

if($w3mode == 'activate' && !empty($w3act_key)){
	$w3all_url_to_cms = $w3all_url_to_cms . "/ucp.php?mode=activate&u=".$w3phpbbuid."&k=".$w3act_key."";
}
the flow of activation in phpBB iframed will work fine now.

Unfortunately, i've build adding iframe=true into a link like this that arrive on confirmation email:

Code: Select all

http://localhost/root_integrations/phpbb32_new2/ucp.php?mode=activate&u=211&k=4XSIX8TGWH
i had to manually change to test into:

Code: Select all

http://localhost/root_integrations/phpbb32_new2/ucp.php?iframe=true&mode=activate&u=211&k=4XSIX8TGWH
because after i've edit the file
yourphpBB/includes/ucp/ucp_register.php
as you suggested and like also i was expecting, the activation email still arrive without iframe=true on activation link.
That's strange because i can't find out at moment where so should be the string to change. Do you experience the same?

The second part about the custom page that is quite easy to understand ins't difficult to be added in the same way, i will follow as soon because at moment i would really understand why the email still arrive without the needed var about iframe, despite it has been added, more little pushed requests on air ...
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Get custom page link (and email activation) rewrite to redirect to iframed phpBB?

Post by axew3 »

About the app.php kind of url, as all is structured, it require a little more complicate way.

the phpBB .htaccess code, need to change into:

Code: Select all

RewriteCond %{QUERY_STRING} ^(.*)(iframe=true&)(.*)(p=)([0-9]+)(.*)?$
RewriteRule . /wp49/index.php/forum/?%3post_id=%5%6 [R,L]
#all others
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true)(.*)$
RewriteRule . /wp49/index.php/forum/?%3 [R,L]
# custom app
RewriteCond %{REQUEST_URI} ^(.*)(app.php/iframe=true/)(.*)$
RewriteRule . /wp49/index.php/forum/?app=%3 [R,L]
so substantially you'll add this to the code added into your phpBB .htaccess

Code: Select all

# custom app
RewriteCond %{REQUEST_URI} ^(.*)(app.php/iframe=true/)(.*)$
RewriteRule . /wp49/index.php/forum/?app=%3 [R,L]
change the /wp49/index.php/forum/ with path to your wp iframed page link.

NOTE that here the passed URL to get this work, still need to contain and pass the var iframe=true in this way (as specified to be grabbed by the .htaccess added code):

Code: Select all

http://localhost/root_integrations/phpbb32/app.php/iframe=true/applicationform
So on page-forum.php, to correctly pass the value for the src attribute of the iframe element, it need to be first sanitized, then we go to build like explained on prev post, same procedure:
after the line:

Code: Select all

$w3iu_folder = isset($_GET["folder"]) ? $_GET["folder"] : '';
add this line:

Code: Select all

$w3app = isset($_GET["app"]) ? $_GET["app"] : '';
now change the line about values sanitization:

Code: Select all

if( preg_match('/[^0-9A-Za-z]/',$w3act_key) OR 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]/',$w3phpbb_viewtopic) OR preg_match('/[^0-9]/',$w3phpbb_viewforum) 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) ){
adding the new value to sanitize, so change into:

Code: Select all

if( preg_match('/[^-0-9A-Za-z_]/',$w3app) OR preg_match('/[^0-9A-Za-z]/',$w3act_key) OR 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]/',$w3phpbb_viewtopic) OR preg_match('/[^0-9]/',$w3phpbb_viewforum) 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) ){
then we go to add the correct redirect to be used as src for iframe element,
so after the code:

Code: Select all

} else {
	$w3all_url_to_cms = $w3all_url_to_cms;
}
add the follow instruction:

Code: Select all

if(!empty($w3app)){
	$w3all_url_to_cms = $w3all_url_to_cms . "/app.php/".$w3app."";
}
After all this maybe will be also necessary to add all the code added into the phpBB overall_footer.html about resizer, checking that the call to include the library is correct where on last added line:
src="./iframeResizer.contentWindow.min.js"
where it in case need to be added (in case it need to be added because this way to add pages into phpBB may not use the overall_footer.html of the forums template) i ignore at moment, because in true i've not install the mod, i've just reproduce the "effect" using custom url calls.
The code about right click to build this kind of link need to be added also in case.
I will add if you want to precede and you like to apply all the joke. Let know if you not find it very complicate.

About email link that after edited the file like u suggest, still send emails without iframe=true on activation link, still it is on my test.
mLgz0rn
User ww
User ww
Posts: 42
Joined: Fri Jan 20, 2017 5:23 pm

Re: Get custom page link?

Post by mLgz0rn »

axew3 wrote: Sun Apr 29, 2018 9:57 pm Unfortunately, i've build adding iframe=true into a link like this that arrive on confirmation email:

Code: Select all

http://localhost/root_integrations/phpbb32_new2/ucp.php?mode=activate&u=211&k=4XSIX8TGWH
i had to manually change to test into:

Code: Select all

http://localhost/root_integrations/phpbb32_new2/ucp.php?iframe=true&mode=activate&u=211&k=4XSIX8TGWH
because after i've edit the file
yourphpBB/includes/ucp/ucp_register.php
as you suggested and like also i was expecting, the activation email still arrive without iframe=true on activation link.
That's strange because i can't find out at moment where so should be the string to change. Do you experience the same?

The second part about the custom page that is quite easy to understand ins't difficult to be added in the same way, i will follow as soon because at moment i would really understand why the email still arrive without the needed var about iframe, despite it has been added, more little pushed requests on air ...
Alright, so for

Code: Select all

/ucp.php?iframe=true&mode=activate&u=211&k=4XSIX8TGWH
to show up in the email, you need to purge the cache of the board after you have edited the file.
If this do not work you will need to recompile the template first and then purge the cache.

Other files that also needs to be edited is /includes/ucp/ucp_remind.php and /includes/ucp/ucp_resend.php

I have also gotten ?iframe=true to show up after the board link in the email
Image
For this you need to go to /language/email/user_welcome_inactive.txt

Code: Select all

Subject: Welcome to "{SITENAME}"

{WELCOME_MSG}

Please keep this email for your records. Your account information is as follows:

----------------------------
Username: {USERNAME}

Board URL: {U_BOARD}
----------------------------

Please visit the following link in order to activate your account:

{U_ACTIVATE}

Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account.

Thank you for registering.

{EMAIL_SIG}
then add /index.php?iframe=true to {U_BOARD} like this

Code: Select all

{U_BOARD}/index.php?iframe=true
other language files you need to do this to is /language/email/user_welcome.txt and /language/email/admin_welcome_inactive.txt

Again, after doing this you need to purge the cache of the board.

I'm gonna test everything else out you have typed :)
Post Reply