mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
added a new function cmp_version
This commit is contained in:
parent
c2357d72a3
commit
43f048acca
@ -117,7 +117,7 @@
|
||||
$line_found = explode(":",chop($lines[$i]));
|
||||
}
|
||||
}
|
||||
if ($line_found[1] > $phpgw_info["server"]["versions"]["phpgwapi"]) {
|
||||
if($phpgw->common->cmp_version($phpgw_info["server"]["versions"]["phpgwapi"],$line_found[1])) {
|
||||
echo "<p>There is a new version of phpGroupWare available. <a href=\""
|
||||
. "http://www.phpgroupware.org\">http://www.phpgroupware.org</a>";
|
||||
}
|
||||
|
@ -44,6 +44,29 @@
|
||||
var $key = '';
|
||||
var $crypto;
|
||||
var $debug_info; // An array with debugging info from the API
|
||||
|
||||
// Compares two Version strings
|
||||
/*!
|
||||
@functionn cmp_version
|
||||
@@abstract Compares two Version strings and return 1 if str2 is newest (bigger version number) than str1
|
||||
@@param $str1
|
||||
@@param $str2
|
||||
*/
|
||||
function cmp_version($str1,$str2)
|
||||
{
|
||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str1,$regs);
|
||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str2,$regs2);
|
||||
//echo "$regs[0] - $regs2[0]";
|
||||
for($i=1;$i<5;$i++) {
|
||||
if($regs2[$i] == $regs[$i])
|
||||
continue;
|
||||
if($regs2[$i] > $regs[$i])
|
||||
return 1;
|
||||
else
|
||||
if($regs2[$i] < $regs[$i])
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert an array into the format needed for the access column.
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user