print "<h2>Subscription results</h2>\n"; $first_time = false; } if ($list_type == "moira") { if (!$krb5ccname) { $krb5ccname = tempnam(TMPDIR, "krb5ccname"); exec("KRB5CCNAME=" . $krb5ccname . " " . GET_KEYTAB); } if ($new_value == "true") { addToMoiraList($list, $moira_entity, $krb5ccname); } else { deleteFromMoiraList($list, $moira_entity, $krb5ccname); } } elseif ($list_type == "mailman") { if ($new_value == "true") { addToMailmanList($list, $email); } else { deleteFromMailmanList($list, $email); } } else { print "<p>Don't know how to manage " . $list . " (" . $list_type . ")</p><br>"; } } } } if ($krb5ccname) { unlink($krb5ccname); } print "<h2>Subscriptions for " . $moira_entity . " (" . $email . ")</h2>"; ?>
function addEditors($uid, $pid, $add) { if (!$add) { return; } if (!canViewPuzzle($uid, $pid)) { utilsError("You do not have permission to modify puzzle {$pid}."); } $name = getUserName($uid); $comment = 'Added '; if (EDITOR_MAILING_LIST) { $list_type = getListType(EDITOR_MAILING_LIST); if ($list_type == "moira") { $krb5ccname = tempnam(TMPDIR, "krb5ccname"); exec("KRB5CCNAME=" . $krb5ccname . " " . GET_KEYTAB); } $membership = getListMembership(EDITOR_MAILING_LIST, $list_type, $moira_entity); } foreach ($add as $editor) { // Check that this editor is available for this puzzle if (!isEditorAvailable($editor, $pid)) { utilsError(getUserName($editor) . ' is not available.'); } // Add editor to puzzle $sql = sprintf("INSERT INTO editor_queue (uid, pid) VALUES ('%s', '%s')", mysql_real_escape_string($editor), mysql_real_escape_string($pid)); query_db($sql); // Add to comment if ($comment != 'Added ') { $comment .= ', '; } $comment .= getUserName($editor); // Email new editor $title = getTitle($pid); $codename = getCodename($pid); $subject = "Discussion editor on {$codename} (puzzle {$pid})"; $message = "{$name} added you as a discussion editor to {$title} (puzzle {$pid})."; $link = URL . "/puzzle.php?pid={$pid}"; sendEmail($editor, $subject, $message, $link); // Subscribe editors to comments on their puzzles if (isAutoSubEditor($editor)) { subscribe($editor, $pid); } if (EDITOR_MAILING_LIST) { $email = getEmail($editor); $moira_entity = getMoiraEntity($email); if (!isMemberOfList($membership, $list_type, $email, $moira_entity)) { if ($list_type == "moira") { addToMoiraList(EDITOR_MAILING_LIST, $moira_entity, $krb5ccname); } else { if ($list_type == "mailman") { addToMailmanList(EDITOR_MAILING_LIST, $email); } } } } } if (EDITOR_MAILING_LIST && list_type == "moira") { unlink($krb5ccname); } $comment .= ' as discussion editor'; if (count($add) > 1) { $comment .= "s"; } addComment($uid, $pid, $comment, TRUE); }