diff --git a/upload/source/admincp/admincp_menu.php b/upload/source/admincp/admincp_menu.php index 4e3b0c4..9270c00 100644 --- a/upload/source/admincp/admincp_menu.php +++ b/upload/source/admincp/admincp_menu.php @@ -242,8 +242,7 @@ if($isfounder) { $menu['founder'] = array( array('menu_founder_perm', 'founder_perm'), - array('menu_setting_mail', 'setting_mail'), - array('menu_patch', 'patch'), + array('menu_setting_mail', 'setting_mail'), array('menu_setting_uc', 'setting_uc'), array('menu_db', 'db_export'), array('menu_membersplit', 'membersplit_check'), diff --git a/upload/source/admincp/admincp_patch.php b/upload/source/admincp/admincp_patch.php deleted file mode 100644 index 596f239..0000000 --- a/upload/source/admincp/admincp_patch.php +++ /dev/null @@ -1,160 +0,0 @@ -fetch_all(array('mastermobile', 'masterqq', 'masteremail')); - $save_mastermobile = $save_master['mastermobile']; - $save_mastermobile = !empty($save_mastermobile) ? authcode($save_mastermobile, 'DECODE', $_G['config']['security']['authkey']) : ''; - - if(!submitcheck('settingsubmit')) { - $view_mastermobile = !empty($save_mastermobile) ? substr($save_mastermobile, 0 , 3).'*****'.substr($save_mastermobile, -3) : ''; - - shownav('founder', 'nav_founder_patch'); - showsubmenu('nav_founder_patch', array( - array('founder_patch_list', 'patch&operation=fixpatch', 0), - array('founder_patch_updatesetting', 'patch&operation=patchsetting', 1), - )); - showformheader('patch&operation=patchsetting'); - showtableheader(); - showsetting('founder_patch_autoupdate', 'settingnew[patch][autoopened]', $_G['setting']['patch']['autoopened'], 'radio'); - showsubmit('settingsubmit', 'submit'); - showtablefooter(); - showformfooter(); - } else { - $settings = array(); - $settingnew = $_POST['settingnew']; - if($settingnew) { - - - - if(!$discuz_patch->save_patch_setting($settingnew)) { - cpmsg('patch_no_privilege_autoupdate', '', 'error'); - } - } - cpmsg('patch_updatesetting_successful', 'action=patch&operation='.$operation, 'succeed'); - } - -} elseif($operation == 'fixpatch') { - - if(!submitcheck('fixpatchsubmit', 1)) { - shownav('founder', 'nav_founder_patch'); - showsubmenu('nav_founder_patch', array( - array('founder_patch_list', 'patch&operation=fixpatch', 1), - array('founder_patch_updatesetting', 'patch&operation=patchsetting', 0), - )); - showformheader('patch&operation=fixpatch'); - showtableheader('', 'fixpadding', '', 5); - showtablerow('class="header"', array('class="td25"','class="td24"','', 'class="td31"', 'class="td25"'), array( - '', - $lang['founder_patch_serial'], - $lang['founder_patch_note'], - $lang['founder_patch_dateline'], - $lang['founder_patch_status'], - )); - $patchlist = C::t('common_patch')->fetch_all(); - foreach($patchlist as $patch) { - showtablerow($patch['status'] <= 0 ? 'title="'.$lang['founder_patchstatus_'.($patch['status'] < 0 ? 'error'.$patch['status'] : $patch['status'])].'"' : '', '', array( - '= 1 ? ' disabled' : ' name="deletefix[]" checked').'>', - $patch['serial'], - $patch['note'], - dgmdate($patch['dateline'], 'Y-m-d H:i:s'), - ' ', - )); - } - showsubmit('fixpatchsubmit', 'founder_patch_fix', 'select_all', ' '); - showtablefooter(); - showformfooter(); - - } else { - $patchlist = $_GET['deletefix']; - if(empty($patchlist)) { - cpmsg('patch_please_select_patch', '', 'error'); - } - $confirm = $_GET['confirm']; - if(!$confirm) { - - if($_GET['siteftpsetting']) { - $action = 'patch&operation=fixpatch&fixpatchsubmit=yes&confirm=ftp'; - foreach($patchlist as $serial) { - $action .= '&deletefix[]='.$serial; - } - siteftp_form($action); - exit; - } - - $flag = 0; - foreach(C::t('common_patch')->fetch_needfix_patch($patchlist) as $patch) { - if(!$discuz_patch->test_patch_writable($patch)) { - $flag = 1; - break; - } - } - if(!$flag) { - $confirm = 'file'; - } else { - $linkurl = ADMINSCRIPT.'?action=patch&operation='.$operation.'&fixpatchsubmit=yes'; - foreach($patchlist as $serial) { - $linkurl .= '&deletefix[]='.$serial; - } - $ftplinkurl = $linkurl.'&siteftpsetting=1'; - cpmsg('patch_cannot_access_file', - '', - '', - array(), - '
'. - '   

' - ); - } - } - - $failed = array(); - if($patchlist) { - $patchlist = C::t('common_patch')->fetch_needfix_patch($patchlist); - foreach($patchlist as $patch) { - $result = $discuz_patch->fix_patch($patch, $confirm); - if($result < 0) { - $failed[] = array('serial' => $patch['serial'], 'reason' => $lang['founder_patchstatus_'.($result < 0 ? 'error'.$result : $result)]); - } - } - } - if($failed) { - $failstr = ''; - foreach($failed as $v) { - $failstr .= $lang['founder_patch_fixpatch'].$v['serial'].'    '.$lang['founder_patch_failedreason'].': '.$v['reason']."
\r\n"; - } - cpmsg('patch_updatesetting_failed', 'action=patch&operation='.$operation, 'error', array('list' => $failstr)); - } else { - cpmsg('patch_successful', 'action=patch&operation='.$operation, 'succeed', array(), ''); - } - } - -} elseif($operation == 'checkpatch') { - - if(!intval($_GET['checking'])) { - cpmsg('patch_cheking', 'action=patch&operation=checkpatch&checking=1', 'loading', '', false); - } - $discuz_patch->check_patch(1); - dheader('Location: '.ADMINSCRIPT.'?action=patch&operation=fixpatch'); - -} elseif($operation == 'recheckpatch') { - - $discuz_patch->recheck_patch(); - cpmsg('patch_successful', 'action=patch&operation=fixpatch', 'succeed'); - -} -?> \ No newline at end of file diff --git a/upload/source/admincp/admincp_upgrade.php b/upload/source/admincp/admincp_upgrade.php deleted file mode 100644 index 373f23a..0000000 --- a/upload/source/admincp/admincp_upgrade.php +++ /dev/null @@ -1,413 +0,0 @@ -fetch('upgrade_step'); - $upgrade_step = dunserialize($upgrade_step['cachevalue']); - $upgrade_step['step'] = $step; - $upgrade_step['operation'] = $operation; - $upgrade_step['version'] = $version; - $upgrade_step['release'] = $release; - $upgrade_step['charset'] = $charset; - $upgrade_step['locale'] = $locale; - C::t('common_cache')->insert(array( - 'cachekey' => 'upgrade_step', - 'cachevalue' => serialize($upgrade_step), - 'dateline' => $_G['timestamp'], - ), false, true); - - $upgrade_run = C::t('common_cache')->fetch('upgrade_run'); - if(!$upgrade_run) { - C::t('common_cache')->insert(array( - 'cachekey' => 'upgrade_run', - 'cachevalue' => serialize($_G['setting']['upgrade']), - 'dateline' => $_G['timestamp'], - ), false, true); - $upgrade_run = $_G['setting']['upgrade']; - } else { - $upgrade_run = dunserialize($upgrade_run['cachevalue']); - } - - shownav('tools', 'nav_founder_upgrade'); - showsubmenusteps('nav_founder_upgrade', array( - array('founder_upgrade_updatelist', $step == 1), - array('founder_upgrade_download', $step == 2), - array('founder_upgrade_compare', $step == 3), - array('founder_upgrade_upgrading', $step == 4), - array('founder_upgrade_complete', $step == 5), - )); - showtableheader(); - - if($step != 5) { - - foreach($upgrade_run as $type => $list) { - if($type == $operation && $version == $list['latestversion'] && $release == $list['latestrelease']) { - $discuz_upgrade->locale = $locale; - $discuz_upgrade->charset = $charset; - $upgradeinfo = $list; - break; - } - } - if(!$upgradeinfo) { - cpmsg('upgrade_none', '', '', array('upgradeurl' => upgradeinformation(-1))); - } - - $updatefilelist = $discuz_upgrade->fetch_updatefile_list($upgradeinfo); - $updatemd5filelist = $updatefilelist['md5']; - $updatefilelist = $updatefilelist['file']; - - $theurl = 'upgrade&operation='.$operation.'&version='.$version.'&locale='.$locale.'&charset='.$charset.'&release='.$release; - - if(empty($updatefilelist)) { - cpmsg('upgrade_download_upgradelist_error', 'action='.$theurl, 'form', array('upgradeurl' => upgradeinformation(-2))); - } - - } - - if($step == 1) { - showtablerow('class="header"', '', $lang['founder_upgrade_preupdatelist']); - foreach($updatefilelist as $file) { - $file = ''.$file.''; - showtablerow('', '', array($file)); - } - $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=2'; - showtablerow('', '', array($lang['founder_upgrade_store_directory'].'./data/update/Discuz! X'.$version.' Release['.$release.']')); - showtablerow('', '', array('')); - echo upgradeinformation(0); - } elseif($step == 2) { - $fileseq = intval($_GET['fileseq']); - $fileseq = $fileseq ? $fileseq : 1; - if($fileseq > count($updatefilelist)) { - if($upgradeinfo['isupdatedb']) { - $discuz_upgrade->download_file($upgradeinfo, 'install/data/install.sql'); - $discuz_upgrade->download_file($upgradeinfo, 'install/data/install_data.sql'); - $discuz_upgrade->download_file($upgradeinfo, 'update.php', 'utility'); - } - $linkurl = 'action='.$theurl.'&step=3'; - cpmsg('upgrade_download_complete_to_compare', $linkurl, 'loading', array('upgradeurl' => upgradeinformation(0))); - } else { - $downloadstatus = $discuz_upgrade->download_file($upgradeinfo, $updatefilelist[$fileseq-1], 'upload', $updatemd5filelist[$fileseq-1]); - if($downloadstatus == 1) { - $linkurl = 'action='.$theurl.'&step=2&fileseq='.$fileseq; - cpmsg('upgrade_downloading_file', $linkurl, 'loading', array('file' => $updatefilelist[$fileseq-1], 'percent' => sprintf("%2d", 100 * $fileseq/count($updatefilelist)).'%', 'upgradeurl' => upgradeinformation(1))); - } elseif($downloadstatus == 2) { - $linkurl = 'action='.$theurl.'&step=2&fileseq='.($fileseq+1); - cpmsg('upgrade_downloading_file', $linkurl, 'loading', array('file' => $updatefilelist[$fileseq-1], 'percent' => sprintf("%2d", 100 * $fileseq/count($updatefilelist)).'%', 'upgradeurl' => upgradeinformation(1))); - } else { - cpmsg('upgrade_redownload', 'action='.$theurl.'&step=2&fileseq='.$fileseq, 'form', array('file' => $updatefilelist[$fileseq-1], 'upgradeurl' => upgradeinformation(-3))); - } - } - } elseif($step == 3) { - list($modifylist, $showlist, $ignorelist) = $discuz_upgrade->compare_basefile($upgradeinfo, $updatefilelist); - if(empty($modifylist) && empty($showlist) && empty($ignorelist)) { - cpmsg('filecheck_nofound_md5file', '', 'error', array('upgradeurl' => upgradeinformation(-4))); - } - showtablerow('class="header"', 'colspan="2"', $lang['founder_upgrade_diff_show']); - foreach($updatefilelist as $v) { - if(isset($ignorelist[$v])) { - continue; - } elseif(isset($modifylist[$v])) { - showtablerow('', array('class="" style="color:red;"', 'class="td24" style="color:red;"'), array(''.$v.'', $lang['founder_upgrade_diff'].' ')); - } elseif(isset($showlist[$v])) { - showtablerow('', array('class=""', 'class="td24"'), array(''.$v.'', $lang['founder_upgrade_normal'].' ')); - } else { - showtablerow('', array('class=""', 'class="td24"'), array(''.$v.'', $lang['founder_upgrade_new'].' ')); - } - } - - $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4'; - showtablerow('', 'colspan="2"', $lang['founder_upgrade_download_file'].' ./data/update/Discuz! X'.$version.' Release['.$release.']'.''); - showtablerow('', 'colspan="2"', $lang['founder_upgrade_backup_file'].' ./data/back/Discuz! '.DISCUZ_VERSION.' Release['.DISCUZ_RELEASE.']'.$lang['founder_upgrade_backup_file2']); - showtablerow('', 'colspan="2"', ''); - echo upgradeinformation(0); - } elseif($step == 4) { - - $confirm = $_GET['confirm']; - if(!$confirm) { - if($_GET['siteftpsetting']) { - $action = $theurl.'&step=4&confirm=ftp'.($_GET['startupgrade'] ? '&startupgrade=1' : ''); - siteftp_form($action); - exit; - } - - if($upgradeinfo['isupdatedb']) { - $checkupdatefilelist = array('install/update.php', 'install/data/install.sql','install/data/install_data.sql'); - $checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist); - } else { - $checkupdatefilelist = $updatefilelist; - } - if($discuz_upgrade->check_folder_perm($checkupdatefilelist)) { - $confirm = 'file'; - } else { - $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4'; - $ftplinkurl = $linkurl.'&siteftpsetting=1'; - cpmsg('upgrade_cannot_access_file', - '', - '', - array(), - '
'. - '  

' - ); - } - } - - $paraftp = ''; - if($_GET['siteftp']) { - foreach($_GET['siteftp'] as $k => $v) { - $paraftp .= '&siteftp['.$k.']='.$v; - } - } - if(!$_GET['startupgrade']) { - if(!$_GET['backfile']) { - cpmsg('upgrade_backuping', 'action='.$theurl.'&step=4&backfile=1&confirm='.$confirm.$paraftp, 'loading', array('upgradeurl' => upgradeinformation(2)), false); - } - foreach($updatefilelist as $updatefile) { - $destfile = DISCUZ_ROOT.$updatefile; - $backfile = DISCUZ_ROOT.'./data/back/Discuz! X'.substr(DISCUZ_VERSION, 1).' Release['.DISCUZ_RELEASE.']/'.$updatefile; - if(is_file($destfile)) { - if(!$discuz_upgrade->copy_file($destfile, $backfile, 'file')) { - cpmsg('upgrade_backup_error', '', 'error', array('upgradeurl' => upgradeinformation(-5))); - } - } - } - cpmsg('upgrade_backup_complete', 'action='.$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp, 'loading', array('upgradeurl' => upgradeinformation(3)), false); - } - - $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp; - $ftplinkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4&startupgrade=1&siteftpsetting=1'; - foreach($updatefilelist as $updatefile) { - $srcfile = DISCUZ_ROOT.'./data/update/Discuz! X'.$version.' Release['.$release.']/'.$updatefile; - if($confirm == 'ftp') { - $destfile = $updatefile; - } else { - $destfile = DISCUZ_ROOT.$updatefile; - } - if(!$discuz_upgrade->copy_file($srcfile, $destfile, $confirm)) { - if($confirm == 'ftp') { - cpmsg('upgrade_ftp_upload_error', - '', - '', - array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6)), - '
'. - '  

' - ); - } else { - cpmsg('upgrade_copy_error', - '', - '', - array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7)), - '
'. - '  

' - ); - } - } - } - if($upgradeinfo['isupdatedb']) { - $dbupdatefilearr = array('update.php', 'install/data/install.sql','install/data/install_data.sql'); - foreach($dbupdatefilearr as $dbupdatefile) { - $srcfile = DISCUZ_ROOT.'./data/update/Discuz! X'.$version.' Release['.$release.']/'.$dbupdatefile; - $dbupdatefile = $dbupdatefile == 'update.php' ? 'install/update.php' : $dbupdatefile; - if($confirm == 'ftp') { - $destfile = $dbupdatefile; - } else { - $destfile = DISCUZ_ROOT.$dbupdatefile; - } - if(!$discuz_upgrade->copy_file($srcfile, $destfile, $confirm)) { - if($confirm == 'ftp') { - cpmsg('upgrade_ftp_upload_error', - '', - '', - array('file' => $dbupdatefile, 'upgradeurl' => upgradeinformation(-6)), - '
'. - '  

' - ); - } else { - cpmsg('upgrade_copy_error', - '', - '', - array('file' => $dbupdatefile, 'upgradeurl' => upgradeinformation(-7)), - '
'. - '  

' - ); - } - } - } - $upgrade_step['step'] = 'dbupdate'; - C::t('common_cache')->insert(array( - 'cachekey' => 'upgrade_step', - 'cachevalue' => serialize($upgrade_step), - 'dateline' => $_G['timestamp'], - ), false, true); - $dbreturnurl = $_G['siteurl'].ADMINSCRIPT.'?action=upgrade&operation='.$operation.'&version='.$version.'&release='.$release.'&step=5'; - cpmsg('upgrade_file_successful', $_G['siteurl'].'install/update.php?step=prepare&from='.rawurlencode($dbreturnurl).'&frommd5='.rawurlencode(md5($dbreturnurl.$_G['config']['security']['authkey'])), '', array('upgradeurl' => upgradeinformation(4))); - } - dheader('Location: '.ADMINSCRIPT.'?action=upgrade&operation='.$operation.'&version='.$version.'&release='.$release.'&step=5'); - - } elseif($step == 5) { - $file = DISCUZ_ROOT.'./data/update/Discuz! X'.$version.' Release['.$release.']/updatelist.tmp'; - @unlink($file); - @unlink(DISCUZ_ROOT.'./install/update.php'); - C::t('common_cache')->delete('upgrade_step'); - C::t('common_cache')->delete('upgrade_run'); - C::t('common_setting')->update('upgrade', ''); - updatecache('setting'); - $old_update_dir = './data/update/'; - $new_update_dir = './data/update'.md5('update'.$_G['config']['security']['authkey']).'/'; - $old_back_dir = './data/back/'; - $new_back_dir = './data/back'.md5('back'.$_G['config']['security']['authkey']).'/'; - $discuz_upgrade->copy_dir(DISCUZ_ROOT.$old_update_dir, DISCUZ_ROOT.$new_update_dir); - $discuz_upgrade->copy_dir(DISCUZ_ROOT.$old_back_dir, DISCUZ_ROOT.$new_back_dir); - $discuz_upgrade->rmdirs(DISCUZ_ROOT.$old_update_dir); - $discuz_upgrade->rmdirs(DISCUZ_ROOT.$old_back_dir); - cpmsg('upgrade_successful', '', 'succeed', array('version' => $version, 'release' => $release, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)), ''); - } - showtablefooter(); - -} elseif($operation == 'check') { - if(!intval($_GET['rechecking'])) { - $upgrade_step = C::t('common_cache')->fetch('upgrade_step'); - if(!empty($upgrade_step['cachevalue'])) { - $upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']); - if(!empty($upgrade_step['cachevalue']['step'])) { - $theurl = 'upgrade&operation='.$upgrade_step['cachevalue']['operation'].'&version='.$upgrade_step['cachevalue']['version'].'&locale='.$upgrade_step['cachevalue']['locale'].'&charset='.$upgrade_step['cachevalue']['charset'].'&release='.$upgrade_step['cachevalue']['release']; - $steplang = array('', cplang('founder_upgrade_updatelist'), cplang('founder_upgrade_download'), cplang('founder_upgrade_compare'), cplang('founder_upgrade_upgrading'), cplang('founder_upgrade_complete'), 'dbupdate' => cplang('founder_upgrade_dbupdate')); - $recheckurl = ADMINSCRIPT.'?action=upgrade&operation=recheck'; - if($upgrade_step['cachevalue']['step'] == 'dbupdate') { - $dbreturnurl = $_G['siteurl'].ADMINSCRIPT.'?action='.$theurl.'&step=5'; - $stepurl = $_G['siteurl'].'install/update.php?step=prepare&from='.rawurlencode($dbreturnurl).'&frommd5='.rawurlencode(md5($dbreturnurl.$_G['config']['security']['authkey'])); - cpmsg('upgrade_continue', - '', - '', - array('step' => $steplang['dbupdate']), - '
    

' - ); - } else { - $stepurl = ADMINSCRIPT.'?action='.$theurl.'&step='.$upgrade_step['cachevalue']['step']; - cpmsg('upgrade_continue', - '', - '', - array('step' => $steplang[$upgrade_step['cachevalue']['step']]), - '
    

' - ); - } - } - } - } else { - C::t('common_cache')->delete('upgrade_step'); - } - if(!intval($_GET['checking'])) { - cpmsg('upgrade_checking', 'action=upgrade&operation=check&checking=1', 'loading', '', false); - } - $discuz_upgrade->check_upgrade(); - dheader('Location: '.ADMINSCRIPT.'?action=upgrade&operation=showupgrade'); - -} elseif($operation == 'showupgrade') { - shownav('tools', 'nav_founder_upgrade'); - showsubmenu('nav_founder_upgrade'); - showtableheader(); - if(!$_G['setting']['upgrade']) { - cpmsg('upgrade_latest_version', '', 'succeed'); - } else { - - C::t('common_cache')->insert(array( - 'cachekey' => 'upgrade_step', - 'cachevalue' => serialize(array('curversion' => $discuz_upgrade->versionpath(), 'currelease' => DISCUZ_RELEASE)), - 'dateline' => $_G['timestamp'], - ), false, true); - - $upgraderow = $patchrow = array(); - $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset'])); - $dbversion = helper_dbtool::dbversion(); - $locale = ''; - if($charset == 'BIG5') { - $locale = 'TC'; - } elseif($charset == 'GBK') { - $locale = 'SC'; - } elseif($charset == 'UTF8') { - if($_G['config']['output']['language'] == 'zh_cn') { - $locale = 'SC'; - } elseif($_G['config']['output']['language'] == 'zh_tw') { - $locale = 'TC'; - } - } - foreach($_G['setting']['upgrade'] as $type => $upgrade) { - $unupgrade = 0; - if(version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) { - $unupgrade = 1; - } - - $linkurl = ADMINSCRIPT.'?action=upgrade&operation='.$type.'&version='.$upgrade['latestversion'].'&locale='.$locale.'&charset='.$charset.'&release='.$upgrade['latestrelease']; - if($unupgrade) { - $upgraderow[] = showtablerow('', '', array('Discuz! X'.$upgrade['latestversion'].'_'.$locale.'_'.$charset.$lang['version'].' [Release '.$upgrade['latestrelease'].']'.($type == 'patch' ? '('.$lang['founder_upgrade_newword'].'release)' : '').'', $lang['founder_upgrade_require_config'].' php v'.PHP_VERSION.'MYSQL v'.$dbversion, ''), TRUE); - } else { - $upgraderow[] = showtablerow('', '', array('Discuz! X'.$upgrade['latestversion'].'_'.$locale.'_'.$charset.$lang['version'].' [Release '.$upgrade['latestrelease'].']'.($type == 'patch' ? '('.$lang['founder_upgrade_newword'].'release)' : '').'', '', ''.$lang['founder_upgrade_manually'].''), TRUE); - } - } - showtablerow('class="header"','', array($lang['founder_upgrade_select_version'], '', '')); - if($upgraderow) { - foreach($upgraderow as $row) { - echo $row; - } - } - if($patchrow) { - foreach($patchrow as $row) { - echo $row; - } - } - } - showtablefooter(); -} elseif($operation == 'recheck') { - - $upgrade_step = C::t('common_cache')->fetch('upgrade_step'); - $upgrade_step = dunserialize($upgrade_step['cachevalue']); - $file = DISCUZ_ROOT.'./data/update/Discuz! X'.$upgrade_step['version'].' Release['.$upgrade_step['release'].']/updatelist.tmp'; - @unlink($file); - @unlink(DISCUZ_ROOT.'./install/update.php'); - C::t('common_cache')->delete('upgrade_step'); - C::t('common_cache')->delete('upgrade_run'); - C::t('common_setting')->update('upgrade', ''); - updatecache('setting'); - $old_update_dir = './data/update/'; - $discuz_upgrade->rmdirs(DISCUZ_ROOT.$old_update_dir); - dheader('Location: '.ADMINSCRIPT.'?action=upgrade'); -} -?> \ No newline at end of file diff --git a/upload/source/class/discuz/discuz_patch.php b/upload/source/class/discuz/discuz_patch.php deleted file mode 100644 index a3ad04c..0000000 --- a/upload/source/class/discuz/discuz_patch.php +++ /dev/null @@ -1,364 +0,0 @@ -test_writable(DISCUZ_ROOT)) { - return false; - } - C::t('common_setting')->update_batch($settingnew); - include_once libfile('function/cache'); - updatecache('setting'); - return true; - } - - public function fetch_patch_notice() { - global $_G; - - $serials = $fixed_serials = $unfixed_serials = array(); - $showpatchnotice = 1; - $serials = C::t('common_patch')->fetch_all(); - if($serials) { - foreach($serials as $serial) { - if($serial['status'] <= 0) { - $showpatchnotice = 2; - $unfixed_serials[] = $serial; - } else { - $fixed_serials[] = $serial; - } - } - } - - if($showpatchnotice == 2) { - $serials = $unfixed_serials; - } else { - C::t('common_setting')->delete('showpatchnotice'); - include_once libfile('function/cache'); - updatecache('setting'); - } - return array('fixed' => (!empty($serials) && $showpatchnotice == 1) ? 1 : 0, 'data' => $serials); - } - - public function check_patch($ignore = 0) { - global $_G; - - if(!$ignore && $_G['cookie']['checkpatch']) { - return false; - } - require_once DISCUZ_ROOT.'source/discuz_version.php'; - require_once libfile('class/xml'); - - $versionpath = ''; - foreach(explode(' ', substr(DISCUZ_VERSION, 1)) as $unit) { - $versionpath = $unit; - break; - } - $patchdir = 'http://upgrade.discuz.com/DiscuzX/'.$versionpath.'/'; - - $checkurl = $patchdir.'md5sums'; - $patchlist = dfsockopen($checkurl); - - if(defined('DISCUZ_FIXBUG')) { - C::t('common_patch')->update_status_by_serial(1, DISCUZ_FIXBUG, '<='); - } - - if($patchlist) { - $serial_md5s = explode("\r\n", $patchlist); - $bound = intval(substr($serial_md5s[count($serial_md5s)-2], 0, 8)); - $maxpatch = intval(C::t('common_patch')->fetch_max_serial()); - if(defined('DISCUZ_FIXBUG')) { - $maxpatch = $maxpatch < DISCUZ_FIXBUG ? DISCUZ_FIXBUG : $maxpatch; - } - if($bound > $maxpatch) { - $insertarrlist = array(); - foreach($serial_md5s as $serial_md5) { - $downloadpatch = $patch = ''; - list($serial, $md5, $release) = explode(' ', $serial_md5); - if($serial > $maxpatch && (!$release || in_array(DISCUZ_RELEASE, explode(',', $release)))) { - $downloadpatch = $patchdir.$serial.'.xml'; - $patch = dfsockopen($downloadpatch); - if(md5($patch) != $md5) { - continue; - } - $patch = xml2array($patch); - if(is_array($patch) && !empty($patch)) { - $insertarr = array( - 'serial' => intval($patch['serial']), - 'rule' => serialize($patch['rule']), - 'note' => $patch['note'], - 'status' => 0, - 'dateline' => $patch['dateline'], - ); - C::t('common_patch')->insert($insertarr); - - $insertarrlist[$insertarr['serial']] = $insertarr; - } - } - } - if($insertarrlist && $_G['setting']['patch']['autoopened']) { - foreach($insertarrlist as $key => $patch) { - $this->fix_patch($patch); - } - } - if($insertarrlist) { - C::t('common_setting')->update('showpatchnotice', 1); - include_once libfile('function/cache'); - updatecache('setting'); - } - } - } - dsetcookie('checkpatch', 1, 60); - return true; - } - - public function fix_patch($patch, $type = 'file') { - - global $_G; - $serial = $patch['serial']; - if(!$serial) { - return -1; - } - - $returnflag = 1; - $trymax = 1000; - $rules = dunserialize($patch['rule']); - $tmpfiles = $bakfiles = array(); - - if($type == 'ftp') { - $siteftp = $_GET['siteftp']; - } - - foreach($rules as $rule) { - $filename = DISCUZ_ROOT.$rule['filename']; - $search = base64_decode($rule['search']); - $replace = base64_decode($rule['replace']); - $count = $rule['count']; - $nums = $rule['nums']; - - if(!$siteftp && !is_writable($filename)) { - $returnflag = -2; - break; - } - - $str = file_get_contents($filename); - $findcount = substr_count($str, $search); - if($findcount != $count) { - $returnflag = 2; - break; - } - - $bakfile = basename($rule['filename']); - $bakfile = '_'.$serial.'_'.substr($bakfile, 0, strrpos($bakfile, '.')).'_'.substr(md5($_G['config']['security']['authkey']), -6).'.bak.'.substr($bakfile, strrpos($bakfile, '.') +1); - $bakfile = $siteftp ? dirname($rule['filename']).'/'.$bakfile : dirname($filename).'/'.$bakfile; - $tmpfile = tempnam(DISCUZ_ROOT.'./data', 'patch'); - - $strarr = explode($search, $str); - $replacestr = ''; - foreach($strarr as $key => $value) { - if($key == $findcount) { - $replacestr .= $value; - } else { - if(in_array(($key + 1), $nums)) { - $replacestr .= $value.$replace; - } else { - $replacestr .= $value.$search; - } - } - } - - if(!file_put_contents($tmpfile, $replacestr)) { - $returnflag = -3; - break; - } - - if($siteftp) { - if(!file_exists(DISCUZ_ROOT.$bakfile) && !$this->copy_file($filename, $bakfile, 'ftp')) { - $returnflag = -4; - break; - } - $i = 0; - while(!$this->copy_file($tmpfile, $rule['filename'], 'ftp')) { - if($i >= $trymax) { - $returnflag = -4; - break; - } - $i++; - } - } else { - if(!file_exists($bakfile) && !$this->copy_file($filename, $bakfile, 'file')) { - $returnflag = -5; - break; - } - $i = 0; - while(!$this->copy_file($tmpfile, $filename, 'file')) { - if($i >= $trymax) { - $returnflag = -5; - break; - } - $i++; - } - } - - $tmpfiles[] = $tmpfile; - $bakfiles[] = $bakfile; - } - - if($returnflag < 0) { - if(!empty($bakfiles)) { - foreach($bakfiles as $backfile) { - if($siteftp) { - $i = 0; - while(!$this->copy_file($backfile, substr($backfile, -12), 'ftp')) { - if($i >= $trymax) { - $returnflag = -6; - break; - } - $i++; - } - } else { - $i = 0; - while(!$this->copy_file($backfile, substr($backfile, -12), 'file')) { - if($i >= $trymax) { - $returnflag = -6; - break; - } - $i++; - } - } - } - } - } - - if(!empty($tmpfiles)) { - foreach($tmpfiles as $tmpfile) { - @unlink($tmpfile); - } - } - - C::t('common_patch')->update($serial, array('status' => $returnflag)); - return $returnflag; - } - - - public function test_writable($sdir) { - - $dir = opendir($sdir); - while($entry = readdir($dir)) { - $file = $sdir.$entry; - if($entry != '.' && $entry != '..') { - if(is_dir($file) && !strrpos($file.'/', '.svn')) { - if(!self::test_writable($file.'/')) { - return false; - } - } - } - } - - if($fp = @fopen("$sdir/test.txt", 'w')) { - @fclose($fp); - @unlink("$sdir/test.txt"); - $writeable = true; - } else { - $writeable = false; - } - return $writeable; - } - - public function test_patch_writable($patch) { - $rules = dunserialize($patch['rule']); - if($rules) { - foreach($rules as $rule) { - if(!is_writable(DISCUZ_ROOT.$rule['filename'])) { - return false; - } - } - return true; - } - return false; - } - - public function copy_file($srcfile, $desfile, $type) { - global $_G; - - if(!is_file($srcfile)) { - return false; - } - if($type == 'file') { - $this->mkdirs(dirname($desfile)); - copy($srcfile, $desfile); - } elseif($type == 'ftp') { - $siteftp = $_GET['siteftp']; - $siteftp['on'] = 1; - $siteftp['password'] = authcode($siteftp['password'], 'ENCODE', md5($_G['config']['security']['authkey'])); - $ftp = & discuz_ftp::instance($siteftp); - $ftp->connect(); - $ftp->upload($srcfile, $desfile); - if($ftp->error()) { - return false; - } - } - return true; - } - - public function mkdirs($dir) { - if(!is_dir($dir)) { - if(!self::mkdirs(dirname($dir))) { - return false; - } - if(!mkdir($dir)) { - return false; - } - } - return true; - } - - public function test_patch($patch) { - $serial = $patch['serial']; - $rules = dunserialize($patch['rule']); - foreach($rules as $rule) { - $filename = DISCUZ_ROOT.$rule['filename']; - $search = base64_decode($rule['search']); - $replace = base64_decode($rule['replace']); - $count = $rule['count']; - $nums = $rule['nums']; - - $str = file_get_contents($filename); - $findcount = substr_count($str, $search); - if($findcount != $count) { - return true; - } - $replacefindcount = substr_count($str, $replace); - if($replacefindcount == $count) { - return true; - } - } - return false; - } - - public function recheck_patch() { - - $updatestatus = array(); - $patchlist = C::t('common_patch')->fetch_patch_by_status(array(1,2)); - foreach($patchlist as $patch) { - if(!$this->test_patch($patch)) { - $updatestatus[] = $patch['serial']; - } - } - if($updatestatus) { - C::t('common_patch')->update_status_by_serial(0, $updatestatus); - } - return true; - } -} -?> \ No newline at end of file diff --git a/upload/source/class/optimizer/optimizer_patch.php b/upload/source/class/optimizer/optimizer_patch.php deleted file mode 100644 index 476eebf..0000000 --- a/upload/source/class/optimizer/optimizer_patch.php +++ /dev/null @@ -1,48 +0,0 @@ -check_patch(); - - $discuz_patch = new discuz_patch(); - $patchnum = 0; - $patchnotice = $discuz_patch->fetch_patch_notice(); - if($patchnotice['data']) { - foreach($patchnotice['data'] as $patch) { - if($patch['status'] <= 0) { - $patchnum++; - } - } - } - if($patchnum) { - $return = array('status' => 1, 'type' =>'header', 'lang' => lang('optimizer', 'optimizer_patch_have', array('patchnum' => $patchnum))); - } else { - $return = array('status' => 0, 'type' =>'none', 'lang' => lang('optimizer', 'optimizer_patch_check_safe')); - } - return $return; - } - - public function optimizer() { - $adminfile = defined(ADMINSCRIPT) ? ADMINSCRIPT : 'admin.php'; - dheader('Location: '.$_G['siteurl'].$adminfile.'?action=patch'); - } -} - -?> \ No newline at end of file diff --git a/upload/source/class/optimizer/optimizer_upgrade.php b/upload/source/class/optimizer/optimizer_upgrade.php deleted file mode 100644 index e061235..0000000 --- a/upload/source/class/optimizer/optimizer_upgrade.php +++ /dev/null @@ -1,36 +0,0 @@ -check_upgrade()) { - $return = array('status' => 1, 'type' =>'header', 'lang' => lang('optimizer', 'optimizer_upgrade_need_optimizer')); - } else { - $return = array('status' => 0, 'type' =>'none', 'lang' => lang('optimizer', 'optimizer_upgrade_no_need')); - } - return $return; - } - - public function optimizer() { - $adminfile = defined(ADMINSCRIPT) ? ADMINSCRIPT : 'admin.php'; - dheader('Location: '.$_G['siteurl'].$adminfile.'?action=upgrade'); - } -} - -?> \ No newline at end of file diff --git a/upload/source/include/cron/cron_checkpatch_daily.php b/upload/source/include/cron/cron_checkpatch_daily.php deleted file mode 100644 index b8bbada..0000000 --- a/upload/source/include/cron/cron_checkpatch_daily.php +++ /dev/null @@ -1,17 +0,0 @@ -check_patch(); - -?> \ No newline at end of file diff --git a/upload/source/module/misc/misc_patch.php b/upload/source/module/misc/misc_patch.php index 67bdede..0fa5167 100644 --- a/upload/source/module/misc/misc_patch.php +++ b/upload/source/module/misc/misc_patch.php @@ -11,52 +11,7 @@ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } -if($_GET['action'] == 'checkpatch') { - - header('Content-Type: text/javascript'); - - if($_G['uid'] && $_G['member']['allowadmincp'] == 1) { - $discuz_patch = new discuz_patch(); - $discuz_patch->check_patch(); - } - exit; - -} elseif($_GET['action'] == 'patchnotice') { - - $patchlist = ''; - if($_G['member']['allowadmincp'] == 1) { - $discuz_patch = new discuz_patch(); - $patchnotice = $discuz_patch->fetch_patch_notice(); - if(!empty($patchnotice['data'])) { - $lang = lang('forum/misc'); - $patchlist .= '
'.$lang['patch_close'].'

'; - if($patchnotice['fixed']) { - $patchlist .= $lang['patch_site_have'].' '.count($patchnotice['data']).' '.$lang['patch_is_fixed']; - } else { - $patchlist .= $lang['patch_site_have'].' '.count($patchnotice['data']).' '.$lang['patch_need_fix']; - } - $patchlist .= '

'; - foreach($patchnotice['data'] as $notice) { - $patchlist .= ''; - } - $patchlist .= '
'.$lang['patch_name'].''.$lang['patch_dateline'].''.$lang['patch_status'].'
'.$notice['serial'].''.dgmdate($notice['dateline'], 'Y-m-d').''; - if($notice['status'] >= 1) { - $patchlist .= ''.$lang['patch_fixed_status'].''; - } elseif($notice['status'] < 0) { - $patchlist .= ''.$lang['patch_fix_failed_status'].''; - } else { - $patchlist .= ''.$lang['patch_unfix_status'].''; - } - $patchlist .= '

'.($patchnotice['fixed'] ? $lang['patch_view_fix_detail'] : $lang['patch_fix_right_now']).'

'; - $patchlist .= '
'; - } - } - include template('common/header_ajax'); - echo $patchlist; - include template('common/footer_ajax'); - exit; - -} elseif($_GET['action'] == 'pluginnotice') { +if($_GET['action'] == 'pluginnotice') { require_once libfile('function/admincp'); require_once libfile('function/plugin'); require_once libfile('function/cloudaddons'); diff --git a/upload/static/js/common.js b/upload/static/js/common.js index eafc5f9..96d89a3 100644 --- a/upload/static/js/common.js +++ b/upload/static/js/common.js @@ -1753,12 +1753,6 @@ function strLenCalc(obj, checklen, maxlen) { } } -function patchNotice() { - if($('patch_notice')) { - ajaxget('misc.php?mod=patch&action=patchnotice', 'patch_notice', ''); - } -} - function pluginNotice() { if($('plugin_notice')) { ajaxget('misc.php?mod=patch&action=pluginnotice', 'plugin_notice', ''); diff --git a/upload/template/default/common/footer.htm b/upload/template/default/common/footer.htm index 3a09d89..08586ce 100644 --- a/upload/template/default/common/footer.htm +++ b/upload/template/default/common/footer.htm @@ -44,9 +44,6 @@ var focusautoshow = window.setInterval('showfocus(\'next\', 1);', 5000); - -
- @@ -101,10 +98,7 @@ - - - - +