| @@ 432-444 (lines=13) @@ | ||
| 429 | ||
| 430 | $comps = explode('/', $path); |
|
| 431 | $new_comps = array(); |
|
| 432 | foreach ($comps as $comp) { |
|
| 433 | if (in_array($comp, array('', '.'))) { |
|
| 434 | continue; |
|
| 435 | } |
|
| 436 | ||
| 437 | if (($comp != '..') |
|
| 438 | || (!$initial_slashes && !$new_comps) |
|
| 439 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 440 | array_push($new_comps, $comp); |
|
| 441 | } elseif ($new_comps) { |
|
| 442 | array_pop($new_comps); |
|
| 443 | } |
|
| 444 | } |
|
| 445 | $comps = $new_comps; |
|
| 446 | $path = implode('/', $comps); |
|
| 447 | if ($initial_slashes) { |
|
| @@ 176-188 (lines=13) @@ | ||
| 173 | ||
| 174 | $comps = explode('/', $path); |
|
| 175 | $new_comps = array(); |
|
| 176 | foreach ($comps as $comp) { |
|
| 177 | if (in_array($comp, array('', '.'))) { |
|
| 178 | continue; |
|
| 179 | } |
|
| 180 | ||
| 181 | if (($comp != '..') |
|
| 182 | || (!$initial_slashes && !$new_comps) |
|
| 183 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 184 | array_push($new_comps, $comp); |
|
| 185 | } elseif ($new_comps) { |
|
| 186 | array_pop($new_comps); |
|
| 187 | } |
|
| 188 | } |
|
| 189 | $comps = $new_comps; |
|
| 190 | $path = implode('/', $comps); |
|
| 191 | if ($initial_slashes) { |
|