<?php include $this->admin_tpl('meta');?>
<title>系统设置 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 系统设置 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form class="form form-horizontal" method="post" action="<?php echo U('save');?>" onsubmit="return check_all()">
		<div id="tab_system" class="HuiTab">
			<div class="tabBar cl"><span>基本设置</span><span>附加设置</span><span>安全设置</span><span>邮件设置</span></div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>站点名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" placeholder="站点名称一般不超过80个字符" name="site_name" value="<?php echo $data["site_name"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>站点根网址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" placeholder="格式如：http://www.yzmcms.com/" name="site_url" value="<?php echo $data["site_url"];?>" class="input-text" style="width:50%"> <a href="<?php echo SITE_URL;?>index.php?m=mobile" target="_blank" style="font-size:12px;text-decoration:none;line-height:22px"  title="浏览手机站点"><i class="Hui-iconfont">&#xe696;</i>WAP</a>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><!-- <span class="c-red">*</span> -->站点Logo：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input class="input-text uploadfile" type="text" name="site_logo"  value="<?php echo $data["site_logo"];?>"  onmouseover="yzm_img_preview('site_logo', this.value)" onmouseout="layer.closeAll();" id="site_logo" style="width:370px" >
						<a href="javascript:;" onclick="yzm_upload_att('<?php echo U('attachment/api/upload_box', array('module'=>ROUTE_M, 'pid'=>'site_logo'));?>')" class="btn btn-primary radius upload-btn"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
					</div>
				</div>	
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">站点关键词：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" placeholder="多个关键词用英文,隔开" name="site_keyword" value="<?php echo $data["site_keyword"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">网站版权信息：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" placeholder="&copy; 2014-2021 www.yzmcms.com" name="site_copyright" value="<?php echo $data["site_copyright"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">网站备案号：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" placeholder="如京ICP备00000000号" name="site_filing" value="<?php echo $data["site_filing"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">站点描述：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<textarea class="textarea" name="site_description" style="width:80%" placeholder="站点描述一般不超过200个字符"><?php echo $data["site_description"];?></textarea>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">统计代码：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<textarea class="textarea" name="site_code" style="width:80%" placeholder="请填写统计代码"><?php echo $data["site_code"];?></textarea>
					</div>
				</div>
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>模板风格：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box" style="width:150px;margin-right:20px">
						<select name="site_theme" class="select">
						<option value="">PC端模板风格</option>
						  <?php 
						      foreach($pc_theme_list as $val){
									$str = $data["site_theme"]==$val ? ' selected="selected" ' : '';
									echo '<option value="'.$val.'" '.$str.'>'.$val.'</option>';
							  }
						  ?>
						</select>
						</span>
						<span class="select-box" style="width:150px;">
						<select name="site_wap_theme" class="select">
						<option value="">WAP端模板风格</option>
						  <?php 
						      foreach($wap_theme_list as $val){
									$str = $data["site_wap_theme"]==$val ? ' selected="selected" ' : '';
									echo '<option value="'.$val.'" '.$str.'>'.$val.'</option>';
							  }
						  ?>
						</select>
						</span>						
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>前台URL模式：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<label class="label_radio"><input name="url_mode" type="radio" <?php echo $data["url_mode"]? '' : 'checked' ?> value="0"> 相对地址</label>
						<label class="label_radio"><input name="url_mode" type="radio" <?php echo $data["url_mode"]? 'checked' : '' ?> value="1"> 绝对地址</label>
						<span class="yzm-explain">URL模式修改后，请批量更新URL</span>
					</div>
				</div>	
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>缩略图默认设置：</label>
					<div class="formControls col-xs-8 col-sm-9">
						宽度：<input type="text" name="thumb_width" value="<?php echo $data["thumb_width"];?>"  class="input-text w_120"> PX &nbsp;&nbsp;&nbsp;
						高度：<input type="text" name="thumb_height" value="<?php echo $data["thumb_height"];?>"  class="input-text w_120"> PX
					</div>
				</div>	
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">百度推送token：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="baidu_push_token" placeholder="例如：66XJXYDfMKfeeIRM" value="<?php echo $data["baidu_push_token"];?>"  class="input-text w_420">
						<span class="yzm-explain">百度主动推送token，请到百度申请</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">启用内容关键字替换：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<label class="label_radio"><input name="keyword_link" type="radio" <?php echo $data["keyword_link"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="keyword_link" type="radio" <?php echo $data["keyword_link"]? '' : 'checked' ?> value="0"> 关闭</label>
						<input type="text" name="keyword_replacenum" value="<?php echo $data["keyword_replacenum"];?>"  class="input-text w_120"> 
						替换次数
						<span class="yzm-explain">0为不限,效率高</span>
					</div>
				</div>					
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>前端搜索每页展示条数：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="search_page" value="<?php echo $data["search_page"];?>"  class="input-text w_120">
					</div>
				</div>							
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>允许上传附件大小（KB）</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="upload_maxsize" value="<?php echo $data["upload_maxsize"];?>"  class="input-text w_120">
						<span class="yzm-explain">最大限制不能超过服务器“upload_max_filesize”配置</span>
					</div>
				</div>		
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>允许上传附件类型</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="upload_types" value="<?php echo $data["upload_types"];?>"  class="input-text w_420">
						<span class="yzm-explain">多个类型直接用“|”分开</span>
						<a href="http://www.yzmcms.com/dongtai/123.html" target="_blank" style="color:#3b639f;font-size:12px">不在系统白名单时，设置无效？</a>
					</div>
				</div>		
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否开启图片水印：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="watermark_enable" type="radio" <?php echo $data["watermark_enable"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="watermark_enable" type="radio" <?php echo $data["watermark_enable"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>	
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>水印图片名称：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="watermark_name" value="<?php echo $data["watermark_name"];?>"  class="input-text w_420">
						<span class="yzm-explain">水印存放路径：/common/data/water</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">水印的位置：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input type="radio" value="0" <?php echo $data["watermark_position"]==0 ? 'checked' : '' ?> name="watermark_position">随机</label>
						<label class="label_radio"><input type="radio" value="1" <?php echo $data["watermark_position"]==1 ? 'checked' : '' ?> name="watermark_position">顶部居左</label>
						<label class="label_radio"><input type="radio" value="2" <?php echo $data["watermark_position"]==2 ? 'checked' : '' ?> name="watermark_position">顶部居中</label>
						<label class="label_radio"><input type="radio" value="3" <?php echo $data["watermark_position"]==3 ? 'checked' : '' ?> name="watermark_position">顶部居右</label>
						<label class="label_radio"><input type="radio" value="4" <?php echo $data["watermark_position"]==4 ? 'checked' : '' ?> name="watermark_position">中部居左</label>
						<label class="label_radio"><input type="radio" value="5" <?php echo $data["watermark_position"]==5 ? 'checked' : '' ?> name="watermark_position">中部居中</label>
						<label class="label_radio"><input type="radio" value="6" <?php echo $data["watermark_position"]==6 ? 'checked' : '' ?> name="watermark_position">中部居右</label>
						<label class="label_radio"><input type="radio" value="7" <?php echo $data["watermark_position"]==7 ? 'checked' : '' ?> name="watermark_position">底部居左</label>
						<label class="label_radio"><input type="radio" value="8" <?php echo $data["watermark_position"]==8 ? 'checked' : '' ?> name="watermark_position">底部居中</label>
						<label class="label_radio"><input type="radio" value="9" <?php echo $data["watermark_position"]==9 ? 'checked' : '' ?> name="watermark_position">底部居右</label>
					</div>
				</div>				
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">禁止登录后台的IP列表：<br><span style="color:#888">匹配IP段用“*”占位<br>多个IP用“,”分隔</span></label>
					<div class="formControls col-xs-8 col-sm-9">
						<textarea class="textarea" name="admin_prohibit_ip" placeholder="匹配IP段用“*”占位，如192.168.*.*，多个IP地址请用英文逗号“,”分隔"><?php echo $data["admin_prohibit_ip"];?></textarea>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">启用后台管理操作日志：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="admin_log" type="radio" <?php echo $data["admin_log"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="admin_log" type="radio" <?php echo $data["admin_log"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">是否开启前端留言功能：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="is_words" type="radio" <?php echo $data["is_words"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="is_words" type="radio" <?php echo $data["is_words"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">留言须包含为中文内容：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="is_words_chinese" type="radio" <?php echo $data["is_words_chinese"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="is_words_chinese" type="radio" <?php echo $data["is_words_chinese"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">允许用户申请友情链接：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="is_link" type="radio" <?php echo $data["is_link"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="is_link" type="radio" <?php echo $data["is_link"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">是否开启评论审核：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="comment_check" type="radio" <?php echo $data["comment_check"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="comment_check" type="radio" <?php echo $data["comment_check"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">是否允许游客评论：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="comment_tourist" type="radio" <?php echo $data["comment_tourist"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="comment_tourist" type="radio" <?php echo $data["comment_tourist"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">SMTP服务器：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="mail_server" value="<?php echo $data["mail_server"];?>"  class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">SMTP 端口：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="mail_port" value="<?php echo $data["mail_port"];?>" style="width:100px">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">发件人地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="mail_from" value="<?php echo $data["mail_from"];?>" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">AUTH LOGIN验证：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="mail_auth" type="radio" <?php echo $data["mail_auth"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="mail_auth" type="radio" <?php echo $data["mail_auth"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">验证用户名：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="mail_user" value="<?php echo $data["mail_user"];?>"  class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">验证密码：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="password" name="mail_pass" value="<?php echo $data["mail_pass"];?>" readonly onfocus="this.removeAttribute('readonly');" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">邮件测试：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="email" name="mail_to" value=""  class="input-text" style="width:50%">
						<input type="button" class="btn btn-primary radius" value="测试发送" onclick="test_mail()">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">站点默认邮箱：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="email" name="mail_inbox" value="<?php echo $data["mail_inbox"];?>"  class="input-text" style="width:50%">
						<span class="yzm-explain">用于接收“用户留言”等消息通知</span>
					</div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<input type="submit" class="btn btn-primary radius" name="dosubmit" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
				<input type="reset" class="btn btn-default radius" value="&nbsp;&nbsp;重置&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>

<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">
function check_all(){
	var reg = /^http(.+)\/$/;
	if($("input[name='site_name']").val()==''){
		layer.msg('站点名称不能为空！', {icon:2});
		return false;
	}
	if(!reg.test($("input[name='site_url']").val())){
		layer.alert('站点根网址格式为：http://www.yzmcms.com/，请以“/”结尾！', {icon:2});
		return false;
	}
	if($("select[name='site_theme']").val()=='' || $("select[name='site_wap_theme']").val()==''){
		layer.msg('请选择模板风格！', {icon:2});
		return false;
	}
	if(isNaN($("input[name='thumb_width']").val()) || isNaN($("input[name='thumb_height']").val())){
		layer.msg('缩略图默认设置只能为数字！', {icon:2});
		return false;
	}
	if(isNaN($("input[name='keyword_replacenum']").val()) || $("input[name='keyword_replacenum']").val()<0){
		layer.msg('关键字替换次数只能为数字且不能小于0！', {icon:2});
		return false;
	}	
	if(isNaN($("input[name='search_page']").val()) || $("input[name='search_page']").val()<1){
		layer.msg('前端搜索每页展示条数只能为数字且不能小于1！', {icon:2});
		return false;
	}
	if($("input[name='upload_maxsize']").val()=='' || isNaN($("input[name='upload_maxsize']").val())){
		layer.msg('允许上传附件大小只能为数字！', {icon:2});
		return false;
	}
	if($("input[name='upload_types']").val()==''){
		layer.msg('允许上传附件类型不能为空！', {icon:2});
		return false;
	}
	if($("input[name='watermark_name']").val()==''){
		layer.msg('水印图片名称不能为空！', {icon:2});
		return false;
	}
	return true;			
}

function test_mail() {
	var mail_server = $("input[name='mail_server']").val();
	var mail_port = $("input[name='mail_port']").val();
	var mail_from = $("input[name='mail_from']").val();
	var mail_auth = $("input[name='mail_auth']").val();
	var mail_user = $("input[name='mail_user']").val();
	var mail_pass = $("input[name='mail_pass']").val();
	var mail_to = $("input[name='mail_to']").val();
	if(mail_to == ''){
		layer.msg('请输入邮件测试地址！', {icon:2});
		return false;
	}
	layer.msg('正在测试发送……', { icon: 16, shade: 0.21, shadeClose:true, time:0 });
	$.ajax({
		type: 'POST',
		url: '<?php echo U('public_test_mail');?>', 
		data: 'mail_server='+mail_server+'&mail_port='+mail_port+'&mail_from='+mail_from+'&mail_auth='+mail_auth+'&mail_user='+mail_user+'&mail_pass='+mail_pass+'&mail_to='+mail_to,
		dataType: "json", 
        success: function (msg) {
			if(msg.status == 1){
				layer.msg(msg.message, {icon:1});       
		    }else{
				layer.msg(msg.message, {icon:2});
			}
        }
	})
}

$(function(){
	$.Huitab("#tab_system .tabBar span","#tab_system .tabCon","current","click","<?php echo isset($_GET['tab']) ? intval($_GET['tab']) : '0'?>");
});
</script>

</body>
</html>