-
Notifications
You must be signed in to change notification settings - Fork 3
/
editproposaltake.php
122 lines (98 loc) · 2.78 KB
/
editproposaltake.php
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
include('header.php');
$question = $_POST['question'];
// User is anonymous if anon checkbox has been clicked (is defined)
$is_anon = isset($_POST['anon']);
$userid=isloggedin();
if ($is_anon and $userid)//DEBUG START
{
// userid should be false
set_log(" User $userid submitted anonymously whilst logged in!");
}// DEBUG END
$blurb = $_POST['blurb'];
$abstract = $_POST['abstract'];
$proposal = (int)$_POST['proposal'];
$abstract = trim($abstract);
if ($abstract == '<br>')
{
$abstract = '';
}
$blurb = trim($blurb);
if (!IsQuestionWriting($question))
{
/*
set_message("user", "Sorry, question $question now in voting stage.");
$proposal_str = '<h3>Abstract</h3>' .
"<p>$abstract</p>" .
'<h3>Proposal</h3>' .
"<p>$proposal</p>";
set_message("user", $proposal_str);
header("Location: messagepage.php?q=$question");*/
header("Location: viewquestion.php?q=$question");
exit;
}
if (!get_magic_quotes_gpc())
{
$blurb = addslashes($blurb);
$abstract = addslashes($abstract);
}
//*** Filter user input
//$config = HTMLPurifier_Config::createDefault();
# $config->set('HTML', 'Doctype', 'HTML 4.01 Transitional');
//$config->set('HTML.Doctype', 'HTML 4.01 Transitional');
//$purifier = new HTMLPurifier($config);
//$xsstest= '<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT> <p>Hi there from the XSS Test. Is it safe?</p>';
//$abstract = $purifier->purify($abstract);
//$blurb = $purifier->purify($blurb);
$previousProposal=HasProposalBeenSuggested($proposal, $question,$blurb,$abstract);
if($previousProposal)
{
echo "sorry, it looks like the proposal has already been suggested.";
}
else
{
$room = GetRoom($question);
$urlquery = CreateQuestionURL($question, $room);
if ($is_anon)
{
//$wait = getDelayForRemoteIP();
//$wait_str = formatSeconds($wait);
//set_log("Time remaining before next request for this IP is $wait_str");
$userid = getAnonymousUser($question);
//logUser($userid);
/*
if ($wait > 0)
{
set_message("user", "Posting quota is in place. You are limited from posting again for a short while: $wait_str");
$urlquery = "?query=viewquestion.php".$urlquery;
header("Location: messagepage.php".$urlquery);
exit;
}
else
{
$userid = getAnonymousUser($question);
logUser($userid);
}*/
}
if (!$userid)
{
printbrx("Error: Could not create anonymous user!");
}
$sql = "UPDATE `proposals` SET `blurb` = '$blurb', `abstract` = '$abstract' WHERE `id` = $proposal";
$edit_proposal = mysql_query($sql);
if (!$edit_proposal)
{
handle_db_error($add_proposal);
set_message("error", "System error");
}
if ($is_anon)
{
$urlquery = "?anon=$userid&prop=$newpropid&query=viewquestion.php".$urlquery;
header("Location: anonnewpropfeedback.php".$urlquery);
}
else
{
header("Location: viewquestion.php".$urlquery);
}
}
?>