コード例 #1
0
        {
            elm.style.display = ''
                elmbutton.innerHTML = "Hide Membership List"
        }
    }
    </script>

    <p>This will take about 30 seconds to load while checking
    mailman subscriptions.</p>
    <br>
    <form method="post">
    <table>
<?php 
foreach ($mailing_lists as $list => $description) {
    $list_type = getListType($list);
    $membership = getListMembership($list, $list_type, $moira_entity);
    $is_member = isMemberOfList($membership, $list_type, $email, $moira_entity);
    print '<tr>';
    print '<td>';
    print '<input name="' . $list . '" type="checkbox" value="true"';
    if ($is_member) {
        print ' checked';
    }
    print ">";
    print '<input name="' . $list . '-original" type="hidden" value="';
    if ($is_member) {
        print "true";
    }
    print '">';
    print '<input name="' . $list . '-type" type="hidden" value="' . $list_type . '">';
    print "</td>\n<td>" . $list . "</td>\n<td>" . $description . "</td>\n<td>(" . $list_type . ")</td>\n";
コード例 #2
0
ファイル: utils.php プロジェクト: paultag/puzzle-editing
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);
}