Example #1
0
 /** 
  * Returns the type of this playlist.
  * Currently one of: static|dynamic
  *
  * @author Ben Dodson
  * @since 4/23/05
  * @version 4/23/05
  **/
 function getPlType()
 {
     return getListType($this->id);
 }
        } else if (elm.style.display == 'none')
        {
            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 . '">';
Example #3
0
 function listPlaylists($type = "static")
 {
     $a = $this->loadData("playlists");
     if (!is_array($a)) {
         return array();
     } else {
         if ($type == "all") {
             return $a;
         }
         $b = array();
         foreach ($a as $l => $name) {
             if (getListType($l) == $type) {
                 $b[$l] = $name;
             }
         }
         return array_reverse($b);
     }
 }
Example #4
0
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);
}
Example #5
0
        $arr['createpl'] = "true";
        echo '<form method="POST" action="' . urlize($arr) . '">';
        echo '<table width="40%" align="left" border="0"><tr><td>';
        echo word('Name:') . '<input name="query" class="jz_input"></td></tr><tr><td>';
        echo '<input type="radio" class="jz_radio" name="' . jz_encode('pltype') . '" value="' . jz_encode('static') . '" CHECKED>Static';
        echo '<input type="radio" class="jz_radio" name="' . jz_encode('pltype') . '" value="' . jz_encode('dynamic') . '">Dynamic</td></tr><tr><td>';
        echo '<input type="submit" class="jz_submit" name="' . jz_encode('createpl2') . '" value="' . word('Go') . '"></td></tr>';
        echo '</table>';
        $this->closeBlock();
        return;
    }
}
// * * * * * * * * *
// DYNAMIC PLAYLISTS:
// * * * * * * * * *
if (getListType($_SESSION['jz_playlist']) == "dynamic") {
    $i = 0;
    $pl = $jzUSER->loadPlaylist();
    if (isset($_POST['addrule'])) {
        if ($_POST['source1'] != "") {
            $source = $_POST['source1'];
        } else {
            if ($_POST['source2'] != "") {
                $source = $_POST['source2'];
            } else {
                $source = "";
            }
        }
        $pl->addRule($_POST['amount'], $_POST['function'], $_POST['type'], $source);
        $jzUSER->storePlaylist($pl);
    }