function getAllPreprints() { global $authClass, $dbClass, $nor_pp_period, $year; core_declare_input("nor_pp_period", $year); if (list($g, $l, $uid) = $authClass->whoami()) { $q = $dbClass->query("SELECT * FROM publications WHERE " . ($authClass->isAdmin() ? "Year='{$nor_pp_period}'" : "Id='{$uid}'") . " ORDER BY Year,Report DESC"); } else { return False; } if ($dbClass->num_rows($q)) { return $q; } else { return False; } }
<?php // ============================================================================ // PREPRINTS/DELETE_PREPRINT.PHP // ============================================================================ require_once "config.manage.php"; core_declare_input("rowId"); if (!$authClass->isAdmin()) { errorPage("Preprints may only be deleted by administrative staff"); } $deleteRes = $dbClass->query("SELECT * FROM publications WHERE RowId='" . $rowId . "'"); $row = $dbClass->next_record($deleteRes); $q = $dbClass->query("UPDATE publications SET " . "Status='free', Field='', Location='', Authors='', " . "Title='', PublIn='' WHERE RowId='" . $rowId . "'"); mail2secretary("Deleted"); logIt("delete", pp_preprintID($row["Year"], $row["Report"]), uid2gecos($row["Id"])); if (file_exists($row["Location"])) { unlink($row["Location"]); } require "show_preprints.php";
<?php // ============================================================================ // PREPRINTS/RESERVE_PPN.PHP // ============================================================================ include_once "config.manage.php"; core_declare_input("res_UID"); core_declare_input("field"); core_declare_input("authors", ""); core_declare_input("title", ""); startPage("Reserve Preprint Number"); if (!$title) { errorPage("Preprint title is missing", "Submit Preprint", "Error"); } if (!$authors) { errorPage("Authors list is missing", "Submit Preprint", "Error"); } if (!($account = core_getpwuid($res_UID, $dbClass))) { bugPage("no account found for UID='{$res_UID}'"); } $res_login = $account["name"]; if (!$authClass->isAdmin() && $res_login != $AUTH_login) { errorPage("Reserving of preprint nbrs for others is only " . "permitted for administrative staff."); } $res_gecos = $account["gecos"]; $res_ppn = pp_reserveNumber($nor_pp_year, $res_UID, $field, $authors, $title); // reread back the record $q = $dbClass->query("SELECT * FROM publications WHERE Year={$nor_pp_year} AND Report={$res_ppn} AND Field='{$field}'"); $row = $dbClass->next_record($q); $_POST["rowId"] = $row["RowId"]; require "update_preprint.inc.php";
<?php // ============================================================================ // PREPRINTS/INDEX.PHP // ============================================================================ require_once "config.php"; if ($rowId = $_GET["selectPP"]) { header("Location: edit_preprints.php?rowId=" . $rowId & nor_pp_mode . "=" . NOR_PP_MODE_EDIT); } core_declare_input("period", $year); core_declare_input("group", "all"); core_declare_input("author", ""); core_declare_input("selectPP", ""); $title = array($NOR_fields[$group]); if ($period != "all") { $title[] = $period; } if (TRUE) { $title[] = "preprints"; } if ($author != "") { $title[] = "with author '" . $author . "'"; } startPage(join(" ", $title)); $t = new table("width='95%'", "<form action='index.php' method='get'>"); $t->tro(); $t->td("align='left'", getSelection()); if ($authClass->authenticated()) { if (getAllPreprints()) { $t->td("", core_getLink("manage preprints", "show_preprints.php")); }
<?php // ============================================================================ // PREPRINTS/SHOW_PREPRINTS.PHP // ============================================================================ require_once "config.manage.php"; startPage("Managing preprints"); $time = time(); $date = getdate($time); $year = $date["year"]; core_declare_input("nor_pp_period", $year); /* * show the legend (edit, delete buttons) */ $my = $authClass->isAdmin() ? "" : " my"; define("PP_PENDING", "manage" . $my . " pending preprints"); define("PP_ALL", "manage all" . $my . " preprints"); /* * draw tabs */ $links = array(); if ($pendingHash = getPendingPreprints()) { $links[PP_PENDING] = $_SERVER["PHP_SELF"] . "?show=" . urlencode(PP_PENDING); } if ($allHash = getAllPreprints()) { if ($dbClass->num_rows($pendingHash) != $dbClass->num_rows($allHash)) { $links[PP_ALL] = $_SERVER["PHP_SELF"] . "?show=" . urlencode(PP_ALL); } } $tabs = new tabs(); $tabs->show($links);
<?php // ============================================================================ // PREPRINTS/EDIT_PREPRINTS.PHP // ============================================================================ require_once "config.manage.php"; core_declare_input("nor_pp_mode"); core_declare_input("nor_pp_period", $year); core_declare_input("rowId", false); core_declare_input("confirmed", false); if ($nor_pp_mode != NOR_PP_MODE_RESERVE && !@$rowId) { errorPage("Entry not selected, please go back and select an entry", "Manage preprints", "Select the preprint"); } switch ($nor_pp_mode) { case NOR_PP_MODE_RESERVE: startPage("Reservation of new Preprint Number"); $row = array("Year" => $year, "Report" => PP_UNDEFINED); $t = new table("", "<form action='reserve_ppn.php' method='post'>" . "<input type='hidden' name='nor_pp_period' value='" . $nor_pp_period . "'>"); $t->tro(); $t->th("", "submitter"); $t->td("", make_user_selection()); $t->trc(); getEditDialog(); $t->tro(); $t->td(); $t->td("", "<input type='submit' value='allocate the preprint number'> " . pp_getLink("cancel", ".")); $t->trc(); $t->close("</form>"); break; case NOR_PP_MODE_UNRESERVE: $res = $dbClass->query("select * from publications where RowId={$rowId}");
<?php // ============================================================================ // PREPRINTS/UPDATE_PREPRINT.INC.PHP // ============================================================================ core_declare_input("rowId"); core_declare_input("field"); core_declare_input("losAlamosLocation", ""); core_declare_input("authors", ""); core_declare_input("title", ""); core_declare_input("journal", ""); core_declare_input("res_UID"); core_declare_input("year"); core_declare_input("location", ""); core_declare_input("report", PP_UNDEFINED); core_declare_input("pp_id", ""); if (!($authClass->isAdmin() || $AUTH_uid == $res_UID)) { errorPage("You can not modify preprint for uid={$res_UID}"); } if (!$title) { errorPage("Preprint title is missing", "Edit Preprints", "User error"); } if (!$authors) { errorPage("Authors list is missing", "Edit Preprints", "User error"); } // this will be overriden if a preprint upload is selected if ($losAlamosLocation) { $location = $losAlamosLocation; } if (@$_FILES["preprint"]) { // Handle file upload