Files
hustoj/web/admin/setmsg.php
2026-04-10 16:36:57 +08:00

50 lines
1.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once("admin-header.php");
if(!(isset($_SESSION[$OJ_NAME.'_'.'administrator']))){
echo "<a href='../loginpage.php'>Please Login First!</a>";
exit(1);
}
echo "<hr>";
echo "<center><h3>".$MSG_NEWS."-".$MSG_SETMESSAGE."</h3></center>";
$msgfile=$OJ_SAE?"saestor://web/msg.txt":"msg/$domain.txt";
if(isset($_POST['do'])){
require_once("../include/check_post_key.php");
mkdir("msg");
$fp = fopen($msgfile,"w");
$msg = $_POST['msg'];
$msg = str_replace("<p>", "", $msg);
$msg = str_replace("</p>", "<br />", $msg);
$msg = str_replace(",", "&#44;", $msg);
if(false){
$title = stripslashes($title);
}
$msg = RemoveXSS($msg);
fputs($fp,$msg);
fclose($fp);
echo "<center><h4 class='text-danger'>Message Updated At ".date('Y-m-d h:i:s')."</h4></center>";
}
if(file_exists($msgfile))
$msg = file_get_contents($msgfile);
include("vditor.php");
?>
<div class="container">
<form action='setmsg.php' method='post'>
<textarea name='msg' class="vditor-editor" ><?php echo $msg?></textarea><br>
<input type='hidden' name='do' value='do'>
<center><input type='submit' value='<?php echo $MSG_SAVE?>'></center>
<!-- <br>
如果升级无法修改公告发送“修改公告”到微信公众号onlinejudge看解决方案。<br>
if this does not work, try run "sudo chown -R www-data /home/judge/src/web " in terminal.
-->
<?php require_once("../include/set_post_key.php");?>
</form>
</div>
<?php require_once('../oj-footer.php'); ?>