$result = $db->GetRow($query);
        if ($result) {
            $_SESSION[APPLICATION_IDENTIFIER]["tmp"][$MODULE]["poll_id"] = $result["poll_id"];
        } else {
            $query = "\tSELECT a.`poll_id`\n\t\t\t\t\t\tFROM `poll_questions` AS a\n\t\t\t\t\t\tLEFT JOIN `poll_results` AS b\n\t\t\t\t\t\tON b.`poll_id` = a.`poll_id`\n\t\t\t\t\t\tWHERE b.`result_id` IS NOT NULL\n\t\t\t\t\t\tAND (`poll_from` = '0' OR `poll_from` <= '" . time() . "')\n\t\t\t\t\t\tAND (`poll_until` = '0' OR `poll_until` >= '" . time() . "')\n\t\t\t\t\t\tORDER BY RAND() LIMIT 1";
            $result = $db->GetRow($query);
            if ($result) {
                $_SESSION[APPLICATION_IDENTIFIER]["tmp"][$MODULE]["poll_id"] = $result["poll_id"];
            } else {
                $_SESSION[APPLICATION_IDENTIFIER]["tmp"][$MODULE]["poll_id"] = 0;
            }
        }
    }
    if ($_SESSION[APPLICATION_IDENTIFIER]["tmp"][$MODULE]["poll_id"]) {
        $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/poll-js.php\"></script>\n";
        new_sidebar_item($translate->_("Quick Polls"), poll_display($_SESSION[APPLICATION_IDENTIFIER]["tmp"][$MODULE]["poll_id"]), "quick-poll", "open");
    }
    if (defined("ENABLE_NOTICES") && ENABLE_NOTICES) {
        $notices_to_display = Models_Notice::fetchUserNotices();
        if ($notices_to_display && ($total_notices = count($notices_to_display))) {
            ?>
			<form action="<?php 
            echo ENTRADA_RELATIVE;
            ?>
/dashboard?action=read" method="post">
				<div class="dashboard-notices alert">
					<div class="row-fluid">
						<div class="span8">
							<h2><?php 
            echo APPLICATION_NAME . " " . $translate->_("Message Center");
            ?>
Beispiel #2
0
echo "<form accept-charset=\"utf-8\" name=\"f_delete\" action=\"close_poll.php\" method=\"post\" target=\"_self\">\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
echo "  ", form_input_hidden('msg', htmlentities_array($msg)), "\n";
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"720\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"left\" class=\"posthead\">\n";
echo "              <table class=\"posthead\" width=\"100%\">\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" class=\"subhead\">", gettext("End Poll"), "</td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"left\"><br />";
poll_display($tid, $thread_data['LENGTH'], $pid, $thread_data['FID'], false, $thread_data['CLOSED'], false, $show_sigs, true);
echo "                  </td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"left\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
echo "    </tr>\n";
echo "    <tr>\n";
echo "      <td align=\"left\">&nbsp;</td>\n";
echo "    </tr>\n";
echo "    <tr>\n";
Beispiel #3
0
echo "                      </tr>\n";
echo "                    </table>\n";
echo "                  </td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
if (!$new_thread && $reply_to_pid > 0) {
    echo "              <table class=\"posthead\" width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td align=\"left\" class=\"subhead\">", gettext("In reply to"), "</td>\n";
    echo "                </tr>\n";
    if ($thread_data['POLL_FLAG'] == 'Y' && $reply_message['PID'] == 1) {
        echo "                <tr>\n";
        echo "                  <td align=\"left\"><br />", poll_display($reply_to_tid, $thread_data['LENGTH'], $reply_to_pid, $thread_data['FID'], false, false, false, $show_sigs, true), "</td>\n";
        echo "                </tr>\n";
    } else {
        echo "                <tr>\n";
        echo "                  <td align=\"left\"><br />", message_display($reply_to_tid, $reply_message, $thread_data['LENGTH'], $reply_to_pid, $thread_data['FID'], false, false, false, false, $show_sigs, true), "</td>\n";
        echo "                </tr>\n";
    }
    echo "                <tr>\n";
    echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
    echo "                </tr>\n";
    echo "              </table>\n";
}
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
Beispiel #4
0
echo "      <td align=\"center\">", form_submit("post", gettext("Post")), "&nbsp;", form_submit("more", gettext("More")), "&nbsp;", form_button("cancel", gettext("Cancel")), "</td>\n";
echo "    </tr>\n";
echo "  </table>\n";
echo "</form>\n";
echo "</div>\n";
echo "<div id=\"messages\" data-navigation=\"{$tid}_{$pid}_{$thread_data['LENGTH']}_{$posts_per_page}\">\n";
if ($msg_count > 0) {
    foreach ($messages as $message_number => $message) {
        if (isset($message['RELATIONSHIP']) && ($message['RELATIONSHIP'] & USER_IGNORED || $message['RELATIONSHIP'] & USER_IGNORED_COMPLETELY)) {
            $message['CONTENT'] = gettext("Ignored");
        } else {
            $message['CONTENT'] = message_get_content($tid, $message['PID']);
        }
        if ($thread_data['POLL_FLAG'] == 'Y') {
            if ($message['PID'] == 1) {
                poll_display($tid, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], $show_sigs, false, $highlight_array);
                $last_pid = $message['PID'];
            } else {
                message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, $show_sigs, false, $highlight_array);
                $last_pid = $message['PID'];
            }
        } else {
            message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], false, $show_sigs, false, $highlight_array);
            $last_pid = $message['PID'];
        }
        if (adsense_check_user() && adsense_check_page($message_number, $posts_per_page, $thread_data['LENGTH'])) {
            adsense_output_html();
            echo "<br />\n";
        }
    }
}
Beispiel #5
0
echo "                    </table>\n";
echo "                  </td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
if (!$new_thread && $reply_to_pid > 0) {
    echo "              <table class=\"posthead\" width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td align=\"left\" class=\"subhead\">", gettext("In reply to"), "</td>\n";
    echo "                </tr>\n";
    if ($thread_data['POLL_FLAG'] == 'Y' && $reply_message['PID'] == 1) {
        echo "                <tr>\n";
        echo "                  <td align=\"left\"><br />";
        poll_display($tid, $thread_data['LENGTH'], $reply_to_pid, $thread_data['FID'], false, false, $show_sigs, true);
        echo "                  </td>\n";
        echo "                </tr>\n";
    } else {
        echo "                <tr>\n";
        echo "                  <td align=\"left\"><br />";
        message_display($tid, $reply_message, $thread_data['LENGTH'], $reply_to_pid, $thread_data['FID'], false, false, false, $show_sigs, true);
        echo "                  </td>\n";
        echo "                </tr>\n";
    }
    echo "                <tr>\n";
    echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
    echo "                </tr>\n";
    echo "              </table>\n";
}
echo "            </td>\n";
        $POLL_TARGETS["all"] = "Poll all students, faculty &amp; staff";
        $POLL_TARGETS["students"] = "Poll all students";
        $active_cohorts = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
        if (isset($active_cohorts) && !empty($active_cohorts)) {
            foreach ($active_cohorts as $cohort) {
                $POLL_TARGETS[$cohort["group_id"]] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Poll " . html_encode($cohort["group_name"]);
            }
        }
        $POLL_TARGETS["faculty"] = "Poll all faculty";
        $POLL_TARGETS["staff"] = "Poll all staff";
        if (isset($_GET["id"]) && ($tmp_input = clean_input($_GET["id"], array("nows", "int")))) {
            $POLL_ID = $tmp_input;
        } else {
            $POLL_ID = 0;
        }
        $module_file = $router->getRoute();
        if ($module_file) {
            require_once $module_file;
        }
        $query = "\tSELECT a.`poll_id`\n\t\t\t\t\tFROM `poll_questions` AS a\n\t\t\t\t\tLEFT JOIN `poll_results` AS b\n\t\t\t\t\tON b.`poll_id` = a.`poll_id`\n\t\t\t\t\tWHERE b.`result_id` IS NOT NULL\n\t\t\t\t\tORDER BY RAND() LIMIT 1";
        $result = $db->GetRow($query);
        if ($result) {
            $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/poll-js.php\"></script>\n";
            new_sidebar_item("Poll Results", poll_display($result["poll_id"]), "quick-poll-results", "open");
        }
        /**
         * Check if preferences need to be updated on the server at this point.
         */
        preferences_update($MODULE, $PREFERENCES);
    }
}
Beispiel #7
0
/**
 * display a poll
 *
 * @return null
 */
function Polls_pollDisplay()
{
    require_once SCRIPTBASE . 'ww.plugins/polls/frontend/polls.php';
    return poll_display();
}
    $POLL_ID = 0;
    if (isset($_GET["poll_id"]) && (int) trim($_GET["poll_id"])) {
        $POLL_ID = (int) trim($_GET["poll_id"]);
    } elseif (isset($_POST["poll_id"]) && (int) trim($_POST["poll_id"])) {
        $POLL_ID = (int) trim($_POST["poll_id"]);
    }
    if ($POLL_ID) {
        if (isset($_GET["pollSend"])) {
            if (poll_prevote_check($POLL_ID)) {
                $PROCESSED = array();
                $PROCESSED["poll_id"] = $POLL_ID;
                $PROCESSED["answer_id"] = (int) trim($_POST["poll_answer_id"]);
                $PROCESSED["proxy_id"] = (int) $ENTRADA_USER->getID();
                $PROCESSED["ip"] = $_SERVER["REMOTE_ADDR"];
                $PROCESSED["timestamp"] = time();
                if ($db->AutoExecute("poll_results", $PROCESSED, "INSERT")) {
                    application_log("success", "Successfully recorded result for poll [" . $POLL_ID . "]");
                } else {
                    application_log("error", "Unable to store poll results.");
                }
            }
            echo poll_results($POLL_ID);
        } elseif (isset($_GET["pollGet"])) {
            echo poll_results($POLL_ID);
        }
    } else {
        echo poll_display(0);
    }
} else {
    application_log("notice", "Unauthorised access to the serve-polls.php file.");
}
if (!($folder_data = folder_get($thread_data['FID']))) {
    html_draw_error(gettext("The requested folder could not be found or access was denied."));
}
if (!($poll_data = poll_get($tid))) {
    html_draw_error(gettext("The requested thread could not be found or access was denied."));
}
$show_sigs = session::get_value('VIEW_SIGS') == 'N' ? false : true;
$highlight_array = array();
$poll_user_count = 0;
$poll_results = poll_get_votes($tid);
$user_poll_votes_array = poll_get_user_votes($tid);
html_draw_top("title={$thread_data['TITLE']}", 'pm_popup_disabled', 'class=window_title', 'poll.js');
echo "<div align=\"center\">\n";
echo "<table width=\"96%\" border=\"0\">\n";
echo "  <tr>\n";
echo "    <td align=\"left\">", messages_top($tid, 1, $thread_data['FID'], $folder_data['TITLE'], $thread_data['TITLE'], $thread_data['INTEREST'], $folder_data['INTEREST'], $thread_data['STICKY'], $thread_data['CLOSED'], $thread_data['ADMIN_LOCK'], $thread_data['DELETED'] == 'Y', false, array()), "</td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "<table width=\"100%\" border=\"0\">\n";
echo "  <tr>\n";
echo "    <td width=\"2%\">&nbsp;</td>\n";
echo "    <td align=\"left\">", poll_display($tid, $thread_data['LENGTH'], 1, $thread_data['FID'], false, $thread_data['CLOSED'], false, $show_sigs, true, $highlight_array), "</td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<form accept-charset=\"utf-8\" method=\"post\" action=\"poll_results.php\" target=\"_self\">\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
echo "  ", form_button('close_popup', gettext("Close")), "\n";
echo "</form>\n";
echo "</div>\n";
html_draw_bottom();
Beispiel #10
0
echo "    <td align=\"right\">";
messages_social_links($tid);
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</div>\n";
if ($message) {
    $first_msg = $message['PID'];
    $message['CONTENT'] = message_get_content($tid, $message['PID']);
    echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n";
    echo "  <tr>\n";
    echo "    <td align=\"left\" width=\"2%\" valign=\"top\">&nbsp;</td>\n";
    echo "    <td align=\"center\">\n";
    if ($thread_data['POLL_FLAG'] == 'Y') {
        if ($message['PID'] == 1) {
            poll_display($tid, $thread_data['LENGTH'], $first_msg, $thread_data['FID'], true, $thread_data['CLOSED'], $show_sigs, true);
        } else {
            message_display($tid, $message, $thread_data['LENGTH'], $first_msg, $thread_data['FID'], true, $thread_data['CLOSED'], true, $show_sigs, true);
        }
    } else {
        message_display($tid, $message, $thread_data['LENGTH'], $first_msg, $thread_data['FID'], true, $thread_data['CLOSED'], false, $show_sigs, true);
    }
    echo "    </td>\n";
    echo "    <td width=\"2%\">&nbsp;</td>\n";
    echo "  </tr>\n";
    echo "</table>\n";
    if (adsense_check_user() && adsense_check_page($message['PID'], 1, $thread_data['LENGTH'])) {
        adsense_output_html();
        echo "<br />\n";
    }
}