Skip to content

Commit

Permalink
Переписана проверка версии на httpget
Browse files Browse the repository at this point in the history
  • Loading branch information
stdex committed Feb 21, 2017
1 parent 5ec048b commit cfe1031
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 19 additions & 1 deletion engine/actions/statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
// Protect against hack attempts
if (!defined('NGCMS')) die ('HAL');

// ==============================================================
// Module functions
// ==============================================================
@include_once root . 'includes/inc/httpget.inc.php';

$lang = LoadLang('statistics', 'admin');

// Create a protective .htaccess
Expand All @@ -32,6 +37,19 @@ function phpConfigGetBytes($size_str) {
}
}

function coreVersionSync() {

global $config;
if (($vms = cacheRetrieveFile('coreversion.dat', 86400)) === false) {
$paramList = array('_ver' => urlencode(engineVersion), 'type' => urlencode(engineVersionType), 'build' => urlencode(engineVersionBuild), 'uuid' => $config['UUID'], 'pdo' => ((extension_loaded('PDO') && extension_loaded('pdo_mysql') && class_exists('PDO')) ? 'yes' : 'no'));
$req = new http_get();
$vms = $req->get('http://ngcms.ru/sync/versionInfo.php' . '?' . http_build_query($paramList), 3, 1);
cacheStoreFile('coreversion.dat', $vms);
}

return $vms;
}

// Gather information about directories
$STATS = array();
$timeLimit = 0;
Expand Down Expand Up @@ -140,7 +158,7 @@ function phpConfigGetBytes($size_str) {
'mysql_version' => $mysql->mysql_version(),
'gd_version' => (isset($gd_version) && is_array($gd_version)) ? $gd_version["GD Version"] : '<font color="red"><b>NOT INSTALLED</b></font>',
'currentVersion' => $displayEngineVersion,
'versionNotifyURL' => 'http://ngcms.ru/sync/versionInfo.php?ver=' . urlencode(engineVersion) . '&type=' . urlencode(engineVersionType) . '&build=' . urlencode(engineVersionBuild) . '&uuid=' . $config['UUID'] . '&pdo=' . ((extension_loaded('PDO') && extension_loaded('pdo_mysql') && class_exists('PDO')) ? 'yes' : 'no'),
'versionNotify' => coreVersionSync(),
'mysql_size' => $mysql_size,
'allowed_size' => $df,
'avatars' => $avatars,
Expand Down
4 changes: 3 additions & 1 deletion engine/skins/default/tpl/statistics.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@
</tr>
</table>

<script type="text/javascript" language="JavaScript" src="{{ versionNotifyURL }}"></script>
<script type="text/javascript" language="JavaScript">
{{ versionNotify }}
</script>

<br/><br/>

Expand Down

0 comments on commit cfe1031

Please sign in to comment.