633eb72d64d47c5df93ed0d85aa211704217d596.file.upgrade.lbi.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <?php /* Smarty version Smarty-3.1.7, created on 2016-12-20 16:43:33
  2. compiled from "D:/phpStudy/WWW_krpano100/vradmin/template\lib\upgrade.lbi" */ ?>
  3. <?php /*%%SmartyHeaderCode:127365858ef353e3da7-03530322%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
  4. $_valid = $_smarty_tpl->decodeProperties(array (
  5. 'file_dependency' =>
  6. array (
  7. '633eb72d64d47c5df93ed0d85aa211704217d596' =>
  8. array (
  9. 0 => 'D:/phpStudy/WWW_krpano100/vradmin/template\\lib\\upgrade.lbi',
  10. 1 => 1479550265,
  11. 2 => 'file',
  12. ),
  13. ),
  14. 'nocache_hash' => '127365858ef353e3da7-03530322',
  15. 'function' =>
  16. array (
  17. ),
  18. 'variables' =>
  19. array (
  20. '_lang' => 0,
  21. 'act' => 0,
  22. ),
  23. 'has_nocache_code' => false,
  24. 'version' => 'Smarty-3.1.7',
  25. 'unifunc' => 'content_5858ef355b4b9',
  26. ),false); /*/%%SmartyHeaderCode%%*/?>
  27. <?php if ($_valid && !is_callable('content_5858ef355b4b9')) {function content_5858ef355b4b9($_smarty_tpl) {?><style>
  28. .s1_content ol{
  29. line-height:180%;
  30. }
  31. .s_prompt{
  32. float:left;
  33. line-height:30px;
  34. margin-left:10px;
  35. }
  36. .s3_step{
  37. display:inline-block;
  38. }
  39. .s3_content{
  40. max-height: 500px;
  41. overflow-y: scroll;
  42. overflow-x: hidden;
  43. }
  44. .s3_cofirm{
  45. margin-top:10px;
  46. }
  47. </style>
  48. <script>
  49. var url = '/<?php echo $_smarty_tpl->tpl_vars['_lang']->value['admin_path'];?>
  50. /?m=upgrade';
  51. </script>
  52. <div class="idTabs">
  53. <ul class="tab">
  54. <li><a <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_1'){?>class="selected"<?php }?>>1.检测新版本</a></li>
  55. <li><a <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_2'){?>class="selected"<?php }?>>2.下载升级包</a></li>
  56. <li><a <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_3'){?>class="selected"<?php }?>>3.检查目录权限</a></li>
  57. <li><a <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_4'){?>class="selected"<?php }?>>4.更新程序</a></li>
  58. <li><a <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_5'){?>class="selected"<?php }?>>5.更新数据库</a></li>
  59. <li><a <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_6'){?>class="selected"<?php }?>>6.升级完成</a></li>
  60. </ul>
  61. <div class="items">
  62. <?php if ($_smarty_tpl->tpl_vars['act']->value=='step_1'){?>
  63. <table class="tableBasic" border="0" cellpadding="8" cellspacing="0" width="100%">
  64. <tr>
  65. <td >
  66. <span style="font-weight:bold">注意:</span><span style="color:red">如果自定义过管理后台目录,升级前请修改回/vradmin/,升级完成后再修过为自定义目录;</span>升级是不可逆的,请严格按照提示进行升级,如果有修改过程序,请务必先进行备份!
  67. </td>
  68. </tr>
  69. <tr><td>
  70. <div class="s1_content">
  71. <button class="btn" onclick="check()">检测新版本</button>
  72. </div>
  73. </td></tr>
  74. </table>
  75. <script type="text/javascript">
  76. function check(){
  77. $(".s1_content").html('<img src="/static/images/tm_loading.gif" height="30px" />');
  78. $.post(url,
  79. {
  80. 'act':'check'
  81. },function(res){
  82. var html = "";
  83. if (res.status==1) {
  84. html+='<h2>检测到新版本:<font color="red">'+res.version+'</font>,发布时间:'+res.pubtime+' >></h2>';
  85. html+= '<ol><li>---------------------------------------------------------------</li>';
  86. var info = res.info;
  87. for (var i = 0; i <info.length; i++) {
  88. html+='<li>'+(i+1)+'.'+info[i]+'<li>'
  89. }
  90. html+='<li>---------------------------------------------------------------</li></ol>';
  91. html+='<a href="'+url+'&act=step_2" class="btn">确认升级</a>';
  92. }else if(res.status==0){
  93. html+='当前版本 <font color="red">'+res.cur_version+'</font> 已是最新版本!';
  94. }else{
  95. html+='<font color="red">'+res.message+'</font>请联系客服QQ:932625974';
  96. }
  97. $(".s1_content").html(html);
  98. },'json')
  99. }
  100. </script>
  101. <?php }elseif($_smarty_tpl->tpl_vars['act']->value=='step_2'){?>
  102. <table class="tableBasic" border="0" cellpadding="8" cellspacing="0" width="100%">
  103. <tr><td>
  104. <div class="s_content">
  105. <img src="/static/images/tm_loading.gif" height="30px" style="float:left">
  106. <div class="s_prompt">正在下载升级包...</div>
  107. </div>
  108. </td></tr>
  109. </table>
  110. <script>
  111. $(function(){
  112. $.post(url,
  113. {
  114. 'act':'download',
  115. },function(res){
  116. if(res.status==1){
  117. $(".s_prompt").html("升级包下载完毕,正在解压...");
  118. unzip(res.zip_file);
  119. }else{
  120. $(".s_prompt").html(res.msg);
  121. }
  122. },'json');
  123. })
  124. function unzip(zip_file){
  125. $.post(url,
  126. {
  127. 'act':'unzip',
  128. 'zip_file':zip_file
  129. },function(res){
  130. if(res.status==1){
  131. $(".s_prompt").html("解压完毕,开始校验程序文件...");
  132. setTimeout(function(){
  133. window.location.href = url+'&act=step_3'
  134. },1500)
  135. }else{
  136. $(".s_prompt").html(res.msg);
  137. }
  138. },'json')
  139. }
  140. </script>
  141. <?php }elseif($_smarty_tpl->tpl_vars['act']->value=='step_3'){?>
  142. <div class="s3_content">
  143. <table class="tableBasic" border="0" cellpadding="4" cellspacing="0" width="100%">
  144. <thead>
  145. <tr>
  146. <th>目录路径</th>
  147. <th>是否可写</th>
  148. </tr>
  149. </thead>
  150. <tbody style="text-align: center;">
  151. </tbody>
  152. </table>
  153. </div>
  154. <div class="s3_cofirm">
  155. <div class="s3_step">
  156. <!-- <button class="btn" onclick="javascript:window.location.href='/<?php echo $_smarty_tpl->tpl_vars['_lang']->value['admin_path'];?>
  157. /?m=upgrade&act=step_4'">确认更新程序</button> -->
  158. <button class="btn" onclick="javascript:window.location.reload()">刷新</button>
  159. </div>
  160. <span class="s3_prompt" style="color:red">请仔细检查要更新的目录是否全部可写,请登录服务器赋予目录写入权限!</span>
  161. </div>
  162. <script>
  163. $(function(){
  164. $.post(url,{
  165. 'act':'validate_dir'
  166. },function(res){
  167. var html = "";
  168. var flag = true;
  169. if(res.status==1){
  170. var list = res.list;
  171. for( var key in list){
  172. if (list[key]==0) {
  173. flag = false;
  174. }
  175. html+='<tr>'+
  176. '<td>'+key+'</td>'+
  177. '<td>'+(list[key]==1?"<img src='/static/images/ico/yes.gif'>":"<span style=\"color:#c40000\">否,请先修改权限</span>")+'</td>'+
  178. '</tr>';
  179. }
  180. }else{
  181. html =res.msg;
  182. }
  183. $(".tableBasic tbody").html(html);
  184. if (flag) {
  185. $(".s3_step").html('<button class="btn" onclick="to_step_4()">确认更新程序</button>');
  186. }
  187. },"json");
  188. })
  189. function to_step_4(){
  190. window.location.href = url+"&act=step_4";
  191. }
  192. </script>
  193. <?php }elseif($_smarty_tpl->tpl_vars['act']->value=='step_4'){?>
  194. <div class="s3_content">
  195. <table class="tableBasic" border="0" cellpadding="4" cellspacing="0" width="100%">
  196. <thead>
  197. <tr>
  198. <th>文件路径</th>
  199. <th>是否被手动修改</th>
  200. <th>状态</th>
  201. </tr>
  202. </thead>
  203. <tbody style="text-align: center;">
  204. </tbody>
  205. </table>
  206. </div>
  207. <div class="s3_cofirm">
  208. <div class="s3_step"><button class="btn" onclick="confirm()">确认更新文件</button></div>
  209. <span class="s3_prompt" style="color:red">请仔细检查要更新的文件是否被修改过,请在升级前做好备份!</span>
  210. </div>
  211. <script>
  212. var up_list = new Array();
  213. var suc_data = new Array();
  214. var fail_data = new Array();
  215. $(function(){
  216. $.post(url,
  217. {
  218. 'act':'validate'
  219. },function(res){
  220. var html = "";
  221. if(res.status==1){
  222. var list = res.list;
  223. var index = 0;
  224. for( var key in list){
  225. ++index;
  226. html+='<tr>'+
  227. '<td>'+key+'</td>'+
  228. '<td>'+(list[key]==1?"<span style=\"color:red\">是(请先备份)</span>":"否")+'</td>'+
  229. '<td id="s3_op_'+index+'">等待</td>'+
  230. '</tr>';
  231. var file = {};
  232. file.index = 's3_op_'+index;
  233. file.key = key;
  234. up_list.push(file);
  235. }
  236. }else{
  237. html = res.msg;
  238. }
  239. $(".tableBasic tbody").html(html);
  240. },'json');
  241. })
  242. var loading = '<img src="/static/images/s_loading.gif">';
  243. var success = '<img src="/static/images/ico/yes.gif">';
  244. var error = '<img src="/static/images/ico/no.gif">';
  245. var do_confirm_flag = false;
  246. function confirm(){
  247. do_confirm(0);
  248. var inter = setInterval(function(){
  249. if (do_confirm_flag) {
  250. clearInterval(inter);
  251. $('.s3_prompt').html("程序替换完成,开始重新计算hash码");
  252. refresh();
  253. if (fail_data.length>0) {
  254. $('.s3_prompt').html("<span style='color:red'>替换程序失败 "+fail_data.length+" 个,请找到服务器根目录 upgrade/package/code/ 下的文件,进行手动替换</span>");
  255. }
  256. $('.s3_step').html('<a href="'+url+'&act=step_5" class="btn">下一步</a>');
  257. }
  258. },500);
  259. }
  260. function do_confirm(i){
  261. var f = up_list[i];
  262. $("#"+f.index).html(loading);
  263. $('.s3_prompt').html("正在替换 "+f.key);
  264. $.post(url,
  265. {
  266. 'act':'apply',
  267. 'file':f.key
  268. },function(res){
  269. if (res.status==1) {
  270. $("#"+f.index).html(success);
  271. suc_data.push(f.key);
  272. }else{
  273. $("#"+f.index).html(error);
  274. fail_data.push(f.key);
  275. }
  276. ++i;
  277. if(i==up_list.length){
  278. do_confirm_flag = true;
  279. return ;
  280. }
  281. do_confirm(i);
  282. },'json')
  283. }
  284. function refresh(){
  285. if (suc_data.length>0) {
  286. $.ajax({
  287. type : "post",
  288. url : url,
  289. data : {
  290. 'act':'refresh',
  291. 'files':JSON.stringify(suc_data),
  292. 'rm':fail_data.length>0?0:1
  293. },
  294. async : false,
  295. dataType:'json',
  296. success : function(res){
  297. if (res.status==1) {
  298. $('.s3_prompt').html("文件更新完成,若有更新失败的文件,请手动更新!");
  299. }else{
  300. $('.s3_prompt').html(res.msg);
  301. }
  302. }
  303. });
  304. }
  305. }
  306. </script>
  307. <?php }elseif($_smarty_tpl->tpl_vars['act']->value=='step_5'){?>
  308. <table class="tableBasic" border="0" cellpadding="8" cellspacing="0" width="100%">
  309. <tr><td>
  310. <div class="s_content">
  311. <img src="/static/images/tm_loading.gif" height="30px" style="float:left">
  312. <div class="s_prompt">正在检查更新数据库...</div>
  313. </div>
  314. </td></tr>
  315. </table>
  316. <script>
  317. $(function(){
  318. $.post(url,
  319. {
  320. 'act':'update_db'
  321. },function(res){
  322. $('.s_prompt').html(res.msg);
  323. setTimeout(function(){
  324. window.location.href = url+'&act=step_6'
  325. },1500);
  326. },'json')
  327. })
  328. </script>
  329. <?php }elseif($_smarty_tpl->tpl_vars['act']->value=='step_6'){?>
  330. <table class="tableBasic" border="0" cellpadding="8" cellspacing="0" width="100%">
  331. <tr><td>恭喜,升级完成!</td></tr>
  332. </table>
  333. <?php }?>
  334. </div>
  335. </div><?php }} ?>