Exemplo n.º 1
0
                         <a href="/2/1" class="sectionLink"><img src="/img/informationSmall.png?2" alt="Information Exchange" title="Module 2: Information Exchange" width="38" height="38" /></a> 
                        <a href="/1/1" class="sectionLink"><img src="/img/walkingSmall.png?1" alt="Walking to the counter" title="Module 1: Walking to the counter" width="38" height="38" /></a>
                    </p>
                </nav>
                <?php 
                }
                ?>
                 	
                <?php 
                $main_content = getContent('main_content', $page);
                $userLogin = $_SESSION['userID'];
                if ($page == '4___print') {
                    $userLogin = preg_replace('/\\@/', '-_-', $_SESSION['userID']);
                    $survey = array(1 => $_REQUEST['survey1'], 2 => $_REQUEST['survey2'], 3 => $_REQUEST['survey3'], 4 => $_REQUEST['survey4'], 5 => $_REQUEST['survey5'], 6 => $_REQUEST['survey6'], 7 => $_REQUEST['survey7'], 8 => $_REQUEST['survey8'], 9 => $_REQUEST['survey9'], 10 => $_REQUEST['survey10']);
                    if ($survey[1] != '') {
                        survey($survey);
                    }
                    if ($completed === 4) {
                        ?>
                            <h1>Certificate of Completion</h1>
                            <p><strong><?php 
                        echo getInfo("fullname", $userLogin);
                        ?>
</strong> has successfully completed training on identifying possible medical impairments during the license renewal process. The training is meant to help with the identification of drivers who may have vision, cognitive, or psychomotor impairments and refer them for additional evaluation.</p>
                           
                            <p><img src="/img/check.png?4" alt="Check box"> Walking to the Counter<br />
                            <img src="/img/check.png?4" alt="Check box"> Information Exchange<br /> 
                            <img src="/img/check.png?4" alt="Check box"> Testing<br /> 
                            <img src="/img/check.png?4" alt="Check box"> State Reporting</p>
                            <br />
                            <button id="printResults">Print</button>
Exemplo n.º 2
0
function survey_vote($id)
{
    global $db;
    if (isset($_GET['ajax'])) {
        ob_end_clean();
        $db->setMode(0);
    }
    $umfrage = $db->fetch_assoc('SELECT `start`, `ende`, `antworten`, `sperre` FROM ' . DB_PRE . 'ecp_survey WHERE (access = "" OR ' . $_SESSION['access_search'] . ') AND surveyID = ' . $id);
    if (isset($umfrage['antworten'])) {
        $sperre = false;
        if (isset($_COOKIE['surveys'][$id]) and $_COOKIE['surveys'][$id]) {
            if ($_COOKIE['surveys'][$id] + $umfrage['sperre'] > time()) {
                $zeit = $_COOKIE['surveys'][$id];
                $sperre = true;
            }
        } elseif (isset($_SESSION['userID'])) {
            $zeit = @$db->result(DB_PRE . 'ecp_survey_votes', 'votedatum', 'userID = ' . $_SESSION['userID'] . ' AND surID = ' . $id . ' ORDER BY votedatum DESC LIMIT 1');
            if ((int) $zeit + $umfrage['sperre'] > time()) {
                $sperre = true;
            }
        } else {
            $zeit = $db->result(DB_PRE . 'ecp_survey_votes', 'votedatum', 'IP = \'' . $_SERVER['REMOTE_ADDR'] . '\' AND surID = ' . $id . ' ORDER BY votedatum DESC LIMIT 1');
            if ((int) $zeit + $umfrage['sperre'] > time()) {
                $sperre = true;
            }
        }
        if ($umfrage['start'] > time() or $umfrage['ende'] < time()) {
            if (isset($_GET['ajax'])) {
                echo SURVEY_NOT_AKTIV;
            } else {
                table(ERROR, SURVEY_NOT_AKTIV);
                survey();
            }
        } elseif ($sperre) {
            if (isset($_GET['ajax'])) {
                echo str_replace('{zeit}', ($zeit + $umfrage['sperre'] - time()) / 60, SURVEY_RELOAD_LOCK);
            } else {
                table(ERROR, str_replace('{zeit}', ($zeit + $umfrage['sperre'] - time()) / 60, SURVEY_RELOAD_LOCK));
                survey();
            }
        } else {
            if ($umfrage['antworten'] == 1) {
                $aid = (int) @$_POST['answer'];
                if ($aid) {
                    if ($db->result(DB_PRE . 'ecp_survey_answers', 'COUNT(answerID)', 'sID = ' . $id . ' AND answerID = ' . $aid)) {
                        if ($db->query('UPDATE ' . DB_PRE . 'ecp_survey_answers SET votes = votes+1 WHERE sID = ' . $id . ' AND answerID = ' . $aid)) {
                            $db->query('INSERT INTO ' . DB_PRE . 'ecp_survey_votes (`surID`, `userID`, `IP`, `votedatum`) VALUES (' . $id . ', ' . (int) @$_SESSION['userID'] . ', \'' . $_SERVER['REMOTE_ADDR'] . '\', ' . time() . ')');
                            setcookie("survey[{$id}]", time(), time() + 365 * 86400);
                            if (isset($_GET['ajax'])) {
                                echo 'ok';
                            } else {
                                header1('?section=survey');
                            }
                        }
                    } else {
                        if (isset($_GET['ajax'])) {
                            echo SURVEY_CHOOSE_EQAL_ID;
                        } else {
                            table(ERROR, SURVEY_CHOOSE_EQAL_ID);
                            survey();
                        }
                    }
                } else {
                    if (isset($_GET['ajax'])) {
                        echo SURVEY_MAKE_A_CHOOSE;
                    } else {
                        table(ERROR, SURVEY_MAKE_A_CHOOSE);
                        survey();
                    }
                }
            } else {
                $db->query('SELECT answerID FROM ' . DB_PRE . 'ecp_survey_answers WHERE sID = ' . $id);
                $answers = array();
                while ($row = $db->fetch_assoc()) {
                    $answers[] = $row['answerID'];
                }
                $antworten = '';
                foreach ($_POST as $key => $value) {
                    if (strpos($key, 'answer_') !== false) {
                        $key = (int) substr($key, strpos($key, '_') + 1);
                        if (in_array($key, $answers)) {
                            @($antworten .= ' OR answerID = ' . $key);
                            @$gesamt++;
                        }
                    }
                }
                if ($gesamt > $umfrage['antworten']) {
                    if (isset($_GET['ajax'])) {
                        echo str_replace('{anzahl}', $umfrage['antworten'], SURVEY_TOO_MANY);
                    } else {
                        table(ERROR, str_replace('{anzahl}', $umfrage['antworten'], SURVEY_TOO_MANY));
                        survey();
                    }
                } elseif (strlen($antworten)) {
                    if ($db->query('UPDATE ' . DB_PRE . 'ecp_survey_answers SET votes = votes+1 WHERE sID = ' . $id . ' AND (' . substr($antworten, 4) . ')')) {
                        $db->query('INSERT INTO ' . DB_PRE . 'ecp_survey_votes (`surID`, `userID`, `IP`, `votedatum`) VALUES (' . $id . ', ' . (int) @$_SESSION['userID'] . ', \'' . $_SERVER['REMOTE_ADDR'] . '\', ' . time() . ')');
                        setcookie("survey[{$id}]", time(), time() + 365 * 86400);
                        if (isset($_GET['ajax'])) {
                            echo 'ok';
                        } else {
                            header1('?section=survey');
                        }
                    }
                } else {
                    if (isset($_GET['ajax'])) {
                        echo SURVEY_MAKE_A_CHOOSE;
                    } else {
                        table(ERROR, SURVEY_MAKE_A_CHOOSE);
                        survey();
                    }
                }
            }
        }
    } else {
        if (isset($_GET['ajax'])) {
            echo NO_ENTRIES_ID;
        } else {
            table(ERROR, NO_ENTRIES_ID);
            survey();
        }
    }
    if (isset($_GET['ajax'])) {
        die;
    }
}
Exemplo n.º 3
0
function manage_surveys()
{
    global $table_prefix, $wpdb;
    $survey_table = $table_prefix . "surveys";
    if (isset($_REQUEST["wpsurv_submit"])) {
        require_once 'functions.php';
        if ($_POST["wpsurv_submit"] == __('Edit', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Cancel', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Back to Edit Survey', 'wp-surveys')) {
            edit($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Update', 'wp-surveys')) {
            update($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Update Options', 'wp-surveys')) {
            update_options($_POST['survey_id'], $_POST['question_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Activate', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Make Active', 'wp-surveys')) {
            activate($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Retire', 'wp-surveys')) {
            retire($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Update Leaderboard', 'wp-surveys')) {
            recach_utility($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Edit Options', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Add Some Options', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Edit or Add more Options', 'wp-surveys')) {
            edit_options($_POST['survey_id'], $_POST['question_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Add More Questions', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Add Some Questions', 'wp-surveys')) {
            add_question($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Step 2', 'wp-surveys')) {
            step2($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Create Question', 'wp-surveys')) {
            create_quest($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Change Survey', 'wp-surveys') || $_POST["wpsurv_submit"] == __('Add Survey', 'wp-surveys')) {
            survey($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('Add This Survey', 'wp-surveys')) {
            add_survey($_POST['survey_id']);
        } elseif ($_POST["wpsurv_submit"] == __('View Survey Results', 'wp-surveys')) {
            results($_POST['survey_id']);
        }
        //elseif($_POST["wpsurv_submit"] == __('View Survey Results in CSV File', 'wp-surveys'))
        //results_CSV($_POST['survey_id']);
        //elseif($_POST["wpsurv_submit"] == __('Delete File', 'wp-surveys'))
        //delete_file($_POST['survey_id']);
    } else {
        $current_plugins = get_option('active_plugins');
        if (file_exists(ABSPATH . PLUGINDIR . '/polyglot.php') && in_array('polyglot.php', $current_plugins)) {
            $polyglot = true;
        }
        echo '<div class="wrap">';
        $open_surveys = $wpdb->get_results("SELECT * FROM `" . $survey_table . "` WHERE `survey_open`='1' LIMIT 1;", ARRAY_A);
        echo '<h2>' . __('Survey Management', 'wp-surveys') . '</h2><h3><u>' . __('Active Survey', 'wp-surveys') . '</u>:</h3>';
        if ($open_surveys) {
            echo '<table class="widefat" width="100%" cellpadding="4" cellspacing="4">';
            echo '<tr><th align="left">' . __('Title', 'wp-surveys') . '</th><th align="left">' . __('Description', 'wp-surveys') . '</th><th></th><th></th><th></th></tr>';
            foreach ($open_surveys as $survey) {
                echo '<tr class="alternate">';
                if ($polyglot) {
                    echo '<td><b>' . polyglot_filter(stripcslashes($survey['survey_name'])) . '</b></td><td>' . polyglot_filter(stripcslashes($survey['survey_describe'])) . '</td>';
                } elseif (!$polyglot) {
                    echo '<td><b>' . stripcslashes($survey['survey_name']) . '</b></td><td>' . stripcslashes($survey['survey_describe']) . '</td>';
                }
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Edit', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Retire', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('View Survey Results', 'wp-surveys') . '" /></form></td>';
                //echo '<td align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="'.$survey['survey_id'].'" />';
                //echo '<input type="submit" name="wpsurv_submit" value="'.__('View Survey Results in CSV File', 'wp-surveys').'" /></form></td>';
                echo '</tr>';
            }
            echo '</table>';
            $next = ++$survey['survey_id'];
            echo '<br /><form method="post" action=""><input type="hidden" name="survey_id" value="' . $next . '" /><input class="button" type="submit" name="wpsurv_submit" value="' . __('Change Survey', 'wp-surveys') . '" title="' . __('Current Survey will be saved as Retired', 'wp-surveys') . '" /></form>';
        } else {
            echo __('There are no open tournaments or contests.', 'wp-surveys') . '.';
            //$last = $wpdb->get_var("SELECT COUNT(`survey_id`) FROM `".$survey_table."`;");
            $last = $wpdb->get_var("SELECT `survey_id` FROM `" . $survey_table . "` ORDER BY `survey_id` DESC LIMIT 1;");
            $next = ++$last;
            echo '<br /><br /><form method="post" action=""><input type="hidden" name="survey_id" value="' . $next . '" /><input class="button" type="submit" name="wpsurv_submit" value="' . __('Add Survey', 'wp-surveys') . '" /></form>';
        }
        $closed_surveys = $wpdb->get_results("SELECT * FROM `" . $survey_table . "` WHERE `survey_open`='0';", ARRAY_A);
        echo '<h3><u>' . __('Retired Surveys', 'wp-surveys') . '</u>:</h3>';
        if ($closed_surveys) {
            echo '<table class="widefat" width="100%" cellpadding="4" cellspacing="4">';
            echo '<tr><th align="left">' . __('Title', 'wp-surveys') . '</th><th align="left">' . __('Description', 'wp-surveys') . '</th><th></th><th></th><th></th></tr>';
            foreach ($closed_surveys as $survey) {
                echo '<tr class="alternate">';
                if ($polyglot) {
                    echo '<td><b>' . polyglot_filter(stripcslashes($survey['survey_name'])) . '</b></td><td>' . polyglot_filter(stripcslashes($survey['survey_describe'])) . '</td>';
                } elseif (!$polyglot) {
                    echo '<td><b>' . stripcslashes($survey['survey_name']) . '</b></td><td>' . stripcslashes($survey['survey_describe']) . '</td>';
                }
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Edit', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('Make Active', 'wp-surveys') . '" /></form></td>';
                echo '<td class="submit" align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="' . $survey['survey_id'] . '" />';
                echo '<input type="submit" name="wpsurv_submit" value="' . __('View Survey Results', 'wp-surveys') . '" /></form></td>';
                //echo '<td align="center"><form method="post" action=""><input type="hidden" name="survey_id" value="'.$survey['survey_id'].'" />';
                //echo '<input type="submit" name="wpsurv_submit" value="'.__('View Survey Results in CSV File', 'wp-surveys').'" /></form></td>';
                echo '</tr>';
            }
            echo '</table>';
        } else {
            echo __('There are no retired surveys', 'wp-surveys') . '.';
        }
        echo '</div>';
    }
}
Exemplo n.º 4
0
function forum_survey_vote($id)
{
    global $db;
    if (isset($_GET['ajax'])) {
        ob_end_clean();
        $db->setMode(0);
    }
    if (isset($_SESSION['userID'])) {
        $survey = $db->fetch_assoc('SELECT threadID, boardID, `ende`, `frage`, `antworten`, COUNT(voteID) AS anzahl FROM `' . DB_PRE . 'ecp_forum_survey` LEFT JOIN ' . DB_PRE . 'ecp_forum_survey_votes ON (fsurID = ' . $id . ' AND userID = ' . (int) @$_SESSION['userID'] . ') WHERE fsurveyID = ' . $id . ' GROUP BY fsurveyID');
    } else {
        $survey = $db->fetch_assoc('SELECT threadID, boardID, `ende`, `frage`, `antworten`, COUNT(voteID) AS anzahl FROM `' . DB_PRE . 'ecp_forum_survey` LEFT JOIN ' . DB_PRE . 'ecp_forum_survey_votes ON (fsurID = ' . $id . ' AND IP = \'' . $_SERVER['REMOTE_ADDR'] . '\') WHERE fsurveyID = ' . $id . ' GROUP BY fsurveyID');
    }
    $thread = $db->fetch_assoc('SELECT `threadID`, `bID`, ' . DB_PRE . 'ecp_forum_threads.closed, a.rightsread, a.votesurvey, b.rightsread as parentRead FROM ' . DB_PRE . 'ecp_forum_threads LEFT JOIN ' . DB_PRE . 'ecp_forum_boards AS a ON (bID = a.boardID) LEFT JOIN ' . DB_PRE . 'ecp_forum_boards AS b ON (b.boardID = a.boardparentID) WHERE threadID = ' . $survey['threadID'] . ' AND bID = ' . $survey['boardID']);
    if (find_access($thread['rightsread']) and find_access($thread['parentRead']) and find_access($thread['votesurvey'])) {
        if ($survey['anzahl'] or isset($_COOKIE['forum']['survey_' . $id]) or !find_access($thread['votesurvey']) or $survey['ende'] != 0 and $survey['ende'] < time()) {
            if (isset($_GET['ajax'])) {
                echo SURVEY_NOT_AKTIV;
            } else {
                table(ERROR, SURVEY_NOT_AKTIV);
                survey();
            }
        } else {
            if ($survey['antworten'] == 1) {
                $aid = (int) @$_POST['answer'];
                if ($aid) {
                    if ($db->result(DB_PRE . 'ecp_forum_survey_answers', 'COUNT(answerID)', 'fsID = ' . $id . ' AND answerID = ' . $aid)) {
                        if ($db->query('UPDATE ' . DB_PRE . 'ecp_forum_survey_answers SET votes = votes+1 WHERE fsID = ' . $id . ' AND answerID = ' . $aid)) {
                            $db->query('INSERT INTO ' . DB_PRE . 'ecp_forum_survey_votes (`fsurID`, `userID`, `IP`, `votedatum`) VALUES (' . $id . ', ' . (int) @$_SESSION['userID'] . ', \'' . $_SERVER['REMOTE_ADDR'] . '\', ' . time() . ')');
                            setcookie("forum[survey_{$id}]", time(), time() + 365 * 86400);
                            if (isset($_GET['ajax'])) {
                                echo 'ok';
                            } else {
                                header1('?section=forum&action=thread&boardID=' . $survey['boardID'] . '&threadID=' . $survey['threadID']);
                            }
                        }
                    } else {
                        if (isset($_GET['ajax'])) {
                            echo SURVEY_CHOOSE_EQAL_ID;
                        } else {
                            table(ERROR, SURVEY_CHOOSE_EQAL_ID);
                            forum_thread($survey['boardID'], $survey['threadID']);
                        }
                    }
                } else {
                    if (isset($_GET['ajax'])) {
                        echo SURVEY_MAKE_A_CHOOSE;
                    } else {
                        table(ERROR, SURVEY_MAKE_A_CHOOSE);
                        forum_thread($survey['boardID'], $survey['threadID']);
                    }
                }
            } else {
                $db->query('SELECT answerID FROM ' . DB_PRE . 'ecp_forum_survey_answers WHERE fsID = ' . $id);
                $answers = array();
                while ($row = $db->fetch_assoc()) {
                    $answers[] = $row['answerID'];
                }
                $antworten = '';
                foreach ($_POST as $key => $value) {
                    if (strpos($key, 'answer_') !== false) {
                        $key = (int) substr($key, strpos($key, '_') + 1);
                        if (in_array($key, $answers)) {
                            @($antworten .= ' OR answerID = ' . $key);
                            @$gesamt++;
                        }
                    }
                }
                if ($gesamt > $survey['antworten']) {
                    if (isset($_GET['ajax'])) {
                        echo str_replace('{anzahl}', $survey['antworten'], SURVEY_TOO_MANY);
                    } else {
                        table(ERROR, str_replace('{anzahl}', $survey['antworten'], SURVEY_TOO_MANY));
                        forum_thread($survey['boardID'], $survey['threadID']);
                    }
                } elseif (strlen($antworten)) {
                    if ($db->query('UPDATE ' . DB_PRE . 'ecp_forum_survey_answers SET votes = votes+1 WHERE fsID = ' . $id . ' AND (' . substr($antworten, 4) . ')')) {
                        $db->query('INSERT INTO ' . DB_PRE . 'ecp_forum_survey_votes (`fsurID`, `userID`, `IP`, `votedatum`) VALUES (' . $id . ', ' . (int) @$_SESSION['userID'] . ', \'' . $_SERVER['REMOTE_ADDR'] . '\', ' . time() . ')');
                        setcookie("forum[survey_{$id}]", time(), time() + 365 * 86400);
                        if (isset($_GET['ajax'])) {
                            echo 'ok';
                        } else {
                            header1('?section=forum&action=thread&boardID=' . $survey['boardID'] . '&threadID=' . $survey['threadID']);
                        }
                    }
                } else {
                    if (isset($_GET['ajax'])) {
                        echo SURVEY_MAKE_A_CHOOSE;
                    } else {
                        table(ERROR, SURVEY_MAKE_A_CHOOSE);
                        forum_thread($survey['boardID'], $survey['threadID']);
                    }
                }
            }
        }
    }
    if (isset($_GET['ajax'])) {
        die;
    }
}
Exemplo n.º 5
0
function add_survey($survey_id)
{
    if (trim($_POST['name']) == '') {
        echo '<div id="message" class="updated fade"><p><strong>' . __('Please, fill Title field!!', 'wp-surveys') . ' </strong></p></div>';
        survey($survey_id, trim($_POST['name']), trim($_POST['describe']));
    } else {
        global $table_prefix, $wpdb;
        $survey_table = $table_prefix . "surveys";
        if ($wpdb->query("SELECT `survey_id` FROM `" . $survey_table . "` WHERE `survey_open` = '1';")) {
            $wpdb->query("UPDATE `" . $survey_table . "` SET `survey_open` = '0' WHERE `survey_open` = '1';");
        }
        $this_sql = "INSERT INTO `" . $survey_table . "` (`survey_name`, `survey_describe`, `survey_open`) VALUES ('" . $wpdb->escape(trim($_POST['name'])) . "', '" . $wpdb->escape(trim($_POST['describe'])) . "', 1);";
        if ($wpdb->query($this_sql)) {
            echo '<div id="message" class="updated fade"><h3><strong>' . __('Survey succesfully created!', 'wp-surveys') . '</strong></h3><p>' . __('Thank You. A new survey has been added and the previous survey has been retired', 'wp-surveys') . '.</p>';
            echo '<form method="post" action=""><p class="submit"><input type="hidden" name="survey_id" value="' . $survey_id . '" /><input type="submit" name="wpsurv_submit" value="' . __('Add Some Questions', 'wp-surveys') . '" /></p></form>';
            echo '<p><a href="http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '">' . __('Continue', 'wp-surveys') . '...</a></p></div>';
        }
    }
}