<?php
require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';
$zbp->Load();
$action = 'root';
if (!$zbp->CheckRights($action)) {
	$zbp->ShowError(6);
	die();
}
if (!$zbp->CheckPlugin('ly_ueditor_plus')) {
	$zbp->ShowError(48);
	die();
}

if (count($_POST) > 0) {
	CheckIsRefererValid();
	if (GetVars('act') == 'save') {
		foreach ($_POST as $k => $v) {
			if ($k == 'toolbars') {
				$zbp->Config('ly_ueditor_plus')->toolbars = json_encode($_POST['toolbars']);
			} elseif ($k != 'csrfToken') {
				$zbp->Config('ly_ueditor_plus')->$k = $v;
			}
		}
		$zbp->SaveConfig('ly_ueditor_plus');
		$zbp->SetHint('good');
		Redirect('./main.php');
	}
}

$app = new App();
$app->LoadInfoByXml('plugin', 'ly_ueditor_plus');
$blogtitle = $app->name . ' - 设置';
require $blogpath . 'zb_system/admin/admin_header.php';
require $blogpath . 'zb_system/admin/admin_top.php';
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/ly_ueditor_plus/ueditor.config.php"></script>';
?>

<link href="<?php echo $zbp->host; ?>zb_users/plugin/ly_ueditor_plus/ueditor-plus/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">
<div id="divMain">
	<div class="divHeader"><?php echo $blogtitle; ?></div>
	<div class="SubMenu">
	</div>
	<div id="divMain2">
		<!--代码-->
		<style>
			#divMain a {
				color: #4662D9;
				text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
			}

			form .int {
				width: 66px;
			}

			form .w50 {
				min-width: 50%;
			}

			form .w100 {
				width: 100%;
			}

			table {
				width: 100%;
			}

			table th,
			table td {
				word-break: break-all;
			}

			table.ul2 th:nth-child(1) {
				text-align: center;
				min-width: 150px !important;
			}

			table.ul2 th:nth-child(2) {
				width: 100%;
			}
		</style>
		<form action="?act=save" method="post">
			<table class="ul2">
				<tbody>
					<tr>
						<th><a href="<?php echo $app->url; ?>" target="_blank"><?php echo $app->author_name; ?></a></th>
						<th><?php echo $app->note; ?></th>
					</tr>
					<tr>
						<td title="配置工具栏">配置工具栏:</td>
						<td>

							<div class="edui-editor-toolbarboxinner edui-default">
								<div id="edui22" class="edui-toolbar   edui-default">

									<script>
										$(function() {
											var d = <?php echo ly_ueditor_plus('toolbars', '[]'); ?>;
											var s = '';
											var t = window.ly_toolbars;
											var lang = window.UEDITOR_CONFIG.lang;
											UE.I18N = [];
											$('head').append('<script type="text/javascript" src="' + window.UEDITOR_CONFIG.langPath + lang + '/' + lang + '.js"/>');
											$(function() {
												lang = UE.I18N[lang].labelMap;
												for (var i = 0; i < t.length; i++) {
													if (t[i].length > 1) {
														s += '<div class="edui-box edui-button edui-for-' + t[i] + ' edui-default" title="' + lang[t[i]] + '">';
														s += '<label><input name="toolbars[]" type="checkbox" value="' + t[i] + '" ';
														if (d.length == 0 || d.length > 0 && d.includes('' + t[i])) {
															s += 'checked="checked" ';
														}
														s += '/><div class="edui-box edui-icon edui-default"></div>' + lang[t[i]] + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>';
														s += '</div>';
													}
												}
												$('#toolbars').html(s);
											});
										});
									</script>
									<div id="toolbars"></div>

								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td title="在线管理数量">在线管理数量:</td>
						<td><input name="num" class="form-control int" value="<?php echo ly_ueditor_plus('num', 30); ?>">-》数值,在线管理的显示数量,默认30个图片附件</td>
					</tr>
					<tr>
						<td title="右键菜单功能">右键菜单功能:</td>
						<td>
							<input name="Menu" style="" type="text" value="<?php echo ly_ueditor_plus('Menu'); ?>" class="checkbox" />-》PC打开右键菜单功能,处理表格相关的右键功能
						</td>
					</tr>
					<tr>
						<td title="一个兼容设置">一个兼容设置:</td>
						<td>
							<input name="ised" style="" type="text" value="<?php echo ly_ueditor_plus('ised'); ?>" class="checkbox" />-》特殊情况编辑器不能正常显示就需要开启
						</td>
					</tr>
					<tr>
						<td title="抓取远程图片">抓取远程图片:</td>
						<td>
							<input name="catchRemoteImageEnable" style="" type="text" value="<?php echo ly_ueditor_plus('catchRemoteImageEnable'); ?>" class="checkbox" />-》粘贴包含远程图片本地化,推荐使用<a href="<?php echo $zbp->host; ?>zb_users/plugin/AppCentre/main.php?id=32456" target="_blank">LY_批量清除无效图片+批量图片本地化</a>
						</td>
					</tr>
					<tr>
						<td title="默认源码模式">默认源码模式:</td>
						<td>
							<input name="ishtml" style="" type="text" value="<?php echo ly_ueditor_plus('ishtml'); ?>" class="checkbox" />-》编辑器初始化完成后是否进入源码模式
						</td>
					</tr>
					<tr>
						<td title="禁止加载自动保存">禁止加载自动保存:</td>
						<td>
							<input name="Auto-save" style="" type="text" value="<?php echo ly_ueditor_plus('Auto-save', 1); ?>" class="checkbox" />-》禁止加载自动保存
						</td>
					</tr>
					<tr>
						<td title="兼容盲人阅读器">兼容盲人阅读器:</td>
						<td>
							<input name="isrr" style="" type="text" value="<?php echo ly_ueditor_plus('isrr'); ?>" class="checkbox" />-》编辑器内编辑内容支持盲人阅读器
						</td>
					</tr>
					<tr>
						<td title="图片上传后缀">图片上传后缀:</td>
						<td><input name="image" class="form-control w50" value="<?php echo ly_ueditor_plus('image', 'jpg|jpeg|png|gif|ico|webp|bmp'); ?>">-》默认:jpg|jpeg|png|gif|ico|webp|bmp</td>
					</tr>
					<tr>
						<td title="影音上传后缀">影音上传后缀:</td>
						<td><input name="video" class="form-control w50" value="<?php echo ly_ueditor_plus('video', 'mp3|mp4|m3u8|flv'); ?>">-》默认:mp3|mp4|m3u8|flv</td>
					</tr>
					<tr>
						<td title="编辑器内CSS">编辑器内CSS:</td>
						<td><input name="css" class="form-control w50" value="<?php echo ly_ueditor_plus('css', 'img{max-width:100% !important;}'); ?>">-》默认:img{max-width:100% !important;}</td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="hidden" name="csrfToken" value="<?php echo $zbp->GetCsrfToken(); ?>">
							<input type="submit" value=" 保 存 " class="button" />
						</td>
					</tr>
				</tbody>
			</table>
		</form>

	</div>
</div>
<?php
require '../../../zb_system/admin/admin_footer.php';
RunTime();