Index: branches/5.3.x/core/admin_templates/mailing_lists/send_queue.tpl =================================================================== diff -u -N -r15916 -r15974 --- branches/5.3.x/core/admin_templates/mailing_lists/send_queue.tpl (.../send_queue.tpl) (revision 15916) +++ branches/5.3.x/core/admin_templates/mailing_lists/send_queue.tpl (.../send_queue.tpl) (revision 15974) @@ -6,10 +6,10 @@ \ No newline at end of file Index: branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl (.../item_selector_advanced_view.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl (.../item_selector_advanced_view.tpl) (revision 15974) @@ -21,7 +21,7 @@ this.switchTab(); } - var $Catalog = new Catalog('', 'is_advanced_view_', 'ItemSelectorAdvancedView'); + var $Catalog = new Catalog('', 'is_advanced_view_', 'ItemSelectorAdvancedView'); Index: branches/5.3.x/core/admin_templates/browser/frmresourceslist.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/browser/frmresourceslist.tpl (.../frmresourceslist.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/browser/frmresourceslist.tpl (.../frmresourceslist.tpl) (revision 15974) @@ -432,12 +432,12 @@ // 'admin/index.php?env=-dummy:fck--OnLoadCmsTree---&admin=1' - var files_list_url = '' - // '' + var files_list_url = '' + // '' var files_list = new AjaxFilesList(files_list_url); - var rename_url = ''; - var delete_url = ''; - var create_folder_url = ''; + var rename_url = ''; + var delete_url = ''; + var create_folder_url = ''; window.onload = function() { Index: branches/5.3.x/core/admin_templates/tools/import1.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/import1.tpl (.../import1.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/import1.tpl (.../import1.tpl) (revision 15974) @@ -14,7 +14,7 @@ } ) ); a_toolbar.AddButton( new ToolBarButton('next', '', function() { - location.href = ''; + location.href = ''; } ) ); Index: branches/5.3.x/core/admin_templates/categories/ci_blocks.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/categories/ci_blocks.tpl (.../ci_blocks.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/categories/ci_blocks.tpl (.../ci_blocks.tpl) (revision 15974) @@ -75,7 +75,7 @@ - $menu_frame.SyncActive(''); + $menu_frame.SyncActive(''); } Index: branches/5.3.x/core/kernel/session/session.php =================================================================== diff -u -N -r15928 -r15974 --- branches/5.3.x/core/kernel/session/session.php (.../session.php) (revision 15928) +++ branches/5.3.x/core/kernel/session/session.php (.../session.php) (revision 15974) @@ -1,6 +1,6 @@ Application->GetVar('m_wid'); - $last_env = $this->getLastTemplateENV($t, Array ('m_opener' => 'u')); + $last_env = $this->getLastTemplateENV($t, array('m_opener' => 'u')); $last_template = basename($_SERVER['PHP_SELF']) . '|' . $last_env; $this->StoreVar(rtrim('last_template_' . $wid, '_'), $last_template); // prepare last_template for opener stack, module & session could be added later - $last_env = $this->getLastTemplateENV($t, null, false); + $last_env = $this->getLastTemplateENV($t); $last_template = basename($_SERVER['PHP_SELF']) . '|' . $last_env; // save last_template in persistent session @@ -920,27 +920,19 @@ } } - function getLastTemplateENV($t, $params = null, $encode = true) + protected function getLastTemplateENV($t, $params = null) { if (!isset($params)) { $params = Array (); } - $params['__URLENCODE__'] = 1; // uses "&" instead of "&" for url part concatenation + replaces "\" to "%5C" (works in HTML) - - if ($this->Application->GetVar('admin') && !array_key_exists('admin', $params) && !defined('EDITING_MODE')) { $params['editing_mode'] = ''; // used in kApplication::Run } $params = array_merge($this->Application->getPassThroughVariables($params), $params); - $ret = $this->Application->BuildEnv($t, $params, 'all', false, false); - if (!$encode) { - // cancels 2nd part of replacements, that URLENCODE does - $ret = str_replace('%5C', '\\', $ret); - } - return $ret; + return $this->Application->BuildEnv($t, $params, 'all', false, false); } /** Index: branches/5.3.x/core/admin_templates/tools/compile_templates.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/compile_templates.tpl (.../compile_templates.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/compile_templates.tpl (.../compile_templates.tpl) (revision 15974) @@ -8,10 +8,10 @@ \ No newline at end of file Index: branches/5.3.x/core/admin_templates/tools/import2.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/import2.tpl (.../import2.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/import2.tpl (.../import2.tpl) (revision 15974) @@ -11,7 +11,7 @@ \ No newline at end of file Index: branches/5.3.x/core/admin_templates/tools/backup3.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/backup3.tpl (.../backup3.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/backup3.tpl (.../backup3.tpl) (revision 15974) @@ -9,7 +9,7 @@ Index: branches/5.3.x/core/admin_templates/browser/browser_footer.tpl =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/admin_templates/browser/browser_footer.tpl (.../browser_footer.tpl) (revision 15902) +++ branches/5.3.x/core/admin_templates/browser/browser_footer.tpl (.../browser_footer.tpl) (revision 15974) @@ -8,7 +8,7 @@ document.body.scroll = 'no'; var _Simultaneous_Edit_Message = ''; - var _DropTempUrl = ''; + var _DropTempUrl = ''; addLoadEvent(function() {Form.Init('scroll_container')}); } Index: branches/5.3.x/core/admin_templates/users/users_list.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/users/users_list.tpl (.../users_list.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/users/users_list.tpl (.../users_list.tpl) (revision 15974) @@ -33,7 +33,7 @@ 'setprimary', '::', function() { - openSelector('u.regular', '', 'PrimaryGroupId', '800x600', 'OnSaveSelected'); + openSelector('u.regular', '', 'PrimaryGroupId', '800x600', 'OnSaveSelected'); } ) );*/ @@ -79,7 +79,7 @@ function() { Application.SetVar('remove_specials[u.regular]', 1); Application.SetVar('mailing_recipient_type', 'u'); - openSelector('mailing-list', '', 'UserEmail', null, 'OnNew'); + openSelector('mailing-list', '', 'UserEmail', null, 'OnNew'); } ) ); Index: branches/5.3.x/core/admin_templates/modules/modules_list.tpl =================================================================== diff -u -N -r15956 -r15974 --- branches/5.3.x/core/admin_templates/modules/modules_list.tpl (.../modules_list.tpl) (revision 15956) +++ branches/5.3.x/core/admin_templates/modules/modules_list.tpl (.../modules_list.tpl) (revision 15974) @@ -17,7 +17,7 @@ $(document).ready( function() { Application.SetVar('continue', 1); - openSelector('c', ''); + openSelector('c', ''); } ); Index: branches/5.3.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r15946 -r15974 --- branches/5.3.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15946) +++ branches/5.3.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15974) @@ -1,6 +1,6 @@ Application->RecallVar(rtrim('last_template_'.$wid, '_')), 2); $vars_backup = Array (); - $vars = $this->Application->processQueryString( str_replace('%5C', '\\', $env) ); + $vars = $this->Application->processQueryString($env); foreach ($vars as $var_name => $var_value) { $vars_backup[$var_name] = $this->Application->GetVar($var_name); @@ -992,14 +992,16 @@ } // 3. suggestion not found in database, ask webservice - $app_id = $this->Application->ConfigValue('YahooApplicationId'); - $url = 'http://search.yahooapis.com/WebSearchService/V1/spellingSuggestion?appid=' . $app_id . '&query='; - $curl_helper = $this->Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ - $xml_data = $curl_helper->Send( $url . kUtil::escape($keywords, kUtil::ESCAPE_URL) ); + $curl_helper->SetRequestData(array( + 'appid' => $this->Application->ConfigValue('YahooApplicationId'), + 'query' => $keywords, + )); + $xml_data = $curl_helper->Send('http://search.yahooapis.com/WebSearchService/V1/spellingSuggestion'); + $xml_helper = $this->Application->recallObject('kXMLHelper'); /* @var $xml_helper kXMLHelper */ @@ -1469,13 +1471,13 @@ $template = $this->Application->GetVar('t'); $theme_id = $this->Application->GetVar('m_theme'); - $url_params = Array ('block' => '#BLOCK#', 'theme-file_event' => '#EVENT#', 'theme_id' => $theme_id, 'source' => $template, 'pass' => 'all,theme-file', 'front' => 1, 'm_opener' => 'd', '__NO_REWRITE__' => 1, 'no_amp' => 1); + $url_params = Array ('block' => '#BLOCK#', 'theme-file_event' => '#EVENT#', 'theme_id' => $theme_id, 'source' => $template, 'pass' => 'all,theme-file', 'front' => 1, 'm_opener' => 'd', '__NO_REWRITE__' => 1); $edit_template_url = $this->Application->HREF('themes/template_edit', ADMIN_DIRECTORY, $url_params, 'index.php'); - $url_params = Array ('theme-file_event' => 'OnSaveLayout', 'source' => $template, 'pass' => 'all,theme-file', '__NO_REWRITE__' => 1, 'no_amp' => 1); + $url_params = Array ('theme-file_event' => 'OnSaveLayout', 'source' => $template, 'pass' => 'all,theme-file', '__NO_REWRITE__' => 1); $save_layout_url = $this->Application->HREF('index', '', $url_params); - $url_params = Array ('content_event' => 'OnSaveContentBlock', 'pass' => 'all,content', '__NO_REWRITE__' => 1, 'no_amp' => 1); + $url_params = Array ('content_event' => 'OnSaveContentBlock', 'pass' => 'all,content', '__NO_REWRITE__' => 1); $save_content_url = $this->Application->HREF('index', ADMIN_DIRECTORY, $url_params, 'index.php'); $page =& $this->_getPage($params); @@ -1488,7 +1490,7 @@ 'pageId' => $page->GetID(), 'pageInfo' => $page->isLoaded() ? $page_helper->getPageInfo( $page->GetID() ) : Array (), 'editUrl' => $edit_template_url, - 'browseUrl' => $this->Application->HREF('', '', Array ('editing_mode' => '#EDITING_MODE#', '__NO_REWRITE__' => 1, 'no_amp' => 1)), + 'browseUrl' => $this->Application->HREF('', '', Array ('editing_mode' => '#EDITING_MODE#', '__NO_REWRITE__' => 1)), 'saveLayoutUrl' => $save_layout_url, 'saveContentUrl' => $save_content_url, 'editingMode' => (int)EDITING_MODE, @@ -1509,7 +1511,7 @@ $ret .= "var base_url = '" . $this->Application->BaseURL() . "';" . "\n"; $ret .= 'TB.closeHtml = \'close
\';' . "\n"; - $url_params = Array ('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', '__NO_REWRITE__' => 1, 'no_amp' => 1); + $url_params = Array ('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', '__NO_REWRITE__' => 1); $browse_url = $this->Application->HREF('catalog/catalog', ADMIN_DIRECTORY, $url_params, 'index.php'); $browse_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $browse_url); @@ -1594,7 +1596,6 @@ 'theme_event' => 'OnEdit', 'theme-file_id' => $this->_getThemeFileId(), 'front' => 1, - '__URLENCODE__' => 1, '__NO_REWRITE__'=> 1, 'index_file' => 'index.php', ); @@ -1706,7 +1707,6 @@ 'pass' => 'm', 'm_opener' => 'd', 'm_cat_id' => $page->GetID(), - '__URLENCODE__' => 1, '__NO_REWRITE__'=> 1, 'front' => 1, 'index_file' => 'index.php', Index: branches/5.3.x/core/admin_templates/head.tpl =================================================================== diff -u -N -r15677 -r15974 --- branches/5.3.x/core/admin_templates/head.tpl (.../head.tpl) (revision 15677) +++ branches/5.3.x/core/admin_templates/head.tpl (.../head.tpl) (revision 15974) @@ -5,7 +5,7 @@ @@ -22,7 +22,7 @@
@@ -50,7 +50,7 @@ ##--> - + @@ -81,10 +81,10 @@ | - " target="_parent" class="kx-header-link"> + - " target="_parent"> +
@@ -119,7 +119,7 @@ } - $FrameResizer = new FrameResizer('', '', window.parent, '', ); + $FrameResizer = new FrameResizer('', '', window.parent, '', ); $FrameResizer.InitControls($FrameResizer); $FrameResizer.SetStatus(01); \ No newline at end of file Index: branches/5.3.x/core/admin_templates/no_permission.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/no_permission.tpl (.../no_permission.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/no_permission.tpl (.../no_permission.tpl) (revision 15974) @@ -42,7 +42,7 @@ $(document).ready( function () { - window.location.href = ''; + window.location.href = ''; } ); Index: branches/5.3.x/core/admin_templates/groups/groups_edit_users.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/groups/groups_edit_users.tpl (.../groups_edit_users.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/groups/groups_edit_users.tpl (.../groups_edit_users.tpl) (revision 15974) @@ -40,7 +40,7 @@ a_toolbar.AddButton( new ToolBarButton('usertogroup', '', function() { - openSelector('g-ug', '', 'GroupId', '800x600'); + openSelector('g-ug', '', 'GroupId', '800x600'); } ) ); a_toolbar.AddButton( new ToolBarButton('delete', '', function() { Index: branches/5.3.x/core/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 15974) @@ -351,7 +351,7 @@ @@ -715,7 +715,7 @@ - GridScrollers[''].SaveURL = ''; + GridScrollers[''].SaveURL = ''; // 2. scan grid (only when using selector) Index: branches/5.3.x/core/kernel/managers/url_manager.php =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 15902) +++ branches/5.3.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 15974) @@ -1,6 +1,6 @@ get(kOpenerStack::LAST_ELEMENT, true)); $ret = $this->Application->BaseURL($prefix, $ssl) . $index_file . '?' . ENV_VAR_NAME . '=' . $env; - // TODO: tag, which uses resulting url should do escaping - if ( isset($params['escape']) && $params['escape'] ) { - $ret = kUtil::escape($ret, kUtil::ESCAPE_JS); - } - if ( isset($params['m_opener']) && $params['m_opener'] == 'u' ) { $opener_stack->pop(); $opener_stack->save(true); Index: branches/5.3.x/core/admin_templates/incs/footer.tpl =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 15902) +++ branches/5.3.x/core/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 15974) @@ -18,7 +18,7 @@ // for popups only; TODO: find a way, how to identify editing popups, not selectors - var _DropTempUrl = ''; + var _DropTempUrl = ''; Application.footerInit(); Index: branches/5.3.x/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r15965 -r15974 --- branches/5.3.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15965) +++ branches/5.3.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15974) @@ -1,6 +1,6 @@ Application->HREF($template, $prefix, $params); + $no_html_escape = false; + + if ( isset($params['no_amp']) ) { + $no_html_escape = $params['no_amp']; + unset($params['no_amp']); + } + + $ret = $this->Application->HREF($template, $prefix, $params); + + if ( !$no_html_escape ) { + // most of the time links are placed into HTML document + // TODO: in future always do escaping according to current "escape context" + $ret = kUtil::escape($ret, kUtil::ESCAPE_HTML); + } + + return $ret; } function Link($params) @@ -899,7 +914,7 @@ // TODO: $next_t variable is ignored !!! (is anyone using m_RequireLogin tag with "next_template" parameter?) $redirect_params = Array ( 'm_cat_id' => 0, - 'next_template' => kUtil::escape('external:' . $_SERVER['REQUEST_URI'], kUtil::ESCAPE_URL), + 'next_template' => 'external:' . $_SERVER['REQUEST_URI'], ); } else { Index: branches/5.3.x/core/admin_templates/incs/close_popup.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 15974) @@ -6,11 +6,11 @@ Index: branches/5.3.x/core/admin_templates/groups/groups_list.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/groups/groups_list.tpl (.../groups_list.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/groups/groups_list.tpl (.../groups_list.tpl) (revision 15974) @@ -38,7 +38,7 @@ function() { Application.SetVar('remove_specials[g.total]', 1); Application.SetVar('mailing_recipient_type', 'g'); - openSelector('mailing-list', '', 'UserEmail', null, 'OnNew'); + openSelector('mailing-list', '', 'UserEmail', null, 'OnNew'); } ) ); @@ -62,7 +62,7 @@ @@ -242,7 +242,7 @@ $me.prop('disabled', true).removeClass('button').addClass('button-disabled'); $.post( - '', + '', { key: $('#memory_cache_key_name').val() }, @@ -281,7 +281,7 @@ $me.prop('disabled', true).removeClass('button').addClass('button-disabled'); $.post( - '', + '', { key: $('#memory_cache_key_name').val(), value: $('#memory_cache_key_value').val() Index: branches/5.3.x/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r15943 -r15974 --- branches/5.3.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 15943) +++ branches/5.3.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 15974) @@ -1,6 +1,6 @@ Application->HREF($template, '', $section_data['url']); $ret .= $this->Application->ParseBlock( array_merge($params, $section_data) ); @@ -206,7 +205,6 @@ $url_params = $section_data['url']; unset($url_params['t']); - $url_params['__URLENCODE__'] = 1; $section_data['section_url'] = $this->Application->HREF($section_data['url']['t'], '', $url_params); $ret = $this->Application->ParseBlock( array_merge($params, $section_data) ); @@ -285,7 +283,6 @@ // remove template, so it doesn't appear as additional parameter in url $template = $section_data['url']['t']; unset($section_data['url']['t']); - $section_data['url']['__URLENCODE__'] = 1; $section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']); @@ -476,7 +473,7 @@ $params['t'] = 'catalog/item_selector/item_selector_'.$mode; $params['m_cat_id'] = $this->Application->getBaseCategory(); - $default_params = Array('no_amp' => 1, 'pass' => 'all,'.$params['prefix']); + $default_params = Array('pass' => 'all,'.$params['prefix']); unset($params['prefix']); $pass_through = Array(); @@ -1196,4 +1193,4 @@ return $this->Application->ParseBlock($block_params); } - } + } \ No newline at end of file Index: branches/5.3.x/core/admin_templates/users/users_edit_groups.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/users/users_edit_groups.tpl (.../users_edit_groups.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/users/users_edit_groups.tpl (.../users_edit_groups.tpl) (revision 15974) @@ -41,7 +41,7 @@ a_toolbar.AddButton( new ToolBarButton('select_user', '::', function() { - openSelector('u-ug', '', 'GroupId', '800x600'); + openSelector('u-ug', '', 'GroupId', '800x600'); } ) ); a_toolbar.AddButton( new ToolBarButton('edit', '', edit) ); Index: branches/5.3.x/core/kernel/utility/formatters/upload_formatter.php =================================================================== diff -u -N -r15928 -r15974 --- branches/5.3.x/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 15928) +++ branches/5.3.x/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 15974) @@ -1,6 +1,6 @@ 1, 'pass' => 'm,'.$object->Prefix, + 'pass' => 'm,'.$object->Prefix, $object->Prefix . '_event' => 'OnViewFile', - 'file' => kUtil::escape($value, kUtil::ESCAPE_URL), 'field' => $field_name + 'file' => $value, 'field' => $field_name ); return $this->Application->HREF('', '', $url_params); Index: branches/5.3.x/core/admin_templates/js/ajax_dropdown.js =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/js/ajax_dropdown.js (.../ajax_dropdown.js) (revision 15483) +++ branches/5.3.x/core/admin_templates/js/ajax_dropdown.js (.../ajax_dropdown.js) (revision 15974) @@ -15,7 +15,7 @@ new AJAXDropDown('combo_input1', function(cur_value) {return 'items1.xml?cur='+encodeURIComponent(cur_value)}); new AJAXDropDown('curr_search_keyword', function(cur_value) { - var $url = ''; + var $url = ''; return $url.replace('#CUR_VALUE#', encodeURIComponent(cur_value)); } ); Index: branches/5.3.x/core/kernel/application.php =================================================================== diff -u -N -r15962 -r15974 --- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15962) +++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15974) @@ -1,6 +1,6 @@ isAdmin ) { - $redirect_params['next_template'] = kUtil::escape($_SERVER['REQUEST_URI'], kUtil::ESCAPE_URL); + $redirect_params['next_template'] = $_SERVER['REQUEST_URI']; } $this->Redirect($maintenance_template, $redirect_params); @@ -1887,7 +1887,6 @@ $params['ajax'] = 'yes'; } - $params['__URLENCODE__'] = 1; $location = $this->HREF($t, $prefix, $params, $index_file); if ( $this->isDebugMode() && (kUtil::constOn('DBG_REDIRECT') || (kUtil::constOn('DBG_RAISE_ON_WARNINGS') && $this->Debugger->WarningCount)) ) { Index: branches/5.3.x/core/admin_templates/catalog/advanced_view.tpl =================================================================== diff -u -N -r15907 -r15974 --- branches/5.3.x/core/admin_templates/catalog/advanced_view.tpl (.../advanced_view.tpl) (revision 15907) +++ branches/5.3.x/core/admin_templates/catalog/advanced_view.tpl (.../advanced_view.tpl) (revision 15974) @@ -23,7 +23,7 @@ $(document).ready( function() { Application.SetVar('continue', 1); - openSelector('c', ''); + openSelector('c', ''); } ); @@ -38,7 +38,7 @@ this.switchTab(); } - var $Catalog = new Catalog('', 'advanced_view_', 'AdvancedView'); + var $Catalog = new Catalog('', 'advanced_view_', 'AdvancedView'); var a_toolbar = new ToolBar(); @@ -87,7 +87,7 @@ var $kf = document.getElementById($form_name); var $prev_action = $kf.action; - $kf.action = ''; + $kf.action = ''; set_hidden_field('remove_specials[' + $Catalog.ActivePrefix + ']', 1); std_edit_item( @@ -103,7 +103,7 @@ var $kf = document.getElementById($form_name); var $prev_action = $kf.action; - $kf.action = ''; + $kf.action = ''; set_hidden_field('remove_specials[' + $Catalog.ActivePrefix + ']', 1); std_precreate_item( @@ -130,7 +130,7 @@ var $menu_frame = getFrame('menu'); if (typeof $menu_frame.ShowStructure != 'undefined') { - $menu_frame.ShowStructure('', false); + $menu_frame.ShowStructure('', false); } Application.setHook( Index: branches/5.3.x/core/admin_templates/js/script.js =================================================================== diff -u -N -r15907 -r15974 --- branches/5.3.x/core/admin_templates/js/script.js (.../script.js) (revision 15907) +++ branches/5.3.x/core/admin_templates/js/script.js (.../script.js) (revision 15974) @@ -366,7 +366,7 @@ set_hidden_field('events[trans]', 'OnLoad'); var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(.*)'); - var $t = $regex.exec(url)[3]; + var $t = $regex.exec(rawurldecode(url))[3]; $kf.target = wnd; submit_event(prefix, '', $t, url); @@ -549,7 +549,7 @@ function openSelector($prefix, $url, $dst_field, $window_size, $event) { // get template name from url var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); - $regex = $regex.exec($url); + $regex = $regex.exec(rawurldecode($url)); var $t = $regex[3]; @@ -1839,7 +1839,7 @@ // setTimeout allows to call method indirectly. Without it whole idea won't work 2nd time (try adding 2 relations one after another) setTimeout( function () { - openSelector('adm', $ru.replace(/%5C/g, '\\') + '&merge_opener_stack=1'); + openSelector('adm', $ru + '&merge_opener_stack=1'); }, 200 ); @@ -1850,7 +1850,7 @@ window.focus(); if ( !(($force_skip_refresh === true) || (typeof $skip_refresh != 'undefined' && $skip_refresh)) ) { - window.location.href = $redirect_url.replace(/%5C/g, '\\'); + window.location.href = rawurldecode($redirect_url); } } @@ -1861,6 +1861,20 @@ return document.getElementById($prepend + $mask.replace('#FIELD_NAME#', $field) + $append); } +function rawurldecode(str) { + + if ( str.indexOf('?') != -1 ) { + var $parts = str.split('?', 2); + + return $parts[0] + ($parts.length == 2 ? '?' + rawurldecode($parts[1]) : ''); + } + + return decodeURIComponent((str + '').replace(/%(?![\da-f]{2})/gi, function () { + // PHP tolerates poorly formed escape sequences + return '%25'; + })); +} + Array.prototype.each = function ($callback) { var $result = null; Index: branches/5.3.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r15962 -r15974 --- branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15962) +++ branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15974) @@ -1,6 +1,6 @@ _removePassThroughVariables($vars); } - // transform arrays - return $this->_transformArrays($vars); + return $vars; } /** @@ -696,23 +695,6 @@ return $url_params; } - function _transformArrays($array, $level_prefix = '') - { - $ret = Array (); - foreach ($array as $var_name => $var_value) { - $new_var_name = $level_prefix ? $level_prefix . '[' . $var_name . ']' : $var_name; - - if (is_array($var_value)) { - $ret = array_merge($ret, $this->_transformArrays($var_value, $new_var_name)); - } - else { - $ret[$new_var_name] = $var_value; - } - } - - return $ret; - } - /** * Checks, that url is empty * Index: branches/5.3.x/core/kernel/managers/request_manager.php =================================================================== diff -u -N -r15910 -r15974 --- branches/5.3.x/core/kernel/managers/request_manager.php (.../request_manager.php) (revision 15910) +++ branches/5.3.x/core/kernel/managers/request_manager.php (.../request_manager.php) (revision 15974) @@ -1,6 +1,6 @@ 'u', '__URLENCODE__' => 1); + $default_params = Array ('m_opener' => 'u'); if ( !$this->Application->ConfigValue('UsePopups') && $opener_stack->getWindowID() ) { // remove wid to show combined header block in editing window Index: branches/5.3.x/core/admin_templates/export/export_complete.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/export/export_complete.tpl (.../export_complete.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/export/export_complete.tpl (.../export_complete.tpl) (revision 15974) @@ -24,7 +24,7 @@ Index: branches/5.3.x/core/admin_templates/users/user_edit_items.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/users/user_edit_items.tpl (.../user_edit_items.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/users/user_edit_items.tpl (.../user_edit_items.tpl) (revision 15974) @@ -42,7 +42,7 @@ } }*/ - var $Catalog = new Catalog('', 'useritems_', 'UserItemEditor'); + var $Catalog = new Catalog('', 'useritems_', 'UserItemEditor'); a_toolbar = new ToolBar(); a_toolbar.AddButton( new ToolBarButton('select', '', function() { @@ -90,7 +90,7 @@ var $kf = document.getElementById($form_name); var $prev_action = $kf.action; - $kf.action = ''; + $kf.action = ''; set_hidden_field('remove_specials[' + $Catalog.ActivePrefix + ']', 1); std_edit_item( Index: branches/5.3.x/core/units/admin/admin_config.php =================================================================== diff -u -N -r15941 -r15974 --- branches/5.3.x/core/units/admin/admin_config.php (.../admin_config.php) (revision 15941) +++ branches/5.3.x/core/units/admin/admin_config.php (.../admin_config.php) (revision 15974) @@ -1,6 +1,6 @@ null, 'icon' => 'site', 'label' => 'SITE_NAME', - 'url' => Array ('t' => 'index', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1), + 'url' => Array ('t' => 'index', 'pass' => 'm'), 'permissions' => Array ('view'), 'priority' => 0, 'container' => true, Index: branches/5.3.x/core/admin_templates/tools/restore1.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/restore1.tpl (.../restore1.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/restore1.tpl (.../restore1.tpl) (revision 15974) @@ -12,7 +12,7 @@ } ) ); a_toolbar.AddButton( new ToolBarButton('next', '', function() { - location.href = ''; + location.href = ''; } ) ); a_toolbar.Render(); Index: branches/5.3.x/core/admin_templates/tools/restore2.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/restore2.tpl (.../restore2.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/restore2.tpl (.../restore2.tpl) (revision 15974) @@ -9,7 +9,7 @@ \ No newline at end of file Index: branches/5.3.x/core/units/helpers/curl_helper.php =================================================================== diff -u -N -r15928 -r15974 --- branches/5.3.x/core/units/helpers/curl_helper.php (.../curl_helper.php) (revision 15928) +++ branches/5.3.x/core/units/helpers/curl_helper.php (.../curl_helper.php) (revision 15974) @@ -1,6 +1,6 @@ Application->HttpQuery->_transformArrays($data); - - foreach ($data as $key => $value) { - $params_str .= $key . '=' . kUtil::escape($value, kUtil::ESCAPE_URL) . '&'; - } - - $data = $params_str; + $data = http_build_query($data); } $this->requestData = $data; @@ -532,4 +525,4 @@ return ($this->lastHTTPCode == 200) || ($this->lastHTTPCode >= 300 && $this->lastHTTPCode < 310); } - } + } \ No newline at end of file Index: branches/5.3.x/core/kernel/managers/rewrite_url_processor.php =================================================================== diff -u -N -r15928 -r15974 --- branches/5.3.x/core/kernel/managers/rewrite_url_processor.php (.../rewrite_url_processor.php) (revision 15928) +++ branches/5.3.x/core/kernel/managers/rewrite_url_processor.php (.../rewrite_url_processor.php) (revision 15974) @@ -1,6 +1,6 @@ $value) { - $params_str .= $join_string . $param . '=' . $value; - } - - $ret .= '?' . substr($params_str, strlen($join_string)); + $params_str = http_build_query($params); + $ret .= '?' . str_replace('%23', '#', $params_str); } - if ( $encode ) { - $ret = str_replace('\\', '%5C', $ret); - } - return $ret; } Index: branches/5.3.x/core/admin_templates/tools/restore4.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/tools/restore4.tpl (.../restore4.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/tools/restore4.tpl (.../restore4.tpl) (revision 15974) @@ -9,7 +9,7 @@ Index: branches/5.3.x/core/admin_templates/incs/menu_blocks.tpl =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/admin_templates/incs/menu_blocks.tpl (.../menu_blocks.tpl) (revision 15902) +++ branches/5.3.x/core/admin_templates/incs/menu_blocks.tpl (.../menu_blocks.tpl) (revision 15974) @@ -59,7 +59,7 @@ $Menus[''+'_view_menu'].showIcon = true; - $Menus[''+'_view_menu'].addItem(rs('.columns'),'','javascript:openSelector("", "")'); + $Menus[''+'_view_menu'].addItem(rs('.columns'),'','javascript:openSelector("", "")'); Index: branches/5.3.x/core/admin_templates/stylesheets/base_style_edit.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/stylesheets/base_style_edit.tpl (.../base_style_edit.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/stylesheets/base_style_edit.tpl (.../base_style_edit.tpl) (revision 15974) @@ -46,7 +46,7 @@ { if( ValidateRequired() ) { - openSelector('selectors', '', '', '850x460', 'OnOpenStyleEditor'); + openSelector('selectors', '', '', '850x460', 'OnOpenStyleEditor'); } else { Index: branches/5.3.x/core/admin_templates/stylesheets/block_style_edit.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/stylesheets/block_style_edit.tpl (.../block_style_edit.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/stylesheets/block_style_edit.tpl (.../block_style_edit.tpl) (revision 15974) @@ -53,7 +53,7 @@ { if( ValidateRequired() ) { - openSelector('selectors', '', '', '850x460', 'OnOpenStyleEditor'); + openSelector('selectors', '', '', '850x460', 'OnOpenStyleEditor'); } else { Index: branches/5.3.x/core/units/helpers/permissions_helper.php =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/units/helpers/permissions_helper.php (.../permissions_helper.php) (revision 15902) +++ branches/5.3.x/core/units/helpers/permissions_helper.php (.../permissions_helper.php) (revision 15974) @@ -1,6 +1,6 @@ SetRedirectParam('m_cat_id', 0); // category means nothing on admin login screen - $event->SetRedirectParam('next_template', kUtil::escape('external:' . $_SERVER['REQUEST_URI'], kUtil::ESCAPE_URL)); + $event->SetRedirectParam('next_template', 'external:' . $_SERVER['REQUEST_URI']); } else { $event->SetRedirectParam('next_template', $this->Application->GetVar('t')); @@ -500,7 +500,7 @@ // TODO: $next_t variable is ignored !!! (is anyone using m_RequireLogin tag with "next_template" parameter?) $redirect_params = Array ( 'm_cat_id' => 0, // category means nothing on admin login screen - 'next_template' => kUtil::escape('external:' . $_SERVER['REQUEST_URI'], kUtil::ESCAPE_URL), + 'next_template' => 'external:' . $_SERVER['REQUEST_URI'], ); } else { Index: branches/5.3.x/core/kernel/utility/opener_stack.php =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/kernel/utility/opener_stack.php (.../opener_stack.php) (revision 15483) +++ branches/5.3.x/core/kernel/utility/opener_stack.php (.../opener_stack.php) (revision 15974) @@ -1,6 +1,6 @@ data[$index]; } - list ($index_file, $original_env) = explode('|', $this->data[$index], 2); - $fixed_env = str_replace(Array ('&', '%5C'), Array ('&', '\\'), $original_env); + list ($index_file, $env) = explode('|', $this->data[$index], 2); + $params = $this->Application->processQueryString($env, 'pass'); - $params = $this->Application->processQueryString($fixed_env, 'pass'); - - // opener stack is used from JavaScript / redirecting, so any "&" could break it - $params['__URLENCODE__'] = 1; - $template = kUtil::popParam('t', $params, ''); return Array ($template, $params, $index_file); Index: branches/5.3.x/core/units/helpers/geocode_helper.php =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/units/helpers/geocode_helper.php (.../geocode_helper.php) (revision 15902) +++ branches/5.3.x/core/units/helpers/geocode_helper.php (.../geocode_helper.php) (revision 15974) @@ -1,6 +1,6 @@ Application->ConfigValue('GoogleMapsURL').'output=xml&key='. - $this->Application->ConfigValue('GoogleMapsKey').'&q='.kUtil::escape($qaddress, kUtil::ESCAPE_URL); + $delay = 0; + $query_address = $address . ', ' . $city . ', ' . $state; - $curl_helper = $this->Application->recallObject('CurlHelper'); + $curl_helper = $this->Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ - $delay = 0; - while (true) - { - $xml = $curl_helper->Send($request_url); + while ( true ) { + $curl_helper->SetRequestData(array( + 'output' => 'xml', + 'key' => $this->Application->ConfigValue('GoogleMapsKey'), + 'q' => $query_address + )); - if (strpos($xml, '620')) { - $delay += 100000; - } elseif (strpos($xml, '200')) { - // get latitude, longitude and zip from xml-answer + $xml = $curl_helper->Send($this->Application->ConfigValue('GoogleMapsURL')); + + if ( strpos($xml, '620') ) { + $delay += 100000; + } + elseif ( strpos($xml, '200') ) { + // get latitude, longitude and zip from xml-answer $a_coords = explode(',', $this->getTag('coordinates', $xml)); $lat = $a_coords[1]; $lon = abs($a_coords[0]); // set to positive, because required by SQL formula @@ -105,20 +109,21 @@ $carrier = ''; $assoc_data = Array(); break; - } else { + } + else { $lon = ''; $lat = ''; $zip4 = ''; $dpbc = ''; $carrier = ''; $assoc_data = Array(); break; - } - usleep($delay); - } + } - return Array($lon, $lat, $zip4, $dpbc, $carrier, serialize($assoc_data)); + usleep($delay); + } + return Array($lon, $lat, $zip4, $dpbc, $carrier, serialize($assoc_data)); } /** Index: branches/5.3.x/core/admin_templates/login.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/login.tpl (.../login.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/login.tpl (.../login.tpl) (revision 15974) @@ -245,7 +245,7 @@ } function close_windows() { - page = ''; // a_parent.location.href + '?expired=1'; + page = ''; // a_parent.location.href + '?expired=1'; // alert('redirecting ' + a_parent.name + ' to ' + page); a_parent.location.href = page; Index: branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl (.../item_selector_catalog.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl (.../item_selector_catalog.tpl) (revision 15974) @@ -15,7 +15,7 @@ "/> Index: branches/5.3.x/core/admin_templates/promo_block_groups/section_reload.tpl =================================================================== diff -u -N -r15483 -r15974 --- branches/5.3.x/core/admin_templates/promo_block_groups/section_reload.tpl (.../section_reload.tpl) (revision 15483) +++ branches/5.3.x/core/admin_templates/promo_block_groups/section_reload.tpl (.../section_reload.tpl) (revision 15974) @@ -6,7 +6,7 @@ - $menu_frame.SyncActive(''); + $menu_frame.SyncActive(''); Index: branches/5.3.x/core/admin_templates/catalog_tab.tpl =================================================================== diff -u -N -r15902 -r15974 --- branches/5.3.x/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 15902) +++ branches/5.3.x/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 15974) @@ -32,7 +32,7 @@ - // substiture form action, like from was created from here + // substitute form action, like from was created from here document.getElementById('categories_form').action = ''; $Catalog.setItemCount('', ''); $Catalog.setCurrentCategory('', ); @@ -81,7 +81,7 @@ Application.SetVar('continue', 1); - openSelector('c', ''); + openSelector('c', ''); #separator# Index: branches/5.3.x/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r15943 -r15974 --- branches/5.3.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 15943) +++ branches/5.3.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 15974) @@ -1,6 +1,6 @@ 0, - 'next_template' => kUtil::escape('external:' . $_SERVER['REQUEST_URI'], kUtil::ESCAPE_URL), + 'next_template' => 'external:' . $_SERVER['REQUEST_URI'], ); } else { @@ -1841,7 +1841,7 @@ $simultaneous_edit_message = $this->Application->GetVar('_simultaneous_edit_message'); if ( $simultaneous_edit_message ) { - $event->SetRedirectParam('_simultaneous_edit_message', kUtil::escape($simultaneous_edit_message, kUtil::ESCAPE_URL)); + $event->SetRedirectParam('_simultaneous_edit_message', $simultaneous_edit_message); } }