Exemple #1
0
function _compo2_admin($params)
{
    $user = $params["user"];
    if ($user->user_level < 7) {
        compo2_error("admin");
    }
    $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "preview";
    if ($action == "default") {
        $action = "preview";
    }
    if ($action == "edit") {
        return _compo2_active_form($params, $_REQUEST["uid"], 1);
    } elseif ($action == "save") {
        return _compo2_active_save($params, $_REQUEST["uid"], 1);
    } elseif ($action == "preview") {
        return _compo2_preview($params, "?admin=1&action=edit");
    } elseif ($action == "ratelist") {
        return _compo2_rate_list($params);
    } elseif ($action == "results") {
        return _compo2_results_results($params);
    } elseif ($action == "top") {
        return _compo2_results_top($params);
    } elseif ($action == "recalc") {
        return _compo2_admin_recalc($params);
    } elseif ($action == "resetcache") {
        return _compo2_admin_resetcache($params);
    } elseif ($action == "get_user") {
        return _compo2_admin_get_user($params);
    } elseif ($action == "cron") {
        return _compo2_mike_cron($params);
    }
}
Exemple #2
0
function _compo2_closed($params)
{
    $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "default";
    if ($action == "default") {
        return _compo2_preview($params);
    } elseif ($action == "preview") {
        return _compo2_preview($params);
    } elseif ($action == "me") {
        _compo2_preview_me($params);
    } elseif ($action == "edit") {
        return _compo2_active_form($params);
    } elseif ($action == "save") {
        return _compo2_active_save($params);
    }
}
Exemple #3
0
function _compo2_results($params)
{
    $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "default";
    if ($action == "default") {
        return _compo2_results_results($params);
    } elseif ($action == "preview") {
        return _compo2_preview($params);
    } elseif ($action == "me") {
        _compo2_preview_me($params);
    } elseif ($action == "top") {
        return _compo2_results_top($params);
    } elseif ($action == "rate") {
        header("Location: ./?action=preview&uid=" . intval($_REQUEST["uid"]));
        die;
    } elseif ($action == "edit") {
        return _compo2_active_form($params);
    } elseif ($action == "save") {
        return _compo2_active_save($params);
    }
}
Exemple #4
0
function _compo2_active($params)
{
    if (!$params["uid"]) {
        echo "<p class='message'>You must sign in to submit an Entry.</p>";
        return _compo2_preview($params);
    }
    $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "default";
    if ($action == "default") {
        $ce = compo2_entry_load($params["cid"], $params["uid"]);
        $action = "edit";
        if ($ce["id"]) {
            $action = "preview";
        }
    }
    if ($action == "edit") {
        return _compo2_active_form($params);
    } elseif ($action == "save") {
        return _compo2_active_save($params);
    } elseif ($action == "me") {
        _compo2_preview_me($params);
    } elseif ($action == "preview") {
        return _compo2_preview($params);
    }
}
Exemple #5
0
function _compo2_rate($params)
{
    if (!$params["uid"]) {
        echo "<p class='message'>You must sign in to vote.</p>";
        return _compo2_preview($params);
    }
    //    echo "<!--";
    //    print_r($params);
    //    echo "-->";
    // handle non-competitors ..
    $ce = compo2_entry_load($params["cid"], $params["uid"]);
    if (!intval($params["pubvote"])) {
        if (!$ce["id"] || !$ce["active"]) {
            $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "preview";
            if ($action == "default") {
                $action = "preview";
            }
            if ($action == "edit") {
                return _compo2_active_form($params);
            } elseif ($action == "save") {
                return _compo2_active_save($params);
            } elseif ($action == "me") {
                _compo2_preview_me($params);
            } elseif ($action == "preview") {
                echo "<p class='message'>Voting is only available to participants.</p>";
                if (!isset($params["locked"])) {
                    if (is_array($params["opendivs"]) && count($params["opendivs"]) > 0 || trim($params["opendivs"]) !== "") {
                        echo "<p><a href='?action=edit'>Submit an Entry</a></p>";
                    }
                }
                return _compo2_preview($params);
            } elseif ($action == "rate") {
                header("Location: ./?action=preview&uid=" . intval($_REQUEST["uid"]));
                die;
            }
            return;
        }
    }
    $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "default";
    if ($action == "default") {
        return _compo2_rate_list($params);
    } elseif ($action == "preview") {
        // send user to rate page
        if (isset($_REQUEST["uid"])) {
            return _compo2_rate_rate($params);
        } else {
            echo "<p><a href='?action=default'>Back to Rate Entries</a></p>";
            return _compo2_preview($params, "?action=preview");
        }
        /*    } elseif ($action == "comments") {
              return _compo2_rate_comments($params);*/
    } elseif ($action == "me") {
        _compo2_preview_me($params);
    } elseif ($action == "rate") {
        // deprecated, but left here to keep old links live
        return _compo2_rate_rate($params);
    } elseif ($action == "submit") {
        return _compo2_rate_submit($params);
    } elseif ($action == "edit") {
        return _compo2_active_form($params);
    } elseif ($action == "save") {
        return _compo2_active_save($params);
    }
}