POSSA / freepbx-weather-by-zip

FreePBX module, reads back weather forcast from dtmf zip code input
4 stars 5 forks source link

Add module update check #20

Closed lgaetz closed 12 years ago

lgaetz commented 12 years ago

Add check for modules updates :

// compare version numbers of local module.xml and remote module.xml 
// returns true if a new version is available
function weatherzip_vercheck() {
    $newver = false;
    if ( function_exists(xml2array)){
        $module_local = xml2array("modules/urihand/module.xml");
        $module_remote = xml2array("https://raw.github.com/POSSA/freepbx-weather-by-zip/master/module.xml");
        if ( $module_remote[module][version] > $module_local[module][version])
            {
            $newver = true;
            }
        return ($newver);
        }
    }

First line of page.urihand.php is:

if ($foo = weatherzip_vercheck()) {
    print "<br>A <b>new version of this module is available</b> from the <a target='_blank' href='http://pbxossa.org'>PBX Open Source Software Alliance</a><br>";
    }
lgaetz commented 12 years ago

done in ver. 1.3.0.3