1);
showmenu('nav_founder_optimizer', array(
array('founder_optimizer_security', 'optimizer&anchor=security', $current['security']),
array('founder_optimizer_performance', 'optimizer&anchor=performance', $current['performance']),
));
if($operation == 'optimize_unit') {
$optimizer->optimizer();
} elseif($operation == 'check_unit') {
$checkstatus = $optimizer->check();
C::t('common_optimizer')->update($type.'_checkrecord', ($checkstatus['status'] == 1 ? $checkstatus['status'] : 0));
C::t('common_optimizer')->update($check_record_time_key, $_G['timestamp']);
include template('common/header_ajax');
echo '';
include template('common/footer_ajax');
exit;
} elseif($operation == 'setting_optimizer') {
if(submitcheck('setting_optimizer', 1)) {
$setting_options = $_GET['options'];
if($optimizer->option_optimizer($setting_options)) {
cpmsg('founder_optimizer_setting_succeed', 'action=optimizer&operation=setting_optimizer&type=optimizer_setting', 'succeed');
} else {
cpmsg('founder_optimizer_setting_error', '', 'error');
}
} else {
showformheader('optimizer&operation=setting_optimizer&type=optimizer_setting');
showtableheader();
$option = $optimizer->get_option();
echo '
';
foreach($option as $setting) {
$color = ' style="'.($setting[4] ? 'color:red;' : 'color:green').'"';
echo '';
echo ' | ';
echo ''.$setting[1].' | ';
echo ''.$setting[2].' | ';
echo ''.$setting[3].' | ';
echo '
';
}
showsubmit('setting_optimizer');
showtablefooter();
showformfooter();
}
} else {
$checkrecordtime = C::t('common_optimizer')->fetch($check_record_time_key);
if(!$_GET['checking'] && $_GET['anchor'] == 'security') {
showtips('optimizer_security_tips');
}
showtableheader();
echo '';
echo $_GET['checking'] ? '
'.$lang['founder_optimizer_checking'].'' :
'
'.$lang['founder_optimizer_start_check'].'';
if($_GET['checking']) {
echo '
';
echo '
';
echo '
0%
';
echo '
';
}
echo '
';
if(!$checkrecordtime) {
echo $lang['founder_optimizer_first_use'];
} else {
$num = 0;
$checkrecordkey = array();
foreach($optimizer_option as $option) {
$checkrecordkey[] = $option.'_checkrecord';
}
foreach(C::t('common_optimizer')->fetch_all($checkrecordkey) as $checkrecordvalue) {
if($checkrecordvalue['v'] == 1) {
$num++;
}
}
if(!$_GET['checking']) {
echo $lang['founder_optimizer_lastcheck'].dgmdate($checkrecordtime).$lang['founder_optimizer_findnum'].$num.$lang['founder_optimizer_neednum'];
}
}
echo '
';
echo '
';
if($_GET['checking']) {
$inc_unit = ceil(100/count($optimizer_option));
$adminscipt = ADMINSCRIPT;
$C = '$C';
print <<
var checkpercent = 0;
var checknum = 0;
var optimize_num = 0;
var security_num = 0;
var tip_num = 0;
var securitygrade = '';
function updatecheckpercent() {
checkpercent += {$inc_unit};
checknum++;
$('percent').innerHTML = parseInt(checkpercent) + '%';
$('percentprocess').style.width = parseInt(checkpercent) * 2 + 'px';
}
function updatecheckstatus(id, msg, status, type, extraurl) {
var optimize_table = $('optimizerable');
var optimize_tablerows = optimize_table.rows.length;
var security_table = $('securityoption');
var security_tablerows = security_table.rows.length;
var tip_table = $('tipoption');
var tip_tablerows = tip_table.rows.length;
if(id == 'optimizer_upgrade' || id == 'optimizer_patch') {
securitygrade = '{$lang[founder_optimizer_low]}';
}
var optiontype = id;
id = 'progress_' + id;
$(id + '_tr').style.display = 'none';
var color = 'green';
if(status == 1) {
color = 'red';
optimize_num++;
$('optimizerablenum').innerHTML = optimize_num;
optimize_table.style.display = 'block';
var newtr = optimize_table.insertRow(optimize_tablerows);
newtr.className = 'ooclass';
} else if(status == 2) {
color = 'blue';
tip_num++;
$('tipoptionnum').innerHTML = tip_num;
tip_table.style.display = 'block';
var newtr = tip_table.insertRow(tip_tablerows);
newtr.className = 'toclass';
newtr.style.display = 'none';
} else {
color = 'green';
security_num++;
$('securityoptionnum').innerHTML = security_num;
security_table.style.display = 'block';
var newtr = security_table.insertRow(security_tablerows);
newtr.className = 'soclass';
newtr.style.display = 'none';
}
var statusstr = '';
if(status != 0) {
if(type == 'header') {
statusstr = '{$lang[founder_optimizer_optimizer]}';
} else if(type == 'view') {
statusstr = '{$lang[founder_optimizer_view]}';
} else if(type == 'scan') {
statusstr = '{$lang[founder_optimizer_scan]}';
}
}
newtr.insertCell(0).innerHTML = $(id + '_unit').innerHTML;
newtr.insertCell(1).innerHTML = msg;
newtr.insertCell(2).innerHTML = statusstr;
if(parseInt(checkpercent) >= 100) {
$('checking').innerHTML = '{$lang[founder_optimizer_recheck_js]}';
$('checking').href = '{$adminscipt}?action=optimizer&checking=1&anchor={$_GET[anchor]}';
$('processid').style.display = 'none';
if('$_GET[anchor]' == 'security') {
if(securitygrade == '') {
if(optimize_num <= 1) {
securitygrade = '{$lang[founder_optimizer_high]}';
} else if(optimize_num >=2 && optimize_num <=4) {
securitygrade = '{$lang[founder_optimizer_middle]}';
} else {
securitygrade = '{$lang[founder_optimizer_low]}';
}
}
$('checkstatus').innerHTML = '{$lang[founder_optimizer_check_complete_js]}' + checknum + '{$lang[founder_optimizer_findnum]}' + optimize_num + '{$lang[founder_optimizer_neednum]}' + ' {$lang[founder_optimizer_level]}: ' + securitygrade + '';
} else {
$('checkstatus').innerHTML = '{$lang[founder_optimizer_check_complete_js]}' + checknum + '{$lang[founder_optimizer_findnum]}' + optimize_num + '{$lang[founder_optimizer_neednum]}';
}
}
}
function showoptions(obj, option) {
var o = $C(option);
var isopen = 0;
if(obj.innerHTML == '[-]') {
isoepn = 0;
obj.innerHTML = '[+]';
} else {
isopen = 1;
obj.innerHTML = '[-]';
}
for(var i=0; i
END;
echo '';
foreach($optimizer_option as $option) {
echo '';
echo ''.$lang['optimizer_check_unit_'.$option].' | ';
echo ''.$lang['founder_optimizer_checking'].'... | ';
echo ' | ';
echo '
';
}
echo '
';
echo '';
echo '[-] '.$lang['founder_optimizer_needopti'].'() | | |
';
echo '
';
echo '';
echo '[+] '.$lang['founder_optimizer_safe'].'() | | |
';
echo '
';
echo '';
echo '[+] '.$lang['founder_optimizer_notice'].'() | | |
';
echo '
';
}
showtablefooter();
}
?>