Rev 76 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 76 | Rev 77 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php /* <ViaThinkSoftSignature> |
1 | <?php /* <ViaThinkSoftSignature> |
2 | Y47HtMofXduSMBqHYs0A2zUutszEFPtnTiplJnrXJJCTA4aIl3/mw1UwycL+xmcvG |
2 | FJRVnIdhB1D3LlEHa+sUsf8GetU/KYLo8RBGo0FxQ1JKQmjSNbvmLswrjaPoGodu+ |
3 | eeO81pkefEWiXtWhoRqX4MIBUv7zZ7Yp+O9/uUs/l+++WvBHkEue++SyuJXgRlYOS |
3 | 5tylc9Oh0UGXodM+I4tEgInSIA7tCESSvMdRS3+I1rgX9xDdlMRoHuZwIFpMRxfcJ |
4 | 14NGZl2w4LJjLEw6RYFtq7UhHlojVrFfysBXgbzYyvMx+mbkstNLTwJZ34T2wJCAK |
4 | hzDzGPf0NPpCfupiaxlHK8ZWkDshwNKbUalNQrONKddv1JjGV6e1tp9qJZH+kDopo |
5 | b3bYzIavozAoSBPiyq1LblDE+EMFbVEdHvRzNTNrcc7fVcDuZt3pzbHkXbJzAbIT+ |
5 | qJvZFkVcvbFNDYX7/GvgD8qZW77bJA4wPmLjTsqUIllnHdxso3byAPtwpLuDW3139 |
6 | 8s5ZCwxrzuy+Q2kq4GCeiTUdpneq8UwWFqrM5pgSpjLP0MM8DZMVJeYcm5KWomOnO |
6 | aFD8SUKHZV2J4clj/NmdJ7Fl1h1u435c/5IQbShKBFDXh68QHsPfxqStOjHUwWMx3 |
7 | HjGhU53upbQkMpadXJOU8eLm0XSD8WwxK6cWiZTGyS0Vg22Hepgv5HDobHWk3Dt7I |
7 | vwKH6yyBXidC2e5O5Vc4MNjayYbffXtGg8GEnQUEqHyDhR5mgxTEprx5KphfgNDxb |
8 | 8ryhwdS2wtfvioWcabm95coxWIayQq/49bW/U0iBZCUlizpkLFVQiqFrPV7BpMN5G |
8 | /Ba7hPa34Z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VCN/Du37EW/IsMPoOQNVKbWOEj3HYbwi |
16 | no6fNBQJRX54x36E3PyeyENjV2yY2Os97agvZADbpjpsdheoTYjEZT5FG+gdg722W |
17 | 7wr4ebqMtjMxfikc1uUu2WIlnooYDF5NusE3y24Vok0sUv3qqZ9nDrI6tOG1wFUSx |
17 | zNffSrbAR6VnldTHUK7LlevS6n+vc9mEZB+rRGXy+njqh0VmR+oJti4InshgDGrJF |
18 | CYyJVAUV0tgjOeixgzdseR7oi5pT8RjUHg3Y/EOHDMg3ZXPZiJzITQaprkB9Zu3Kg |
18 | RwxfdFxSYu6msy/TqO9h70Ixs5C/ALeC5jEEJmScRN1CLLiuwNMdyBEMnmDmU1I6a |
19 | v7ks3PZqxBRxYtCBsMHXmKsWavRBmL7NZP8ETk0SIXmhpK45LHh/LkD/8KktRQ8Gx |
19 | Sg6hgIvBRCyDTOwokFSApy0Zq+25OhmD9p5bY3eyxKaACscuLuwpv1G/4zIGbSJWv |
20 | PRfqK+LWFmAOBfCABUt0ZsN6lA0u5U+ddOMl0sSTsSn7C3mCnTwmFGroGR0gWUQhJ |
20 | DU6/M5UBiKUl6ceDFKMs2Dtizi6ZnvbwYWi2t7fB6HaTPEtXSef52hFXpPgB/VNLw |
21 | wJ4tagVYOJUxgFOa0TiNTttVrYTx+DPfjm7F6c3yjaTg/MKBf5eOKvNPlD22lnsNh |
21 | zF/9mATFKWWhpFtaenVQP3UvAhj+Gvp8ZbNIGyBl48Ww8BYpJY5Lu+AJeMj4SFDX0 |
22 | pkWe14wIwYN7nwVGe6+5IR6GpuYCvfQ0tMTg3NEwraHl0U/wtcGbraAgQQZWoTqNg |
22 | LoJ8f4BCol5mabN46lQZgupmMhxs1vQDWxRQtpXAabY/v/04DwOL2rXUmC8yMa8PS |
23 | Q== |
23 | Q== |
24 | </ViaThinkSoftSignature> */ ?> |
24 | </ViaThinkSoftSignature> */ ?> |
25 | <?php |
25 | <?php |
26 | 26 | ||
27 | /* |
27 | /* |
Line 55... | Line 55... | ||
55 | 55 | ||
56 | protected function get_local_version($path) { |
56 | protected function get_local_version($path) { |
57 | $path = realpath($path) === false ? $path : realpath($path); |
57 | $path = realpath($path) === false ? $path : realpath($path); |
58 | 58 | ||
59 | if (!file_exists("$path/settings.inc.php")) { |
59 | if (!file_exists("$path/settings.inc.php")) { |
60 | throw new Exception("Cannot find net2ftp settings file at $path"); |
60 | throw new VNagException("Cannot find net2ftp settings file at $path"); |
61 | } |
61 | } |
62 | 62 | ||
63 | $cont = @file_get_contents("$path/settings.inc.php"); |
63 | $cont = @file_get_contents("$path/settings.inc.php"); |
- | 64 | if ($cont === false) { |
|
- | 65 | throw new VNagException("Cannot determine version for system $path (settings.inc.php not found)"); |
|
64 | 66 | } |
|
65 | if (!preg_match('@\\$net2ftp_settings\\["application_version"\\]\\s*=\\s*"([^"]+)";@ismU', $cont, $m)) { |
67 | if (!preg_match('@\\$net2ftp_settings\\["application_version"\\]\\s*=\\s*"([^"]+)";@ismU', $cont, $m)) { |
66 | throw new Exception("Cannot determine version for system $path"); |
68 | throw new VNagException("Cannot determine version for system $path (application_version setting not found)"); |
67 | } |
69 | } |
68 | 70 | ||
69 | return $m[1]; |
71 | return $m[1]; |
70 | } |
72 | } |
71 | 73 | ||
72 | protected function get_latest_version() { |
74 | protected function get_latest_version() { |
73 | $cont = $this->url_get_contents('https://www.net2ftp.com/version.js'); |
75 | $cont = $this->url_get_contents('https://www.net2ftp.com/version.js'); |
74 | if ($cont === false) { |
76 | if ($cont === false) { |
75 | throw new Exception('Cannot parse version from net2ftp website. The plugin probably needs to be updated.'); |
77 | throw new VNagException('Cannot parse version from net2ftp website. The plugin probably needs to be updated.'); |
76 | } |
78 | } |
77 | 79 | ||
78 | if (!preg_match("@var latest_stable_version\s*=\s*'(.+)';@ismU", $cont, $m)) { |
80 | if (!preg_match("@var latest_stable_version\s*=\s*'(.+)';@ismU", $cont, $m)) { |
79 | throw new Exception('Cannot parse version from net2ftp website. The plugin probably needs to be updated.'); |
81 | throw new VNagException('Cannot parse version from net2ftp website. The plugin probably needs to be updated.'); |
80 | } else { |
82 | } else { |
81 | $latest_stable = $m[1]; |
83 | $latest_stable = $m[1]; |
82 | } |
84 | } |
83 | 85 | ||
84 | if (!preg_match("@var latest_beta_version\s*=\s*'(.+)';@ismU", $cont, $m)) { |
86 | if (!preg_match("@var latest_beta_version\s*=\s*'(.+)';@ismU", $cont, $m)) { |
85 | throw new Exception('Cannot parse version from net2ftp website. The plugin probably needs to be updated.'); |
87 | throw new VNagException('Cannot parse version from net2ftp website. The plugin probably needs to be updated.'); |
86 | } else { |
88 | } else { |
87 | $latest_beta = $m[1]; |
89 | $latest_beta = $m[1]; |
88 | } |
90 | } |
89 | 91 | ||
90 | return array($latest_stable, $latest_beta); |
92 | return array($latest_stable, $latest_beta); |
91 | } |
93 | } |
92 | 94 | ||
93 | protected function cbRun($optional_args=array()) { |
95 | protected function cbRun($optional_args=array()) { |
94 | $system_dir = $this->argSystemDir->getValue(); |
96 | $system_dir = $this->argSystemDir->getValue(); |
95 | if (empty($system_dir)) { |
97 | if (empty($system_dir)) { |
96 | throw new Exception("Please specify the directory of the net2ftp installation."); |
98 | throw new VNagException("Please specify the directory of the net2ftp installation."); |
97 | } |
99 | } |
98 | $system_dir = realpath($system_dir) === false ? $system_dir : realpath($system_dir); |
100 | $system_dir = realpath($system_dir) === false ? $system_dir : realpath($system_dir); |
99 | 101 | ||
100 | if (!is_dir($system_dir)) { |
102 | if (!is_dir($system_dir)) { |
101 | throw new Exception('Directory "'.$system_dir.'" not found.'); |
103 | throw new VNagException('Directory "'.$system_dir.'" not found.'); |
102 | } |
104 | } |
103 | 105 | ||
104 | $version = $this->get_local_version($system_dir); |
106 | $version = $this->get_local_version($system_dir); |
105 | 107 | ||
106 | list($latest_stable, $latest_beta) = $this->get_latest_version(); |
108 | list($latest_stable, $latest_beta) = $this->get_latest_version(); |