forked from zblogapp/duoshuo-zblog
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexport.asp
283 lines (282 loc) · 10.5 KB
/
export.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<%@ LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Option Explicit %>
<% 'On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<!-- #include file="..\..\c_option.asp" -->
<!-- #include file="..\..\..\zb_system\function\c_function.asp" -->
<!-- #include file="..\..\..\zb_system\function\c_system_lib.asp" -->
<!-- #include file="..\..\..\zb_system\function\c_system_base.asp" -->
<!-- #include file="..\..\..\zb_system\function\c_system_event.asp" -->
<!-- #include file="..\..\..\zb_system\function\c_system_manage.asp" -->
<!-- #include file="..\..\..\zb_system\function\c_system_plugin.asp" -->
<!-- #include file="..\p_config.asp" -->
<%
Call System_Initialize()
'检查非法链接
Call CheckReference("")
'检查权限
If BlogUser.Level>1 Then Call ShowError(6)
If CheckPluginState("duoshuo")=False Then Call ShowError(48)
BlogTitle="多说社会化评论"
Call DuoShuo_Initialize
%>
<!--#include file="..\..\..\zb_system\admin\admin_header.asp"-->
<style type="text/css">
tr {
height: 32px
}
#divMain2 ul li {
margin-top: 6px;
margin-bottom: 6px
}
.bold {
font-weight: bold;
}
.note {
margin-left: 10px
}
</style>
<!--#include file="..\..\..\zb_system\admin\admin_top.asp"-->
<div id="divMain">
<div id="ShowBlogHint">
<%Call GetBlogHint()%>
</div>
<div class="divHeader"><%=BlogTitle%></div>
<div class="SubMenu"><%=duoshuo_SubMenu("export")%></div>
<div id="divMain2">
<script type="text/javascript">ActiveTopMenu("aPlugInMng");</script>
<form action="noresponse.asp?act=export" method="post" id="_form">
<p id="_status">必须导出数据到多说才可以正常使用。如导入有任何问题,请联系多说客服解决。</p>
<table width="100%">
<thead>
<tr>
<th width="30%">配置项 </th>
<th>选择 </th>
</tr>
</thead>
<tbody>
<tr>
<td><p><span class="bold"> · 立即进行数据同步</span><br/>
<span class="note"></span></p></td>
<td><input name="" type="submit" class="button" onClick="$('#type').val('backup')" value="立即从多说备份数据" /></td>
</tr>
<tr>
<td><p><span class="bold"> · 一键导出</span><br/>
<span class="note">如您的站点数据过多,请选择下面的分块导出</span></p></td>
<td><input name="" type="submit" class="button" onClick="return stepbystep()" value="一键导出全部数据" /></td>
</tr>
<tr>
<td><p><span class="bold"> · 用户数据导出</span><br/>
<span class="note">用于历史评论中用户的展示,站点管理权限的匹配,以及文章被评论时的提醒等功能。<span style="color:red">请先导用户,再导文章和评论,以匹配正确的用户信息</span></span></p></td>
<td><input name="" type="submit" class="button" onClick="$('#type').val('member')" value="导出用户" /></td>
</tr>
<tr>
<td><p><span class="bold"> · 文章数据导出</span><br/>
<span class="note">文章数据无论是否存在都将同步</span></p></td>
<td><%Dim o:o=objConn.Execute("SELECT MAX([log_ID]) FROM blog_Article")(0)%>
<p> 文章ID:
<input type="number" id="articlemin" name="articlemin" min="1" max="<%=o%>" value="1"/>
-
<input type="number" id="articlemax" name="articlemax" min="1" max="<%=o%>" value="<%=o%>"/>
</p>
<p>
<input name="" type="submit" class="button" onClick="$('#type').val('article')" value="导出文章" />
</p></td>
</tr>
<tr>
<%o=objConn.Execute("SELECT MAX([comm_ID]) FROM blog_Comment")(0):Dim p:p=objConn.Execute("SELECT COUNT([comm_ID]) FROM blog_Comment WHERE comm_IsCheck=0")(0)-objConn.Execute("SELECT COUNT([ds_cmtid]) FROM blog_Plugin_Duoshuo")(0)%>
<td><p><span class="bold"> · 评论数据导出</span><br/>
<span class="note">只同步未向多说同步的评论,还有<%=IIf(p>0,p,0)%>条未同步</span></p></td>
<td><p> 评论ID:
<input type="number" id="commentmin" name="commentmin" min="1" max="<%=o%>" value="1"/>
-
<input type="number" id="commentmax" name="commentmax" min="1" max="<%=o%>" value="<%=o%>"/>
</p>
<p>
<input name="" type="submit" class="button" onClick="$('#type').val('comment')" value="导出评论" />
</p></td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
<p>
<input type="hidden" name="type" value="all" id="type"/>
</p>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
ActiveLeftMenu("aCommentMng");
$("#_form").submit(function() {
$("#_status").html("正在执行操作,请稍等..");
$.ajax({
type: "POST",
url: "noresponse.asp?act=export",
data: {
type: $("#type").val(),
commentmin: $("#commentmin").val(),
commentmax: $("#commentmax").val(),
articlemax: $("#articlemax").val(),
articlemin: $("#articlemin").val()
},
success: function(data) {
try {
console.log(data)
var o = eval('(' + data + ')');
$("#_status").html(o.success);
}
catch(e) {
$("#_status").html("操作出错..服务器返回" + data);
}
},
error: function(xmlObj, txterr) {
if (xmlObj.readyState == 4) {
$("#_status").html("操作出错..HTTP状态码" + xmlObj.status + ",错误信息" + xmlObj.responseText);
}
else {
$("#_status").html("操作出错.." + txterr);
}
},
});
return false;
})
})
function stepbystep() {
$('#divMain2').hide().after("<div id='divMain3' style='margin:0.5px;padding:0px'><p style='line-height:20px'>当前状态:<span id='s'>0</span>%</p><div id='bar'></div><ul id='_hint'><li>正在导入,请稍等</li></ul></div>");;
$("#bar").progressbar({
min: 0,
max: 100,
value: 0
});
setTimeout(stepbystep_main, 5);
return false
}
function stepbystep_main() {
stepbystep_member()
stepbystep_article(parseInt($("#articlemin").val()), parseInt($("#articlemax").val()))
stepbystep_comment(parseInt($("#commentmin").val()), parseInt($("#commentmax").val()))
}
function stepbystep_log(data) {
$("#_hint").append("<li>" + data + "</li>");
}
function stepbystep_article(articlemin, articlemax) {
$.ajax({
type: "POST",
url: "noresponse.asp?act=export",
data: {
type: "article",
articlemin: articlemin,
articlemax: articlemin + 20
},
success: function(data) {
try {
var o = eval('(' + data + ')');
stepbystep_log(o.success)
}
catch(e) {
stepbystep_log("<span style='color:red'>操作出错..服务器返回" + data + "</span>");
}
$("#bar").progressbar({
value: 1 / 3 * 100 + (articlemin / articlemax) / 3 * 100
});
$("#s").text(Math.floor(1 / 3 * 100 + (articlemin / articlemax) / 3 * 100));
if (articlemin + 20 >= articlemax) {
$("#bar").progressbar({
value: 2 / 3 * 100
});
$("#s").text(Math.floor(2 / 3 * 100));
return true
}
else {
return stepbystep_article(articlemin + 20, articlemax);
}
},
error: function(xmlObj, txterr) {
if (xmlObj.readyState == 4) {
$("#_status").html("<span style='color:red'>操作出错..HTTP状态码" + xmlObj.status + ",错误信息" + xmlObj.responseText + "</span>");
}
else {
$("#_status").html("<span style='color:red'>操作出错.." + txterr + "</span>");
}
},
});
}
function stepbystep_member() {
$.ajax({
type: "POST",
url: "noresponse.asp?act=export",
data: {
type: "member"
},
success: function(data) {
try {
console.log(data)
var o = eval('(' + data + ')');
stepbystep_log(o.success);
$("#bar").progressbar({
value: 1 / 3 * 100
});
$("#s").text(Math.floor(1 / 3 * 100));
}
catch(e) {
stepbystep_log("<span style='color:red'>操作出错..服务器返回" + data + "</span>");
}
return true
},
error: function(xmlObj, txterr) {
if (xmlObj.readyState == 4) {
stepbystep_log("<span style='color:red'>操作出错..HTTP状态码" + xmlObj.status + ",错误信息" + xmlObj.responseText + "</span>");
}
else {
stepbystep_log("<span style='color:red'>操作出错.." + txterr + "</span>");
}
},
});
}
function stepbystep_comment(commentmin, commentmax) {
$.ajax({
type: "POST",
url: "noresponse.asp?act=export",
data: {
type: "comment",
commentmin: commentmin,
commentmax: commentmin + 20
},
success: function(data) {
try {
var o = eval('(' + data + ')');
stepbystep_log(o.success)
}
catch(e) {
stepbystep_log("<span style='color:red'>操作出错..服务器返回" + data + "</span>");
}
$("#bar").progressbar({
value: 2 / 3 * 100 + (commentmin / commentmax) / 3 * 100
});
$("#s").text(Math.floor(2 / 3 * 100 + (commentmin / commentmax) / 3 * 100));
if (commentmin + 20 >= commentmax) {
$("#bar").progressbar({
value: 3 / 3 * 100
});
$("#s").text(Math.floor(3 / 3 * 100));
return true
}
else {
return stepbystep_comment(commentmin + 20, commentmax);
}
},
error: function(xmlObj, txterr) {
if (xmlObj.readyState == 4) {
$("#_status").html("<span style='color:red'>操作出错..HTTP状态码" + xmlObj.status + ",错误信息" + xmlObj.responseText + "</span>");
}
else {
$("#_status").html("<span style='color:red'>操作出错.." + txterr + "</span>");
}
},
});
}
</script>
<!--#include file="..\..\..\zb_system\admin\admin_footer.asp"-->
<%Call System_Terminate()%>