1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-04 12:17:42 +02:00

System Plugin: updated checkMonstraVersion function

This commit is contained in:
Martynas Barzda
2012-10-29 17:12:28 +02:00
parent dea6d75af3
commit 27e355cd56

View File

@@ -10,19 +10,32 @@
* Check Monstra version
*/
function checkMonstraVersion() {
if(!Session::exists('stable_monstra_version')){
preg_match('/"version" : "(.*)"/', CURL::get('http://monstra.org/api/version.php'), $version);
if(isset($version[1])){
$stable_version = $version[1];
Session::set('stable_monstra_version', $stable_version);
}
}else{
$stable_version = Session::get('stable_monstra_version');
}
if(Core::VERSION < $stable_version){
echo ('
<script type="text/javascript">
$.getJSON("http://monstra.org/api/version.php?jsoncallback=?",
function(data){
var current_monstra_version = "'.Core::VERSION.'";
var stable_monstra_version = data.version;
if (current_monstra_version < stable_monstra_version) {
$("#update-monstra").addClass("alert").html("'.__("Published a new version of the :monstra", "system", array(":monstra" => "<a target='_blank' href='http://monstra.org/download'>Monstra</a>")).'");
}
}
);
</script>
');
}
}
class SystemAdmin extends Backend {