hxp
2025-06-09 6c3f6335c70859ded94a1ad8d218acb0ac34239c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
include_once "/Common/CommFunc.php";
include_once "/Common/Logging.php";
include_once "/Account/User.php";
include_once "/language/lang.php";
 
$Permission = \User\Permission::P_Chatmonitor;
$spid = $_SESSION['spid'];
$user = new \User\User($_SESSION['UserAccount']);
if (!$user->HavePermission($Permission)) {
    exit;
}
 
$wordFile0 = "chatmonitor/word_" . $spid . "_0.txt";
$wordFile1 = "chatmonitor/word_" . $spid . "_1.txt";
 
$ok = 0;
$alertMsg = "";
if ($_POST["submit"]) {
    $words0 = $_POST["words0"];
    $words1 = $_POST["words1"];
    $ret0 = file_put_contents($wordFile0, $words0);
    $ret1 = file_put_contents($wordFile1, $words1);
    if ($ret0 >= 0 && $ret1 >= 0) {
        $ok = 1;
        $alertMsg = "ok";
    } else {
        $alertMsg = "error";
    }
} else {
    $words0 = \CommFunc\GetFileContents($wordFile0);
    $words1 = \CommFunc\GetFileContents($wordFile1);
}
 
?>
 
<!DOCTYPE HTML>
<html>
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title><?php echo \Lang\gettext("敏感词管理"); ?></title>
    <link rel="gettext" type="application/x-po" href="../language/<?php echo \Lang\getLang(); ?>/LC_MESSAGES/<?php echo \Lang\getjspodomain(); ?>.po" />
</head>
 
<body>
    <form action="chatwordmgr.php" method="POST">
        <center>
            <?php echo \Lang\gettext("敏感词用英文','隔开"); ?><br />
            <br />
            <?php echo \Lang\gettext("超级敏感词"); ?>:<br />
            <textarea name="words0" id="words0" cols="100" rows="20"><?php echo $words0; ?></textarea><br />
            <br />
            <?php echo \Lang\gettext("普通敏感词"); ?>:<br />
            <textarea name="words1" id="words1" cols="100" rows="20"><?php echo $words1; ?></textarea><br />
            <input type="submit" name="submit" value="<?php echo \Lang\gettext("提交"); ?>" onclick="return CheckSubmit()" />
        </center>
    </form>
</body>
 
<script type='text/javascript' src="/js/common.js"></script>
<script type="text/javascript">
    window.onload = function() {
        var alertMsg = "<?php echo $alertMsg; ?>";
        if (alertMsg) {
            alert(alertMsg);
        }
 
        var ok = "<?php echo $ok; ?>";
        if (ok == 1) {
            var words0 = "<?php echo $words0; ?>";
            var words1 = "<?php echo $words1; ?>";
            var words0list = words0.split(',');
            var words1list = words1.split(',');
            var words = [words0list, words1list];
            opener.updSensitiveWord(words); //更新父页面数据
        }
    }
 
    function CheckSubmit() {
        var words0 = document.getElementById("words0").value;
        var words1 = document.getElementById("words1").value;
        // 替换中文逗号为英文逗号
        if (words0.indexOf(",") != -1) {
            words0 = words0.replaceAll(",", ",");
            document.getElementById("words0").value = words0;
        }
        if (words1.indexOf(",") != -1) {
            words1 = words1.replaceAll(",", ",");
            document.getElementById("words1").value = words1;
        }
        var words0list = words0.split(',');
        var words1list = words1.split(',');
        var br = getbr();
        confirmStr = "";
        confirmStr += "<?php echo \Lang\gettext("超级敏感词"); ?>" + " : " + br + JSON.stringify(words0list) + br + br;
        confirmStr += "<?php echo \Lang\gettext("普通敏感词"); ?>" + " : " + br + JSON.stringify(words1list) + br + br;
        confirmStr += "<?php echo \Lang\gettext("确定提交?"); ?>";
        if (!window.confirm(confirmStr)) {
            return false;
        }
        return true;
    }
</script>
 
</html>