|
29 | 29 | //# trigger this somewhere else? |
30 | 30 | refreshTlds(); |
31 | 31 |
|
32 | | -// check for latest version |
33 | | -$checkinterval = sprintf('%d', getConfig('check_new_version')); |
34 | | -if (empty($checkinterval)) { |
35 | | - $checkinterval = 7; |
36 | | -} |
37 | | - |
38 | | -$showUpdateAvail = !empty($_GET['showupdate']); //# just to check the design |
39 | | -$thisversion = VERSION; |
40 | | -$thisversion = preg_replace("/[^\.\d]/", '', $thisversion); |
41 | | -$latestversion = getConfig('updateavailable'); |
42 | | -$showUpdateAvail = $showUpdateAvail || (!empty($latestversion) && !versionCompare($thisversion, $latestversion)); |
43 | | - |
44 | | -if (!$showUpdateAvail && $checkinterval) { |
45 | | - |
46 | | - //#https://mantis.phplist.com/view.php?id=16815 |
47 | | - $query = sprintf('select date_add(value, interval %d day) < now() as needscheck from %s where item = "updatelastcheck"', |
48 | | - $checkinterval, $tables['config']); |
49 | | - $needscheck = Sql_Fetch_Row_Query($query); |
50 | | - if ($needscheck[0] != '0') { |
51 | | - @ini_set('user_agent', NAME.' (phplist version '.VERSION.')'); |
52 | | - @ini_set('default_socket_timeout', 5); |
53 | | - if ($fp = @fopen('https://www.phplist.com/files/LATESTVERSION', 'r')) { |
54 | | - $latestversion = fgets($fp); |
55 | | - $latestversion = preg_replace("/[^\.\d]/", '', $latestversion); |
56 | | - @fclose($fp); |
57 | | - if (!versionCompare($thisversion, $latestversion)) { |
58 | | - //# remember this, so we can remind about the update, without the need to check the phplist site |
59 | | - //# hmmm, this causes it to be "stuck" on the last version checked |
60 | | - SaveConfig('updateavailable', $latestversion, 0, true); |
61 | | - $showUpdateAvail = true; |
62 | | - } |
63 | | - } |
64 | | - SaveConfig('updatelastcheck', date('Y-m-d H:i:s', time()), 0, true); |
65 | | - } |
66 | | -} |
67 | | - |
68 | | -if ($showUpdateAvail) { |
69 | | - echo '<div class="newversion note">'; |
70 | | - echo s('A new version of phpList is available!'); |
71 | | - echo '<br/>'; |
72 | | - echo '<br/>'.s('The new version may have fixed security issues,<br/>so it is recommended to upgrade as soon as possible'); |
73 | | - echo '<br/>'.s('Your version').': <b>'.$thisversion.'</b>'; |
74 | | - echo '<br/>'.s('Latest version').': <b>'.$latestversion.'</b><br/> '; |
75 | | - echo '<a href="https://www.phplist.com/latestchanges?utm_source=pl'.$thisversion.'&utm_medium=updatenews&utm_campaign=phpList" title="'.s('Read what has changed in the new version').'" target="_blank">'.$GLOBALS['I18N']->get('View what has changed').'</a> '; |
76 | | - echo '<a href="https://www.phplist.com/download?utm_source=pl'.$thisversion.'&utm_medium=updatedownload&utm_campaign=phpList" title="'.s('Download the new version').'" target="_blank">'.$GLOBALS['I18N']->get('Download').'</a></div>'; |
77 | | -} |
78 | | - |
79 | 32 | echo '<div class="accordion">'; |
80 | 33 |
|
81 | 34 | $some = 0; |
|
0 commit comments