修复私有列表未生效的BUG
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Cache-Control" content="no-cache">
|
||||
@@ -37,13 +38,6 @@ if(isset($_POST['startdate'])){
|
||||
$password = $_POST['password'];
|
||||
$description = $_POST['description'];
|
||||
|
||||
if(false){
|
||||
$title = stripslashes($title);
|
||||
$private = stripslashes($private);
|
||||
$password = stripslashes($password);
|
||||
$description = stripslashes($description);
|
||||
}
|
||||
|
||||
$lang = $_POST['lang'];
|
||||
$langmask = 0;
|
||||
foreach ($lang as $t) {
|
||||
@@ -55,7 +49,8 @@ if(isset($_POST['startdate'])){
|
||||
|
||||
$cid = intval($_POST['cid']);
|
||||
|
||||
if(!(isset($_SESSION[$OJ_NAME.'_'."m$cid"])||isset($_SESSION[$OJ_NAME.'_'.'administrator'])||isset($_SESSION[$OJ_NAME.'_'.'contest_creator']))) exit();
|
||||
if (!(isset($_SESSION[$OJ_NAME . '_' . "m$cid"]) || isset($_SESSION[$OJ_NAME . '_' . 'administrator']) || isset($_SESSION[$OJ_NAME . '_' . 'contest_creator'])))
|
||||
exit();
|
||||
|
||||
$description = str_replace("<p>", "", $description);
|
||||
$description = str_replace("</p>", "<br />", $description);
|
||||
@@ -82,7 +77,8 @@ if(isset($_POST['startdate'])){
|
||||
$pid = intval($pieces[$i]);
|
||||
$has = pdo_query($sql, $pid);
|
||||
if (count($has) > 0) {
|
||||
if($plist) $plist.=",";
|
||||
if ($plist)
|
||||
$plist .= ",";
|
||||
$plist .= intval($pieces[$i]);
|
||||
pdo_query($sql_1, $cid, $pieces[$i], $num);
|
||||
$sql = "UPDATE `contest_problem` SET `c_accepted`=(SELECT count(1) FROM `solution` WHERE `problem_id`=? and contest_id=? AND `result`=4) WHERE `problem_id`=? and contest_id=?";
|
||||
@@ -101,14 +97,14 @@ if(isset($_POST['startdate'])){
|
||||
pdo_query($sql);
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM `privilege` WHERE `rightstr`=?";
|
||||
pdo_query($sql,"c$cid");
|
||||
$sql = "DELETE FROM `testusers` WHERE `contest_id`=?";
|
||||
pdo_query($sql, $cid);
|
||||
$pieces = explode("\n", trim($_POST['ulist']));
|
||||
$pieces = array_unique($pieces);
|
||||
if (count($pieces) > 0 && strlen($pieces[0]) > 0) {
|
||||
$sql_1 = "INSERT INTO `privilege`(`user_id`,`rightstr`) VALUES (?,?)";
|
||||
$sql_1 = "INSERT INTO `testusers`(`user_id`,`contest_id`) VALUES (?,?)";
|
||||
for ($i = 0; $i < count($pieces); $i++) {
|
||||
pdo_query($sql_1,trim($pieces[$i]),"c$cid") ;
|
||||
pdo_query($sql_1, trim($pieces[$i]), $cid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,16 +134,18 @@ if(isset($_POST['startdate'])){
|
||||
$result = pdo_query($sql, $cid);
|
||||
|
||||
foreach ($result as $row) {
|
||||
if($plist) $plist .= ",";
|
||||
if ($plist)
|
||||
$plist .= ",";
|
||||
$plist .= $row[0];
|
||||
}
|
||||
|
||||
$ulist = "";
|
||||
$sql = "SELECT `user_id` FROM `privilege` WHERE `rightstr`=? order by user_id";
|
||||
$result = pdo_query($sql,"c$cid");
|
||||
$sql = "SELECT `user_id` FROM `testusers` WHERE `contest_id`=? order by user_id";
|
||||
$result = pdo_query($sql, $cid);
|
||||
|
||||
foreach ($result as $row) {
|
||||
if($ulist) $ulist .= "\n";
|
||||
if ($ulist)
|
||||
$ulist .= "\n";
|
||||
$ulist .= $row[0];
|
||||
}
|
||||
}
|
||||
@@ -177,7 +175,8 @@ if(isset($_POST['startdate'])){
|
||||
<p align=left>
|
||||
<?php echo $MSG_CONTEST . "-" . $MSG_PROBLEM_ID ?>
|
||||
<?php echo "( Add problemIDs with coma , )" ?><br>
|
||||
<input id="plist" onchange="showTitles()" class=input-xxlarge type=text style="width:100%" name=cproblem value='<?php echo $plist?>'>
|
||||
<input id="plist" onchange="showTitles()" class=input-xxlarge type=text style="width:100%" name=cproblem
|
||||
value='<?php echo $plist ?>'>
|
||||
<div id="ptitles"></div>
|
||||
</p>
|
||||
<br>
|
||||
@@ -199,11 +198,14 @@ if(isset($_POST['startdate'])){
|
||||
$lang_count = count($language_ext);
|
||||
$lang = (~((int) $langmask)) & ((1 << $lang_count) - 1);
|
||||
|
||||
if(isset($_COOKIE['lastlang'])) $lastlang=$_COOKIE['lastlang'];
|
||||
else $lastlang = 0;
|
||||
if (isset($_COOKIE['lastlang']))
|
||||
$lastlang = $_COOKIE['lastlang'];
|
||||
else
|
||||
$lastlang = 0;
|
||||
|
||||
for ($i = 0; $i < $lang_count; $i++) {
|
||||
if( (1<<$i) & $OJ_LANGMASK ) continue;
|
||||
if ((1 << $i) & $OJ_LANGMASK)
|
||||
continue;
|
||||
echo "<option value=$i " . ($lang & (1 << $i) ? "selected" : "") . ">" . $language_name[$i] . "</option>";
|
||||
}
|
||||
?>
|
||||
@@ -219,7 +221,8 @@ if(isset($_POST['startdate'])){
|
||||
<option value=1 <?php echo $private == '1' ? 'selected=selected' : '' ?>><?php echo $MSG_Private ?></option>
|
||||
</select>
|
||||
<?php echo $MSG_CONTEST . "-" . $MSG_PASSWORD ?>:
|
||||
<input type=text name=password style="width:150px;" value='<?php echo htmlentities($password,ENT_QUOTES,'utf-8')?>'>
|
||||
<input type=text name=password style="width:150px;"
|
||||
value='<?php echo htmlentities($password, ENT_QUOTES, 'utf-8') ?>'>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -230,7 +233,9 @@ if(isset($_POST['startdate'])){
|
||||
<?php echo "( Add private contest's userIDs with newline /n )" ?>
|
||||
<br>
|
||||
<textarea name='ulist' rows='10' style='width:100%;' placeholder='user1<?php echo "\n" ?>user2<?php echo "\n" ?>user3<?php echo "\n" ?>
|
||||
<?php echo $MSG_PRIVATE_USERS_ADD?><?php echo "\n"?>'><?php if(isset($ulist)){ echo $ulist;}?></textarea>
|
||||
<?php echo $MSG_PRIVATE_USERS_ADD ?><?php echo "\n" ?>'><?php if (isset($ulist)) {
|
||||
echo $ulist;
|
||||
} ?></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -263,5 +268,5 @@ if(isset($_POST['startdate'])){
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user