<?php require 'authentication_member.php';
?>
<style type="text/css">
<!--
#ad_table { background-color:#D8D8D8; }
#ad_table th { background-color:#EEEEEE; text-align:center; }
#ad_table th, #ad_table td { padding:5px 10px; font-size:12px; line-height:normal; word-wrap:break-word; word-break:break-all; }
#ad_table td { background-color:#FFFFFF; text-align:center; font-size:14px; }
.s_noset_bg { background:#CCC; }
-->
</style>
<?php

/*
$sbar = @glob('readonly/js/search_bar_*.js');
$sbar_n = @count($sbar);
*/

$sbar_n = 3;

$s_b = (!empty($_COOKIE['searchBarBody']) && $_COOKIE['searchBarBody'] != 0 && abs($_COOKIE['searchBarBody']) <= $sbar_n) ? abs($_COOKIE['searchBarBody']) : $web['search_bar'];
?>
<h5 class="list_title" id="list_title"><a class="list_title_in">我的引擎模式</a></h5>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">
  <tr>
    <td width="200" align="right">系统默认设置：</td>
    <td align="left"><b>样式<?php echo $web['search_bar']; ?></b></td>
  </tr>
  <tr>
    <td width="200" align="right">我的设置：</td>
    <td align="left">
<?php
if ($sbar_n > 0) {
  for ($i = 1; $i<=$sbar_n; $i++) {
    echo '
    样式'.$i.'[<a href="search_bar.php?type='.$i.'" target="_blank">预览</a>] <button type="button" onclick="setS('.$i.');" id="yes'.$i.'"'.($s_b == $i ? ' class="s_noset_bg">√已选' : '>选择').'</button>  
';
  }
} else {
  echo '没有发现搜索引擎样式模板！';
}
?></td>
  </tr>
</table>
<script language="javascript" type="text/javascript">
<!--
var dfSet=<?php echo $s_b; ?>;
function setS(v) {
  if ($('yes'+v+'').innerHTML == '√已选择该样式') {
    alert('已是当前设置！');
    return;
  }
  setCookie('searchBarBody', v, 365);
  $('yes'+dfSet+'').innerHTML = '选择';
  $('yes'+dfSet+'').className = '';
  $('yes'+v+'').innerHTML = '√已选择该样式';
  $('yes'+v+'').className = '';
  dfSet = v;
  alert('设置好了！再次使用将显示此样式');
}
-->
</script>


<?php

$s_file1 = 'readonly/js/search.js';
$s_file2 = 'writable/js/search.js';
$s_file1_ = file_get_contents($s_file1);
$s_file2_ = file_get_contents($s_file2);

if (preg_match('/var\s+strMax\s+=\s+(\d+).*var\s+strNum\s+=\s+(\d+)/is', $s_file1_, $mm)) {
  $strMaxNum = '（限'.$mm[2].'个字串/'.$mm[1].'个字符）';
} else {
  $strMaxNum = '';
}
unset($s_file1_);

preg_match('/getCookie\([\'\"]searchRemenber[\'\"]\)\s*\=\=\s*[\'\"](c|o)[\'\"]/i', $s_file2_, $mmm);
if ($mmm[1]) {
  if ($mmm[1] == 'o') {
    $strMaxNumSet = '<b>关闭</b>';
  } else {
    $strMaxNumSet = '<b>开启'.$strMaxNum.'</b>';
  } 
  unset($mmm);
} else {
  $strMaxNumSet = '<b>开启'.$strMaxNum.'</b>';
}
$setV = 1;
if ($strMaxNumSet == '<b>关闭</b>') {
  if ($_COOKIE['searchRemenber'] == 'o') {
    $setV = 1;
  } else {
    $setV = 0;
  }
} else {
  if ($_COOKIE['searchRemenber'] == 'c') {
    $setV = 0;
  } else {
    $setV = 1;
  }
}
?>
<script language="javascript" type="text/javascript">
<!--
function setMN() {
<?php
if ($strMaxNumSet == '<b>关闭</b>') {
  echo '
  var setV = \'关闭\';';
} else {
  echo '
  var setV = \'开启\';';
}
?>

  if (setV == '关闭') {
    if ($('zn_6').checked == true) {
      setCookie('searchRemenber', '', -366);
    } else {
      setCookie('searchRemenber', 'o', 365);
    }
  } else {
    if ($('zn_5').checked == true) {
      setCookie('searchRemenber', '', -366);
    } else {
      setCookie('searchRemenber', 'c', 365);
    }
  }
  alert('设置完毕！');
}
-->
</script>
<h5 class="list_title" id="list_title"><a class="list_title_in">搜索框关键词记忆</a></h5>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">
  <tr>
    <td width="200" align="right">系统默认设置：</td>
    <td align="left"><?php echo $strMaxNumSet; ?></td>
  </tr>
  <tr>
    <td width="200" align="right">我的设置：</td>
    <td align="left"><label for="zn_5"><input type="radio" class="radio" name="zmn" id="zn_5" <?php echo $setV == 1 ? ' checked="checked"' : ''; ?> /> 开启（搜索后关键词自动记忆在搜索框下面或旁边）</label>
<label for="zn_6"><input type="radio" class="radio" name="zmn" id="zn_6" <?php echo $setV != 1 ? ' checked="checked"' : ''; ?> /> 关闭</label> &nbsp;&nbsp; <button type="button" onclick="setMN()">确定</button></td>
  </tr>
</table>
<script language="javascript" type="text/javascript">
<!--
<?php
if (preg_match('/var\s+search\_lenovo\s*=\s*\'(.+)\'\;/iU', $s_file2_, $mmmm)) {
  echo 'var search_lenovo = \''.$mmmm[1].'\';';
} else {
  echo 'var search_lenovo = \'x\';';
}
unset($s_file2_);
?>

function setZ() {
  if ($('zn_1').checked == true) {
    if ($('zn2').checked == true) {
      if (search_lenovo == 'yy') {
	    setCookie('searchLenovo', '', -365);
	    return;
	  } else {
        setCookie('searchLenovo', 'yy', 365);
	  }
    } else {
      if (search_lenovo == 'yx') {
	    setCookie('searchLenovo', '', -365);
	    return;
	  } else {
        setCookie('searchLenovo', 'yx', 365);
	  }
    }
  } else {
    if (search_lenovo != 'x') {
	  setCookie('searchLenovo', 'x', 365);
	} else {
      setCookie('searchLenovo', '', -365);
	  return;
    }
  }
  alert('设置完毕！刷新首页就好了');
}
-->
</script>
<h5 class="list_title" id="list_title"><a class="list_title_in">搜索框关键词联想</a></h5>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">
  <tr>
    <td width="200" align="right">系统默认设置：</td>
    <td align="left"><b id="search_lenovo_title">开启</b></td>
  </tr>
  <tr>
    <td width="200" align="right">我的设置：</td>
    <td align="left"><label for="zn_1"><input type="radio" class="radio" name="zn" id="zn_1" value="1" onclick="$('zn2').disabled=false;" checked="checked" /> 开启</label>（<input type="checkbox" class="checkbox" id="zn2" onclick="$('zn_1').checked=true;" checked="checked" />点选关键词自动搜索）
<label for="zn_2"><input type="radio" class="radio" name="zn" id="zn_2" value="0" onclick="$('zn2').disabled='disabled';" /> 关闭</label> &nbsp;&nbsp; <button type="button" onclick="setZ()">确定</button></td>
  </tr>
</table>

<script language="javascript" type="text/javascript">
<!--
if (search_lenovo != 'x') {
  if (search_lenovo == 'yx') {
    $('search_lenovo_title').innerHTML = '开启（点选关键词进入搜索框但不自动搜索）';
    $('zn2').checked = false;
  } else {
    $('search_lenovo_title').innerHTML = '开启（点选关键词自动搜索）';
    $('zn2').checked = 'checked';
  }
  $('zn_1').checked = 'checked';
  $('zn2').disabled = false;
} else {
  $('search_lenovo_title').innerHTML = '关闭';
  $('zn_1').checked = false;
  $('zn_2').checked = 'checked';
  $('zn2').disabled = 'disabled';
}

var SEARCH_LENOVO_MODE_COOKIE = getCookie('searchLenovo');
var s_l_is = 0;
if (SEARCH_LENOVO_MODE_COOKIE) {
  if (SEARCH_LENOVO_MODE_COOKIE == 'x') {
    s_l_is = 0;
    search_lenovo = 0;
  } else {
    s_l_is = 1;
    search_lenovo = SEARCH_LENOVO_MODE_COOKIE;
  }
} else {
  if (search_lenovo != 'x') {
    s_l_is = 1;
  }
}
if (s_l_is == 1) {
  $('zn_1').checked = 'checked';
  $('zn2').disabled = false;
  if (search_lenovo == 'yx') {
    $('zn2').checked = false;
  } else {
    $('zn2').checked = 'checked';
  }
} else {
  $('zn_1').checked = false;
  $('zn_2').checked = 'checked';
  $('zn2').disabled = 'disabled';
}
-->
</script>













