信呼OA版本v2.3.8
This commit is contained in:
149
webmain/install/installAction.php
Normal file
149
webmain/install/installAction.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
set_time_limit(90);
|
||||
class installClassAction extends ActionNot{
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
if(getconfig('systype')=='demo')exit('');
|
||||
}
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
$this->tpltype = 'html';
|
||||
$this->title = TITLE.'_安装';
|
||||
$dbdiz = '127.0.0.1';
|
||||
$paths = '../../mysql5.6.10/my.ini';
|
||||
if(@file_exists($paths)){
|
||||
$_conts = @file_get_contents($paths);
|
||||
if($_conts && contain($_conts,'3307'))$dbdiz.=':3307';
|
||||
}
|
||||
$this->assign('dbdiz', $dbdiz);
|
||||
}
|
||||
|
||||
private function rmdirs($dir){
|
||||
$dir_arr = scandir($dir);
|
||||
foreach($dir_arr as $key=>$val){
|
||||
if($val == '.' || $val == '..'){
|
||||
}else{
|
||||
@unlink($dir.'/'.$val);
|
||||
}
|
||||
}
|
||||
@rmdir($dir);
|
||||
}
|
||||
|
||||
public function delinstallAjax()
|
||||
{
|
||||
$this->delinstall();
|
||||
echo 'success';
|
||||
}
|
||||
|
||||
private function delinstall()
|
||||
{
|
||||
$dir = ROOT_PATH.'/'.PROJECT.'/install';
|
||||
$this->rmdirs($dir);
|
||||
}
|
||||
|
||||
public function saveAjax()
|
||||
{
|
||||
$dbtype = $this->post('dbtype');
|
||||
$host = $this->post('host');
|
||||
$user = $this->post('user');
|
||||
$pass = $this->post('pass');
|
||||
$base = $this->post('base');
|
||||
$xinhukey = $this->post('xinhukey');
|
||||
$perfix = strtolower($this->post('perfix','xinhu_'));
|
||||
$engine = $this->post('engine','MyISAM');
|
||||
$title = '信呼协同办公系统';
|
||||
$qom = 'xinhu_';
|
||||
$url = $this->post('url');
|
||||
$paths = ''.P.'/'.P.'Config.php';
|
||||
$paths1 = ''.P.'/'.P.'Config.php1';
|
||||
$inpaths = ROOT_PATH.'/'.$paths.'';
|
||||
|
||||
|
||||
$msg = '';
|
||||
|
||||
if($dbtype=='mysql' && !function_exists('mysql_connect'))exit('未开启mysql扩展模块');
|
||||
if($dbtype=='mysqli' && !class_exists('mysqli'))exit('未开启mysqli扩展模块');
|
||||
@unlink($inpaths);
|
||||
$this->rock->createtxt($paths, '<?php return array();');
|
||||
if(!file_exists($inpaths))exit('无法写入文件夹'.P.'');
|
||||
|
||||
//1
|
||||
$db1 = import($dbtype);
|
||||
$db1->changeattr($host, $user, $pass, 'information_schema');
|
||||
$db1->connectdb();
|
||||
$msg = $db1->errormsg;
|
||||
if(!$this->isempt($msg))exit('数据库用户名/密码有误:'.$msg.'');
|
||||
|
||||
|
||||
//2
|
||||
$db = import($dbtype);
|
||||
$db->changeattr($host, $user, $pass, $base);
|
||||
$db->connectdb();
|
||||
$msg = $db->errormsg;
|
||||
if(!$this->isempt($msg)){
|
||||
$db1->query("CREATE DATABASE `$base` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");
|
||||
}
|
||||
|
||||
$db->connectdb();
|
||||
$msg = $db->errormsg;
|
||||
if(!$this->isempt($msg))exit('无法创建数据库:'.$msg.'');
|
||||
|
||||
|
||||
$dburl = ROOT_PATH.'/'.PROJECT.'/install/rockxinhu.sql';
|
||||
if(!file_exists($dburl))exit('数据库sql文件不存在');
|
||||
|
||||
$sqlss = file_get_contents($dburl);
|
||||
$a = explode(";
|
||||
", $sqlss);
|
||||
for($i=0; $i<count($a)-1; $i++){
|
||||
$sql = $a[$i];
|
||||
$sql = str_replace('`xinhu_', '`'.$perfix.'', $sql);
|
||||
$sql = str_replace('ENGINE=MyISAM', 'ENGINE='.$engine.'', $sql); //使用引擎
|
||||
$bo = $db->query($sql);
|
||||
if(!$bo){
|
||||
exit('导入失败:'.$db->error().'');
|
||||
}
|
||||
}
|
||||
$db->query("delete from `".$perfix."option` where `name` is null");
|
||||
$urs = $db->getone("".$perfix."admin", "`id`=1");
|
||||
if(!is_array($urs))exit('安装失败:'.$db->error().',可选择手动安装<a href="'.URLY.'view_anzz.html" style="color:blue" target="_blank">[查看]</a>');
|
||||
|
||||
$rand = $this->rock->jm->getRandkey();
|
||||
$asynkey= md5($this->rock->jm->getRandkey());
|
||||
$openkey= md5($this->rock->jm->getRandkey());
|
||||
$txt = "<?php
|
||||
if(!defined('HOST'))die('not access');
|
||||
//系统配置文件
|
||||
return array(
|
||||
'url' => '', //系统URL
|
||||
'localurl' => '', //本地系统URL,用于服务器上浏览地址
|
||||
'title' => '$title', //系统默认标题
|
||||
'apptitle' => '信呼OA', //APP上或PC客户端上的标题
|
||||
'db_host' => '$host', //数据库地址
|
||||
'db_user' => '$user', //数据库用户名
|
||||
'db_pass' => '$pass', //数据库密码
|
||||
'db_base' => '$base', //数据库名称
|
||||
'db_engine' => '$engine', //数据库使用引擎
|
||||
'perfix' => '$perfix', //数据库表名前缀
|
||||
'qom' => '$qom', //session、cookie前缀
|
||||
'highpass' => '', //超级管理员密码,可用于登录任何帐号
|
||||
'db_drive' => '$dbtype', //操作数据库驱动有mysql,mysqli,pdo三种
|
||||
'randkey' => '$rand', //系统随机字符串密钥
|
||||
'asynkey' => '$asynkey', //这是异步任务key
|
||||
'openkey' => '$openkey', //对外接口openkey
|
||||
'updir' => 'upload', //默认上传目录
|
||||
'sqllog' => false, //是否记录sql日志保存upload/sqllog下
|
||||
'asynsend' => false, //是否异步发送提醒消息,为true需开启服务端
|
||||
'editpass' => '1', //用户登录修改密码:0不用修改,1强制用户必须修改
|
||||
'install' => true, //已安装,不要去掉啊
|
||||
'xinhukey' => '$xinhukey', //信呼官网key,在线升级使用
|
||||
);";
|
||||
$this->rock->createtxt($paths, $txt);
|
||||
$this->delinstall();
|
||||
if(file_exists($paths1))@unlink($paths1);
|
||||
c('xinhu')->getdata('xinhuinstall');//这个只是用于统计安装数而已
|
||||
echo 'success';
|
||||
}
|
||||
}
|
||||
89
webmain/install/installscript.js
Normal file
89
webmain/install/installscript.js
Normal file
@@ -0,0 +1,89 @@
|
||||
function initbody(){
|
||||
var tit = document.title;
|
||||
if(tit.indexOf('<?')>-1){
|
||||
alert('提示:您没有开启php短标签,系统将不能使用\n\n请到php.ini下将short_open_tag = ON。');
|
||||
}
|
||||
}
|
||||
var bool = false;
|
||||
function nextabc(){
|
||||
$('#step1').hide();
|
||||
$('#step2').show();
|
||||
}
|
||||
|
||||
function backabc(){
|
||||
$('#step2').hide();
|
||||
$('#step1').show();
|
||||
}
|
||||
|
||||
function wancla(){
|
||||
$('#step2').hide();
|
||||
$('#step3').show();
|
||||
}
|
||||
|
||||
function delinstall(){
|
||||
var url = js.getajaxurl('delinstall','install');
|
||||
$.get(url,function(){
|
||||
js.msg('success','删除成功');
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function submitla(){
|
||||
if(bool)return;
|
||||
var a = js.getformdata();
|
||||
if(isempt(a.host)){
|
||||
js.setmsg('数据库地址不能为空');
|
||||
return;
|
||||
}
|
||||
if(isempt(a.user)){
|
||||
js.setmsg('用户名不能为空');
|
||||
return;
|
||||
}
|
||||
if(isempt(a.base)){
|
||||
js.setmsg('数据库名称不能为空');
|
||||
return;
|
||||
}
|
||||
if(isempt(a.perfix)){
|
||||
js.setmsg('表名前缀不能为空');
|
||||
return;
|
||||
}
|
||||
var url = location.href;
|
||||
a.url = url.substr(0, url.lastIndexOf('/')+1);
|
||||
js.setmsg('处理中...');
|
||||
bool = true;
|
||||
$.ajax({
|
||||
data:a,url:js.getajaxurl('save','install'),
|
||||
type:'post',
|
||||
success:function(da){
|
||||
js.setmsg();
|
||||
if(da!='success'){
|
||||
js.setmsg(da);
|
||||
bool = false;
|
||||
}else{
|
||||
wancla();
|
||||
}
|
||||
},
|
||||
error:function(e){
|
||||
js.setmsg('出错:'+e.responseText+'');
|
||||
bool = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getxhkey(o1){
|
||||
var url = 'http://www.rockoa.com/';
|
||||
url+='api.php?a=getxhkey&gkey='+device+'';
|
||||
js.open(url, 400,300,'huoq');
|
||||
js.alert('根据弹框提示就可以','提示', function(){
|
||||
try{js.openarr['huoq'].close();}catch(e){}
|
||||
o1.innerHTML=js.getmsg('获取中...');
|
||||
$.getJSON(url+'&stype=1&callback=?',function(ret){
|
||||
if(ret.success){
|
||||
form('xinhukey').value=ret.data.xhkey;
|
||||
o1.innerHTML=js.getmsg(ret.data.msg);
|
||||
}else{
|
||||
o1.innerHTML=js.getmsg(ret.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
7916
webmain/install/rockxinhu.sql
Normal file
7916
webmain/install/rockxinhu.sql
Normal file
File diff suppressed because it is too large
Load Diff
148
webmain/install/tpl_install.html
Normal file
148
webmain/install/tpl_install.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?=TITLE?>_安装</title>
|
||||
<link rel="stylesheet" type="text/css" href="<?=P?>/css/css.css"/>
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/js.js"></script>
|
||||
<script type="text/javascript" src="<?php echo P;?>/install/installscript.js"></script>
|
||||
<style>
|
||||
.input{width:210px;height:30px;line-height:20px}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="padding:10px">
|
||||
<center>
|
||||
<div style="padding:10px;font-size:30px;"><b><?=TITLE?>-安装</b></div>
|
||||
<div style="width:500px;padding:10px;border:2px #cccccc solid;border-radius:5px">
|
||||
<div style="text-align:left;">
|
||||
<div id="step1" style="padding:20px;line-height:35px;font-size:16px;display:">
|
||||
<b>安装使用前必读:</b><br>
|
||||
<p>我们网站:<?=URLY?></p>
|
||||
<p>产品名称:信呼</p>
|
||||
|
||||
<p>源码仅供学习开发使用,禁止原封不动出售。</p>
|
||||
<p style="color:red">版权来自:信呼开发团队,二次开发请标识来自《信呼》。</p>
|
||||
<p><b>为了您使用系统安全请时时关注官网在线升级,有出现bug漏洞等要及时修复,尽量不要将自己公网地址暴露给不相关人员。</b></p>
|
||||
<p>版权所有:<a href="<?=URLY?>" class="blue" target="_blank">信呼开发团队</a>,<a href="<?=URLY?>view_shengming.html" target="_blank" class="blue"><u>责任声明</u></a></p>
|
||||
<p>当前版本:V<?=VERSION?></p>
|
||||
<p><a href="<?=URLY?>view_demo.html" class="blue" target="_blank"><u>在线演示</u></a> 已安装?<a href="?m=login" class="blue"><u>直接登录</u></a></p>
|
||||
<div align="center" style="text-align:center;padding-top:15px"><input class="webbtn" onclick="nextabc()" disabled id="zhidbtns" value="我知道了" style="border-radius:5px" type="button"> <a target="_blank" href="<?=URLY?>view_anzz.html" class="blue" ></a></div>
|
||||
</div>
|
||||
<div id="step2" style="display:none">
|
||||
<form name="myform">
|
||||
<table width="100%">
|
||||
<tr><td colspan="2" height="40" align="center"><font color=#888888>数据库采用是<font color=red>mysql</font>,请先配置好本地</font></td></tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td style="padding:5px;0px;line-height:30px">
|
||||
PHP版本:<?=PHP_VERSION?><br>
|
||||
操作系统:<?=PHP_OS?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">操作数据库方法:</td>
|
||||
<td><select class="input" name="dbtype"><option value="mysqli">mysqli(推荐)</option></select></td>
|
||||
</tr>
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">mysql数据库引擎:</td>
|
||||
<td><select class="input" name="engine"><option value="MyISAM">MyISAM</option></select> <a href="<?=URLY?>view_dbyin.html" class="blue" target="_blank">[看区别]</a></td>
|
||||
</tr>
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" width="150px"><font color=red>*</font>数据库地址:</td>
|
||||
<td><input class="input" name="host" value="<?=$dbdiz?>"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
<tr>
|
||||
<td align="right"><font color=red>*</font>用户名:</td>
|
||||
<td><input class="input" name="user" value="root"></td>
|
||||
</tr>
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
<tr>
|
||||
<td align="right">数据库密码:</td>
|
||||
<td><input name="pass" class="input" value=""> <font color=#888888>您的数据库密码</font></td>
|
||||
</tr>
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
<tr>
|
||||
<td align="right"><font color=red>*</font>数据库名称:</td>
|
||||
<td><input class="input" name="base" value="rockxinhu"></td>
|
||||
</tr>
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
<tr>
|
||||
<td align="right"><font color=red>*</font>表名前缀:</td>
|
||||
<td><input class="input" name="perfix" value="xinhu_"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
<tr>
|
||||
<td align="right"><a target="_blank" class="blue" href="<?=URLY?>view_xhkey.html">信呼官网key</a>:</td>
|
||||
<td><input name="xinhukey" placeholder="在线升级使用" class="input" value=""> <span><a class="blue" href="javascript:;" onclick="getxhkey(this)">点我获取</a></span></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr><td height="8"></td></tr>
|
||||
|
||||
<tr><td colspan="2" height="60" align="left" style="padding-left:80px"><a href="javascript:" onclick="backabc()" class="blue" ><u><<返回</u></a>
|
||||
<?php
|
||||
if(version_compare(PHP_VERSION, '5.2.0','<')){
|
||||
echo '<font color=red>您当前php版本太低了,至少需要5.2+以上版本</font>';
|
||||
}else{
|
||||
echo '<a class="webbtn" style="padding:10px 20px;font-size:16px;border-radius:5px" onclick="submitla()" href="javascript:">提交安装</a>';
|
||||
}
|
||||
?>
|
||||
<span id="msgview"></span></td></tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="step3" style="display:none;padding:20px">
|
||||
<div style="color:green;font-size:30px;padding:50px" align="center">√安装完成</div>
|
||||
<div style="padding:10px" align="center"><a href="?m=login" class="webbtn" >前去登录页面</a> 访问<a class="blue" href="<?=URLY?>">信呼官网</a></div>
|
||||
<div style="padding:20px;color:#333333" align="center">登录系统管理员帐号:admin,密码:123456</div>
|
||||
<div style="padding:20px" align="center"><font color=#888888>记得删除安装目录(<?=P?>/install)哦</font>,<a class="red" onclick="return delinstall()" href="javascript:">[马上删除]</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div align="center" style="line-height:40px;color:#555555">
|
||||
Copyright ©<?=date('Y')?> 信呼v<?=VERSION?> <?=substr(URLY,7,-1)?> -
|
||||
版权所有:<a href="<?=URLY?>" class="blue" target="_blank">信呼开发团队</a>
|
||||
</div>
|
||||
|
||||
</center>
|
||||
|
||||
<script>
|
||||
function restimes(sj){
|
||||
var o = get('zhidbtns');
|
||||
if(sj==0){
|
||||
o.value='知道了';
|
||||
o.disabled=false;
|
||||
return;
|
||||
}
|
||||
o.value='在读'+sj+'秒';
|
||||
o.disabled=true;
|
||||
setTimeout('restimes('+(sj-1)+')',1000);
|
||||
}
|
||||
restimes(10);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user