| @@ 122-136 (lines=15) @@ | ||
| 119 | ||
| 120 | if ($context['package_download_broken']) |
|
| 121 | { |
|
| 122 | if (isset($_POST['ftp_username'])) |
|
| 123 | { |
|
| 124 | require_once($sourcedir . '/Class-Package.php'); |
|
| 125 | $ftp = new ftp_connection($_POST['ftp_server'], $_POST['ftp_port'], $_POST['ftp_username'], $_POST['ftp_password']); |
|
| 126 | ||
| 127 | if ($ftp->error === false) |
|
| 128 | { |
|
| 129 | // I know, I know... but a lot of people want to type /home/xyz/... which is wrong, but logical. |
|
| 130 | if (!$ftp->chdir($_POST['ftp_path'])) |
|
| 131 | { |
|
| 132 | $ftp_error = $ftp->error; |
|
| 133 | $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp_path'])); |
|
| 134 | } |
|
| 135 | } |
|
| 136 | } |
|
| 137 | ||
| 138 | if (!isset($ftp) || $ftp->error !== false) |
|
| 139 | { |
|
| @@ 1023-1037 (lines=15) @@ | ||
| 1020 | $files = packageRequireFTP($destination_url, $files, $return); |
|
| 1021 | return $files; |
|
| 1022 | } |
|
| 1023 | elseif (isset($_POST['ftp_username'])) |
|
| 1024 | { |
|
| 1025 | require_once($sourcedir . '/Class-Package.php'); |
|
| 1026 | $ftp = new ftp_connection($_POST['ftp_server'], $_POST['ftp_port'], $_POST['ftp_username'], $_POST['ftp_password']); |
|
| 1027 | ||
| 1028 | if ($ftp->error === false) |
|
| 1029 | { |
|
| 1030 | // Common mistake, so let's try to remedy it... |
|
| 1031 | if (!$ftp->chdir($_POST['ftp_path'])) |
|
| 1032 | { |
|
| 1033 | $ftp_error = $ftp->last_message; |
|
| 1034 | $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp_path'])); |
|
| 1035 | } |
|
| 1036 | } |
|
| 1037 | } |
|
| 1038 | ||
| 1039 | if (!isset($ftp) || $ftp->error !== false) |
|
| 1040 | { |
|
| @@ 620-633 (lines=14) @@ | ||
| 617 | ||
| 618 | $incontext['ftp_errors'] = array(); |
|
| 619 | ||
| 620 | if (isset($_POST['ftp_username'])) |
|
| 621 | { |
|
| 622 | $ftp = new ftp_connection($_POST['ftp_server'], $_POST['ftp_port'], $_POST['ftp_username'], $_POST['ftp_password']); |
|
| 623 | ||
| 624 | if ($ftp->error === false) |
|
| 625 | { |
|
| 626 | // Try it without /home/abc just in case they messed up. |
|
| 627 | if (!$ftp->chdir($_POST['ftp_path'])) |
|
| 628 | { |
|
| 629 | $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 630 | $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp_path'])); |
|
| 631 | } |
|
| 632 | } |
|
| 633 | } |
|
| 634 | ||
| 635 | if (!isset($ftp) || $ftp->error !== false) |
|
| 636 | { |
|