Skip to content
Permalink
Browse files

Serial setting update

  • Loading branch information...
sergejey committed Jul 8, 2019
1 parent f51bce3 commit 807a15c87e4726b1f8478b003b26e7e60f80c83c
Showing with 30 additions and 20 deletions.
  1. +24 −0 lib/common.class.php
  2. +6 −20 modules/market/market.class.php
@@ -1,5 +1,29 @@
<?php
function getSystemSerial($force_update = 0) {
$serial = gg('Serial');
if (!$serial || $serial == '0' || $force_update) {
$serial = '';
if (IsWindowsOS()) {
$data = exec('vol c:');
if (preg_match('/[\w]+\-[\w]+/', $data, $m)) {
$serial = strtolower($m[0]);
}
} else {
$data = trim(exec("cat /proc/cpuinfo | grep Serial | cut -d '':'' -f 2"));
if ($data == '') {
$data = trim(exec("sudo cat /proc/cpuinfo | grep Serial | cut -d '':'' -f 2"));
}
$serial = ltrim($data, '0');
}
if (!$serial) {
$serial = uniqid('uniq');
}
sg('Serial', $serial);
}
return $serial;
}
function sayReplySafe($ph, $level = 0, $replyto = '')
{
$data = array(
@@ -205,7 +205,7 @@ function admin(&$out)
}
if ($this->ajax && $_GET['op'] == 'news') {
$result = $this->marketRequest('op=news', 5 * 60);
$result = $this->marketRequest('op=news', 15*60); //15*60
$data = json_decode($result, true);
//echo json_encode($data);
if (is_array($data)) {
@@ -561,30 +561,16 @@ function admin(&$out)
function marketRequest($details = '', $cache_timeout = 0)
{
$serial = gg('Serial');
if (!$serial || $serial == '0') {
$serial = '';
if (IsWindowsOS()) {
$data = exec('vol c:');
if (preg_match('/[\w]+\-[\w]+/', $data, $m)) {
$serial = strtolower($m[0]);
}
} else {
$data = trim(exec("cat /proc/cpuinfo | grep Serial | cut -d '':'' -f 2"));
$serial = ltrim($data, '0');
}
if (!$serial) {
$serial = uniqid('uniq');
}
sg('Serial', $serial);
}
$serial = getSystemSerial();
if (IsWindowsOS()) {
$os = 'Windows';
} else {
$os = trim(exec("uname -a"));
if (!$os) {
$os = 'Linux';
$os = trim(exec("sudo uname -a"));
if (!$os) {
$os = 'Linux';
}
}
}
$locale = $_SERVER['HTTP_ACCEPT_LANGUAGE'];

0 comments on commit 807a15c

Please sign in to comment.
You can’t perform that action at this time.