示例#1
0
function nor_auth_is_member($groupname)
{
    nor_auth_require_login();
    $conn = nor_db_connect();
    $res = nor_db_q("select id from groups where groupname = " . nor_sql_quote($groupname), $conn);
    $row = nor_db_fetch_row($res);
    if (!$row) {
        nor_fail("Internal error: Missing group in database.");
    }
    $account_id = $_SESSION['auth_account_id'];
    $group_id = $row[0];
    $res = nor_db_q("select * from account_group_memberships" . " where account_id={$account_id} and group_id={$group_id}", $conn);
    return nor_db_fetch_row($res) !== false;
}
示例#2
0
     $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}");
     $row = mysql_fetch_array($res);
     if (!$authClass->isAdmin() && $AUTH_uid != $row["Id"]) {
         nor_fail("You are not the owner of this preprint number.");
     } else {
         if ($row["Status"] != "reserved" && $row["Status"] != "registered") {
             nor_fail("The preprint is not reserved or registered");
         } else {
             if ($confirmed) {
                 if ($confirmed === "yes") {
                     $dbClass->query("UPDATE publications SET Status='free' WHERE RowId='" . $rowId . "' AND Status='reserved'");
                 }
                 header("Location: show_preprints.php");
                 exit;
             } else {
                 startPage("Cancellation of Preprint Number Reservation");
                 if ($row["Status"] == "registered") {
                     echo "<p>Are you sure you want to delete the <i>registered</i> preprint ";
                 } else {
                     echo "<p>Are you sure you want to release the preprint ";
                 }
                 echo "\nnumber {$row['Year']}-{$row['Report']}?</p>\n<form action='" . $_SERVER["PHP_SELF"] . "'>\n  <input type='hidden' name='nor_pp_mode' value='{$nor_pp_mode}'>\n  <input type='hidden' name='nor_pp_period' value='{$nor_pp_period}'>\n  <input type='hidden' name='rowId' value='{$rowId}'>\n  <p><input type='submit' name='confirmed' value='yes'>\n     <input type='submit' name='confirmed' value='no'></p>\n</form>\n";