Index: branches/5.2.x/core/kernel/processors/main_processor.php =================================================================== diff -u -r16273 -r16339 --- branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 16273) +++ branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 16339) @@ -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) @@ -910,7 +925,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.2.x/core/units/admin/admin_tag_processor.php =================================================================== diff -u -r15906 -r16339 --- branches/5.2.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 15906) +++ branches/5.2.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 16339) @@ -1,6 +1,6 @@ Application->HREF($template, '', $section_data['url']); $ret .= $this->Application->ParseBlock( array_merge($params, $section_data) ); @@ -207,7 +206,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) ); @@ -286,7 +284,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']); @@ -465,7 +462,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(); @@ -1115,4 +1112,4 @@ { return $this->Application->isCachingType(CACHING_TYPE_MEMORY); } - } \ No newline at end of file + } Index: branches/5.2.x/core/units/helpers/permissions_helper.php =================================================================== diff -u -r15856 -r16339 --- branches/5.2.x/core/units/helpers/permissions_helper.php (.../permissions_helper.php) (revision 15856) +++ branches/5.2.x/core/units/helpers/permissions_helper.php (.../permissions_helper.php) (revision 16339) @@ -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.2.x/core/kernel/managers/plain_url_processor.php =================================================================== diff -u -r15856 -r16339 --- branches/5.2.x/core/kernel/managers/plain_url_processor.php (.../plain_url_processor.php) (revision 15856) +++ branches/5.2.x/core/kernel/managers/plain_url_processor.php (.../plain_url_processor.php) (revision 16339) @@ -1,6 +1,6 @@ $this->manager->getTemplateName()); } - $vars = Array (); - $more_vars = strpos($env_var, '&'); + parse_str(ENV_VAR_NAME . '=' . $env_var, $vars); + $env_var = $vars[ENV_VAR_NAME]; + unset($vars[ENV_VAR_NAME]); - if ( $more_vars !== false ) { - parse_str(substr($env_var, $more_vars + 1), $vars); - $env_var = substr($env_var, 0, $more_vars); - } - // replace escaped ":" symbol not to explode by it $env_var = str_replace('\:', '_&+$$+&_', $env_var); // replace escaped "=" with spec-chars :) $parts = explode(':', $env_var); @@ -160,19 +156,6 @@ $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : 0; $sid = isset($params['sid']) && !$this->Application->RewriteURLs($ssl) ? $params['sid'] : ''; - $ret = ''; - if ( $env_var ) { - $ret = ENV_VAR_NAME . '='; - } - - $ret .= $sid . '-'; // SID-TEMPLATE - - $encode = false; - if ( isset($params['__URLENCODE__']) ) { - $encode = $params['__URLENCODE__']; - unset($params['__URLENCODE__']); - } - if ( isset($params['__SSL__']) ) { unset($params['__SSL__']); } @@ -214,31 +197,17 @@ } } - $ret .= $t . ':' . $this->BuildModuleEnv('m', $params, $pass_events) . $env_string; - + $env_string = $sid . '-' . $t . ':' . $this->BuildModuleEnv('m', $params, $pass_events) . $env_string; unset($params['pass'], $params['opener'], $params['m_event']); + $params = array(ENV_VAR_NAME => $env_string) + $params; - // TODO: tag, which uses resulting url should do escaping - if ( array_key_exists('escape', $params) && $params['escape'] ) { - $ret = kUtil::escape($ret, kUtil::ESCAPE_JS); - unset($params['escape']); - } + $params_str = http_build_query($params); + $ret = str_replace('%23', '#', $params_str); - if ( $params ) { - $params_str = ''; - $join_string = $encode ? '&' : '&'; - - foreach ($params as $param => $value) { - $params_str .= $join_string . $param . '=' . $value; - } - - $ret .= $params_str; + if ( !$env_var ) { + $ret = substr($ret, strlen(ENV_VAR_NAME) + 1); } - if ( $encode ) { - $ret = str_replace('\\', '%5C', $ret); - } - return $ret; } Index: branches/5.2.x/core/units/helpers/geocode_helper.php =================================================================== diff -u -r15856 -r16339 --- branches/5.2.x/core/units/helpers/geocode_helper.php (.../geocode_helper.php) (revision 15856) +++ branches/5.2.x/core/units/helpers/geocode_helper.php (.../geocode_helper.php) (revision 16339) @@ -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.2.x/core/admin_templates/catalog/advanced_view.tpl =================================================================== diff -u -r15906 -r16339 --- branches/5.2.x/core/admin_templates/catalog/advanced_view.tpl (.../advanced_view.tpl) (revision 15906) +++ branches/5.2.x/core/admin_templates/catalog/advanced_view.tpl (.../advanced_view.tpl) (revision 16339) @@ -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.2.x/core/units/content/content_eh.php =================================================================== diff -u -r16016 -r16339 --- branches/5.2.x/core/units/content/content_eh.php (.../content_eh.php) (revision 16016) +++ branches/5.2.x/core/units/content/content_eh.php (.../content_eh.php) (revision 16339) @@ -1,6 +1,6 @@ getTransitParams(); foreach ($transit_params as $param_name => $param_value) { - $event->SetRedirectParam($param_name, kUtil::escape($param_value, kUtil::ESCAPE_URL)); + $event->SetRedirectParam($param_name, $param_value); } } Index: branches/5.2.x/core/kernel/managers/request_manager.php =================================================================== diff -u -r15252 -r16339 --- branches/5.2.x/core/kernel/managers/request_manager.php (.../request_manager.php) (revision 15252) +++ branches/5.2.x/core/kernel/managers/request_manager.php (.../request_manager.php) (revision 16339) @@ -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.2.x/core/admin_templates/promo_blocks/promo_block_list.tpl =================================================================== diff -u -r15373 -r16339 --- branches/5.2.x/core/admin_templates/promo_blocks/promo_block_list.tpl (.../promo_block_list.tpl) (revision 15373) +++ branches/5.2.x/core/admin_templates/promo_blocks/promo_block_list.tpl (.../promo_block_list.tpl) (revision 16339) @@ -119,7 +119,7 @@ 'tools', '', function () { - direct_edit('promo-block', ''); + direct_edit('promo-block', ''); } ) ); Index: branches/5.2.x/core/admin_templates/users/users_list.tpl =================================================================== diff -u -r14663 -r16339 --- branches/5.2.x/core/admin_templates/users/users_list.tpl (.../users_list.tpl) (revision 14663) +++ branches/5.2.x/core/admin_templates/users/users_list.tpl (.../users_list.tpl) (revision 16339) @@ -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.2.x/core/admin_templates/tools/backup3.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/tools/backup3.tpl (.../backup3.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/tools/backup3.tpl (.../backup3.tpl) (revision 16339) @@ -9,7 +9,7 @@ \ No newline at end of file Index: branches/5.2.x/core/admin_templates/modules/modules_list.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/modules/modules_list.tpl (.../modules_list.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/modules/modules_list.tpl (.../modules_list.tpl) (revision 16339) @@ -17,7 +17,7 @@ $(document).ready( function() { Application.SetVar('continue', 1); - openSelector('c', ''); + openSelector('c', ''); } ); Index: branches/5.2.x/core/admin_templates/login.tpl =================================================================== diff -u -r15459 -r16339 --- branches/5.2.x/core/admin_templates/login.tpl (.../login.tpl) (revision 15459) +++ branches/5.2.x/core/admin_templates/login.tpl (.../login.tpl) (revision 16339) @@ -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.2.x/core/kernel/utility/formatters/upload_formatter.php =================================================================== diff -u -r16029 -r16339 --- branches/5.2.x/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 16029) +++ branches/5.2.x/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 16339) @@ -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.2.x/core/admin_templates/head.tpl =================================================================== diff -u -r16062 -r16339 --- branches/5.2.x/core/admin_templates/head.tpl (.../head.tpl) (revision 16062) +++ branches/5.2.x/core/admin_templates/head.tpl (.../head.tpl) (revision 16339) @@ -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); Index: branches/5.2.x/core/units/admin/admin_config.php =================================================================== diff -u -r15718 -r16339 --- branches/5.2.x/core/units/admin/admin_config.php (.../admin_config.php) (revision 15718) +++ branches/5.2.x/core/units/admin/admin_config.php (.../admin_config.php) (revision 16339) @@ -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.2.x/core/admin_templates/catalog/catalog.tpl =================================================================== diff -u -r15906 -r16339 --- branches/5.2.x/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 15906) +++ branches/5.2.x/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 16339) @@ -24,7 +24,7 @@ $(document).ready( function() { Application.SetVar('continue', 1); - openSelector('c', ''); + openSelector('c', ''); } ); @@ -35,7 +35,7 @@ Request.progressText = ''; var $is_catalog = true; - var $Catalog = new Catalog('', 'catalog_', 'Catalog'); + var $Catalog = new Catalog('', 'catalog_', 'Catalog'); $Catalog.TabByCategory = truefalse; var a_toolbar = new ToolBar(); @@ -220,7 +220,7 @@ function executeButton($button_name) { switch ($button_name) { case 'editcat': - var $edit_url = ''; + var $edit_url = ''; var $category_id = get_hidden_field('m_cat_id'); var $redirect_url = $edit_url.replace('#CATEGORY_ID#', $category_id); $redirect_url = $redirect_url.replace('#TEMPLATE#', $category_id == 0 || $category_id == ? 'categories/categories_edit_permissions' : 'categories/categories_edit'); @@ -241,7 +241,7 @@ break; case 'rebuild_cache': - openSelector('c', ''); + openSelector('c', ''); break; case 'recalculate_priorities': @@ -290,7 +290,7 @@ var $menu_frame = getFrame('menu'); if (typeof $menu_frame.ShowStructure != 'undefined') { - $menu_frame.ShowStructure('', true); + $menu_frame.ShowStructure('', true); } Application.setHook( Index: branches/5.2.x/core/admin_templates/categories/categories_edit_relations.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/categories/categories_edit_relations.tpl (.../categories_edit_relations.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/categories/categories_edit_relations.tpl (.../categories_edit_relations.tpl) (revision 16339) @@ -37,7 +37,7 @@ //Relations related: a_toolbar.AddButton( new ToolBarButton('new_item', '::', function() { - openSelector('c-rel', '', 'TargetId', '950x600'); + openSelector('c-rel', '', 'TargetId', '950x600'); } ) ); function edit() Index: branches/5.2.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r16308 -r16339 --- branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 16308) +++ branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 16339) @@ -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); @@ -1010,14 +1010,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 */ @@ -1464,10 +1466,10 @@ $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); $page =& $this->_getPage($params); @@ -1479,7 +1481,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, 'editingMode' => (int)EDITING_MODE, ); @@ -1499,7 +1501,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); @@ -1584,7 +1586,6 @@ 'theme_event' => 'OnEdit', 'theme-file_id' => $this->_getThemeFileId(), 'front' => 1, - '__URLENCODE__' => 1, '__NO_REWRITE__'=> 1, 'index_file' => 'index.php', ); @@ -1701,7 +1702,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.2.x/core/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -r16307 -r16339 --- branches/5.2.x/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 16307) +++ branches/5.2.x/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 16339) @@ -351,7 +351,7 @@ @@ -719,7 +719,7 @@ - GridScrollers[''].SaveURL = ''; + GridScrollers[''].SaveURL = ''; // 2. scan grid (only when using selector) Index: branches/5.2.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl (.../item_selector_advanced_view.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl (.../item_selector_advanced_view.tpl) (revision 16339) @@ -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.2.x/core/admin_templates/promo_block_groups/section_reload.tpl =================================================================== diff -u -r15165 -r16339 --- branches/5.2.x/core/admin_templates/promo_block_groups/section_reload.tpl (.../section_reload.tpl) (revision 15165) +++ branches/5.2.x/core/admin_templates/promo_block_groups/section_reload.tpl (.../section_reload.tpl) (revision 16339) @@ -6,7 +6,7 @@ - $menu_frame.SyncActive(''); + $menu_frame.SyncActive(''); Index: branches/5.2.x/core/admin_templates/tools/system_tools.tpl =================================================================== diff -u -r15858 -r16339 --- branches/5.2.x/core/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 15858) +++ branches/5.2.x/core/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 16339) @@ -11,7 +11,7 @@ } function compile_templates() { - openwin('', 'compile', 800, 575); + openwin('', 'compile', 800, 575); } @@ -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.2.x/core/admin_templates/export/export_complete.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/export/export_complete.tpl (.../export_complete.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/export/export_complete.tpl (.../export_complete.tpl) (revision 16339) @@ -24,7 +24,7 @@ Index: branches/5.2.x/core/admin_templates/users/admins_edit_groups.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/users/admins_edit_groups.tpl (.../admins_edit_groups.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/users/admins_edit_groups.tpl (.../admins_edit_groups.tpl) (revision 16339) @@ -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.2.x/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r16314 -r16339 --- branches/5.2.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 16314) +++ branches/5.2.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 16339) @@ -1,6 +1,6 @@ Special == 'import') { // this is used? $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1)); + $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1)); } elseif ($this->Special == 'export') { // used for orders export in In-Commerce @@ -2744,9 +2744,7 @@ } $params['front'] = 1; // to make opener stack work properly - $params['__URLENCODE__'] = 1; // don't use "&" $params['__NO_REWRITE__'] = 1; // since admin link -// $params['escape'] = 1; // needed? unset($params['button_icon'], $params['button_class'], $params['button_title'], $params['template'], $params['item_prefix'], $params['temp_mode']); Index: branches/5.2.x/core/admin_templates/mailing_lists/send_queue.tpl =================================================================== diff -u -r15608 -r16339 --- branches/5.2.x/core/admin_templates/mailing_lists/send_queue.tpl (.../send_queue.tpl) (revision 15608) +++ branches/5.2.x/core/admin_templates/mailing_lists/send_queue.tpl (.../send_queue.tpl) (revision 16339) @@ -6,10 +6,10 @@ - \ No newline at end of file + Index: branches/5.2.x/core/admin_templates/tools/import2.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/tools/import2.tpl (.../import2.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/tools/import2.tpl (.../import2.tpl) (revision 16339) @@ -11,7 +11,7 @@ Index: branches/5.2.x/core/units/helpers/curl_helper.php =================================================================== diff -u -r16120 -r16339 --- branches/5.2.x/core/units/helpers/curl_helper.php (.../curl_helper.php) (revision 16120) +++ branches/5.2.x/core/units/helpers/curl_helper.php (.../curl_helper.php) (revision 16339) @@ -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; @@ -577,4 +570,4 @@ return ($this->lastHTTPCode == 200) || ($this->lastHTTPCode >= 300 && $this->lastHTTPCode < 310); } - } + } \ No newline at end of file Index: branches/5.2.x/core/admin_templates/reviews/reviews.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/reviews/reviews.tpl (.../reviews.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/reviews/reviews.tpl (.../reviews.tpl) (revision 16339) @@ -41,7 +41,7 @@ } } - var $Catalog = new Catalog('', 'reviews_', 'Reviews'); + var $Catalog = new Catalog('', 'reviews_', 'Reviews'); var a_toolbar = new ToolBar(); a_toolbar.AddButton( new ToolBarButton('edit', '', edit) ); @@ -84,7 +84,7 @@ var $kf = document.getElementById($form_name); var $prev_action = $kf.action; - $kf.action = '' . replace('#PREFIX#', $Catalog.ActivePrefix); + $kf.action = '' . replace('#PREFIX#', $Catalog.ActivePrefix); std_edit_temp_item( $Catalog.ActivePrefix, 'reviews/review_direct_edit', Index: branches/5.2.x/core/admin_templates/incs/close_popup.tpl =================================================================== diff -u -r16249 -r16339 --- branches/5.2.x/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 16249) +++ branches/5.2.x/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 16339) @@ -6,11 +6,11 @@ Index: branches/5.2.x/core/kernel/session/session.php =================================================================== diff -u -r16338 -r16339 --- branches/5.2.x/core/kernel/session/session.php (.../session.php) (revision 16338) +++ branches/5.2.x/core/kernel/session/session.php (.../session.php) (revision 16339) @@ -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 @@ -919,27 +919,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.2.x/core/admin_templates/tree.tpl =================================================================== diff -u -r16308 -r16339 --- branches/5.2.x/core/admin_templates/tree.tpl (.../tree.tpl) (revision 16308) +++ branches/5.2.x/core/admin_templates/tree.tpl (.../tree.tpl) (revision 16339) @@ -35,7 +35,7 @@ getFrame('head').$FrameResizer.OpenWidth = $width; $.get( - '', + '', {width: $width} ); @@ -76,7 +76,7 @@ the_tree.AddFromXML(''); - var fld = the_tree.locateItemByURL(''); + var fld = the_tree.locateItemByURL(''); if (fld) { fld.highLight(); } @@ -113,7 +113,7 @@ // highlight "Structure & Data" node, when one of it's shortcut nodes are clicked - var $structure_node = the_tree.locateItemByURL(''); + var $structure_node = the_tree.locateItemByURL(''); if ($catalog_type == 'AdvancedView') { $right_frame.$Catalog.switchTab($prefix); Index: branches/5.2.x/core/admin_templates/catalog_tab.tpl =================================================================== diff -u -r16062 -r16339 --- branches/5.2.x/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 16062) +++ branches/5.2.x/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 16339) @@ -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.2.x/core/admin_templates/tools/import1.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/tools/import1.tpl (.../import1.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/tools/import1.tpl (.../import1.tpl) (revision 16339) @@ -14,7 +14,7 @@ } ) ); a_toolbar.AddButton( new ToolBarButton('next', '', function() { - location.href = ''; + location.href = ''; } ) ); Index: branches/5.2.x/core/admin_templates/users/users_edit_groups.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/users/users_edit_groups.tpl (.../users_edit_groups.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/users/users_edit_groups.tpl (.../users_edit_groups.tpl) (revision 16339) @@ -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.2.x/core/kernel/utility/http_query.php =================================================================== diff -u -r16267 -r16339 --- branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 16267) +++ branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 16339) @@ -1,6 +1,6 @@ _removePassThroughVariables($vars); } - // transform arrays - return $this->_transformArrays($vars); + return $vars; } /** @@ -731,23 +730,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; - } - function writeRequestLog($filename) { $log_file = (defined('RESTRICTED') ? RESTRICTED : FULL_PATH) . '/' . $filename; Index: branches/5.2.x/core/admin_templates/js/ajax_dropdown.js =================================================================== diff -u -r16153 -r16339 --- branches/5.2.x/core/admin_templates/js/ajax_dropdown.js (.../ajax_dropdown.js) (revision 16153) +++ branches/5.2.x/core/admin_templates/js/ajax_dropdown.js (.../ajax_dropdown.js) (revision 16339) @@ -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.2.x/core/admin_templates/tools/restore4.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/tools/restore4.tpl (.../restore4.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/tools/restore4.tpl (.../restore4.tpl) (revision 16339) @@ -9,7 +9,7 @@ \ No newline at end of file Index: branches/5.2.x/core/admin_templates/tools/restore2.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/tools/restore2.tpl (.../restore2.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/tools/restore2.tpl (.../restore2.tpl) (revision 16339) @@ -9,7 +9,7 @@ Index: branches/5.2.x/core/admin_templates/tools/compile_templates.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/tools/compile_templates.tpl (.../compile_templates.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/tools/compile_templates.tpl (.../compile_templates.tpl) (revision 16339) @@ -8,10 +8,10 @@ \ No newline at end of file Index: branches/5.2.x/core/admin_templates/groups/groups_edit_users.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/groups/groups_edit_users.tpl (.../groups_edit_users.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/groups/groups_edit_users.tpl (.../groups_edit_users.tpl) (revision 16339) @@ -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.2.x/core/admin_templates/stylesheets/base_style_edit.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/stylesheets/base_style_edit.tpl (.../base_style_edit.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/stylesheets/base_style_edit.tpl (.../base_style_edit.tpl) (revision 16339) @@ -46,7 +46,7 @@ { if( ValidateRequired() ) { - openSelector('selectors', '', '', '850x460', 'OnOpenStyleEditor'); + openSelector('selectors', '', '', '850x460', 'OnOpenStyleEditor'); } else { Index: branches/5.2.x/core/admin_templates/incs/footer.tpl =================================================================== diff -u -r15856 -r16339 --- branches/5.2.x/core/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 15856) +++ branches/5.2.x/core/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 16339) @@ -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.2.x/core/admin_templates/groups/groups_list.tpl =================================================================== diff -u -r14244 -r16339 --- branches/5.2.x/core/admin_templates/groups/groups_list.tpl (.../groups_list.tpl) (revision 14244) +++ branches/5.2.x/core/admin_templates/groups/groups_list.tpl (.../groups_list.tpl) (revision 16339) @@ -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 @@ Index: branches/5.2.x/core/admin_templates/js/script.js =================================================================== diff -u -r16276 -r16339 --- branches/5.2.x/core/admin_templates/js/script.js (.../script.js) (revision 16276) +++ branches/5.2.x/core/admin_templates/js/script.js (.../script.js) (revision 16339) @@ -365,7 +365,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); @@ -548,7 +548,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]; @@ -1852,7 +1852,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 ); @@ -1863,7 +1863,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); } } @@ -1874,6 +1874,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.2.x/core/admin_templates/export/export_progress.tpl =================================================================== diff -u -r16062 -r16339 --- branches/5.2.x/core/admin_templates/export/export_progress.tpl (.../export_progress.tpl) (revision 16062) +++ branches/5.2.x/core/admin_templates/export/export_progress.tpl (.../export_progress.tpl) (revision 16339) @@ -8,7 +8,7 @@