<div  class="comments-area" style=" margin-bottom: 30px;">
	<div class="row mb-2">
		<div class="col-sm-3 d-none d-md-block ">
			<h3>{{ lang['statistics'] }}</h3>
		</div>
		<!-- /.col -->
		<div class="col-sm-9">
			<ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item">
					<a href="{{ php_self }}">
						<i class="fa fa-home"></i>
					</a>
				</li>
				<li class="breadcrumb-item active" aria-current="page"><a href="{{ php_self }}?mod=statistics" title="{{ lang['statistics'] }}">{{ lang['statistics'] }}</a> </li>
			</ol>
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->
</div>
<div  class="comments-area">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
						<td>{{ lang['os'] }}</td>
						<td>{{ php_os }}</td>
					</tr>
					<tr>
						<td>{{ lang['php_version'] }}</td>
						<td>{{ php_version }}</td>
					</tr>
					<tr>
						<td>{{ lang['mysql_version'] }}</td>
						<td>{{ mysql_version }}</td>
					</tr>
					<tr>
						<td>{{ lang['pdo_support'] }}</td>
						<td>{{ pdo_support }}</td>
					</tr>
					<tr>
						<td>{{ lang['gd_version'] }}</td>
						<td>{{ gd_version }}</td>
					</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="contentHead"><b> Next Generation CMS</b></td>
</tr>
<tr>
<td width="50%" class="contentEntry1">{{ lang['current_version'] }}</td>
<td width="50%" class="contentEntry2"><span style="font-weight: bold; color: #6cb7ef;">{{ currentVersion }}</span></td>
</tr>
<tr>
						<td>{{ lang['last_version'] }}</td>
						<td>
							<span id="syncLastVersion">loading..</span>
						</td>
					</tr>
					<tr>
						<td>{{ lang['git_version'] }}</td>
						<td>
							<span id="syncSVNVersion">loading..</span>
						</td>
					</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" class="contentHead"><b> {{ lang['size'] }}</b></td>
</tr>
<tr><td class="contentEntry1">{{ lang['group'] }}</td><td class="contentEntry1" align="right">{{ lang['amount'] }}</td><td class="contentEntry1"align="right">{{ lang['volume'] }}</td><td class="contentEntry1"> &nbsp; {{ lang['permissions'] }}</td></tr>
<tr><td class="contentEntry1">{{ lang['group_images'] }}</td><td class="contentEntry1"align="right">{{ image_amount }}</td><td class="contentEntry1"align="right">{{ image_size }}</td><td class="contentEntry1"> &nbsp; {{ image_perm }}</td></tr>
<tr>
<td class="contentEntry1">{{ lang['group_files'] }}</td><td class="contentEntry1"align="right">{{ file_amount }}</td><td class="contentEntry1"align="right">{{ file_size }}</td><td class="contentEntry1"> &nbsp; {{ file_perm }}</td></tr>
<tr>
<td class="contentEntry1">{{ lang['group_avatars'] }}</td><td class="contentEntry1" align="right">{{ avatar_amount }}</td><td class="contentEntry1" align="right">{{ avatar_size }}</td><td class="contentEntry1">&nbsp; {{ avatar_perm }}</td></tr>
<tr><td class="contentEntry1">{{ lang['group_backup'] }}</td><td class="contentEntry1" align="right">{{ backup_amount }}</td>
<td class="contentEntry1" align="right">{{ backup_size }}</td>
<td class="contentEntry1"> &nbsp; {{ backup_perm }}</td></tr>
<tr>
						<td>{{ lang['cache.size'] }}</td>
						<td id="cacheFileCount">-</td>
						<td id="cacheSize">-</td>
						<td class="text-сenter">
							<div class="btn-group btn-group-sm" role="group">
								<button type="button" onclick="return getCacheSize();" class="btn btn-outline-primary">{{ lang['cache.calculate'] }}</button>
								<button type="button" onclick="return clearCache();" class="btn btn-outline-primary">{{ lang['cache.clean']}}</button>
							</div>
						</td>
					</tr></table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="contentHead"><b> {{ lang['size'] }}</b></td>
</tr>
<tr>
<td width="50%" class="contentEntry1">{{ lang['allowed_size'] }}</td>
<td width="50%" class="contentEntry2">{{ allowed_size }}</td>
</tr>
<tr>
<td width="50%" class="contentEntry1">{{ lang['mysql_size'] }}</td>
<td width="50%" class="contentEntry2">{{ mysql_size }}</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="contentHead"><b>{{ lang['system'] }}</b></td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_cats'] }}</td>
<td width="30%" class="contentEntry2">{{ categories|default(0) }}</td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_news'] }}</td>
<td width="30%" class="contentEntry2"><a href="{{ php_self }}?mod=news&status=1">{{ news_draft|default(0) }}</a> / <a href="{{ php_self }}?mod=news&status=2">{{ news_unapp|default(0) }}</a> / <a href="{{ php_self }}?mod=news&status=3">{{ news|default(0) }}</a></td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_comments'] }}</td>
<td width="30%" class="contentEntry2">{{ comments|default(0) }}</td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_users'] }}</td>
<td width="30%" class="contentEntry2">{{ users|default(0) }}</td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_users_unact'] }}</td>
<td width="30%" class="contentEntry2">{{ users_unact|default(0) }}</td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_images'] }}</td>
<td width="30%" class="contentEntry2">{{ images|default(0) }}</td>
</tr>
<tr>
<td width="70%" class="contentEntry1">{{ lang['all_files'] }}</td>
<td width="30%" class="contentEntry2">{{ files|default(0) }}</td>
</tr>
</table>
{% if (flags.confError) %}
<!-- Configuration errors -->
 <table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr><td colspan="2" class="contentHead"><font color="red">{{ lang['pconfig.error'] }}</font></td></tr>
  <tr><td>
<table width="100%">
<thead><tr><td>{{ lang['perror.parameter'] }}</td><td>{{ lang['perror.shouldbe'] }}</td><td>{{ lang['perror.set'] }}</td></thead>
<tr><td>Register Globals</td><td>{{ lang['perror.off'] }}</td><td>{{ flags.register_globals }}</td></tr>
<tr><td>Magic Quotes GPC</td><td>{{ lang['perror.off'] }}</td><td>{{ flags.magic_quotes_gpc }}</td></tr>
<tr><td>Magic Quotes Runtime</td><td>{{ lang['perror.off'] }}</td><td>{{ flags.magic_quotes_runtime }}</td></tr>
<tr><td>Magic Quotes Sybase</td><td>{{ lang['perror.off'] }}</td><td>{{ flags.magic_quotes_sybase }}</td></tr>
</table>
<br/>
&nbsp;<a style="cursor: pointer; color: red;" onclick="document.getElementById('perror_resolve').style.display='block';">{{ lang['perror.howto'] }}</a><br/>
<div id="perror_resolve" style="display: none;">
{{ lang['perror.descr'] }}
</div>
  </td></tr>
 </table>
{% endif %}
<div class="card">
	<h5 class="card-header font-weight-light">{{ lang['note'] }}</h5>
	<div class="card-body">
		<form method="post" action="{{ php_self }}?mod=statistics">
			<input type="hidden" name="action" value="save"/>
			<textarea name="note" rows="6" cols="70" class="form-control mb-3" style="background-color: lightyellow;" placeholder="{{ lang['no_notes'] }}">{{ admin_note }}</textarea>
			<button type="submit" class="btn btn-outline-success">{{ lang['save_note'] }}</button>
		</form>
	</div>
</div>
</div>
<script type="text/javascript">
	function getCacheSize() {
$("#cacheFileCount").html('-');
$("#cacheSize").html('-');
post('admin.statistics.getCacheSize', {
'token':'{{ token }}'
}, false).then(function (response) {
if (response.numFiles) {
$("#cacheFileCount").html(response.numFiles);
$("#cacheSize").html(response.size);
}
});
return false;
}
function clearCache() {
$("#cacheFileCount").html('-');
$("#cacheSize").html('-');
post('admin.statistics.cleanCache', {
'token':'{{ token }}'
}, false).then(function (response) {
getCacheSize();
});
return false;
}
function coreVersionSync() {
post('admin.statistics.coreVersionSync', {
'token':'{{ token }}'
}, false).then(function (response) {});
return false;
}
</script>
 <script>
	$(function () {
var reqReleas = "https://api.github.com/repos/irbees2008/ngcms-core/releases/latest";
requestJSON(reqReleas, function (json) {
if (json.message == "Not Found") {
$('#syncLastVersion').html("No Info Found");
} else {
var currentVersion = '{{ currentVersion }}';
var engineVersionBuild = '{{ engineVersionBuild }}';
var publish = json.published_at;
if (currentVersion >= json.tag_name && engineVersionBuild >= publish.split('T')[0]) {
$('#needUpdate').html('Обновление не требуется');
} else {
$('#needUpdate').html('Обновите CMS');
}
$('#syncLastVersion').html('<a href="' + json.zipball_url + '">' + json.tag_name + '</a> [ ' + json.published_at.slice(0, 10) + ' ]');
}
});
var reqCommit = "https://api.github.com/repos/irbees2008/ngcms-core/commits";
requestJSON(reqCommit, function (json) {
if (json.message == "Not Found") {
$('#syncSVNVersion').html("No Info Found");
} else {
$('#syncSVNVersion').html('<a href="' + json[0].html_url + '" target="_blank">' + json[0].sha.slice(0, 7) + '</a> \
                <b>@</b> <a href="' + json[0].committer.html_url + '" target="_blank">' + json[0].committer.login + '</a> [ ' + json[0].commit.author.date.slice(0, 10) + ' ]');
/*$('#syncSVNVersion').html('<a href="#" id="compare">Обновить до Git</a> [ '+json[0].commit.author.date.slice(0, 10) + ' ]');*/
}
});
coreVersionSync();
function requestJSON(url, callback) {
$.ajax({
url: url,
beforeSend: function (jqXHR) {
jqXHR.overrideMimeType("application/json; charset=UTF-8");
// Repeat send header ajax
jqXHR.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
}).done(function (data, textStatus, jqXHR) {
if (typeof(data) == 'object') {
callback.call(null, data);
} else {
$.notify({
message: '<i><b>Bad reply from server</b></i>'
}, {type: 'danger'});
}
}).catch(function (jqXHR) {
if (0 === jqXHR.status || jqXHR.status >= 400)
$.notify({
message: '<i><b>Bad reply from server</b></i>'
}, {type: 'danger'});
});
}
});
</script>
