<?php

/**
 *      [Dzz!] (C)2010-2011 dzz.cc
 *      This is NOT a freeware, use is subject to license terms
 *
 * ============================================================================
 * 版权所有 2010-2011 Dzz!Desktop，并保留所有权利。
 * 网站地址: http://dzz.cc；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式、任何目的的再发布。
 * ============================================================================
 */
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}
@include_once DISCUZ_ROOT.'./dzz/dzz_version.php';
$isfounder = isfounder();

$dsiteuniqueid =isset($_G['setting']['dsiteuniqueid'])?$_G['setting']['dsiteuniqueid']: DB::result_first("SELECT siteuniqueid FROM ".DB::table('dzz_config')." WHERE id='1'");
if(empty($dsiteuniqueid) || strlen($dsiteuniqueid) < 16) {
	$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
	$dsiteuniqueid = 'Dzz'.$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'].TIMESTAMP), 0, 4).random(4);
	$temp = array(
		'skey' => 'dsiteuniqueid',
		'svalue' => $dsiteuniqueid
	);

	DB::insert('common_setting', $temp, false, true);
	updatecache(array('setting', 'dsiteuniqueid'));
	DB::update('dzz_config',array('siteuniqueid'=>$dsiteuniqueid),"id='1'");
	if($config=DB::fetch_first("select * from ".DB::table('dzz_config')." where id='1'")){
			DB::insert('common_setting', array(
				'skey' => 'dzz_sysconfig',
				'svalue' => addslashes(serialize(dstripslashes($config))),
			), false, true);
			updatecache(array('setting', 'dzz_sysconfig'));
	}
}
$delete_install='';
if(is_file(DISCUZ_ROOT.'./dzz/admin/admincp/admincp_install.php')){
	$delete_install=dzzlang('admin/template','install_file_need_delete_for_safe');
}
$serverinfo = PHP_OS.' / PHP v'.PHP_VERSION;
$serverinfo .= @ini_get('safe_mode') ? ' Safe Mode' : NULL;
$serversoft = $_SERVER['SERVER_SOFTWARE'];
$dbversion = DB::result_first("SELECT VERSION()");
if(@ini_get('allow_url_fopen')){
	$allow_url_fopen='Yes';
}else{
	$allow_url_fopen='No';
}
if(function_exists('curl_init')!==false){
	$curl='Yes';
}else{
	$curl='No';
}
if(function_exists('json_decode')!==false){
	$json='Yes';
}else{
	$json='No';
}
if(@ini_get('file_uploads')) {
	$fileupload = ini_get('upload_max_filesize');
} else {
	$fileupload = '<font color="red">'.$lang['no'].'</font>';
}


$dbsize = 0;
$dzz_pre=$_G['config']['db'][1]['tablepre'].'dzz_';
$query = DB::query("SHOW TABLE STATUS LIKE '{$dzz_pre}%'", 'SILENT');
while($table = DB::fetch($query)) {
	$dbsize += $table['Data_length'] + $table['Index_length'];
}
$dbsize = $dbsize ? sizecount($dbsize) : $lang['unknown'];


dzz_cpheader();
dzz_shownav($lang['index']);
include dzztemplate('admin/dzz_index');
dzzfooter();
?>