Permalink
Browse files

Fixing the version comparison function of both 1.4 and 1.2. This also…

… allows for proper comparison when using strings such as 1.4-beta2 etc.

One point worth noting however is that 1.4 and 1.4.0 are treated as unequal (1.4.0 is apparently greater than 1.4). This isn't a problem, it's just maybe not obvious.
  • Loading branch information...
reines committed Aug 13, 2009
1 parent 3d6c201 commit 14f29e1d6ea6310c072cd13bb18cfa4bed34ba75
Showing with 3 additions and 12 deletions.
  1. +3 −12 upload/admin_index.php
View
@@ -43,20 +43,11 @@
if (!ini_get('allow_url_fopen'))
message('Unable to check for upgrade since \'allow_url_fopen\' is disabled on this system.');
$fp = @fopen('http://fluxbb.org/latest_version', 'r');
$latest_version = trim(@fread($fp, 16));
@fclose($fp);
if ($latest_version == '')
$latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version'));
if (empty($latest_version))
message('Check for upgrade failed for unknown reasons.');
$cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version']));
$cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version);
$latest_version = str_replace('.', '', strtolower($latest_version));
$latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version);
if ($cur_version >= $latest_version)
if (version_compare($pun_config['o_cur_version'], $latest_version, '>='))
message('You are running the latest version of FluxBB.');
else
message('A new version of FluxBB has been released. You can download the latest version at <a href="http://fluxbb.org/">FluxBB.org</a>.');

0 comments on commit 14f29e1

Please sign in to comment.