diff --git a/.gitignore b/.gitignore index 6acb932d..1906e272 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store bl-content/* bl-plugins/timemachine +bl-kernel/bludit.pro.php \ No newline at end of file diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 97e1e19e..908ef9b3 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -187,6 +187,11 @@ include(PATH_HELPERS.'paginator.class.php'); include(PATH_HELPERS.'image.class.php'); include(PATH_HELPERS.'tcp.class.php'); +// Include Bludit PRO +if( file_exists(PATH_KERNEL.'bludit.pro.php') ) { + include(PATH_KERNEL.'bludit.pro.php'); +} + // Session Session::start(); if(Session::started()===false) { diff --git a/bl-kernel/helpers/filesystem.class.php b/bl-kernel/helpers/filesystem.class.php index 0fc43b4c..b3848d60 100644 --- a/bl-kernel/helpers/filesystem.class.php +++ b/bl-kernel/helpers/filesystem.class.php @@ -54,4 +54,8 @@ class Filesystem { return unlink($filename); } + public static function fileExists($filename) + { + return file_exists($filename); + } } \ No newline at end of file diff --git a/bl-kernel/helpers/tcp.class.php b/bl-kernel/helpers/tcp.class.php index 73961489..6fde7ade 100644 --- a/bl-kernel/helpers/tcp.class.php +++ b/bl-kernel/helpers/tcp.class.php @@ -2,7 +2,7 @@ class TCP { - public static function http($url, $method='GET', $verifySSL=true) + public static function http($url, $method='GET', $verifySSL=true, $timeOut=1) { if( function_exists('curl_version') ) { $ch = curl_init(); @@ -10,6 +10,8 @@ class TCP { // TRUE to include the header in the output curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $verifySSL); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeOut); + curl_setopt($ch, CURLOPT_TIMEOUT, $timeOut); if($method=='POST') { curl_setopt($ch, CURLOPT_POST, true); } @@ -22,7 +24,8 @@ class TCP { else { $options = array( 'http'=>array( - 'method'=>$method + 'method'=>$method, + 'timeout'=>$timeOut ), "ssl"=>array( "verify_peer"=>$verifySSL, diff --git a/bl-plugins/version/plugin.php b/bl-plugins/version/plugin.php index 81198104..d263f683 100644 --- a/bl-plugins/version/plugin.php +++ b/bl-plugins/version/plugin.php @@ -28,18 +28,22 @@ class pluginVersion extends Plugin { { global $ADMIN_CONTROLLER; - $timeToCheck = time() + 10; - if( ($ADMIN_CONTROLLER=='dashboard') && (Session::get('timeToCheck')>$timeToCheck) ) { - //$versions = $this->getVersion(); - $versions = array('latest'=>'2.1'); - Session::set('timeToCheck', $timeToCheck); + $timeToCheck = Session::get('timeToCheck') + 10*60; + if( ($ADMIN_CONTROLLER=='dashboard') && ($timeToCheckgetVersion(); + $versions = array('latest'=>'2.0'); + Session::set('timeToCheck', time()); Session::set('latestVersion', $versions['latest']); } if( version_compare(Session::get('latestVersion'), BLUDIT_VERSION, '>') ) { $html = '
New version available
'; } else { - $html = '
Bludit v'.BLUDIT_VERSION.'Upgrade to Bludit PRO
'; + if(BLUDIT_PRO) { + $html = '
Bludit PRO v'.BLUDIT_VERSION.'
'; + } else { + $html = '
Bludit v'.BLUDIT_VERSION.'Upgrade to Bludit PRO
'; + } } return $html; @@ -48,12 +52,11 @@ class pluginVersion extends Plugin { private function getVersion() { $url = 'https://version.bludit.com'; - $output = TCP::http($url); $json = json_decode($output, true); if(empty($json)) { - return array('version'=>''); + return array('latest'=>''); } return $json;