/** * Attempt to authenticate the current request based on request params and basic auth * @param iclicker_controller $cntlr the controller instance * @throws ClickerSecurityException if authentication is impossible given the request values * @throws ClickerSSLRequiredException if the auth request is bad (requires SSL but SSL not used) */ function iclicker_handle_authn($cntlr) { global $CFG; // extract the authn params $auth_username = optional_param(iclicker_controller::LOGIN, NULL, PARAM_NOTAGS); $auth_password = optional_param(iclicker_controller::PASSWORD, NULL, PARAM_NOTAGS); if (empty($auth_username) && isset($_SERVER['PHP_AUTH_USER'])) { // no username found in normal params so try to get basic auth $auth_username = $_SERVER['PHP_AUTH_USER']; $auth_password = $_SERVER['PHP_AUTH_PW']; if (empty($auth_username)) { // attempt to get it from the header as a final try list($auth_username, $auth_password) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); } } if (iclicker_service::$block_iclicker_sso_enabled && !empty($auth_password)) { // when SSO is enabled and the password is set it means this is not actually a user password so we can proceed without requiring SSL } else { // this is a user password so https must be used if the loginhttps option is enabled $ssl_request = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443; $ssl_required = isset($CFG->forcehttps) && $CFG->forcehttps == true || isset($CFG->loginhttps) && $CFG->loginhttps == true; if ($ssl_required && !$ssl_request) { throw new ClickerSSLRequiredException('SSL is required when performing a user login (and sending user passwords)'); } } //$session_id = optional_param(iclicker_controller::SESSION_ID, NULL, PARAM_NOTAGS); if (!empty($auth_username)) { $sso_key = optional_param(iclicker_controller::SSO_KEY, NULL, PARAM_NOTAGS); iclicker_service::authenticate_user($auth_username, $auth_password, $sso_key); // throws exception if fails //} else if ($session_id) { // $valid = FALSE; // validate the session key // if (! $valid) { // throw new SecurityException("Invalid "+iclicker_controller::SESSION_ID+" provided, session may have expired, send new login credentials"); // } } $current_user_id = iclicker_service::get_current_user_id(); if (isset($current_user_id)) { $cntlr->setHeader(iclicker_controller::SESSION_ID, sesskey()); $cntlr->setHeader('_userId', $current_user_id); } }
* You should have received a copy of the GNU General Public License * along with i>clicker Moodle integrate. If not, see <http://www.gnu.org/licenses/>. */ /* $Id$ */ /** * Handles rendering the form for creating new pages and the submission of the form as well * NOTE: table is named iclicker */ require_once '../../config.php'; global $CFG, $USER, $COURSE, $OUTPUT, $PAGE; require_once 'iclicker_service.php'; require_once 'controller.php'; $site = get_site(); require_login($site); // activate the controller $cntlr = new iclicker_controller(); $cntlr->processInstructor(); extract($cntlr->results); // begin rendering $PAGE->set_title(strip_tags($site->fullname) . ':' . iclicker_service::msg('app.iclicker') . ':' . iclicker_service::msg('inst.title')); $PAGE->set_heading(iclicker_service::msg('app.iclicker') . ' ' . iclicker_service::msg('inst.title')); $PAGE->navbar->add(iclicker_service::msg('inst.title')); $PAGE->set_focuscontrol(''); $PAGE->set_cacheable(false); $PAGE->requires->css(iclicker_service::BLOCK_PATH . '/css/iclicker.css'); $PAGE->set_url(iclicker_service::BLOCK_PATH . '/instructor.php'); //$PAGE->requires->js('mod/mymod/styles.css'); echo $OUTPUT->header(); ?> <div class="iclicker">
* * You should have received a copy of the GNU General Public License * along with i>clicker Moodle integrate. If not, see <http://www.gnu.org/licenses/>. */ /* $Id: admin.php 173 2012-11-04 20:05:05Z azeckoski@gmail.com $ */ /** * Handles rendering the CSV which represents all clicker registrations in the system */ require_once '../../config.php'; global $CFG, $USER, $COURSE, $OUTPUT, $PAGE; require_once 'iclicker_service.php'; require_once 'controller.php'; $site = get_site(); require_login($site); // activate the controller $cntlr = new iclicker_controller(); $cntlr->processAdminCSV(); extract($cntlr->results); // set CSV headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Transfer-Encoding: binary"); header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=\"registrations.csv\";"); // begin rendering $regHeaderData = array('ClickerId', 'UserId', 'UserDisplayName', 'UserEmail', 'Activated', 'TimeCreated', 'TimeModified'); $row = iclicker_service::make_CSV_row($regHeaderData); echo $row; foreach ($registrations as $registration) {
* You should have received a copy of the GNU General Public License * along with i>clicker Moodle integrate. If not, see <http://www.gnu.org/licenses/>. */ /* $Id$ */ /** * Handles rendering the form for creating new pages and the submission of the form as well * NOTE: table is named iclicker */ require_once '../../config.php'; global $CFG, $USER, $COURSE, $OUTPUT, $PAGE; require_once 'iclicker_service.php'; require_once 'controller.php'; $site = get_site(); require_login($site); // activate the controller $cntlr = new iclicker_controller(); $cntlr->processAdmin(); extract($cntlr->results); // begin rendering $PAGE->set_title(strip_tags($site->fullname) . ':' . iclicker_service::msg('app.iclicker') . ':' . iclicker_service::msg('admin.title')); $PAGE->set_heading(iclicker_service::msg('app.iclicker') . ' ' . iclicker_service::msg('admin.title')); $PAGE->navbar->add(iclicker_service::msg('admin.title')); $PAGE->set_focuscontrol(''); $PAGE->set_cacheable(false); // NOTE: switching over to locally hosted JS and CSS files $PAGE->requires->js(iclicker_service::BLOCK_PATH . '/js/jquery-1.11.0.min.js', true); $PAGE->requires->js(iclicker_service::BLOCK_PATH . '/js/jquery-ui-1.10.4.custom.min.js', true); $PAGE->requires->css(iclicker_service::BLOCK_PATH . '/css/jquery-ui-1.10.4.custom.min.css'); $PAGE->requires->css(iclicker_service::BLOCK_PATH . '/css/iclicker.css'); $PAGE->set_url(iclicker_service::BLOCK_PATH . '/admin.php'); echo $OUTPUT->header();
* You should have received a copy of the GNU General Public License * along with i>clicker Moodle integrate. If not, see <http://www.gnu.org/licenses/>. */ /* $Id: instructor.php 119 2012-04-15 22:16:23Z azeckoski@gmail.com $ */ /** * Handles rendering the form for creating new pages and the submission of the form as well * NOTE: table is named iclicker */ require_once '../../config.php'; global $CFG, $USER, $COURSE, $OUTPUT, $PAGE; require_once 'iclicker_service.php'; require_once 'controller.php'; $site = get_site(); require_login($site); // activate the controller $cntlr = new iclicker_controller(); $cntlr->processInstructorSSO(); extract($cntlr->results); // begin rendering $PAGE->set_title(strip_tags($site->fullname) . ':' . iclicker_service::msg('app.iclicker') . ':' . iclicker_service::msg('inst.sso.title')); $PAGE->set_heading(iclicker_service::msg('app.iclicker') . ' ' . iclicker_service::msg('inst.sso.title')); $PAGE->navbar->add(iclicker_service::msg('inst.sso.title')); $PAGE->set_focuscontrol(''); $PAGE->set_cacheable(false); $PAGE->requires->css(iclicker_service::BLOCK_PATH . '/css/iclicker.css'); $PAGE->set_url(iclicker_service::BLOCK_PATH . '/instructor_sso.php'); //$PAGE->requires->js('mod/mymod/styles.css'); echo $OUTPUT->header(); ?> <div class="iclicker">
* * You should have received a copy of the GNU General Public License * along with i>clicker Moodle integrate. If not, see <http://www.gnu.org/licenses/>. */ /* $Id$ */ /** * Handles rendering the form for creating new pages and the submission of the form as well */ require_once '../../config.php'; global $CFG, $USER, $COURSE, $OUTPUT, $PAGE; require_once 'iclicker_service.php'; require_once 'controller.php'; $site = get_site(); require_login($site); // activate the controller $cntlr = new iclicker_controller(); $cntlr->processRegistration(); extract($cntlr->results); // begin rendering $PAGE->set_title(strip_tags($site->fullname) . ':' . iclicker_service::msg('app.iclicker') . ':' . iclicker_service::msg('reg.title')); $PAGE->set_heading(iclicker_service::msg('app.iclicker') . ' ' . iclicker_service::msg('reg.title')); $PAGE->navbar->add(iclicker_service::msg('reg.title')); $PAGE->set_focuscontrol(''); $PAGE->set_cacheable(false); // NOTE: switching over to locally hosted JS and CSS files $PAGE->requires->js(iclicker_service::BLOCK_PATH . '/js/jquery-1.11.0.min.js', true); $PAGE->requires->js(iclicker_service::BLOCK_PATH . '/js/jquery-ui-1.10.4.custom.min.js', true); $PAGE->requires->css(iclicker_service::BLOCK_PATH . '/css/jquery-ui-1.10.4.custom.min.css'); $PAGE->requires->css(iclicker_service::BLOCK_PATH . '/css/iclicker.css'); $PAGE->set_url(iclicker_service::BLOCK_PATH . '/registration.php'); //$PAGE->requires->js('mod/mymod/styles.css');