install.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /*
  3. * Install Uninstall Upgrade AutoStat System Code 2017040223OTzC6QbnRW
  4. * This is NOT a freeware, use is subject to license terms
  5. * From www.1314study.com
  6. */
  7. if(!defined('IN_ADMINCP')) {
  8. exit('Access Denied');
  9. }
  10. require_once DISCUZ_ROOT.'./source/discuz_version.php';
  11. require_once ('installlang.lang.php');
  12. $request_url = str_replace('&step='.$_GET['step'],'',$_SERVER['QUERY_STRING']);
  13. if($_GET['available']){
  14. showsubmenusteps($pluginarray['plugin']['name'].$s_installlang[$operation].$s_installlang['ilang_001'], array(
  15. array($s_installlang['ilang_check'], !$_GET['step']),
  16. array($s_installlang['ilang_sql'], $_GET['step'] == 'sql'),
  17. array($s_installlang['ilang_stat'], $_GET['step'] == 'stat'),
  18. array($s_installlang['ilang_addon'], $_GET['step'] == 'addon'),
  19. array($s_installlang['ilang_ok'].$s_installlang[$operation], $_GET['step']=='ok'),
  20. ));
  21. }else{
  22. showsubmenusteps($pluginarray['plugin']['name'].$s_installlang[$operation].$s_installlang['ilang_001'], array(
  23. array($s_installlang['ilang_check'], !$_GET['step']),
  24. array($s_installlang['ilang_sql'], $_GET['step'] == 'sql'),
  25. array($s_installlang['ilang_stat'], $_GET['step'] == 'stat'),
  26. array($s_installlang['ilang_ok'].$s_installlang[$operation], $_GET['step']=='ok'),
  27. ));
  28. }
  29. switch($_GET['step']){
  30. default:
  31. case 'check':
  32. $available = dfsockopen('http://addon.1314study.com/api/available.php?siteurl='.rawurlencode($_G['siteurl']));
  33. if($available == 'succeed'){
  34. $available = 1;
  35. }else{
  36. $available = 0;
  37. }
  38. $addonid = $pluginarray['plugin']['identifier'].'.plugin';
  39. $array = cloudaddons_getmd5($addonid);
  40. if(cloudaddons_open('&mod=app&ac=validator&addonid='.$addonid.($array !== false ? '&rid='.$array['RevisionID'].'&sn='.$array['SN'].'&rd='.$array['RevisionDateline'] : '')) === '0') {
  41. splugin_read_error($pluginarray['plugin']['identifier']);
  42. cpmsg('cloudaddons_file_read_error', '', 'error', array('addonid' => $addonid));
  43. }
  44. cpmsg($s_installlang['ilang_check_ok'], "{$request_url}&step=sql&available=$available", 'loading', array('operation' => $s_installlang[$operation]));
  45. break;
  46. case 'sql':
  47. // $sql = <<<EOF
  48. //EOF;
  49. // runquery($sql);
  50. cpmsg($s_installlang['ilang_sql_ok'], "{$request_url}&step=stat", 'loading', array('operation' => $s_installlang[$operation]));
  51. break;
  52. case 'stat':
  53. $step = $_GET['available'] ? 'addon' : 'ok';
  54. if(!$_GET['agreestat']) {
  55. cpmsg($s_installlang['ilang_stat_agree'], "{$request_url}&step=stat&agreestat=1314", 'form', array(), '', TRUE, ADMINSCRIPT."?{$request_url}&step=$step");
  56. }
  57. $_statInfo = array();
  58. $_statInfo['pluginName'] = $pluginarray['plugin']['identifier'];
  59. $_statInfo['pluginVersion'] = $pluginarray['plugin']['version'];
  60. $_statInfo['bbsVersion'] = DISCUZ_VERSION;
  61. $_statInfo['bbsRelease'] = DISCUZ_RELEASE;
  62. $_statInfo['timestamp'] = TIMESTAMP;
  63. $_statInfo['bbsUrl'] = $_G['siteurl'];
  64. $_statInfo['SiteUrl'] = 'http://bbs.9026.com/';
  65. $_statInfo['ClientUrl'] = 'http://www.9026.com/';
  66. $_statInfo['SiteID'] = 'CAC3A6DA-13A8-9E17-F159-85D92EDD916A';
  67. $_statInfo['bbsAdminEMail'] = $_G['setting']['adminemail'];
  68. $_statInfo['action'] = substr($operation,6);
  69. $_statInfo['genuine'] = splugin_genuine($pluginarray['plugin']['identifier']);
  70. $_statInfo = base64_encode(serialize($_statInfo));
  71. $_md5Check = md5($_statInfo);
  72. $StatUrl = 'http://addon.1314study.com/stat.php';
  73. $_StatUrl = $StatUrl.'?info='.$_statInfo.'&md5check='.$_md5Check;
  74. $code = "<script src=\"".$_StatUrl."\" type=\"text/javascript\"></script>";
  75. cpmsg($s_installlang['ilang_stat_ok'], "{$request_url}&step=$step", 'loading', array('operation' => $s_installlang[$operation], 'stat_code' => $code));
  76. break;
  77. case 'addon':
  78. if($_GET['available']){
  79. $_statInfo = array();
  80. $_statInfo['pluginName'] = $pluginarray['plugin']['identifier'];
  81. $_statInfo['bbsVersion'] = DISCUZ_VERSION;
  82. $_statInfo['bbsUrl'] = $_G['siteurl'];
  83. $_statInfo['action'] = substr($operation,6);
  84. $_statInfo['nextUrl'] = ADMINSCRIPT.'?'.$request_url;
  85. $_statInfo = base64_encode(serialize($_statInfo));
  86. $_md5Check = md5($_statInfo);
  87. $StatUrl = 'http://addon.1314study.com/api/outer_addon.php';
  88. $_StatUrl = $StatUrl.'?type=js&info='.$_statInfo.'&md5check='.$_md5Check;
  89. echo '<script type="text/javascript">location.href="'.$_StatUrl.'";</script>';
  90. }else{
  91. echo '<script type="text/javascript">location.href="'.$_G['siteurl'].ADMINSCRIPT.'?'.$request_url.'&step=ok";</script>';
  92. }
  93. break;
  94. case 'ok':
  95. //¸üлº´æ
  96. splugin_updatecache($pluginarray['plugin']['identifier']);
  97. $finish = TRUE;
  98. break;
  99. }
  100. ?>