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:
@@ -9,20 +9,33 @@
|
||||
/**
|
||||
* Check Monstra version
|
||||
*/
|
||||
function checkMonstraVersion() {
|
||||
echo ('
|
||||
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>")).'");
|
||||
}
|
||||
}
|
||||
);
|
||||
$("#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 {
|
||||
|
Reference in New Issue
Block a user