diff --git a/root/adm/style/portal/acp_portal_menu.html b/root/adm/style/portal/acp_portal_menu.html index cdc153c2..46f299c4 100644 --- a/root/adm/style/portal/acp_portal_menu.html +++ b/root/adm/style/portal/acp_portal_menu.html @@ -17,7 +17,7 @@
diff --git a/root/language/en/mods/portal/portal_main_menu_module.php b/root/language/en/mods/portal/portal_main_menu_module.php index 4818521f..6fa27918 100644 --- a/root/language/en/mods/portal/portal_main_menu_module.php +++ b/root/language/en/mods/portal/portal_main_menu_module.php @@ -49,10 +49,19 @@ $lang = array_merge($lang, array( 'ACP_PORTAL_MENU_INT' => 'Internal link', 'ACP_PORTAL_MENU_EXT' => 'External link', 'ACP_PORTAL_MENU_TITLE' => 'Title', - 'ACP_PORTAL_MENU_URL' => 'URL', + 'ACP_PORTAL_MENU_URL' => 'Link URL', 'ACP_PORTAL_MENU_TYPE' => 'Link type', 'ACP_PORTAL_MENU_TYPE_EXP' => 'If you have a link to a page of your board, choose "Internal link" in order to prevent unwanted logouts.', 'ACP_PORTAL_MENU_CREATE_CAT' => 'You need to create a category first.', + 'ACP_PORTAL_MENU_URL_EXP' => 'External links:All links should be entered with a http://Internal links:Only enter the php file as link url, i.e. index.php.If you would like to add a query string, then define the values below.If your link is index.php?style=4, then enter index.php as link url and style=4 in the textfield for the first post variable.', + 'ACP_PORTAL_MENU_QUERY1' => 'First post variable', + 'ACP_PORTAL_MENU_QUERY1_EXP' => 'Enter the first post variable. Example: style=4', + 'ACP_PORTAL_MENU_QUERY2' => 'Second post variable', + 'ACP_PORTAL_MENU_QUERY2_EXP' => 'Enter the second post variable. Example: style=4', + 'ACP_PORTAL_MENU_QUERY3' => 'Third post variable', + 'ACP_PORTAL_MENU_QUERY3_EXP' => 'Enter the third post variable. Example: style=4', + 'ACP_PORTAL_MENU_LINK' => 'Link settings', + 'ACP_PORTAL_MENU_INT_OPTIONS' => 'Internal links options', )); ?> \ No newline at end of file diff --git a/root/portal/modules/portal_main_menu.php b/root/portal/modules/portal_main_menu.php index 6b178696..54a3ff43 100644 --- a/root/portal/modules/portal_main_menu.php +++ b/root/portal/modules/portal_main_menu.php @@ -79,7 +79,8 @@ class portal_main_menu_module { if($links_options[$i] == B3_LINKS_INT) { - $cur_url = append_sid($phpbb_root_path . $links_urls[$i]); + $links_urls[$i] = str_replace('&', '&', $links_urls[$i]); // we need to do this in order to prevent XHTML validation errors + $cur_url = append_sid($phpbb_root_path . $links_urls[$i]); // the user should know what kind of file it is } else { @@ -178,6 +179,41 @@ class portal_main_menu_module $link_is_cat = request_var('link_is_cat', 0); $link_type = (!$link_is_cat) ? request_var('link_type', 0) : B3_LINKS_CAT; $link_url = ($link_is_cat) ? ' ' : request_var('link_url', ' '); + + if($link_type == B3_LINKS_INT) + { + $link_query1 = utf8_normalize_nfc(request_var('link_query1', '')); + $link_query2 = utf8_normalize_nfc(request_var('link_query2', '')); + $link_query3 = utf8_normalize_nfc(request_var('link_query3', '')); + $link_query_string = ''; + + if($link_query1 != '') + { + $link_query_string .= '?' . $link_query1; + if($link_query2 != '') + { + $link_query_string .= '&' . $link_query2; + } + if($link_query3) + { + $link_query_string .= '&' . $link_query3; + } + } + elseif($link_query2 != '') + { + $link_query_string .= '?' . $link_query2; + if($link_query3) + { + $link_query_string .= '&' . $link_query3; + } + } + elseif($link_query3) + { + $link_query_string .= '&' . $link_query3; + } + + $link_url .= $link_query_string; + } if (!$link_title) { @@ -189,6 +225,7 @@ class portal_main_menu_module trigger_error($user->lang['NO_LINK_URL'] . adm_back_link($u_action), E_USER_WARNING); } + // overwrite already existing links and make sure we don't try to save a link outside of the normal array size of $links_urls if (isset($link_id) && $link_id < sizeof($links_urls)) { $message = $user->lang['LINK_UPDATED'];