This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathaddarticle.php
288 lines (267 loc) · 18.4 KB
/
addarticle.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<?php
include_once 'data.php';
if (isset($_SESSION['permissions']) && ($_SESSION['permissions'] == 'A' || $_SESSION['permissions'] == 'U')) {
include_once 'functions.php';
database_connect(IL_USER_DATABASE_PATH, 'users');
$user_query = $dbHandle->quote($_SESSION['user_id']);
$result = $dbHandle->query("SELECT setting_name FROM settings WHERE userID=$user_query AND setting_name LIKE 'remove_%'");
$settings = $result->fetchAll(PDO::FETCH_ASSOC);
$result = null;
$dbHandle = null;
foreach ($settings as $setting) {
${$setting['setting_name']} = 1;
}
?>
<div class="leftindex" id="addarticle-left" style="float:left;width:240px;height:100%;overflow:scroll">
<button id="uploadlink">Add Single Item</button>
<button id="importlink">Add Multiple Items</button>
<button id="<?php print ($hosted == false) ? 'batchimportlink' : 'importany' ?>">Add Multiple PDFs</button>
<?php
if ($hosted == false) {
?>
<div style="margin-top:0.5em;padding-left: 10px;width:190px">
<div class="select-import" id="importlocalhost">from localhost</div>
<div class="select-import" id="importany">from any computer</div>
</div>
<?php
}
database_connect(IL_DATABASE_PATH, 'library');
$user_query = $dbHandle->quote($_SESSION['user_id']);
$result = $dbHandle->query("SELECT DISTINCT searchname FROM searches WHERE userID=$user_query ORDER BY searchname ASC");
$searchnames = $result->fetchAll(PDO::FETCH_COLUMN);
$result = null;
if (!isset($_SESSION['remove_pubmed'])) {
//HOW MANY FLAGGED?
$result = $dbHandle->query("SELECT count(*) FROM flagged WHERE userID=" . intval($_SESSION['user_id']) . " AND database='pubmed'");
if ($result)
$flagged_count = $result->fetchColumn();
$result = null;
?>
<button id="pubmedlink" title="Search over 23 million records">PubMed</button>
<div id="pubmed-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<div class="ui-state-default empty-flagged pubmed"><i class="fa fa-trash-o"></i></div>
<span class="pubmed flagged-items">Flagged Items</span><br>
<span id="pubmed-flagged-count"><?php print isset($flagged_count) ? $flagged_count : '0' ?></span>/100
<div style="clear:both"></div>
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 7) == "pubmed#") {
$searchname_query = $dbHandle->quote($searchname);
$result = $dbHandle->query("SELECT searchvalue FROM searches WHERE userID=$user_query AND searchfield='last_search' AND searchname=$searchname_query LIMIT 1");
$last_search_stamp = $result->fetchColumn();
$result = null;
$last_search = round((time() - $last_search_stamp) / 86400, 1);
if ($last_search < 1) {
$last_search = round((time() - $last_search_stamp) / 3600);
$last_search .= ' hour' . (($last_search != 1) ? 's' : '') . ' ago';
} elseif ($last_search > 365) {
$last_search = '>1 year ago';
} else {
$last_search = round($last_search);
$last_search .= ' day' . (($last_search != 1) ? 's' : '') . ' ago';
}
if ($last_search_stamp < 2)
$last_search = 'Never';
print '<div class="pubmed">';
print '<div class="ui-state-default del-saved-search pubmed"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search pubmed" id="saved-search-pubmed-' . htmlspecialchars(rawurlencode(substr($searchname, 7))) . '">';
print htmlspecialchars(substr($searchname, 7));
print '</span><br> <span>' . $last_search;
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
if (!isset($_SESSION['remove_pmc'])) {
//HOW MANY FLAGGED?
$result = $dbHandle->query("SELECT count(*) FROM flagged WHERE userID=" . intval($_SESSION['user_id']) . " AND database='pmc'");
if ($result)
$flagged_count = $result->fetchColumn();
$result = null;
?>
<button id="pmclink" title="Search over 3 million records">PubMed Central</button>
<div id="pmc-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<div class="ui-state-default empty-flagged pmc"><i class="fa fa-trash-o"></i></div>
<span class="pmc flagged-items">Flagged Items</span><br>
<span id="pmc-flagged-count"><?php print isset($flagged_count) ? $flagged_count : '0' ?></span>/100
<div style="clear:both"></div>
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 4) == "pmc#") {
$searchname_query = $dbHandle->quote($searchname);
$result = $dbHandle->query("SELECT searchvalue FROM searches WHERE userID=$user_query AND searchfield='pmc_last_search' AND searchname=$searchname_query LIMIT 1");
$last_search_stamp = $result->fetchColumn();
$result = null;
$last_search = round((time() - $last_search_stamp) / 86400, 1);
if ($last_search < 1) {
$last_search = round((time() - $last_search_stamp) / 3600);
$last_search .= ' hour' . (($last_search != 1) ? 's' : '') . ' ago';
} elseif ($last_search > 365) {
$last_search = '>1 year ago';
} else {
$last_search = round($last_search);
$last_search .= ' day' . (($last_search != 1) ? 's' : '') . ' ago';
}
if ($last_search_stamp < 2)
$last_search = 'Never';
print '<div class="pmc">';
print '<div class="ui-state-default del-saved-search pmc"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search pmc" id="saved-search-pmc-' . htmlspecialchars(rawurlencode(substr($searchname, 4))) . '">';
print htmlspecialchars(substr($searchname, 4));
print '</span><br> <span>' . $last_search;
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
if (!isset($_SESSION['remove_nasaads'])) {
//HOW MANY FLAGGED?
$result = $dbHandle->query("SELECT count(*) FROM flagged WHERE userID=" . intval($_SESSION['user_id']) . " AND database='nasaads'");
if ($result)
$flagged_count = $result->fetchColumn();
$result = null;
?>
<button id="nasalink" title="Search over 10 million records">NASA ADS</button>
<div id="nasaads-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<div class="ui-state-default empty-flagged nasaads"><i class="fa fa-trash-o"></i></div>
<span class="nasaads flagged-items">Flagged Items</span><br>
<span id="nasaads-flagged-count"><?php print isset($flagged_count) ? $flagged_count : '0' ?></span>/100
<div style="clear:both"></div>
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 8) == "nasaads#") {
$searchname_query = $dbHandle->quote($searchname);
$result = $dbHandle->query("SELECT searchvalue FROM searches WHERE userID=$user_query AND searchfield='nasa_last_search' AND searchname=$searchname_query LIMIT 1");
$last_search_stamp = $result->fetchColumn();
$result = null;
$last_search = round((time() - $last_search_stamp) / 86400, 1);
if ($last_search < 1) {
$last_search = round((time() - $last_search_stamp) / 3600);
$last_search .= ' hour' . (($last_search != 1) ? 's' : '') . ' ago';
} elseif ($last_search > 365) {
$last_search = '>1 year ago';
} else {
$last_search = round($last_search);
$last_search .= ' day' . (($last_search != 1) ? 's' : '') . ' ago';
}
if ($last_search_stamp < 2)
$last_search = 'Never';
print '<div class="nasaads">';
print '<div class="ui-state-default del-saved-search nasaads"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search nasaads" id="saved-search-nasaads-' . htmlspecialchars(rawurlencode(substr($searchname, 8))) . '">';
print htmlspecialchars(substr($searchname, 8));
print '</span><br> <span>' . $last_search;
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
if (!isset($_SESSION['remove_arxiv'])) {
//HOW MANY FLAGGED?
$result = $dbHandle->query("SELECT count(*) FROM flagged WHERE userID=" . intval($_SESSION['user_id']) . " AND database='arxiv'");
if ($result)
$flagged_count = $result->fetchColumn();
$result = null;
?>
<button id="arxivlink" title="Search over 1 million records">arXiv</button>
<div id="arxiv-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<div class="ui-state-default empty-flagged arxiv"><i class="fa fa-trash-o"></i></div>
<span class="arxiv flagged-items">Flagged Items</span><br>
<span id="arxiv-flagged-count"><?php print isset($flagged_count) ? $flagged_count : '0' ?></span>/100
<div style="clear:both"></div>
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 6) == "arxiv#") {
$searchname_query = $dbHandle->quote($searchname);
$result = $dbHandle->query("SELECT searchvalue FROM searches WHERE userID=$user_query AND searchfield='arxiv_last_search' AND searchname=$searchname_query LIMIT 1");
$last_search_stamp = $result->fetchColumn();
$result = null;
$last_search = round((time() - $last_search_stamp) / 86400, 1);
if ($last_search < 1) {
$last_search = round((time() - $last_search_stamp) / 3600);
$last_search .= ' hour' . (($last_search != 1) ? 's' : '') . ' ago';
} elseif ($last_search > 365) {
$last_search = '>1 year ago';
} else {
$last_search = round($last_search);
$last_search .= ' day' . (($last_search != 1) ? 's' : '') . ' ago';
}
if ($last_search_stamp < 2)
$last_search = 'Never';
print '<div class="arxiv">';
print '<div class="ui-state-default del-saved-search arxiv"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search arxiv" id="saved-search-arxiv-' . htmlspecialchars(rawurlencode(substr($searchname, 6))) . '">';
print htmlspecialchars(substr($searchname, 6));
print '</span><br> <span>' . $last_search;
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
// if (!isset($_SESSION['remove_ieee'])) {
if (false) {
?>
<button id="ieeelink" title="Search over 3 million records">IEEE Xplore</button>
<div id="ieee-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 5) == "ieee#") {
print '<div class="ieee">';
print '<div class="ui-state-default del-saved-search ieee"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search ieee" id="saved-search-ieee-' . htmlspecialchars(rawurlencode(substr($searchname, 5))) . '">';
print htmlspecialchars(substr($searchname, 5));
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
if (!isset($_SESSION['remove_springer'])) {
?>
<button id="springerlink" title="Search over 8 million records">Springer</button>
<div id="springer-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 9) == "springer#") {
print '<div class="springer">';
print '<div class="ui-state-default del-saved-search springer"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search springer" id="saved-search-springer-' . htmlspecialchars(rawurlencode(substr($searchname, 9))) . '">';
print htmlspecialchars(substr($searchname, 9));
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
if (!isset($_SESSION['remove_highwire'])) {
?>
<button id="highwirelink" title="Search over 7 million records">HighWire Press</button>
<div id="highwire-container" style="margin-top:0.5em;padding-left: 10px;width:190px">
<?php
while (list($key, $searchname) = each($searchnames)) {
if (substr($searchname, 0, 9) == "highwire#") {
print '<div class="highwire">';
print '<div class="ui-state-default del-saved-search highwire"><i class="fa fa-trash-o"></i></div>';
print '<span class="saved-search highwire" id="saved-search-highwire-' . htmlspecialchars(rawurlencode(substr($searchname, 9))) . '">';
print htmlspecialchars(substr($searchname, 9));
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
}
$searchnames = null;
$dbHandle = null;
?>
<br>
</div>
<div style="height:100%;overflow:auto" id="addarticle-right"></div>
<?php
} else {
print 'Super User or User permissions required.';
}
?>