execute($item)){ sp_show_msg($msg . ' 完成'); } else { sp_show_msg($msg . ' 失败!', 'error'); } } else { $db->execute($item); } } } /** * 显示提示信息 * @param string $msg 提示信息 */ function sp_show_msg($msg, $class = ''){ echo ""; flush(); ob_flush(); } function sp_update_site_configs($db,$table_prefix){ $sitename=I("post.sitename"); $email=I("post.manager_email"); $siteurl=I("post.siteurl"); $seo_keywords=I("post.sitekeywords"); $seo_description=I("post.siteinfo"); $site_options=<<execute($sql); sp_show_msg("网站信息配置成功!"); } function sp_create_admin_account($db,$table_prefix,$authcode){ $username=I("post.manager"); $password=sp_password(I("post.manager_pwd"),$authcode); $email=I("post.manager_email"); $create_date=date("Y-m-d h:i:s"); $ip=get_client_ip(0,true); $sql =<<execute($sql); sp_show_msg("管理员账号创建成功!"); } /** * 写入配置文件 * @param array $config 配置信息 */ function sp_create_config($config, $authcode){ if(is_array($config)){ //读取配置内容 $conf = file_get_contents(MODULE_PATH . 'Data/config.php'); //替换配置项 foreach ($config as $key => $value) { $conf = str_replace("#{$key}#", $value, $conf); } $conf = str_replace('#AUTHCODE#', $authcode, $conf); $conf = str_replace('#COOKIE_PREFIX#', sp_random_string(6) . "_", $conf); //写入应用配置文件 if(file_put_contents( 'data/conf/db.php', $conf)){ sp_show_msg('配置文件写入成功'); } else { sp_show_msg('配置文件写入失败!', 'error'); } return ''; } }