<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/




 @set_time_limit(0); @ini_set("memory_limit", "512M"); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: text/html;charset=GBK"); require_once "include/data_safe.php"; if (!function_exists('file_get_contents') || !function_exists('fsockopen') || !function_exists('iconv')) { } if ($_SERVER['SERVER_PORT'] != 80 || !isset($_SERVER['HTTP_HOST'])) { echo "本软件只能运行在HTTP80端口模式下！"; exit(); } if (!ini_get('short_open_tag')) { echo "你的PHP.INI文件需要启用“short_open_tag”选项才能运行本软件"; exit(); } define('UPDATE_ROOT', str_replace('\\', '/', dirname(__FILE__))); $step = strip_tags(empty($_GET['step']) ? empty($_POST['step']) ? 'InstallFrame' : $_POST['step'] : $_GET['step']); if (file_exists("./install.ok")) { exit("你已经成功安装了该软件，如果需要重新安装，请删除“./install.ok”"); } $chmod_setting = array("index", "admin", "post", "siteapi", "tool", "update"); if (!@rename('./data/admin.login.ip.txt', './data/admin.login.ip.txt')) { echo "网站无法安装，请务必将网站根目中的以下文件设有“可读、可执行”的属性：<br /><br />"; foreach ($chmod_setting as $k => $v) { echo "./{$v}.php<br />"; } exit(); } require_once UPDATE_ROOT . "/data/install/install.lib.php"; if ($step == 'InstallFrame') { include UPDATE_ROOT . "/data/install/tpl/installframe.html.php"; exit(); } if ($step == 'php_environment') { $server_info['PHP_ENVIRONMENT'] = 1; $os = explode(" ", php_uname()); $server_info['SERVER_OS'] = $os[0]; $server_info['SERVER_SOFTWARE'] = $_SERVER['SERVER_SOFTWARE']; $server_info['PHP_VERSION'] = PHP_VERSION; if (PHP_VERSION < '4.3.0') { $server_info['PHP_ENVIRONMENT'] = 0; } echo array_to_json($server_info); } if ($step == 'chmod') { $json['PHP_CHMOD'] = 1; $json['chmod']['./include/domain.php'] = 0; $json['chmod']['./attachments'] = 0; $json['chmod']['./data'] = 0; $json['chmod']['./data/setting'] = 0; $json['chmod']['./data/cache'] = 0; $json['chmod']['./data/log'] = 0; $json['chmod']['./data/siteteam'] = 0; $json['chmod']['./data/tpl'] = 0; $json['chmod']['./data/admin.login.ip.txt'] = 0; $json['chmod']['./data/version.txt'] = 0; foreach ($json['chmod'] as $k => $v) { if (is_dir($k)) { if ($dh = @opendir($k)) { $json['chmod'][$k] = 1; closedir($dh); } else { $json['chmod'][$k] = 0; $json['PHP_CHMOD'] = 0; } } else { if ($fp = @fopen($k, "rb+")) { $json['chmod'][$k] = 1; fclose($fp); } else { $json['chmod'][$k] = 0; $json['PHP_CHMOD'] = 0; } } } echo array_to_json($json); } if ($step == 'config') { if (isset($_POST['domain']) && isset($_POST['site_id'])) { $config['domain'] = strip_tags(iconv("utf-8", "gbk", $_POST['domain'])); $config['site_title'] = strip_tags(iconv("utf-8", "gbk", $_POST['site_title'])); $config['site_description'] = strip_tags(iconv("utf-8", "gbk", $_POST['site_description'])); $config['site_keywords'] = strip_tags(iconv("utf-8", "gbk", $_POST['site_keywords'])); $config['site_id'] = strip_tags(iconv("utf-8", "gbk", $_POST['site_id'])); $config['skinid'] = strip_tags(iconv("utf-8", "gbk", $_POST['skinid'])); $config['admin'] = strip_tags(iconv("utf-8", "gbk", $_POST['admin'])); $config['password'] = strip_tags(iconv("utf-8", "gbk", $_POST['password'])); $config['SITE_PATH'] = strip_tags(iconv("utf-8", "gbk", $_POST['site_path'])); $config['INSTALL_STATUS'] = '1'; $config['site_id'] = str_replace('-', '_', $config['site_id']); $config_code = file_get_contents(UPDATE_ROOT . "/data/install/config.php"); foreach ($config as $k => $v) { $config_code = str_replace("[config]{$k}[/config]", $v, $config_code); } if ($fp = fopen("include/domain.php", "w")) { fwrite($fp, $config_code); fclose($fp); require_once UPDATE_ROOT . "/include/global.class.php"; require_once UPDATE_ROOT . "/include/global.inc.php"; $site_id = $config['site_id']; $db = new txtSQL('./data/siteteam'); if ($db->connect('root', 'siteteam')){ if (!$db->db_exists(dbname($site_id))) { $db->createdb(array("db" => dbname($site_id))); } if (!$db->table_exists('sm_article', dbname($site_id))) { $columns = array('key' => array('type' => 'int', 'permanent' => 1), 'category' => array('type' => 'string', 'max' => 32), 'body_name' => array('type' => 'string', 'max' => 100), 'body_title' => array('type' => 'string', 'max' => 100), 'status' => array('type' => 'int', 'max' => 9), 'is_first' => array('type' => 'int', 'max' => 9)); $db->createtable(array('db' => dbname($site_id), 'table' => 'sm_article', 'columns' => $columns)); } if (!$db->table_exists('sm_product', dbname($site_id))) { $columns = array('key' => array('type' => 'int', 'permanent' => 1), 'category' => array('type' => 'string', 'max' => 32), 'name' => array('type' => 'string', 'max' => 100), 'ptitle' => array('type' => 'string', 'max' => 100), 'pname' => array('type' => 'string', 'max' => 100), 'pass' => array('type' => 'int', 'max' => 9), 'status' => array('type' => 'int', 'max' => 9)); $db->createtable(array('db' => dbname($site_id), 'table' => 'sm_product', 'columns' => $columns)); } $db->disconnect(); exit('1'); } else { exit('4'); } } else { exit('4'); } } else { include UPDATE_ROOT . "/data/install/tpl/config.html.php"; } } if ($step == 'write_data') { require_once "./admin/zip.inc.php"; $web_host = strip_tags(empty($_GET['web_host']) ? empty($_POST['web_host']) ? $_SERVER['HTTP_HOST'] : $_POST['web_host'] : $_GET['web_host']); $site_id = strip_tags(empty($_GET['site_id']) ? empty($_POST['site_id']) ? substr(md5(preg_replace("/[\.]+/", '', $_SERVER['HTTP_HOST'])), 0, 8) : $_POST['site_id'] : $_GET['site_id']); $json['title'] = '开始写入...'; @move_dir(UPDATE_ROOT . "/data/install/data/97c9c056", UPDATE_ROOT . "/attachments/{$site_id}"); $json['file'][] = "\nOK:/attachments/{$site_id}"; @move_dir(UPDATE_ROOT . "/data/install/data/www.siteteam.cn", UPDATE_ROOT . "/data/setting/{$web_host}"); $json['file'][] = "\nOK:/data/setting/{$web_host}"; file_replace(UPDATE_ROOT . "/data/setting/{$web_host}", "97c9c056", $site_id); require_once UPDATE_ROOT . "/include/common.inc.php"; require_once UPDATE_ROOT . "/admin/admin.inc.php"; $user_product_dir = SITE_ROOT . "/data/setting/{$site_url}/product"; if (file_exists($user_product_dir)) { if ($handle = opendir($user_product_dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && is_dir("{$user_product_dir}/{$file}")) { update_product_index($file); } } } closedir($handle); } $user_article_dir = SITE_ROOT . "/data/setting/{$site_url}/article"; if (file_exists($user_article_dir)) { if ($handle = opendir($user_article_dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && is_dir("{$user_article_dir}/{$file}")) { update_article_index($file); } } } closedir($handle); } echo array_to_json($json); } if ($step == 'copyright') { echo file_get_contents(UPDATE_ROOT . "/data/install/tpl/copyright.html.php"); } if ($step == 'success') { echo '{"install_status":"1"}'; } if ($step == 'lock') { fclose(fopen("./install.ok", "w")); } ?>
