<?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('tx_user_theme')) {$zbp->ShowError(48);die();}

if (isset($_GET['act'])){$act = $_GET['act'];}else{$act = 'base';}

$blogtitle='天兴工作室用户中心模板';
global $zbp;
$tx_user_theme_templates = array();
$tx_user_theme_theme = 0;
$tx_user_theme_index = 0;
$tx_user_theme_templatesname=array("头部","用户认证","发布投稿", "文章列表", "第三方登录", "积分购买", "修改密码", "评论列表", "消费日志", "文章收藏", "底部", "积分充值", "用户登录", "用户名修改", "分页条", "交易列表", "用户注册", "重置密码", "找回密码","VIP充值", "用户中心");
$tx_user_theme_templatesLabel='';
foreach ($GLOBALS['hooks']['Filter_Plugin_YtUser_Dmuc'] as $fpname => &$fpsignal) {
    $fpname($tx_user_theme_templates,$tx_user_theme_theme);
}
require $blogpath . 'zb_system/admin/admin_header.php';
require $blogpath . 'zb_system/admin/admin_top.php';
require './function.php';

if(isset($_POST['side1'])){
    $zbp->Config('tx_user_theme')->side1 = $_POST['side1'];
    $zbp->Config('tx_user_theme')->side2 = $_POST['side2'];
    $zbp->Config('tx_user_theme')->side3 = $_POST['side3'];
    $zbp->Config('tx_user_theme')->side4 = $_POST['side4'];
    $zbp->Config('tx_user_theme')->side5 = $_POST['side5'];
    $zbp->Config('tx_user_theme')->side6 = $_POST['side6'];
    $zbp->Config('tx_user_theme')->side7 = $_POST['side7'];
    $zbp->Config('tx_user_theme')->side8 = $_POST['side8'];
    $zbp->Config('tx_user_theme')->notice = $_POST['notice'];
    $zbp->Config('tx_user_theme')->foot = $_POST['foot'];
    $zbp->Config('tx_user_theme')->alipay = $_POST['alipay'];
    $zbp->Config('tx_user_theme')->qqdl = $_POST['qqdl'];
    $zbp->SaveConfig('tx_user_theme');
    $zbp->ShowHint('good');
}

if(isset($_POST['color1'])){
    $zbp->Config('tx_user_theme')->color1 = $_POST['color1'];
    $zbp->Config('tx_user_theme')->color2 = $_POST['color2'];
    $zbp->Config('tx_user_theme')->color3 = $_POST['color3'];
    $zbp->Config('tx_user_theme')->color4 = $_POST['color4'];
    $zbp->Config('tx_user_theme')->color5 = $_POST['color5'];
    $zbp->Config('tx_user_theme')->color6 = $_POST['color6'];
    $zbp->Config('tx_user_theme')->color7 = $_POST['color7'];
    $zbp->Config('tx_user_theme')->color8 = $_POST['color8'];
    $zbp->SaveConfig('tx_user_theme');
    $zbp->ShowHint('good');
}


function tx_user_theme_SubMenu($id){
    $arySubMenu = array(
        0 => array('插件说明', 'guide', 'left', false),
        1 => array('自定义配置项', 'base', 'left', false),
        2 => array('图片上传', 'logo', 'left', false),
        3 => array('颜色设置', 'ys', 'left', false),
    );
    foreach($arySubMenu as $k => $v){
        echo '<a href="?act='.$v[1].'"><span class="m-'.$v[2].' '.($id==$v[1]?'m-now':'').'">'.$v[0].'</span></a>';
    }
}

?>

<style type="text/css">
    .tx_title {border: 1px solid #ED0027;border-radius: 3px;padding: 5px 15px;margin-bottom: 15px;}
    .tx_title li {border-bottom: 1px solid #eee;line-height: 35px;}
</style>
<script src="source/jscolor.js" type="text/javascript"></script>
<div id="divMain">
    <div class="divHeader"><?php echo $blogtitle;?></div>
    <div class="SubMenu">
        <?php tx_user_theme_SubMenu($act);?>
        <a href="javascript:statistic('?act=misc&amp;type=statistic');" id="statistic"><span class="m-left" style="color:#F00">[清空缓存并重新编译模板]</span></a> <img id="statloading" style="display:none" src="<?php echo $zbp->host.'zb_system';?>/image/admin/loading.gif" alt=""/>
    </div>
    <div id="divMain2">
        <?php
        if ($act == 'guide'){
        ?>
        <ul class="tx_title">
            <li><strong style="color:#c00;">注意：</strong>：此插件为YtUser插件的模板插件，安装了YtUser插件的才用的。YtUser插件地址：<a href="https://app.zblogcn.com/?id=1139" target="_blank">https://app.zblogcn.com/?id=1139</a></li> 
            <li><strong style="color:#c00;">说明：</strong>：安装好YtUser插件后启用插件本即可，这个配置页面只是设置前台界面的颜色和一些自定义配置项。会员的一些功能请到YtUser插件的配置界面设置。</li>
            <li><strong style="color:#c00;">补充：</strong>：修改完配置项后务必点击上面的“清空缓存并重新编译模板”按钮修改项才会生效。</li>
        </ul>
        <?php
        }
        if ($act == 'logo'){
        ?>
        <table width="100%" style='padding:0;margin:0;' cellspacing='0' cellpadding='0' class="tableBorder">
            <th width="30%"><p align="center">图片名称</p></th>
            <th width="20%"><p align="center">当前图片</p></th>
            <th width="50%"><p align="center">上传文件</p></th>  
            <form enctype="multipart/form-data" method="post" action="save.php?type=base">
                <tr>
                    <td><label><p align="center">上传LOGO(大小为220*60)</p></label></td>
                    <td><p align="center">  <img src="img/logo.png" style="width:auto;height:40px;"></p></td>
                    <td><p align="center"><input name="logo.png" type="file" /> <input name="" type="Submit" class="button" value="保存" /></p></td>
                </tr>        
            </form>
        </table> 
        
        <?php
        }
        if ($act == 'base'){
        ?>
        <form id="form1" name="form1" method="post">  
            <table width="100%" style='padding:0;margin:0;' cellspacing='0' cellpadding='0' class="tableBorder">
                <tr>
                    <th colspan="4"><p align="center">左侧导航栏内容</p></th>
                </tr>
                <tr>
                    <td width="25%">
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side1" value="<?php echo $zbp->Config('tx_user_theme')->side1; ?>"/></p>
                    </td>
                    <td width="25%">
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side2" value="<?php echo $zbp->Config('tx_user_theme')->side2; ?>"/></p>
                    </td>
                    <td width="25%">
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side3" value="<?php echo $zbp->Config('tx_user_theme')->side3; ?>"/></p>
                    </td>
                    <td width="25%">
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side4" value="<?php echo $zbp->Config('tx_user_theme')->side4; ?>"/></p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side5" value="<?php echo $zbp->Config('tx_user_theme')->side5; ?>"/></p>
                    </td>
                    <td>
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side6" value="<?php echo $zbp->Config('tx_user_theme')->side6; ?>"/></p>
                    </td>
                    <td>
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side7" value="<?php echo $zbp->Config('tx_user_theme')->side7; ?>"/></p>
                    </td>
                    <td>
                        <p>可修改标题；<strong style="color:#c00;">留空则不显示</strong></p>
                        <p><input style="width:100%" name="side8" value="<?php echo $zbp->Config('tx_user_theme')->side8; ?>"/></p>
                    </td>
                </tr>
                
                <tr>
                    <th colspan="4"><p align="center">配置项</p></th>
                </tr>
                <tr>
                    <td><label><p align="center">公告</p></label></td>
                    <td colspan="2"><p align="left"><textarea name="notice" type="text" id="notice" style="width:100%;height:100px;"><?php echo $zbp->Config('tx_user_theme')->notice;?></textarea></p></td>
                    <td><p align="left">仅修改文字链接即可</p></td>
                </tr>
                <tr>
                    <td><label><p align="center">页面底部文字</p></label></td>
                    <td colspan="2"><p align="left"><textarea name="foot" type="text" id="foot" style="width:100%;"><?php echo $zbp->Config('tx_user_theme')->foot;?></textarea></p></td>
                    <td><p align="left">仅修改文字链接即可</p></td>
                </tr>
                <tr>
                    <td><label><p align="center">QQ登录开关</p></label></td>
                    <td colspan="2"><p align="left"><input name="qqdl" type="text" value="<?php echo $zbp->Config('tx_user_theme')->qqdl; ?>" class="checkbox" style="display:none;" /></p></td>
                    <td><p align="left">在会员中心插件里面配置好qq登录即可打开此开关</p></td>
                </tr>
                <tr>
                    <td><label><p align="center">支付宝开关</p></label></td>
                    <td colspan="2"><p align="left"><input name="alipay" type="text" value="<?php echo $zbp->Config('tx_user_theme')->alipay; ?>" class="checkbox" style="display:none;" /></p></td>
                    <td><p align="left">如果你有支付宝接口并在会员插件设置好即可打开此开关。</p></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <input name="" type="Submit" class="button" value="保存"/>
                    </td>
                </tr>
            </table> 
        </form>
        <?php
        }
        if ($act == 'ys'){
        ?>
        <form id="form1" name="form1" method="post">
            <table width="100%" style='padding:0;margin:0;' cellspacing='0' cellpadding='0' class="tableBorder">
                <tr>
                    <td width="25%">页面主色（初始颜色2D2B32）</td>
                    <td width="25%">
                        <input name="color1" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color1;?>">
                    </td>
                    <td width="25%">辅助颜色（初始颜色111111）</td>
                    <td width="25%">
                        <input name="color2" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color2;?>" />
                    </td>
                </tr>
                <tr>
                    <td width="25%">线的颜色（初始颜色DDDDDD）</td>
                    <td width="25%">
                        <input name="color3" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color3;?>">
                    </td>
                    <td width="25%">点亮颜色（初始颜色CC0000）</td>
                    <td width="25%">
                        <input name="color4" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color4;?>" />
                    </td>
                </tr>
                <tr>
                    <td width="25%">模块背景（初始颜色FFFFFF）</td>
                    <td width="25%">
                        <input name="color5" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color5;?>">
                    </td>
                    <td width="25%">背景颜色（初始颜色FAFAFA）</td>
                    <td width="25%">
                        <input name="color6" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color6;?>" />
                    </td>
                </tr>
                <tr>
                    <td width="25%">文字颜色（初始颜色5E5E5E）</td>
                    <td width="25%">
                        <input name="color7" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color7;?>">
                    </td>
                    <td width="25%">链接文字颜色（初始颜色6E6E6E）</td>
                    <td width="25%">
                        <input name="color8" type="text" class="color" style="width:50%" value="#<?php echo $zbp->Config('tx_user_theme')->color8;?>" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <input name="" type="Submit" class="button" value="保存" />
                    </td>
                </tr>
            </table>
        </form>
        <?php
        }
        ?>

        <script type="text/javascript">ActiveLeftMenu("aPluginMng");</script>
        <script type="text/javascript">AddHeaderIcon("<?php echo $bloghost . 'zb_users/plugin/tx_user_theme/logo.png';?>");</script>	
    </div>
</div>
<?php
require $blogpath . 'zb_system/admin/admin_footer.php';
RunTime();
?>