示例#1
0
            $settings = array();
            $settings["popup"] = $_REQUEST["popup"] ? 1 : 0;
            $settings["pm"] = $_REQUEST["pm"] ? 1 : 0;
            $settings["aInterval"] = $aInterval;
            $settings["iInterval"] = $iInterval;
            $settings["smileys"] = $_REQUEST["smileys"] ? 1 : 0;
            $settings["smileySet"] = $smileySet;
            $settings["format"] = $_REQUEST["format"];
            $settings["lastLine"] = $lastLine;
            if ($settings["pm"] && file_exists(getSettingsPath() . "/chat/nopm")) {
                if (!unlink(getSettingsPath() . "/chat/nopm")) {
                    $ret = "{ \"error\": theUILang.chatPMError }";
                }
            } elseif (!$settings["pm"]) {
                if (!touch(getSettingsPath() . "/chat/nopm")) {
                    $ret = "{ \"error\": theUILang.chatPMError }";
                }
            }
            $chat = new rChat();
            if (!$chat->set($settings)) {
                $ret = "{ \"error\": theUILang.chatSettingsSave }";
            } else {
                $ret = json_encode($chat->get());
            }
            break;
    }
}
if (empty($ret)) {
    $ret = "{ \"error\": theUILang.chatInvalidReq }";
}
cachedEcho($ret, "application/json");