Skip to content

Commit c9ec9b6

Browse files
Отключение сортировки query параметров
1 parent 977823a commit c9ec9b6

1 file changed

Lines changed: 36 additions & 16 deletions

File tree

src/vendor/CanUrl.php

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class CanUrl extends Component implements BootstrapInterface
6868
public $is_track_ajax = false;
6969
public $is_track_pjax = false;
7070
public $is_track_flash = false;
71+
public $is_soret_query_params = false;
7172
protected $_scheme;
7273
protected $_user = '';
7374
protected $_pass = '';
@@ -173,7 +174,7 @@ public function GETquery()
173174
}
174175

175176
$this_query_params = $this->_query_params;
176-
ksort($this_query_params);
177+
//ksort($this_query_params);
177178
$rett_params = $this_query_params;
178179

179180
return UrlHelper::build_query($rett_params);
@@ -248,6 +249,8 @@ public function is_need_redirect($is_final, $current_url = null)
248249

249250
//\Yii::info("parsed_current_url = " . print_r($parsed_current_url, true), self::class);
250251
$redirurl = $this->GETredirurl($parsed_current_url, $is_final);
252+
253+
//print_r($redirurl);die;
251254

252255
//\Yii::info("redirurl = {$redirurl}", self::class);
253256
//\Yii::info("this = " . print_r($this, true), self::class);
@@ -372,25 +375,42 @@ public function make_query_for_redirurl($current_url = null, $is_final = true)
372375
ksort($this_query_params);
373376
$rett_params = $this_query_params;
374377

375-
$this_important_params = (isset($this->_important_params) ? $this->_important_params : []);
376-
ksort($this_important_params);
377-
foreach ($this_important_params as $kkk => $vvv) {
378-
if (!isset($vvv) AND array_key_exists($kkk, $current_params)) {
379-
$vvv = $current_params[$kkk];
380-
}
381-
$rett_params[$kkk] = $vvv;
382-
}
383-
378+
$this_important_params = (isset($this->_important_params) ? $this->_important_params : []);
384379
$this_minor_params = (isset($this->_minor_params) ? $this->_minor_params : []);
385-
ksort($this_minor_params);
386-
foreach ($this_minor_params as $kkk => $vvv) {
387-
if (!isset($vvv) AND array_key_exists($kkk, $current_params)) {
388-
$vvv = $current_params[$kkk];
380+
381+
if ($this->is_soret_query_params === false) {
382+
383+
if ($current_params) {
384+
$this_all_base_prams = ArrayHelper::merge($this_important_params, $this_minor_params);
385+
386+
foreach ($current_params as $key => $val)
387+
{
388+
if (array_key_exists($key, $this_all_base_prams)) {
389+
$rett_params[$key] = $val;
390+
}
391+
}
392+
}
393+
} else {
394+
ksort($this_important_params);
395+
foreach ($this_important_params as $kkk => $vvv) {
396+
if (!isset($vvv) AND array_key_exists($kkk, $current_params)) {
397+
$vvv = $current_params[$kkk];
398+
}
399+
$rett_params[$kkk] = $vvv;
400+
}
401+
402+
ksort($this_minor_params);
403+
foreach ($this_minor_params as $kkk => $vvv) {
404+
if (!isset($vvv) AND array_key_exists($kkk, $current_params)) {
405+
$vvv = $current_params[$kkk];
406+
}
407+
$rett_params[$kkk] = $vvv;
389408
}
390-
$rett_params[$kkk] = $vvv;
391409
}
392410

393-
return UrlHelper::build_query($rett_params);
411+
$res = UrlHelper::build_query($rett_params);
412+
413+
return $res;
394414
}
395415
public function event_after_request(Event $event)
396416
{

0 commit comments

Comments
 (0)