Пример #1
0
		</colgroup>
		<thead>
			<tr>
				<td>Title</td>
				<td style="border-left: none">Voters</td>
				<td style="border-left: none">Votes</td>
				<td style="border-left: none">Available Until</td>
			</tr>
		</thead>
		<tbody>
			<?php 
    foreach ($results as $result) {
        $accessible = TRUE;
        $allowVote = FALSE;
        $voteInfo = communities_polls_latest($result["cpolls_id"]);
        $specificMembers = communities_polls_specific_access($result['cpolls_id']);
        if ($LOGGED_IN) {
            $vote_record = communities_polls_votes_cast_by_member($result["cpolls_id"], $ENTRADA_USER->getActiveId());
        } else {
            $vote_record = array("votes" => 0);
        }
        $allow_main_load = false;
        if ($result["release_date"] && $result["release_date"] > time() || $result["release_until"] && $result["release_until"] < time()) {
            $accessible = FALSE;
        }
        // Check to see if this is a poll that this user can vote in.
        if ($COMMUNITY_ADMIN || ($COMMUNITY_MEMBER && (int) $result['allow_member_vote'] == 1 || !(int) $community_details["community_protected"] && (int) $result['allow_public_vote'] == 1 || !(int) $community_details["community_registration"] && (int) $result['allow_troll_vote'] == 1)) {
            // Check to see if only specific members can vote before checking if they've voted
            if (count($specificMembers) == 0 || is_array($specificMembers) && in_array($ENTRADA_USER->getActiveId(), $specificMembers)) {
                // Check for multiple votes
                if ($result["allow_multiple"] == 0) {
Пример #2
0
/**
 * Add PlotKit to the beginning of the $HEAD array.
 */
array_unshift($HEAD, "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/MochiKit/MochiKit.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/excanvas.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/Base.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/Layout.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/Canvas.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/SweetCanvas.js\"></script>");
$HEAD[] = "<link href=\"" . ENTRADA_URL . "/javascript/calendar/css/xc2_default.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . COMMUNITY_URL . "/javascript/polls.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>";
if ($RECORD_ID) {
    $query = "SELECT * FROM `community_polls` WHERE `community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `cpolls_id` = " . $db->qstr($RECORD_ID);
    $poll_record = $db->GetRow($query);
    if ($poll_record) {
        $terminology = $poll_record["poll_terminology"];
        echo "<h1>View " . $terminology . " Results</h1>\n";
        $query = "\tSELECT * FROM `community_polls_questions`\n\t\t\t\t\tWHERE `cpolls_id` = " . $RECORD_ID . "\n\t\t\t\t\tAND `question_active` = '1'";
        $questions = $db->GetAll($query);
        if ($questions) {
            $specificMembers = communities_polls_specific_access($RECORD_ID);
            $allow_main_load = false;
            $voteInfo = communities_polls_latest($RECORD_ID);
            $voters = $voteInfo["voters"];
            $votesCast = (int) $voteInfo["votes_cast"];
            if ($votesCast > 0) {
                if ($COMMUNITY_ADMIN) {
                    $allow_main_load = true;
                } else {
                    if ($COMMUNITY_MEMBER && (int) $poll_record['allow_member_results'] == 1 || !(int) $community_details["community_protected"] && (int) $poll_record['allow_public_results'] == 1 || !(int) $community_details["community_registration"] && (int) $poll_record['allow_troll_results'] == 1) {
                        if (count($specificMembers) == 0 || is_array($specificMembers) && in_array($ENTRADA_USER->getActiveId(), $specificMembers)) {
                            $allow_main_load = true;
                        }
                    } else {
                        if ($COMMUNITY_MEMBER && (int) $poll_record['allow_member_results_after'] == 1 || !(int) $community_details["community_protected"] && (int) $poll_record['allow_public_results_after'] == 1 || !(int) $community_details["community_registration"] && (int) $poll_record['allow_troll_results_after'] == 1) {
                            if (count($specificMembers) == 0 || is_array($specificMembers) && in_array($ENTRADA_USER->getActiveId(), $specificMembers)) {