<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="<?php echo W_BASE_URL;?>css/admin.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='<?php echo W_BASE_URL;?>js/jquery.min.js'></script>
<script type='text/javascript' src='<?php echo W_BASE_URL;?>js/admin.js'></script>
<script>
function preview(o) {
	$('#preview_loading').show();
	$('#logo_form').submit();
}
function uploadFinished(state, url) {
	$('#preview_loading').hide();
	if (state != '200') {
		alert(state);
		return;
	}
	$('#logo_preview').attr('src', url + '?r=' + Math.random());
	$('#logo').val(url);
}
function rewriteTips(v){
	if (v == '1') {
		$('#rewrite_enable_on_tips').show();
		$('#rewrite_enable_off_tips').hide();
	} else {
		$('#rewrite_enable_on_tips').hide();
		$('#rewrite_enable_off_tips').show();
	}
}
$(function() {
	rewriteTips('<?php echo $config['rewrite_enable'];?>');

<?php if ($config['each_page_wb']) {
?>
	$('#each_page_wb').val('<?php echo $config['each_page_wb'];?>');
<?php
}?>
<?php if ($config['each_page_comment']) {
?>
	$('#each_page_comment').val('<?php echo $config['each_page_comment'];?>');
<?php
}?>
})
</script>
</head>
<body>
<div class="wrap">
	<div class="position">当前位置：<strong>功能设置</strong></div>
	<div class="setting_wrap">
	<?php ?>
	<form id="logo_form" target="logo_upload" method="post" action="<?php echo URL('admin/setting.upload')?>" enctype="multipart/form-data">
        <h4 id="t_logo">请选择希望在网站中使用的Xweibo LOGO图案</h4>
        <div class="setting_box">
            <label for="logo">选择图片：<input type="file" name="logo" onChange="preview(this)"/></label>
            <p class="tips">请选择PNG格式的本地图片文件，为显示美观，图片大小建议为186*50，使用透明底素材</p>
            <div class="logo_preview">
            	<p>效果预览：</p>
                <img width="188" height="55" id="logo_preview" src="<?php echo $config['logo'] ? $config['logo'] . '?r='.rand() : W_BASE_URL .'var/data/logo/default_logo.png';?>" />
                <div class="preview_loading" id="preview_loading">正在上传图片，请稍候...</div>
            </div>
            <iframe name="logo_upload" style="display:none;"></iframe>
            
        </div>
	</form>

	<form method="post">
		<input type="hidden" name="logo" id="logo" value="<?php echo $config['logo'];?>" />
		<h4 id="t_write">请选择是否为你网站中的Xweibo提供Rewrite功能：</h4>
    	<div class="setting_box">
            <p>Rewrite功能将URL 静态化可以提高搜索引擎抓取，开启本功能需要对 Web 服务器增加相应的 Rewrite 规则，且会轻微增加服务器负担。</p>
            <ul>
            <li><input type="radio" name="rewrite_enable" id="rewrite_enable_on" value="1" onclick="rewriteTips(1)" <?php if($config['rewrite_enable']=='1') {?>checked<?php }?> /><label for="rewrite_enable_on">开启</label></li>
            <li><input type="radio" name="rewrite_enable" id="rewrite_enable_off" value="0" onclick="rewriteTips(0)" <?php if($config['rewrite_enable']!='1') {?>checked<?php }?> /><label for="rewrite_enable_off">关闭</label></li>
            </ul>
            <p id="rewrite_enable_on_tips">请复制下的内容到你Apache的配置文件合适位置:</p>
            <p id="rewrite_enable_off_tips">如已经开启过Rewrite功能，需要关闭时，请将已添加的以下内容从Apache服务器代码中删除</p>
            <textarea>RewriteEngine on
            RewriteCond $1 ^(application/|templates/|cron/|config\.php$)
            RewriteRule ^/(.*)$ /deny.php [L]
            RewriteCond $1 !^(js/|img/|css/|flash/|var/|robots\.txt$|189\.php$|admin\.php$|index\.php$|crossdomain\.xml$|favicon\.ico$|admin/|test189|t\.php$)
            RewriteRule ^/(.*)$ /index.php/$1?%{QUERY_STRING} [L]</textarea>
        </div>
		<h4>是否开启帐号梆定</h4>
        <div class="setting_box">
        <p>是否与Sina微博帐号进行绑定</p>
        <ul>
            <li><input type="radio" name="bind_enable" id="bind_enable_on" value="1" <?php if($config['bind_enable']=='1') {?>checked="checked"<?php }?> /><label for="bind_enable_on">开启</label></li>
            <li><input type="radio" name="bind_enable" id="bind_enable_off" value="0" <?php if($config['bind_enable']!='1') {?>checked="checked"<?php }?> /><label for="bind_enable_off">关闭</label></li>
        </ul>
		</div>
		<h4>每页微博条数</h4>
        <div class="setting_box">
        <div>
            在“我的首页”、“我的微博”等页面中，每页显示
            <select name="each_page_wb" id="each_page_wb">
                <option value="10">10</option>
                <option value="20">20</option>
                <option value="30">30</option>
                <option value="40">40</option>
                <option value="50">50</option>
            </select>
            条微博</div>
        <div>
            在“单条微博全部评论”、“我的评论”页面中，每页显示
            <select name="each_page_comment" id="each_page_comment">
                    <option value="10">10</option>
                    <option value="20">20</option>
                    <option value="30">30</option>
                    <option value="40">40</option>
                    <option value="50">50</option>
                </select>
            条评论
        </div>
		</div>
		<!--
		<h4 id="t_header">页头内容</h4>
        <div class="setting_box">
        <p>请选择是否在每个xweibo页面最顶部显示自定义的网站导航内容</p>
        <ul>
            <li><input type="radio" name="display_head" id="display_head_off" value="0" <?php if($config['display_head']!=='1') {?>checked<?php }?> /><label for="display_head_off">不显示</label></li>
            <li><input type="radio" name="display_head" id="display_head_on" value="1" <?php if($config['display_head']=='1') {?>checked<?php }?> /><label for="display_head_on">显示</label></li>
        </ul>
        <p>请按照以下格式，设置显示在每个xweibo页面最顶部的网站导航内容</p>
        <textarea name="header"><?php echo $config['header_html'];?></textarea>
    	</div>
		-->
        <h4 id="t_footer">页尾内容</h4>
        <div class="setting_box">
        <p>请按照以下格式，设置显示在每个xweibo页面最顶部的网站导航内容</p>
        <textarea name="footer"><?php echo $config['footer_html'];?></textarea>
        
        </div>
        <span class="button"><input type="submit" name="" value="保存修改" /></span>
</form>
</div>
</div>
</body>
</html>
