style.php

来自「八星瓢虫留言本特点:采用PHP+Access数据库实现」· PHP 代码 · 共 1,049 行 · 第 1/4 页

PHP
1,049
字号
        GoError("请填写有效水印文字内容,不能为空!");
    }
    if (!isValidColor($GLOBALS["sSYFontColor"])) {
        GoError("请填写有效的水印文字颜色,6位长度,如黑色:000000!");
    }
    if (!isValidColor($GLOBALS["sSYShadowColor"])) {
        GoError("请填写有效的水印文字阴影颜色,6位长度,如白色:FFFFFF!");
    }
    if (!is_numeric($GLOBALS["sSYShadowOffset"])) {
        GoError("请填写有效的水印文字阴影大小,不能为空,且为数字型!");
    }
    if (!is_numeric($GLOBALS["sSYFontSize"])) {
        GoError("请填写有效的水印文字大小,不能为空,且为数字型!");
    }

}

function DoStyleAddSave(){

    if (StyleName2ID($GLOBALS["sStyleName"]) != -1){
        GoError("此样式名已经存在,请用另一个样式名!");
    }

    $nNewStyleID = count($GLOBALS["aStyle"]) + 1;

    $GLOBALS["aStyle"][$nNewStyleID] = $GLOBALS["sStyleName"]."|||".$GLOBALS["sStyleDir"]."|||".$GLOBALS["sStyleCSS"]."|||".$GLOBALS["sStyleUploadDir"]."|||".$GLOBALS["sStyleWidth"]."|||".$GLOBALS["sStyleHeight"]."|||".$GLOBALS["sStyleFileExt"]."|||".$GLOBALS["sStyleFlashExt"]."|||".$GLOBALS["sStyleImageExt"]."|||".$GLOBALS["sStyleMediaExt"]."|||".$GLOBALS["sStyleRemoteExt"]."|||".$GLOBALS["sStyleFileSize"]."|||".$GLOBALS["sStyleFlashSize"]."|||".$GLOBALS["sStyleImageSize"]."|||".$GLOBALS["sStyleMediaSize"]."|||".$GLOBALS["sStyleRemoteSize"]."|||".$GLOBALS["sStyleStateFlag"]."|||".$GLOBALS["sStyleDetectFromWord"]."|||".$GLOBALS["sStyleInitMode"]."|||".$GLOBALS["sStyleBaseUrl"]."|||".$GLOBALS["sStyleUploadObject"]."|||".$GLOBALS["sStyleAutoDir"]."|||".$GLOBALS["sStyleBaseHref"]."|||".$GLOBALS["sStyleContentPath"]."|||".$GLOBALS["sStyleAutoRemote"]."|||".$GLOBALS["sStyleShowBorder"]."|||".$GLOBALS["sStyleMemo"]."|||".$GLOBALS["sAutoDetectLanguage"]."|||".$GLOBALS["sDefaultLanguage"]."|||".$GLOBALS["sSLTFlag"]."|||".$GLOBALS["sSLTMinSize"]."|||".$GLOBALS["sSLTOkSize"]."|||".$GLOBALS["sSYFlag"]."|||".$GLOBALS["sSYText"]."|||".$GLOBALS["sSYFontColor"]."|||".$GLOBALS["sSYFontSize"]."|||".$GLOBALS["sSYFontName"]."|||".$GLOBALS["sSYPicPath"]."|||".$GLOBALS["sSLTSYObject"]."|||".$GLOBALS["sSLTSYExt"]."|||".$GLOBALS["sSYMinSize"]."|||".$GLOBALS["sSYShadowColor"]."|||".$GLOBALS["sSYShadowOffset"]."|||".$GLOBALS["sStyleAllowBrowse"];

    WriteConfig();
    WriteStyle($nNewStyleID);

    ShowMessage("<b><span class=red>样式增加成功!</span></b><li><a href='?action=toolbar&id=".$nNewStyleID."'>设置此样式下的工具栏</a>");

}

function DoUpdateConfig(){
    WriteConfig();
    for ($i=1;$i<=count($GLOBALS["aStyle"]);$i++){
        WriteStyle($i);
    }
    ShowMessage("<b><span class=red>所有样式的前台配置文件更新操作成功!</span></b><li><a href='?'>返回所有样式列表</a>");
}

function DoStyleSetSave(){
    $GLOBALS["sStyleID"] = toTrim("id");
    if (is_numeric($GLOBALS["sStyleID"])) {
        $n = StyleName2ID($GLOBALS["sStyleName"]);
        if ((($n) != (int)$GLOBALS["sStyleID"]) && ($n != -1)) {
            GoError("此样式名已经存在,请用另一个样式名!");
        }
        
        if (((int)($GLOBALS["sStyleID"]) < 1) && ((int)($GLOBALS["sStyleID"])>count($GLOBALS["aStyle"]))) {
            GoError("无效的样式ID号,请通过页面上的链接进行操作!");
        }

        $aTemp = explode("|||", $GLOBALS["aStyle"][$GLOBALS["sStyleID"]]);
        $s_OldStyleName = $aTemp[0];

        $GLOBALS["aStyle"][$GLOBALS["sStyleID"]] = $GLOBALS["sStyleName"]."|||".$GLOBALS["sStyleDir"]."|||".$GLOBALS["sStyleCSS"]."|||".$GLOBALS["sStyleUploadDir"]."|||".$GLOBALS["sStyleWidth"]."|||".$GLOBALS["sStyleHeight"]."|||".$GLOBALS["sStyleFileExt"]."|||".$GLOBALS["sStyleFlashExt"]."|||".$GLOBALS["sStyleImageExt"]."|||".$GLOBALS["sStyleMediaExt"]."|||".$GLOBALS["sStyleRemoteExt"]."|||".$GLOBALS["sStyleFileSize"]."|||".$GLOBALS["sStyleFlashSize"]."|||".$GLOBALS["sStyleImageSize"]."|||".$GLOBALS["sStyleMediaSize"]."|||".$GLOBALS["sStyleRemoteSize"]."|||".$GLOBALS["sStyleStateFlag"]."|||".$GLOBALS["sStyleDetectFromWord"]."|||".$GLOBALS["sStyleInitMode"]."|||".$GLOBALS["sStyleBaseUrl"]."|||".$GLOBALS["sStyleUploadObject"]."|||".$GLOBALS["sStyleAutoDir"]."|||".$GLOBALS["sStyleBaseHref"]."|||".$GLOBALS["sStyleContentPath"]."|||".$GLOBALS["sStyleAutoRemote"]."|||".$GLOBALS["sStyleShowBorder"]."|||".$GLOBALS["sStyleMemo"]."|||".$GLOBALS["sAutoDetectLanguage"]."|||".$GLOBALS["sDefaultLanguage"]."|||".$GLOBALS["sSLTFlag"]."|||".$GLOBALS["sSLTMinSize"]."|||".$GLOBALS["sSLTOkSize"]."|||".$GLOBALS["sSYFlag"]."|||".$GLOBALS["sSYText"]."|||".$GLOBALS["sSYFontColor"]."|||".$GLOBALS["sSYFontSize"]."|||".$GLOBALS["sSYFontName"]."|||".$GLOBALS["sSYPicPath"]."|||".$GLOBALS["sSLTSYObject"]."|||".$GLOBALS["sSLTSYExt"]."|||".$GLOBALS["sSYMinSize"]."|||".$GLOBALS["sSYShadowColor"]."|||".$GLOBALS["sSYShadowOffset"]."|||".$GLOBALS["sStyleAllowBrowse"];

    }else{
        GoError("无效的样式ID号,请通过页面上的链接进行操作!");
    }

    WriteConfig();
    if (strtolower($s_OldStyleName) != strtolower($GLOBALS["sStyleName"])){
        DeleteFile($s_OldStyleName);
    }
    WriteStyle($GLOBALS["sStyleID"]);

    ShowMessage("<b><span class=red>样式修改成功!</span></b><li><a href='?action=stylepreview&id=".$GLOBALS["sStyleID"]."' target='_blank'>预览此样式</a><li><a href='?action=toolbar&id=".$GLOBALS["sStyleID"]."'>设置此样式下的工具栏</a>");

}

function DoStyleDel(){
    $GLOBALS["aStyle"][$GLOBALS["sStyleID"]] = "";
    WriteConfig();
    DeleteFile($GLOBALS["sStyleName"]);
    GoUrl("?");
}

function ShowStylePreview(){
    echo "<html><head>".
        "<title>样式预览</title>".
        "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>".
        "</head><body>".
        "<input type=hidden name=content1  value=''>".
        "<iframe ID='eWebEditor1' src='../ewebeditor.htm?id=content1&style=".$GLOBALS["sStyleName"]."' frameborder=0 scrolling=no width='".$GLOBALS["sStyleWidth"]."' HEIGHT='".$GLOBALS["sStyleHeight"]."'></iframe>".
        "</body></html>";
}

function ShowStyleCode(){
    echo "<table border=0 cellspacing=1 align=center class=list>".
        "<tr><th>样式(".htmlspecialchars($GLOBALS["sStyleName"]).")的最佳调用代码如下(其中XXX按实际关联的表单项进行修改):</th></tr>".
        "<tr><td><textarea rows=5 cols=65 style='width:100%'><IFRAME ID=\"eWebEditor1\" SRC=\"ewebeditor.htm?id=XXX&style=".$GLOBALS["sStyleName"]."\" FRAMEBORDER=\"0\" SCROLLING=\"no\" WIDTH=\"".$GLOBALS["sStyleWidth"]."\" HEIGHT=\"".$GLOBALS["sStyleHeight"]."\"></IFRAME></textarea></td></tr>".
        "</table>";
}

function ShowToolBarList(){

    ShowMessage("<b class=blue>样式(".htmlspecialchars($GLOBALS["sStyleName"]).")下的工具栏管理:</b>");

    $nMaxOrder = 0;
    for ($i=1;$i<=count($GLOBALS["aToolbar"]);$i++){
        $aCurrToolbar = explode("|||", $GLOBALS["aToolbar"][$i]);
        if ($aCurrToolbar[0] == $GLOBALS["sStyleID"]) {
            if ((int)($aCurrToolbar[3]) > $nMaxOrder) {
                $nMaxOrder = (int)($aCurrToolbar[3]);
            }
        }
    }
    $nMaxOrder = $nMaxOrder + 1;

    $s_AddForm = "<hr width='80%' align=center size=1><table border=0 cellpadding=4 cellspacing=0 align=center>".
    "<form action='?id=".$GLOBALS["sStyleID"]."&action=toolbaradd' name='addform' method=post>".
    "<tr><td>工具栏名:<input type=text name=d_name size=20 class=input value='工具栏".$nMaxOrder."'> 排序号:<input type=text name=d_order size=5 value='".$nMaxOrder."' class=input> <input type=submit name=b1 value='新增工具栏'></td></tr>".
    "</form></table><hr width='80%' align=center size=1>";

    $s_ModiForm = "<form action='?id=".$GLOBALS["sStyleID"]."&action=toolbarmodi' name=modiform method=post>".
        "<table border=0 cellpadding=0 cellspacing=1 align=center class=form>".
        "<tr align=center><th>ID</th><th>工具栏名</th><th>排序号</th><th>操作</th></tr>";

    for ($i=1;$i<=count($GLOBALS["aToolbar"]);$i++){
        $aCurrToolbar = explode("|||", $GLOBALS["aToolbar"][$i]);
        if ($aCurrToolbar[0] == $GLOBALS["sStyleID"]){
            $s_Manage = "<a href='?id=".$GLOBALS["sStyleID"]."&action=buttonset&toolbarid=".$i."'>按钮设置</a>";
            $s_Manage = $s_Manage."|<a href='?id=".$GLOBALS["sStyleID"]."&action=toolbardel&delid=".$i."'>删除</a>";
            $s_ModiForm = $s_ModiForm."<tr align=center>".
                "<td>".$i."</td>".
                "<td><input type=text name='d_name".$i."' value=\"".htmlspecialchars($aCurrToolbar[2])."\" size=30 class=input></td>".
                "<td><input type=text name='d_order".$i."' value='".$aCurrToolbar[3]."' size=5 class=input></td>".
                "<td>".$s_Manage."</td>".
                "</tr>";
        }
    }

    $s_SubmitButton = "<tr><td colspan=4 align=center><input type=submit name=b1 value='  修改  '></td></tr>";
    $s_ModiForm = $s_ModiForm.$s_SubmitButton."</table></form>";

    echo $s_AddForm.$s_ModiForm;

}

function DoToolBarAdd(){
    $s_Name = toTrim("d_name");
    $s_Order = toTrim("d_order");
    if ($s_Name == "") {
        GoError("工具栏名不能为空!");
    }
    if (!is_numeric($s_Order)){
        GoError("无效的工具栏排序号,排序号必须为数字!");
    }

    $nToolbarNum = count($GLOBALS["aToolbar"]) + 1;
    $GLOBALS["aToolbar"][$nToolbarNum] = $GLOBALS["sStyleID"]."||||||".$s_Name."|||".$s_Order;

    WriteConfig();
    WriteStyle($GLOBALS["sStyleID"]);

    echo "<script language=javascript>alert(\"工具栏(".htmlspecialchars($s_Name).")增加操作成功!\");</script>";
    GoUrl("?action=toolbar&id=".$GLOBALS["sStyleID"]);
}

function DoToolBarModi(){

    for ($i=1;$i<=count($GLOBALS["aToolbar"]);$i++){
        $aCurrToolbar = explode("|||", $GLOBALS["aToolbar"][$i]);
        if ($aCurrToolbar[0] == $GLOBALS["sStyleID"]){
            $s_Name = toTrim("d_name".$i);
            $s_Order = toTrim("d_order".$i);
            if (($s_Name == "") || (is_numeric($s_Order) == false)) {
                $aCurrToolbar[0] = "";
                $s_Name = "";
            }
            $GLOBALS["aToolbar"][$i] = $aCurrToolbar[0]."|||".$aCurrToolbar[1]."|||".$s_Name."|||".$s_Order;
        }
    }

    WriteConfig();
    WriteStyle($GLOBALS["sStyleID"]);

    echo "<script language=javascript>alert('工具栏修改操作成功!');</script>";
    GoUrl("?action=toolbar&id=".$GLOBALS["sStyleID"]);

}

function DoToolBarDel(){
    $s_DelID = toTrim("delid");
    if (is_numeric($s_DelID)){
        $GLOBALS["aToolbar"][$s_DelID] = "";
        WriteConfig();
        WriteStyle($GLOBALS["sStyleID"]);
        echo "<script language=javascript>alert('工具栏(ID:".$s_DelID.")删除操作成功!');</script>";
        GoUrl("?action=toolbar&id=".$GLOBALS["sStyleID"]);
    }
}

function InitToolBar(){
    $b = false;
    $GLOBALS["sToolBarID"] = toTrim("toolbarid");
    if (is_numeric($GLOBALS["sToolBarID"])){
        if (((int)($GLOBALS["sToolBarID"]) <= count($GLOBALS["aToolbar"])) && ((int)($GLOBALS["sToolBarID"]) > 0)) {
            $aCurrToolbar = explode("|||", $GLOBALS["aToolbar"][$GLOBALS["sToolBarID"]]);
            $GLOBALS["sToolBarName"] = $aCurrToolbar[2];
            $GLOBALS["sToolBarOrder"] = $aCurrToolbar[3];
            $GLOBALS["sToolBarButton"] = $aCurrToolbar[1];
            $b = true;
        }
    }
    if ($b == false) {
        GoError("无效的工具栏ID号,请通过页面上的链接进行操作!");
    }
}

function ShowButtonList(){

    ShowMessage("<b class=blue>当前样式:<span class=red>".htmlspecialchars($GLOBALS["sStyleName"])."</span>&nbsp;&nbsp;当前工具栏:<span class=red>".htmlspecialchars($GLOBALS["sToolBarName"])."</span></b>");
    
    $s_Option1 = "";
    for ($i=1;$i<=count($GLOBALS["aButton"]);$i++){
        if ($GLOBALS["aButton"][$i][8] == 1) {
            $s_Option1 = $s_Option1."<option value='".$GLOBALS["aButton"][$i][1]."'>".$GLOBALS["aButton"][$i][2]."</option>";
        }
    }

    $aSelButton = explode("|", $GLOBALS["sToolBarButton"]);
    $s_Option2 = "";
    for ($i=0;$i<count($aSelButton);$i++){
        $s_Temp = Code2Title($aSelButton[$i]);
        if ($s_Temp != "") {
            $s_Option2 = $s_Option2."<option value='".$aSelButton[$i]."'>".$s_Temp."</option>";
        }
    }


?>

<script language=javascript>
function Add() {
    var sel1=document.myform.d_b1;
    var sel2=document.myform.d_b2;
    if (sel1.selectedIndex<0) {
        alert("请选择一个待选按钮!");
        return;
    }
    sel2.options[sel2.length]=new Option(sel1.options[sel1.selectedIndex].innerHTML,sel1.options[sel1.selectedIndex].value);
}

function Del() {
    var sel=document.myform.d_b2;
    var nIndex = sel.selectedIndex;
    var nLen = sel.length;
    if (nLen<1) return;
    if (nIndex<0) {
        alert("请选择一个已选按钮!");
        return;
    }
    for (var i=nIndex;i<nLen-1;i++) {
        sel.options[i].value=sel.options[i+1].value;
        sel.options[i].innerHTML=sel.options[i+1].innerHTML;
    }
    sel.length=nLen-1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?