⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 Discuz论坛功能、使用、二次开发的详细介绍说明。
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php

error_reporting(7);

set_magic_quotes_runtime(0);

define('UC_ROOT', substr(__FILE__, 0, -9));
define('UC_CHARSET', 'utf-8');
define('UC_DBCHARSET', 'utf8');

define('UC_CONFIG', UC_ROOT.'../data/config.inc.php');

require UC_ROOT.'./global.func.php';
require UC_ROOT.'./install.lang.php';
require UC_ROOT.'./db.class.php';

define('UC_NAME', 'UCenter');
define('UC_VERSION', '1.0.0');

$step = getgpc('step');

if(file_exists(UC_ROOT.'./../data/install.lock')) {
	uc_install_msg('uc_installed');
}

if(!ini_get('short_open_tag')) {
	uc_install_msg('short_open_tag_invalid');
}

//note 接受POST数据
$ucdbhost = getgpc('ucdbhost', 'P');
$ucdbname = getgpc('ucdbname', 'P');
$ucdbuser = getgpc('ucdbuser', 'P');
$ucdbpw = getgpc('ucdbpw', 'P');
$uctablepre = getgpc('uctablepre', 'P');
$ucdbcharset = getgpc('ucdbcharset', 'P');
$ucfounderpw = getgpc('ucfounderpw', 'P');

$hidden = var_to_hidden('ucdbhost', $ucdbhost);
$hidden .= var_to_hidden('ucdbname', $ucdbname);
$hidden .= var_to_hidden('ucdbuser', $ucdbuser);
$hidden .= var_to_hidden('ucdbpw', $ucdbpw);
$hidden .= var_to_hidden('uctablepre', $uctablepre);
$hidden .= var_to_hidden('ucdbcharset', $ucdbcharset);
$hidden .= var_to_hidden('ucfounderpw', $ucfounderpw);

$ucdbcharset = !empty($ucdbcharset) ? $ucdbcharset : UC_DBCHARSET;

//note 全新安装 UCenter,判断文件权限
if($step == 'license' || empty($step)) {

	uc_install_header();
	echo '</div><div class="main" style="margin-top:-123px;"><div class="licenseblock">';
	echo $lang['license'];
	echo '</div><div class="btnbox marginbot"><form action="index.php?step=ucdir" method="post">';
	echo $hidden;
	echo '<input type="checkbox" onclick="document.getElementById(\'agree\').disabled=!this.checked;"/>'.$lang['i_agree'].'<br /> <input id="agree" disabled="disabled" type="submit" value="'.$lang['new_step'].'">';
	echo '</form></div>';
	uc_install_footer();

} elseif($step == 'ucdir') {

	$pass = TRUE;

	$ucdbcharset = isset($_GET['ucdbcharset']) ? $_GET['ucdbcharset'] : 'gbk';
	$dirs = array('../data/config.inc.php', '../data', '../data/cache', '../data/view', '../data/avatar', '../data/logs', '../data/backup', '../data/tmp');

	uc_install_header();

	$result = array();
	if(function_exists('mysql_connect')) {
		$result['mysql'] = '<td class="w pdleft1">'.$lang['supportted'].'</td>';
	} else {
		$result['mysql'] = '<td class="nw pdleft1">'.$lang['unsupportted'].'</td>';
		$pass = FALSE;
	}
	if(PHP_VERSION > '4.3.0') {
		$result['phpversion'] = '<td class="w pdleft1">'.PHP_VERSION.'</td>';
	} else {
		$result['phpversion'] = '<td class="nw pdleft1">'.PHP_VERSION.'</td>';
		$pass = FALSE;
	}

	if(@ini_get(file_uploads)) {
		$max_size = @ini_get(upload_max_filesize);
		$result['upload'] = '<td class="w pdleft1">'.$lang['max_size'].$max_size.'</td>';
	} else {
		$result['upload'] = '<td class="nw pdleft1">'.$lang['unsupportted'].'</td>';
		$pass = FALSE;
	}

	if(function_exists('diskfreespace')) {
		$curr_disk_space = intval(diskfreespace('.') / (1024 * 1024)).'M';
		if($curr_disk_space > 10) {
			$result['diskfree'] = '<td class="w pdleft1">'.$curr_disk_space.'</td>';
		} else {
			$result['diskfree'] = '<td class="nw pdleft1">'.$curr_disk_space.'</td>';
			$pass = FALSE;
		}
	} else {
		$result['diskfree'] = '<td class="w pdleft1">'.$lang['diskfreespace_unsupportted'].'</td>';
	}
?>

		<div class="setup step1">
			<h2><?=$lang['step1_title']?></h2>
			<p><?=$lang['step1_desc']?></p>
		</div>
		<div class="stepstat">
			<ul>
				<li class="current">1</li>
				<li class="unactivated">2</li>
				<li class="unactivated">3</li>
				<li class="unactivated last">4</li>
			</ul>
			<div class="stepstatbg stepstat1"></div>
		</div>
	</div>

	<div class="main">
		<h2 class="title"><?php echo $lang['env_check'];?></h2>
		<table class="tb" style="margin:20px 0 20px 55px;">
			<tr>
				<th><?php echo $lang['project'];?></th>
				<th class="padleft"><?php echo $lang['ucenter_required'];?></th>
				<th class="padleft"><?php echo $lang['ucenter_best'];?></th>
				<th class="padleft"><?php echo $lang['curr_server'];?></th>
			</tr>
			<tr>
				<td><?php echo $lang['os'];?></td>
				<td class="padleft"><?php echo $lang['unlimit'];?></td>
				<td class="padleft">UNIX/Linux/FreeBSD</td>
				<td class="padleft"><?php echo PHP_OS;?></td>
			</tr>
			<tr>
				<td>PHP <?php echo $lang['version'];?></td>
				<td class="padleft">4.3.0+</td>
				<td class="padleft">5.0.0+</td>
				<?php echo $result['phpversion'];?>
			</tr>
			<tr>
				<td><?php echo $lang['attach_upload'];?></td>
				<td class="padleft"><?php echo $lang['allow'];?></td>
				<td class="padleft"><?php echo $lang['allow'];?></td>
				<?php echo $result['upload'];?>
			</tr>
			<tr>
				<td>MySQL <?php echo $lang['supportted'];?></td>
				<td class="padleft">MySQL4.0+</td>
				<td class="padleft">MySQL5.0+</td>
				<?php echo $result['mysql'];?>
			</tr>
			<tr>
				<td><?php echo $lang['disk_free'];?></td>
				<td class="padleft">10M+</td>
				<td class="padleft"><?php echo $lang['unlimit'];?></td>
				<?php echo $result['diskfree'];?>
			</tr>
		</table>
		<h2 class="title"><?php echo $lang['priv_check'];?></h2>
		<table class="tb" style="margin:20px 0 20px 55px;width:90%;">
			<tr>
				<th><?=$lang['step1_file']?></th>
				<th class="padleft"><?=$lang['step1_need_status']?></th>
				<th class="padleft"><?=$lang['step1_status']?></th>
			</tr>
<?

	if(!file_exists(UC_ROOT.'../data/config.inc.php')) {
		$fp = @fopen(UC_ROOT.'../data/config.inc.php', 'w');
		@fclose($fp);
	}

        foreach($dirs as $dir) {
		$iswritable = is_writable(UC_ROOT.'/'.$dir);
		$pass == TRUE && !$iswritable && $pass = FALSE;
		echo '<tr><td>'.$dir.'</td><td class="w pdleft1">'.$lang['writeable'].'</td><td'.($iswritable ? ' class="w pdleft1">'.$lang['writeable'] : ' class="nw pdleft1">'.$lang['unwriteable']).'</td></tr>';
	}
?>
		</table>
		<h2 class="title"><?php echo $lang['func_depend'];?></h2>
		<table class="tb" style="margin:20px 0 20px 55px;width:90%;">
			<tr>
				<th><?php echo $lang['func_name'];?></th>
				<th class="padleft"><?php echo $lang['check_result'];?></th>
				<th class="padleft"><?php echo $lang['suggestion'];?></th>
			</tr>
<?php
	$functions = array('mysql_connect'=>FALSE, 'fsockopen'=>FALSE, 'gethostbyname'=>FALSE, 'file_get_contents'=>FALSE, 'xml_parser_create'=>FALSE);
	$advices = array(
		'mysql_connect' => $lang['advice_mysql'],
		'fsockopen' => $lang['advice_fopen'],
		//'gethostbyname' => '服务器 DNS 解析可能有问题,请联系空间商,确定 DNS 解析没有问题',
		'file_get_contents' => $lang['advice_file_get_contents'],
		'xml_parser_create' => $lang['advice_xml'],
	);
	foreach($functions as $name=>$status) {
		/*if($name == 'fsockopen') {
			//$status = @fsockopen('www.discuz.net', 80, $errno, $errstr, 15) || @fsockopen('www.discuz.com', 80, $errno, $errstr, 15) || @fsockopen('www.comsenz.com', 80, $errno, $errstr, 15);
		} else {
			$status = function_exists($name);
		}*/
		$status = function_exists($name);
		if(!$status) {
			$pass = FALSE;
		}
		echo '<tr><td>'.$name.'()</td>'.($status ? '<td class="w pdleft1">'.$lang['supportted'].'</td>' : '<td class="nw pdleft1">'.$lang['unsupportted'].'</td>').($status ? '<td class="padleft">'.$lang['none'].'</td>' : '<td><font color="red">'.$advices[$name].'</font></td>').'</tr>';
	}
?>
		</table>


<?php

	echo '<form action="index.php?step=ucdb" method="post">';
	echo $hidden;
	if($pass) {
		$nextstep = ' <input type="button" onclick="history.back();" value="'.$lang['old_step'].'"><input type="submit" value="'.$lang['new_step'].'">';
	} else {
		$nextstep = ' <input type="button" disabled="disabled" value="'.$lang['step1_unwriteable'].'">';
	}
	echo '<div class="btnbox marginbot"> '.$nextstep.'</div>';
	echo '</form>';

	uc_install_footer();

} elseif($step == 'ucdb') {

	uc_install_header();

	$msg = getgpc('msg', 'P');
	@include UC_CONFIG;

?>
		<div class="setup step2">
			<h2><?=$lang['step2_title']?></h2>
			<p><?=$lang['step2_desc']?></p>
		</div>
		<div class="stepstat">
			<ul>
				<li>1</li>
				<li class="current">2</li>
				<li class="unactivated">3</li>
				<li class="unactivated last">4</li>
			</ul>
			<div class="stepstatbg stepstat2"></div>
		</div>
	</div>
	<div class="main">
		<form method="post" action="index.php?step=ucadmin">
<?

	if($msg) {

?>
		<div class="desc">
			<ul>
				<?=$msg?>
			</ul>
		</div>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -