-
Notifications
You must be signed in to change notification settings - Fork 0
/
addarticle.php
388 lines (366 loc) · 19.8 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?php
include_once 'data.php';
if (isset($_SESSION['permissions']) && ($_SESSION['permissions'] == 'A' || $_SESSION['permissions'] == 'U')) {
include_once 'functions.php';
database_connect($usersdatabase_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 'settings_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">
<table cellspacing=0 style="margin:8px 0 6px 0;width:93%">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="uploadlink">
Manual Upload
</td>
</tr>
</table>
<table cellspacing=0 style="margin:6px 0;width:93%">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="importlink">
Import Metadata
</td>
</tr>
</table>
<table cellspacing=0 style="margin:6px 0;width:93%">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="batchimportlink">
PDF Batch Import
</td>
</tr>
</table>
<div style="padding-left: 10px;width:190px">
<div class="select-import" id="import-localhost">from localhost</div>
<div class="select-import" id="import-any">from any computer</div>
</div>
<?php
database_connect($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($settings_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;
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 21 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="pubmedlink">
PubMed
</td>
</tr>
</table>
<div id="pubmed-container" style="padding-left: 10px;width:190px">
<div class="ui-state-highlight empty-flagged pubmed" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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-highlight del-saved-search pubmed" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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($settings_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;
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 2 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="pmclink">
PubMed Central
</td>
</tr>
</table>
<div id="pmc-container" style="padding-left: 10px;width:190px">
<div class="ui-state-highlight empty-flagged pmc" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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-highlight del-saved-search pmc" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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($settings_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;
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 9 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="nasalink">
NASA ADS
</td>
</tr>
</table>
<div id="nasaads-container" style="padding-left: 10px;width:190px">
<div class="ui-state-highlight empty-flagged nasaads" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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-highlight del-saved-search nasaads" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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($settings_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;
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 700 thousands records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="arxivlink">
arXiv
</td>
</tr>
</table>
<div id="arxiv-container" style="padding-left: 10px;width:190px">
<div class="ui-state-highlight empty-flagged arxiv" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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-highlight del-saved-search arxiv" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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($settings_remove_ieee)) {
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 3 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="ieeelink">
IEEE Xplore®
</td>
</tr>
</table>
<div id="ieee-container" style="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-highlight del-saved-search ieee" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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($settings_remove_highwire)) {
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 5 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="highwirelink">
HighWire Press®
</td>
</tr>
</table>
<div id="highwire-container" style="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-highlight del-saved-search highwire" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></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>';
}
if (!isset($settings_remove_sciencedirect)) {
/*
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 10 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="sciencedirectlink">
ScienceDirect®
</td>
</tr>
</table>
<div id="sciencedirect-container" style="padding-left: 10px;width:190px">
<?php
while (list($key,$searchname) = each($searchnames)) {
if (substr($searchname, 0, 5) == "sciencedirect#") {
print '<div class="sciencedirect">';
print '<div class="ui-state-highlight del-saved-search sciencedirect" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></div>';
print '<span class="saved-search sciencedirect" id="saved-search-sciencedirect-'.htmlspecialchars(rawurlencode(substr($searchname, 14))).'">';
print htmlspecialchars(substr($searchname, 14));
print '</span></div><div style="clear:both"></div>';
}
}
reset($searchnames);
print '</div>';
*/
}
if (!isset($settings_remove_jstor)) {
?>
<table cellspacing=0 style="margin:6px 0;width:93%" title="Search over 8 million records">
<tr>
<td class="leftleftbutton"> </td>
<td class="leftbutton" id="jstorlink">
JSTOR®
</td>
</tr>
</table>
<div id="jstor-container" style="padding-left: 10px;width:190px">
<?php
while (list($key,$searchname) = each($searchnames)) {
if (substr($searchname, 0, 6) == "jstor#") {
$searchname_query = $dbHandle->quote($searchname);
$result = $dbHandle->query("SELECT searchvalue FROM searches WHERE userID=$user_query AND searchfield='jstor_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="jstor">';
print '<div class="ui-state-highlight del-saved-search jstor" style="float:right;margin:1px 0"><span class="ui-icon ui-icon-trash"></span></div>';
print '<span class="saved-search jstor" id="saved-search-jstor-'.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>';
}
$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.';
}
?>