1<?
2//
3// This is used to read in papers in USENIX submission format and enter them into the system
4// This takes a single argument which is the paper number. You need to change '$dir' below.
5//
6
7include('../Code/confHeader.inc');
8$Conf -> connect();
9
10print "Hi!\n";
11
12$paperId = $argv[1];
13$dir = "/home/foobar/grunwald/FAST2004/papers/F$paperId";
14print "dir is $dir\n";
15
16$authorInfo=`cat $dir/info.txt`;
17$title=`cat $dir/title.txt`;
18$abstract=`cat $dir/shortabs.txt`;
19$email=`grep Email: $dir/info.txt | sed -e 's/Email: //' `;
20$paperType=`grep Submission-type: $dir/info.txt | sed -e 's/Submission-type: //' `;
21
22$email=trim($email);
23$paperType=trim($paperType);
24$title=addslashes($title);
25$abstract=addslashes($abstract);
26$authorInfo=addslashes($authorInfo);
27
28if ($paperType=="PostScript") {
29  $paperFile="$dir/abstract.ps";
30  $mimetype="application/postscript";
31} else if ($paperType=="PDF") {
32  $paperFile="$dir/abstract.pdf";
33  $mimetype="application/pdf";
34} else {
35  print "Hey, unknown paper type of *$paperType*..\n";
36}
37
38$id = $Conf->emailRegistered($email);
39if ( $id == 0 ) {
40  $newguy = new Contact();
41  $newguy -> initialize("", "", $email, "", "", "");
42  $result = $newguy -> addToDB($Conf);
43  $id = $Conf->emailRegistered($email);
44}
45
46if ($id == 0 ) {
47  print "Unable to register $email\n";
48} else {
49  print "Author contact is $id\n";
50}
51
52$Conf->qe("DELETE FROM Paper WHERE paperId=$paperId");
53
54$query="INSERT INTO Paper SET "
55. "paperId=$paperId, "
56. "contactId='$id', "
57. "title='$title', "
58. "abstract='$abstract', "
59. "acknowledged=1, "
60. "withdrawn=0, "
61. "authorsResponse='$authorsResponse', "
62. "authorInformation='$authorInfo' "
63;
64//print "Query is $query\n";
65$result = $Conf->q($query);
66if (DB::isError($result)) {
67  print "Error in insert for paper\n";
68}
69
70$Conf->qe("DELETE FROM PaperConflict where paperId=$paperId AND authorId=$id");
71$Conf->qe("INSERT INTO PaperConflict set paperId=$paperId, authorId=$id");
72
73$result = $Conf -> storePaper($paperFile,
74			      $mimetype,
75			      $paperId);
76
77
78?>
79