-
Notifications
You must be signed in to change notification settings - Fork 1
/
citation_inc.php
executable file
·144 lines (116 loc) · 3.88 KB
/
citation_inc.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
require_once('db/db.php');
require_once('inc/header.php');
// selected permissions type for report
$perm_type = $_REQUEST['perm_type'];
//get citation info from cookie
$citation_info = unserialize($_COOKIE['citation_info']);
foreach ($citation_info as $key => $value) {
$clean[$key] = filter_var($value, FILTER_SANITIZE_STRING);
}
$citation_text = trim($citation_info['citation_text']);
$issn = strip_tags($citation_info['issn']);
// new citation, journal found, selection made
////////////////////////////////////////////////////////////////////////////////////////////////
if ($perm_type != "in_progress" && empty($clean['reval']) ){
//processing for db insert
$citation_text = trim($citation_info['citation_text']);
//db insert
$query = "INSERT INTO citations SET
person_id = '{$clean['author_id']}',
citation = '$citation_text',
jtitle = '{$clean['jtitle']}',
issn = '$issn',
conditions = '{$clean['conditions']}',
report_choice = '{$perm_type}',
preprint = '{$clean['preprint']}',
postprint = '{$clean['postprint']}',
preprint_restrictions = '{$clean['pre_restrictions']}',
postprint_restrictions = '{$clean['post_restrictions']}'
";
if (!@$CVreviewTool_dbconnect->query($query)) {echo $query; die; }
else {
?>
<div id="page_content">
<?php
echo "Citation added.</br></br>";
echo "<a href='citations.php?author_id={$clean['author_id']}'>Add another</a> / ";
echo "<a href='report.php?author_id={$clean['author_id']}'>View Report</button></a></br>";
?></div><?php
}
}
// udpate citation, journal found, selection made
////////////////////////////////////////////////////////////////////////////////////////////////
if ($perm_type != "in_progress" && !empty($clean['reval'])){
//processing for db insert
$citation_text = trim($citation_info['citation_text']);
//db insert
$query = "UPDATE citations SET
person_id = '{$clean['author_id']}',
citation = '$citation_text',
jtitle = '{$clean['jtitle']}',
issn = '$issn',
conditions = '{$clean['conditions']}',
report_choice = '{$perm_type}',
preprint = '{$clean['preprint']}',
postprint = '{$clean['postprint']}',
preprint_restrictions = '{$clean['pre_restrictions']}',
postprint_restrictions = '{$clean['post_restrictions']}'
WHERE id = {$clean['reval']}";
if (!@$CVreviewTool_dbconnect->query($query)) {echo $query; die; }
else{
?>
<div id="page_content">
<p>Citation Updated.</p>
</div>
<?php
}
}
// new citation, saving for later
////////////////////////////////////////////////////////////////////////////////////////////////
if ($perm_type == "in_progress" && empty($clean['reval']) ) {
$citation_text = trim($citation_info['citation_text']);
//db insert
$query = "INSERT INTO citations SET
person_id = '{$clean['author_id']}',
citation = '$citation_text',
jtitle = '{$clean['jtitle']}',
issn = '$issn',
conditions = '{$clean['conditions']}',
report_choice = '{$perm_type}',
preprint = '{$clean['preprint']}',
postprint = '{$clean['postprint']}',
preprint_restrictions = '{$clean['pre_restrictions']}',
postprint_restrictions = '{$clean['post_restrictions']}'
";
if (!@$CVreviewTool_dbconnect->query($query)) {echo $query; die; }
else {
?>
<div id="page_content">
<p>Saved for Later.</p>
</div>
<?php
}
}
// updating UNFOUND journal citation, "reval" workflow
////////////////////////////////////////////////////////////////////////////////////////////////
if ($perm_type == "in_progress" && !empty($clean['reval'])) {
//db update
$query = "UPDATE citations SET
citation = '$citation_text',
jtitle = '{$clean['jtitle']}',
issn = '$issn',
report_choice = '{$perm_type}'
WHERE id = {$clean['reval']}";
if (!@$CVreviewTool_dbconnect->query($query)) {echo "4th option"; echo $query; die; }
else{
?>
<div id="page_content">
<p>Citation Updated.</p>
</div>
<?php
}
}
//footer
require_once('inc/footer.php');
?>