Rev 1116 | Rev 1131 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1116 | Rev 1130 | ||
---|---|---|---|
Line 92... | Line 92... | ||
92 | } |
92 | } |
93 | else if (OIDplus::getInstallType() === 'svn-snapshot') { |
93 | else if (OIDplus::getInstallType() === 'svn-snapshot') { |
94 | 94 | ||
95 | $rev = $params['rev']; |
95 | $rev = $params['rev']; |
96 | 96 | ||
97 | $update_version = isset($params['update_version']) ? $params['update_version'] : 1; |
97 | $update_version = $params['update_version'] ?? 1; |
98 | if (($update_version != 1) && ($update_version != 2)) { |
98 | if (($update_version != 1) && ($update_version != 2)) { |
99 | throw new OIDplusException(_L('Unknown update version')); |
99 | throw new OIDplusException(_L('Unknown update version')); |
100 | } |
100 | } |
101 | 101 | ||
102 | // Download and unzip |
102 | // Download and unzip |
Line 256... | Line 256... | ||
256 | } |
256 | } |
257 | 257 | ||
258 | $local_installation = OIDplus::getVersion(); |
258 | $local_installation = OIDplus::getVersion(); |
259 | $newest_version = $this->getLatestRevision(); |
259 | $newest_version = $this->getLatestRevision(); |
260 | 260 | ||
261 | $out['text'] .= _L('Local installation: %1',($local_installation ? $local_installation : _L('unknown'))).'<br>'; |
261 | $out['text'] .= _L('Local installation: %1',($local_installation ?: _L('unknown'))).'<br>'; |
262 | $out['text'] .= _L('Latest published version: %1',($newest_version ? $newest_version : _L('unknown'))).'<br><br>'; |
262 | $out['text'] .= _L('Latest published version: %1',($newest_version ?: _L('unknown'))).'<br><br>'; |
263 | 263 | ||
264 | if (!$newest_version) { |
264 | if (!$newest_version) { |
265 | if (!function_exists('curl_init')) { |
265 | if (!function_exists('curl_init')) { |
266 | $out['text'] .= '<p><font color="red">'._L('OIDplus could not determine the latest version.').'<br>'._L('The "%1" PHP extension is not installed at your system. Please enable the PHP extension <code>%2</code>.','CURL','php_curl').'</font></p>'; |
266 | $out['text'] .= '<p><font color="red">'._L('OIDplus could not determine the latest version.').'<br>'._L('The "%1" PHP extension is not installed at your system. Please enable the PHP extension <code>%2</code>.','CURL','php_curl').'</font></p>'; |
267 | } else { |
267 | } else { |
Line 333... | Line 333... | ||
333 | public function tree_search(string $request) { |
333 | public function tree_search(string $request) { |
334 | return false; |
334 | return false; |
335 | } |
335 | } |
336 | 336 | ||
337 | /** |
337 | /** |
338 | * @var null |
338 | * @var string|null |
339 | */ |
339 | */ |
340 | private $releases_ser = null; |
340 | private $releases_ser = null; |
341 | 341 | ||
342 | /** |
342 | /** |
343 | * @param $local_ver |
343 | * @param string $local_ver |
344 | * @return false|string |
344 | * @return false|string |
345 | */ |
345 | */ |
346 | private function showChangelog($local_ver) { |
346 | private function showChangelog(string $local_ver) { |
347 | 347 | ||
348 | try { |
348 | try { |
349 | if (is_null($this->releases_ser)) { |
349 | if (is_null($this->releases_ser)) { |
350 | if (function_exists('gzdecode')) { |
350 | if (function_exists('gzdecode')) { |
351 | $url = OIDplus::getEditionInfo()['revisionlog_gz']; |
351 | $url = OIDplus::getEditionInfo()['revisionlog_gz']; |
Line 399... | Line 399... | ||
399 | } |
399 | } |
400 | $ary = @unserialize($cont); |
400 | $ary = @unserialize($cont); |
401 | if ($ary === false) return false; |
401 | if ($ary === false) return false; |
402 | krsort($ary); |
402 | krsort($ary); |
403 | $max_rev = array_keys($ary)[0]; |
403 | $max_rev = array_keys($ary)[0]; |
404 | $newest_version = 'svn-' . $max_rev; |
404 | return 'svn-' . $max_rev; |
405 | return $newest_version; |
- | |
406 | } catch (\Exception $e) { |
405 | } catch (\Exception $e) { |
407 | return false; |
406 | return false; |
408 | } |
407 | } |
409 | } |
408 | } |
410 | 409 | ||
411 | /** |
410 | /** |
412 | * @param $local_installation |
411 | * @param string $local_installation |
413 | * @param $newest_version |
412 | * @param string $newest_version |
414 | * @return string |
413 | * @return string |
415 | */ |
414 | */ |
416 | private function showPreview($local_installation, $newest_version) { |
415 | private function showPreview(string $local_installation, string $newest_version): string { |
417 | $out = '<h2 id="update_header">'._L('Preview of update %1 → %2',$local_installation,$newest_version).'</h2>'; |
416 | $out = '<h2 id="update_header">'._L('Preview of update %1 → %2',$local_installation,$newest_version).'</h2>'; |
418 | 417 | ||
419 | ob_start(); |
418 | ob_start(); |
420 | try { |
419 | try { |
421 | $cont = $this->showChangelog($local_installation); |
420 | $cont = $this->showChangelog($local_installation); |
Line 440... | Line 439... | ||
440 | return false; |
439 | return false; |
441 | } |
440 | } |
442 | 441 | ||
443 | /** |
442 | /** |
444 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.8 |
443 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.8 |
445 | * @param $user |
444 | * @param string|null $user |
446 | * @return array |
445 | * @return array |
447 | * @throws OIDplusException |
446 | * @throws OIDplusException |
448 | */ |
447 | */ |
449 | public function getNotifications($user=null): array { |
448 | public function getNotifications(string $user=null): array { |
450 | $notifications = array(); |
449 | $notifications = array(); |
451 | if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) { |
450 | if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) { |
452 | 451 | ||
453 | // Following code is based on the VNag plugin (admin 901) code |
452 | // Following code is based on the VNag plugin (admin 901) code |
454 | 453 |