aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVjacheslav Trushkin <cyberalien@gmail.com>2013-08-16 19:45:38 +0300
committerVjacheslav Trushkin <cyberalien@gmail.com>2013-09-14 10:10:43 +0300
commit22c8df5403b74cbcad8a267f12c048eaaf053e0f (patch)
treefc1d24e6e9341c920c155b026238185799212f2c
parent4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba (diff)
downloadforums-22c8df5403b74cbcad8a267f12c048eaaf053e0f.tar
forums-22c8df5403b74cbcad8a267f12c048eaaf053e0f.tar.gz
forums-22c8df5403b74cbcad8a267f12c048eaaf053e0f.tar.bz2
forums-22c8df5403b74cbcad8a267f12c048eaaf053e0f.tar.xz
forums-22c8df5403b74cbcad8a267f12c048eaaf053e0f.zip
[ticket/11795] Move PM popup JS to forum_fn.js
Move PM popup JavaScript from overall_header to forum_fn.js Use TWIG to escape PM popup URL PHPBB3-11795
-rw-r--r--phpBB/includes/functions.php1
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js6
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html17
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
4 files changed, 12 insertions, 14 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 70e1cd31fd..888ef59222 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -5333,7 +5333,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox'),
'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox'),
'U_POPUP_PM' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=popup'),
- 'UA_POPUP_PM' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=popup')),
'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.$phpEx"),
'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$phpbb_root_path}viewonline.$phpEx") : '',
'U_LOGIN_LOGOUT' => $u_login_logout,
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index 992479e45e..4b02093b3e 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -323,6 +323,12 @@ jQuery(document).ready(apply_onkeypress_event);
jumpto($(this));
});
+ // PM popup
+ $('body[data-popup-pm-url]').each(function() {
+ var url = this.getAttribute('data-popup-pm-url');
+ window.open(url.replace(/&amp;/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
+ });
+
// Adjust HTML code for IE8 and older versions
var test = document.createElement('div'),
oldBrowser = (typeof test.style.borderRadius == 'undefined');
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 8342136da3..26394034d4 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -24,17 +24,6 @@
Modified by:
-->
-<script type="text/javascript">
-// <![CDATA[
-
- <!-- IF S_USER_PM_POPUP and S_NEW_PM -->
- var url = '{UA_POPUP_PM}';
- window.open(url.replace(/&amp;/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
- <!-- ENDIF -->
-
-// ]]>
-</script>
-
<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
@@ -47,12 +36,16 @@
<link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
<![endif]-->
+<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
+ {% set body_attributes %}{{ body_attributes }} data-popup-pm-url="{{ U_POPUP_PM|e('html_attr') }}"{% endset %}
+<!-- ENDIF -->
+
<!-- EVENT overall_header_head_append -->
{$STYLESHEETS}
</head>
-<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}">
+<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}"{{ body_attributes }}>
<div id="wrap">
<a id="top" accesskey="t"></a>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 5702c62f06..a1f69a81a5 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -23,7 +23,7 @@
<script type="text/javascript">
// <![CDATA[
<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
- popup('{UA_POPUP_PM}', 400, 225, '_phpbbprivmsg');
+ popup('{{ U_POPUP_PM|e('js') }}', 400, 225, '_phpbbprivmsg');
<!-- ENDIF -->
function popup(url, width, height, name)