misc_patch.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: misc_patch.php 33690 2013-08-02 09:07:22Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if($_GET['action'] == 'checkpatch') {
  12. header('Content-Type: text/javascript');
  13. if($_G['uid'] && $_G['member']['allowadmincp'] == 1) {
  14. $discuz_patch = new discuz_patch();
  15. $discuz_patch->check_patch();
  16. }
  17. exit;
  18. } elseif($_GET['action'] == 'patchnotice') {
  19. $patchlist = '';
  20. if($_G['member']['allowadmincp'] == 1) {
  21. $discuz_patch = new discuz_patch();
  22. $patchnotice = $discuz_patch->fetch_patch_notice();
  23. if(!empty($patchnotice['data'])) {
  24. $lang = lang('forum/misc');
  25. $patchlist .= '<div class="bm'.($patchnotice['fixed'] ? ' allfixed' : '').'"><div class="bm_h cl"><a href="javascript:;" onclick="$(\'patch_notice\').style.display=\'none\'" class="y" title="'.$lang['patch_close'].'">'.$lang['patch_close'].'</a><h2 class="i">';
  26. if($patchnotice['fixed']) {
  27. $patchlist .= $lang['patch_site_have'].' '.count($patchnotice['data']).' '.$lang['patch_is_fixed'];
  28. } else {
  29. $patchlist .= $lang['patch_site_have'].' '.count($patchnotice['data']).' '.$lang['patch_need_fix'];
  30. }
  31. $patchlist .= '</h2></div><div class="bm_c"><table width="100%" class="mbm"><tr><th>'.$lang['patch_name'].'</th><th class="patchdate">'.$lang['patch_dateline'].'</th><th class="patchstat">'.$lang['patch_status'].'</th><tr>';
  32. foreach($patchnotice['data'] as $notice) {
  33. $patchlist .= '<tr><td>'.$notice['serial'].'</td><td>'.dgmdate($notice['dateline'], 'Y-m-d').'</td><td>';
  34. if($notice['status'] >= 1) {
  35. $patchlist .= '<span class="fixed">'.$lang['patch_fixed_status'].'<span>';
  36. } elseif($notice['status'] < 0) {
  37. $patchlist .= '<span class="unfixed">'.$lang['patch_fix_failed_status'].'</span>';
  38. } else {
  39. $patchlist .= '<span class="unfixed">'.$lang['patch_unfix_status'].'</span>';
  40. }
  41. $patchlist .= '</td></tr>';
  42. }
  43. $patchlist .= '</table><p class="cl"><a href="admin.php?action=patch" class="y pn"><strong>'.($patchnotice['fixed'] ? $lang['patch_view_fix_detail'] : $lang['patch_fix_right_now']).'</strong></a></p>';
  44. $patchlist .= '</div></div>';
  45. }
  46. }
  47. include template('common/header_ajax');
  48. echo $patchlist;
  49. include template('common/footer_ajax');
  50. exit;
  51. } elseif($_GET['action'] == 'pluginnotice') {
  52. require_once libfile('function/admincp');
  53. require_once libfile('function/plugin');
  54. require_once libfile('function/cloudaddons');
  55. $pluginarray = C::t('common_plugin')->fetch_all_data();
  56. $addonids = $vers = array();
  57. foreach($pluginarray as $row) {
  58. if(ispluginkey($row['identifier'])) {
  59. $addonids[] = $row['identifier'].'.plugin';
  60. $vers[$row['identifier'].'.plugin'] = $row['version'];
  61. }
  62. }
  63. $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
  64. savecache('addoncheck_plugin', $checkresult);
  65. $newversion = 0;
  66. foreach($checkresult as $addonid => $value) {
  67. list(, $newver, $sysver) = explode(':', $value);
  68. if($sysver && $sysver > $vers[$addonid] || $newver) {
  69. $newversion++;
  70. }
  71. }
  72. include template('common/header_ajax');
  73. if($newversion) {
  74. $lang = lang('forum/misc');
  75. echo '<div class="bm"><div class="bm_h cl"><a href="javascript:;" onclick="$(\'plugin_notice\').style.display=\'none\';setcookie(\'pluginnotice\', 1, 86400)" class="y" title="'.$lang['patch_close'].'">'.$lang['patch_close'].'</a>';
  76. echo '<h2 class="i">'.$lang['plugin_title'].'</h2></div><div class="bm_c">';
  77. echo '<div class="cl bbda pbm">'.lang('forum/misc', 'plugin_memo', array('number' => $newversion)).'</div>';
  78. echo '<div class="ptn cl"><a href="admin.php?action=plugins" class="xi2 y">'.$lang['plugin_link'].' &raquo;</a></div>';
  79. echo '</div></div>';
  80. }
  81. include template('common/footer_ajax');
  82. exit;
  83. } elseif($_GET['action'] == 'ipnotice') {
  84. require_once libfile('function/misc');
  85. include template('common/header_ajax');
  86. if($_G['cookie']['lip'] && $_G['cookie']['lip'] != ',' && $_G['uid'] && $_G['setting']['disableipnotice'] != 1) {
  87. $status = C::t('common_member_status')->fetch($_G['uid']);
  88. $lip = explode(',', $_G['cookie']['lip']);
  89. $lastipConvert = convertip($lip[0]);
  90. $lastipDate = dgmdate($lip[1]);
  91. $nowipConvert = convertip($status['lastip']);
  92. $lastipConvert = process_ipnotice($lastipConvert);
  93. $nowipConvert = process_ipnotice($nowipConvert);
  94. if($lastipConvert != $nowipConvert && stripos($lastipConvert, $nowipConvert) == false && stripos($nowipConvert, $lastipConvert) == false) {
  95. $lang = lang('forum/misc');
  96. include template('common/ipnotice');
  97. }
  98. }
  99. include template('common/footer_ajax');
  100. exit;
  101. }
  102. ?>