Example #1
0
					<ul class="breadcrumb" onclick="wrapper('triangle_server','item_server'); return false;"><i class="icon" id="triangle_server">▼</i>&nbsp;<?php 
        _e('Service Information');
        ?>
</ul>
					<div class="item" style="display:block;" id="item_server">
<?php 
        if (function_exists("gd_info")) {
            $gd_info = gd_info();
            $gd_version = $gd_info['GD Version'];
        } else {
            $gd_version = "Unknown";
        }
        $max_upload = ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled";
        date_default_timezone_set("Etc/GMT-8");
        $system_time = date("Y-m-d H:i:s", time());
        $content = "\t\t\t\t\t\t" . __('Server information: ') . $_SERVER["SERVER_SOFTWARE"] . '<br />' . __('Database version: ') . htmlspecialchars(DB::version()) . '<br />' . __('GD library version: ') . htmlspecialchars($gd_version) . '<br />' . __('Upload max filesize: ') . htmlspecialchars($max_upload) . '<br />' . __('Max execution time: ') . sprintf(_n('%d second', '%d seconds', $max_execution_time = ini_get("max_execution_time")), htmlspecialchars($max_execution_time)) . '<br />' . __('Server time: ') . htmlspecialchars($system_time) . "\n";
        echo $content;
        ?>
					</div>
				</div>
				<div class="wrapper">
					<ul class="breadcrumb" onclick="wrapper('triangle_manage','item_manage'); return false;"><i class="icon" id="triangle_manage">▼</i>&nbsp;<?php 
        _e('Management Statistics');
        ?>
</ul>
					<div class="item" style="display:block;" id="item_manage">
<?php 
        $q_info = DB::query("SELECT sum(`DownloadTimes`) FROM `" . DCRM_CON_PREFIX . "Packages`");
        $info = DB::fetch_row($q_info);
        $totalDownloads = (int) $info[0];
        $q_info = DB::query("SELECT sum(`Size`) FROM `" . DCRM_CON_PREFIX . "Packages`");
Example #2
0
 public static function hasCap($DBCap)
 {
     $version = DB::version();
     switch (strtolower($DBCap)) {
         case 'collation':
             // @since 2.5.0
         // @since 2.5.0
         case 'groupConcat':
             // @since 2.7.0
         // @since 2.7.0
         case 'subqueries':
             // @since 2.7.0
             return version_compare($version, '4.1', '>=');
         case 'setCharset':
             return version_compare($version, '5.0.7', '>=');
         case 'utf8mb4':
             // @since 4.1.0
             if (version_compare($version, '5.5.3', '<')) {
                 return false;
             }
             $clientVersion = self::$DBDriver->getClientInfo();
             /*
              * libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server.
              * mysqlnd has supported utf8mb4 since 5.0.9.
              */
             if (false !== strpos($clientVersion, 'mysqlnd')) {
                 $clientVersion = preg_replace('/^\\D+([\\d.]+).*/', '$1', $clientVersion);
                 return version_compare($clientVersion, '5.0.9', '>=');
             } else {
                 return version_compare($clientVersion, '5.5.3', '>=');
             }
     }
     return false;
 }
Example #3
0
			<th><?php 
_e('Loaded Extensions');
?>
</th>
			<td><?php 
echo implode(', ', get_loaded_extensions());
?>
</td>
		</tr>
		<tr>
			<th><?php 
_e('MySQL Version');
?>
</th>
			<td><?php 
echo HTML::anchor('admin/tools/db', HTML::chars(DB::version()));
?>
</td>
		</tr>
		<tr>
			<th><?php 
_e('Memory Limit');
?>
</th>
			<td><?php 
echo System::get_memory_limit();
?>
</td>
		</tr>
		<tr>
			<th><?php 
Example #4
0
function brandinformation()
{
    global $_G, $_SGLOBAL, $_SERVER;
    if (empty($_G['setting']['siteuniqueid']) || bstrlen($_G['setting']['siteuniqueid']) < 8 || strpos($_G['setting']['siteuniqueid'], 'PK') !== 0) {
        $_G['setting']['siteuniqueid'] = DB::result_first('SELECT value FROM ' . tname('settings') . " WHERE variable='siteuniqueid'");
        if (empty($_G['setting']['siteuniqueid']) || bstrlen($_G['setting']['siteuniqueid']) < 8 || strpos($_G['setting']['siteuniqueid'], 'PK') !== 0) {
            $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
            $_G['setting']['siteuniqueid'] = 'PK' . $chars[date('y') % 60] . $chars[date('n')] . $chars[date('j')] . $chars[date('G')] . $chars[date('i')] . $chars[date('s')] . substr(md5($_G['clientip'] . $_G['username'] . $_G['timestamp']), 0, 4) . random(4);
            DB::query('REPLACE INTO ' . tname('settings') . " (variable, value) VALUES ('siteuniqueid', '{$_G['setting']}[siteuniqueid]')");
            require_once B_ROOT . './source/function/cache.func.php';
            updatesettingcache();
        }
    }
    $update = array('id' => $_G['setting']['siteuniqueid'], 'version' => B_VER, 'release' => B_RELEASE, 'php' => PHP_VERSION, 'mysql' => DB::version(), 'charset' => $_G['charset'], 'siteurl' => $_G['setting']['siteurl'], 'sitename' => $_G['setting']['wwwname'] . '->' . $_G['setting']['sitename'], 'email' => $_G['member']['email']);
    $updatetime = @filemtime(B_ROOT . './data/updatetime.lock');
    if (empty($updatetime) || $_G['timestamp'] - $updatetime > 3600 * 4) {
        @touch(B_ROOT . './data/updatetime.lock');
        $update['members'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('members'));
        $update['shops'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('shopitems'));
        $update['discounts'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('shopitems') . " WHERE isdiscount='1'");
        $update['goods'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('gooditems'));
        $update['notices'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('noticeitems'));
        $update['consumes'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('consumeitems'));
        $update['albums'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('albumitems'));
        $update['albumsbbs'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('albumitems') . " WHERE frombbs='1'");
        $update['photos'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('photoitems'));
        $update['comments'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('spacecomments'));
        $update['commentscores'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('commentscores'));
        $update['links'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('brandlinks'));
        $update['reportlog'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('reportlog'));
        foreach (array('shop', 'good', 'notice', 'consume', 'album') as $value) {
            $update[$value . 'cates'] = count($_SGLOBAL[$value . 'cates']);
        }
    }
    $data = '';
    foreach ($update as $key => $value) {
        $data .= $key . '=' . rawurlencode($value) . '&';
    }
    return 'os=pk&update=' . rawurlencode(base64_encode($data)) . '&md5hash=' . substr(md5($_SERVER['HTTP_USER_AGENT'] . implode('', $update) . $_G['timestamp']), 8, 8) . '&timestamp=' . $_G['timestamp'];
}
Example #5
0
function sqldumptablestruct($table)
{
    global $_G, $db, $sqlcompat, $dumpcharset, $sqlcharset;
    $createtable = DB::query("SHOW CREATE TABLE {$table}", 'SILENT');
    if (!DB::error()) {
        $tabledump = "DROP TABLE IF EXISTS {$table};\n";
    } else {
        return '';
    }
    $create = DB::fetch_row($createtable);
    if (strpos($table, '.') !== FALSE) {
        $tablename = substr($table, strpos($table, '.') + 1);
        $create[1] = str_replace("CREATE TABLE {$tablename}", 'CREATE TABLE ' . $table, $create[1]);
    }
    $tabledump .= $create[1];
    if ($sqlcompat == 'MYSQL41' && DB::version() < '4.1') {
        $tabledump = preg_replace("/TYPE\\=(.+)/", "ENGINE=\\1 DEFAULT CHARSET=" . $dumpcharset, $tabledump);
    }
    if (DB::version() > '4.1' && $sqlcharset) {
        $tabledump = preg_replace("/(DEFAULT)*\\s*CHARSET=.+/", "DEFAULT CHARSET=" . $sqlcharset, $tabledump);
    }
    $tablestatus = DB::fetch_first("SHOW TABLE STATUS LIKE '{$table}'");
    $tabledump .= ($tablestatus['Auto_increment'] ? " AUTO_INCREMENT={$tablestatus['Auto_increment']}" : '') . ";\n\n";
    if ($sqlcompat == 'MYSQL40' && DB::version() >= '4.1' && DB::version() < '5.1') {
        if ($tablestatus['Auto_increment'] != '') {
            $temppos = strpos($tabledump, ',');
            $tabledump = substr($tabledump, 0, $temppos) . ' auto_increment' . substr($tabledump, $temppos);
        }
        if ($tablestatus['Engine'] == 'MEMORY') {
            $tabledump = str_replace('TYPE=MEMORY', 'TYPE=HEAP', $tabledump);
        }
    }
    return $tabledump;
}
Example #6
0
 private static function version()
 {
     self::$version = mysql_get_server_info();
     return self::$version;
 }
Example #7
0
function loadtable($table, $force = 0)
{
    global $_G, $_SGLOBAL;
    $tables = array();
    if (!isset($tables[$table]) || $force) {
        if (DB::version() > '4.1') {
            $query = DB::query("SHOW FULL COLUMNS FROM " . tname($table), 'SILENT');
        } else {
            $query = DB::query("SHOW COLUMNS FROM " . tname($table), 'SILENT');
        }
        while ($field = @DB::fetch($query)) {
            $tables[$table][$field['Field']] = $field;
        }
    }
    if (isset($tables[$table])) {
        return $tables[$table];
    }
    return $tables;
}