function show_edit_form($id, $sid, $assign) { global $m, $langGradeOk, $tool_content, $course_code; $sub = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d", $sid); if (count($sub) > 0) { $uid_2_name = display_user($sub->uid); if (!empty($sub->group_id)) { $group_submission = "({$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&group_id={$sub->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($sub->group_id) . "</a>)"; } else { $group_submission = ''; } $tool_content .= "\n <form method='post' action='index.php?course={$course_code}'>\n <input type='hidden' name='assignment' value='{$id}'>\n <input type='hidden' name='submission' value='{$sid}'>\n <fieldset>\n <legend>{$m['addgradecomments']}</legend>\n <table width='99%' class='tbl'>\n <tr>\n <th class='left' width='180'>{$m['username']}:</th>\n <td>{$uid_2_name} " . q($group_submission) . "</td>\n </tr>\n <tr>\n <th class='left'>{$m['sub_date']}:</th>\n <td>" . q($sub->submission_date) . "</td></tr>\n <tr>\n <th class='left'>{$m['filename']}:</th>\n <td><a href='index.php?course={$course_code}&get={$sub->id}'>" . q($sub->file_name) . "</a></td>\n </tr>\n <tr>\n <th class='left'>{$m['grade']}:</th>\n <td><input type='text' name='grade' maxlength='3' size='3' value='" . q($sub->grade) . "'></td></tr>\n <tr>\n <th class='left'>{$m['gradecomments']}:</th>\n <td><textarea cols='60' rows='3' name='comments'>" . q($sub->grade_comments) . "</textarea></td>\n </tr>\n <tr>\n <th><label for='email_button'>{$m['email_users']}:</label></th>\n <td><input type='checkbox' value='1' id='email_button' name='email'></td>\n </tr>\n <tr>\n <th class='left'> </th>\n <td><input class='btn btn-primary' type='submit' name='grade_comments' value='{$langGradeOk}'></td>\n </tr>\n </table>\n </fieldset>\n </form><br>"; } else { Session::Messages($m['WorkNoSubmission'], 'alert-danger'); redirect_to_home_page('modules/work/index.php?course=' . $course_code . '&id=' . $id); } }
} } $auth_user_info['email'] = $_SESSION['shib_email']; $uname = $_SESSION['shib_uname']; $is_valid = true; } elseif ($is_submit or $auth == 7 and !$submit) { unset($_SESSION['was_validated']); if ($auth != 7 and $auth != 6 and ($uname === '' or $passwd === '')) { $tool_content .= "<div class='alert alert-danger'>{$ldapempty} {$errormessage}</div>"; draw($tool_content, 0); exit; } else { // try to authenticate user $auth_method_settings = get_auth_settings($auth); if ($auth == 6) { redirect_to_home_page('secure/index_reg.php' . ($prof ? '?p=1' : '')); } $is_valid = auth_user_login($auth, $uname, $passwd, $auth_method_settings); } if ($auth == 7) { if (phpCAS::checkAuthentication()) { $uname = phpCAS::getUser(); $cas = get_auth_settings($auth); // store CAS released attributes in $GLOBALS['auth_user_info'] get_cas_attrs(phpCAS::getAttributes(), $cas); if (!empty($uname)) { $is_valid = true; } } } }
}, $auth_settings, $auth_instructions, $auth_title, $auth); if ($result) { if ($result->affectedRows == 1) { $tool_content .= "<div class='alert alert-success'>$langHasActivate</div>"; } else { $tool_content .= "<div class='alert alert-warning'>$langAlreadyActiv</div>"; } } } } } else { // handle reloads on auth_process.php after authentication check // also handles requests with empty $auth // without this, a form with just username/password is displayed if (!$auth) { redirect_to_home_page('modules/admin/auth.php'); } $pageName = get_auth_info($auth); // get authentication settings if ($auth != 6) { $auth_data = get_auth_settings($auth); } // display form $tool_content .= "<div class='form-wrapper'> <form class='form-horizontal' name='authmenu' method='post' action='$_SERVER[SCRIPT_NAME]'> <fieldset> <input type='hidden' name='auth' value='" . intval($auth) . "'>"; if (!empty($_SESSION['cas_warn']) && $_SESSION['cas_do']) {
} } // Visibility commands if (isset($_GET['mkVisibl']) || isset($_GET['mkInvisibl'])) { if (isset($_GET['mkVisibl'])) { $newVisibilityStatus = 1; $visibilityPath = $_GET['mkVisibl']; } else { $newVisibilityStatus = 0; $visibilityPath = $_GET['mkInvisibl']; } Database::get()->query("UPDATE document SET visible=?d\n WHERE {$group_sql} AND\n path = ?s", $newVisibilityStatus, $visibilityPath); $r = Database::get()->querySingle("SELECT id FROM document WHERE {$group_sql} AND path = ?s", $visibilityPath); Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $r->id); Session::Messages($langViMod, 'alert-success'); redirect_to_home_page("modules/document/index.php?course={$course_code}"); } // Public accessibility commands if (isset($_GET['public']) || isset($_GET['limited'])) { $new_public_status = intval(isset($_GET['public'])); $path = isset($_GET['public']) ? $_GET['public'] : $_GET['limited']; Database::get()->query("UPDATE document SET public = ?d\n WHERE {$group_sql} AND\n path = ?s", $new_public_status, $path); $r = Database::get()->querySingle("SELECT id FROM document WHERE {$group_sql} AND path = ?s", $path); Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $r->id); $action_message = "<div class='alert alert-success'>{$langViMod}</div>"; } } // teacher only // Common for teachers and students // define current directory // Check if $var is set and return it - if $is_file, then return only dirname part
start_date = ?t, finish_date = ?t, keywords = '', created = " . DBHelper::timeAfter() . ", glossary_expand = 0, glossary_index = 1, description = ?s", $code, $language, $title, $_POST['formvisible'], intval($course_license), $prof_names, $code, $doc_quota * 1024 * 1024, $video_quota * 1024 * 1024, $group_quota * 1024 * 1024, $dropbox_quota * 1024 * 1024, $password, $view_type, $_POST['start_date'], $_POST['finish_date'], $description); $new_course_id = $result->lastInsertID; if (!$new_course_id) { Session::Messages($langGeneralError); redirect_to_home_page('modules/create_course/create_course.php'); } //===================course format and start and finish date=============== if ($view_type == "weekly") { //get the last inserted id as the course id $course_id = $new_course_id; $begin = new DateTime($_POST['start_date']); //check if there is no end date if ($_POST['finish_date'] == "" || $_POST['finish_date'] == '0000-00-00') { $end = new DateTime($begin->format("Y-m-d")); $end->add(new DateInterval('P26W')); } else {
// indexing was previously on, but now set to off, need to empty it if (get_config('enable_indexing') && !$enable_indexing) { require_once 'modules/search/indexer.class.php'; Indexer::deleteAll(); } // update table `config` foreach ($config_vars as $varname => $what) { set_config($varname, $GLOBALS[$varname]); } // Display result message Session::flash('scheduleIndexing', $scheduleIndexing); Session::Messages($langFileUpdatedSuccess, 'alert-success'); redirect_to_home_page('modules/admin/eclassconf.php'); } // end of if($submit) else { // Display config.php edit form $head_content .= " <script> $(function() { $('body').scrollspy({ target: '#affixedSideNav' }); }); </script> "; // Display link to index.php $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "index.php",
} } if (isset($require_departmentmanage_user) && $require_departmentmanage_user) { if (!($is_admin or $is_departmentmanage_user)) { $toolContent_ErrorExists = $langCheckDepartmentManageUser; } } if (!isset($guest_allowed) || $guest_allowed != true) { if (check_guest()) { $toolContent_ErrorExists = $langCheckGuest; } } if (isset($_SESSION['mail_verification_required']) && !isset($mail_ver_excluded)) { // don't redirect to mail verification on logout if (!isset($_GET['logout'])) { redirect_to_home_page('modules/auth/mail_verify_change.php'); } } // Restore saved old_dbname function function restore_dbname_override($do_unset = false) { if (defined('old_dbname')) { $_SESSION['dbname'] = old_dbname; } elseif ($do_unset) { unset($_SESSION['dbname']); } } // Temporary dbname override if (isset($_GET['course'])) { if (isset($_SESSION['dbname'])) { define('old_dbname', $_SESSION['dbname']);
} $ev = add_event($event_title, $content, $startdate, $duration, $recursion); foreach($ev['event'] as $id) { $agdx->store($id); } } Session::Messages($langStoredOK, 'alert-success'); redirect_to_home_page("modules/agenda/index.php?course=$course_code"); } elseif (isset($_GET['delete']) && $_GET['delete'] == 'yes') { $resp = (isset($_GET['rep']) && $_GET['rep'] == 'yes')? delete_recursive_event($id):delete_event($id); $agdx->remove($id); $msgresp = ($resp['success'])? $langDeleteOK : $langDeleteError.": ".$resp['message']; $alerttype = ($resp['success'])? 'alert-success' : 'alert-error'; Session::Messages($msgresp, $alerttype); redirect_to_home_page("modules/agenda/index.php?course=$course_code"); } $is_recursive_event = false; if (isset($_GET['addEvent']) or isset($_GET['edit'])) { $pageName = $langAddEvent; $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label', 'show' => $is_editor))); $navigation[] = array("url" => $_SERVER['SCRIPT_NAME'] . "?course=$course_code", "name" => $langAgenda); $applytogroup = ''; if (isset($id) && $id) { $myrow = Database::get()->querySingle("SELECT * FROM agenda WHERE course_id = ?d AND id = ?d", $course_id, $id);
redirect_to_home_page("modules/exercise/question_pool.php?course={$course_code}" . (isset($fromExercise) ? "&fromExercise={$fromExercise}" : "") . "&exerciseId={$exerciseId}"); } elseif (isset($_GET['recup']) && isset($fromExercise)) { $recup = intval($_GET['recup']); // construction of the Question object $objQuestionTmp = new Question(); // if the question exists if ($objQuestionTmp->read($recup)) { // adds the exercise ID into the list of exercises for the current question $objQuestionTmp->addToList($fromExercise); } // destruction of the Question object unset($objQuestionTmp); // adds the question ID into the list of questions for the current exercise $objExercise->addToList($recup); Session::Messages($langQuestionReused, 'alert-success'); redirect_to_home_page("modules/exercise/question_pool.php?course={$course_code}" . (isset($fromExercise) ? "&fromExercise={$fromExercise}" : "") . "&exerciseId={$exerciseId}"); } if (isset($fromExercise)) { $action_bar_options[] = array('title' => $langGoBackToEx, 'url' => "admin.php?course={$course_code}&exerciseId={$fromExercise}", 'icon' => 'fa-reply', 'level' => 'primary-label'); } else { $action_bar_options = array(array('title' => $langNewQu, 'url' => "admin.php?course={$course_code}&newQuestion=yes", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langImportQTI, 'url' => "admin.php?course={$course_code}&importIMSQTI=yes", 'icon' => 'fa-download', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langExportQTI, 'url' => "question_pool.php?" . $_SERVER['QUERY_STRING'] . "&exportIMSQTI=yes", 'icon' => 'fa-upload', 'level' => 'primary-label', 'button-class' => 'btn-success')); } $tool_content .= action_bar($action_bar_options); if (isset($fromExercise)) { $result = Database::get()->queryArray("SELECT id, title FROM `exercise` WHERE course_id = ?d AND id <> ?d ORDER BY id", $course_id, $fromExercise); } else { $result = Database::get()->queryArray("SELECT id, title FROM `exercise` WHERE course_id = ?d ORDER BY id", $course_id); } $exercise_options = "<option value = '0'>-- {$langAllExercises} --</option>\n\n <option value = '-1' " . (isset($exerciseId) && $exerciseId == -1 ? "selected='selected'" : "") . ">-- {$langOrphanQuestions} --</option>\n"; foreach ($result as $row) { $exercise_options .= "\n <option value='" . $row->id . "' " . (isset($exerciseId) && $exerciseId == $row->id ? "selected='selected'" : "") . ">{$row->title}</option>\n";
// for real uids not equal to admin if ($u !== false && $u > 1) { // full deletion $success = deleteUser($u, true); // progress report if ($success === true) { Session::Messages("{$langUserWithId} {$line} {$langWasDeleted}", 'alert-success'); redirect_to_home_page('modules/admin/multideluser.php'); } else { Session::Messages("{$langErrorDelete}: {$line}", 'alert-danger'); redirect_to_home_page('modules/admin/multideluser.php'); } } } } redirect_to_home_page('modules/admin/multideluser.php'); } else { $usernames = ''; if (isset($_POST['dellall_submit'])) { // get the incoming values $search = isset($_POST['search']) ? $_POST['search'] : ''; $c = isset($_POST['c']) ? intval($_POST['c']) : ''; $lname = isset($_POST['lname']) ? $_POST['lname'] : ''; $fname = isset($_POST['fname']) ? $_POST['fname'] : ''; $uname = isset($_POST['uname']) ? canonicalize_whitespace($_POST['uname']) : ''; $am = isset($_POST['am']) ? $_POST['am'] : ''; $verified_mail = isset($_POST['verified_mail']) ? intval($_POST['verified_mail']) : 3; $user_type = isset($_POST['user_type']) ? $_POST['user_type'] : ''; $auth_type = isset($_POST['auth_type']) ? $_POST['auth_type'] : ''; $email = isset($_POST['email']) ? mb_strtolower(trim($_POST['email'])) : ''; $reg_flag = isset($_POST['reg_flag']) ? intval($_POST['reg_flag']) : '';
</div> </form> </div>"; } else { if (isset($_SESSION['uid']) and $_GET['u'] == $_SESSION['uid']) { $q = Database::get()->query("DELETE from course_user WHERE course_id = ?d AND user_id = ?d", $cid, $_GET['u']); if ($q->affectedRows > 0) { Log::record($cid, MODULE_ID_USERS, LOG_DELETE, array('uid' => $_GET['u'], 'right' => 0)); $code = course_id_to_code($cid); // clear session access to lesson unset($_SESSION['dbname']); unset($_SESSION['cid_tmp']); unset($_SESSION['courses'][$code]); Session::Messages($langCoursDelSuccess, 'alert-success'); redirect_to_home_page('main/portfolio.php'); } else { $tool_content .= "<div class='alert alert-danger'>$langCoursError</div>"; } } $tool_content .= "<br><br><div align=right><a href='../index.php' class=mainpage>$langBack</a></div>"; } if (isset($_SESSION['uid'])) { draw($tool_content, 1); } else { draw($tool_content, 0); }
} catch (Exception $ex) { require_once 'include/not_installed.php'; } if (isset($language)) { // Old-style config.php, redirect to upgrade $language = langname_to_code($language); if (isset($_SESSION['langswitch'])) { $_SESSION['langswitch'] = langname_to_code($_SESSION['langswitch']); } $session = new Session(); $uid = $session->user_id; if (!isset($active_ui_languages)) { $active_ui_languages = array('el'); } if (!defined('UPGRADE')) { redirect_to_home_page('upgrade/'); } } else { // Global configuration $siteName = get_config('site_name'); $Institution = get_config('institution'); $InstitutionUrl = get_config('institution_url'); $urlServer = get_config('base_url'); $urlSecure = get_config('secure_url'); if (empty($urlSecure)) { $urlSecure = $urlServer; } $session = new Session(); $uid = $session->user_id; $language = $session->language; }
if ($comments_enabled) { if ($post->getCommenting() == 1) { commenting_add_js(); //add js files needed for comments $comm = new Commenting('blogpost', $post->getId()); if ($blog_type == 'course_blog') { $tool_content .= $comm->put($course_code, $is_editor, $uid, true); } elseif ($blog_type == 'perso_blog') { $tool_content .= $comm->put(NULL, $is_blog_editor, $uid, true); } } } } else { Session::Messages($langBlogPostNotFound); redirect_to_home_page("modules/blog/index.php?$url_params"); } } //show all blog posts if ($action == "showBlog") { if ($blog_type == 'course_blog') { $allow_to_create = $blog->permCreate($is_editor, $stud_allow_create, $uid); } elseif ($blog_type == 'perso_blog') { $allow_to_create = $is_blog_editor; } $tool_content .= action_bar(array( array('title' => $langBlogAddPost, 'url' => "$_SERVER[SCRIPT_NAME]?$url_params&action=createPost", 'icon' => 'fa-plus-circle',
<div class='col-sm-offset-3 col-sm-9'> <input class='btn btn-primary' type='submit' name='changePass' value='$langModify'> <a class='btn btn-default' href='{$urlServer}modules/admin/edituser.php?u=" . urlencode($_REQUEST['userid']) . "'>$langCancel</a> </div> </fieldset> ". generate_csrf_token_form_field() ." </form> </div>"; } else { $userid = intval($_POST['userid']); if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error(); if (empty($_POST['password_form']) || empty($_POST['password_form1'])) { Session::Messages($langFieldsMissing); redirect_to_home_page("modules/admin/password.php?userid=" . urlencode($userid)); } if ($_POST['password_form1'] !== $_POST['password_form']) { Session::Messages($langPassTwo); redirect_to_home_page("modules/admin/password.php?userid=" . urlencode($userid)); } // All checks ok. Change password! $hasher = new PasswordHash(8, false); $new_pass = $hasher->HashPassword($_POST['password_form']); Database::get()->query("UPDATE `user` SET `password` = ?s WHERE `id` = ?d", $new_pass, $userid); Session::Messages($langPassChanged); redirect_to_home_page("modules/admin/edituser.php?u=" . urlencode($userid)); } draw($tool_content, 3, null, $head_content);
foreach ($hits2 as $hit2) { if (in_array($hit2->pkid, $subscribed)) { $hits3[] = $hit2; } } $hits = array_merge($hits1, $hits3); // eponymous user can also search for his subscribed courses } } else { $hits = $hits1; // anonymous can only access with visible 1 or 2 } // exit if not results if (count($hits) <= 0) { Session::Messages($langNoResult); redirect_to_home_page('modules/search/search.php'); } //////// PRINT RESULTS //////// $tool_content .= action_bar(array(array('title' => $langNewSearch, 'url' => "search.php", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'))); $tool_content .= "\n <div class='alert alert-info'>{$langDoSearch}: <label>" . count($hits) . " {$langResults2}</label></div>\n <table class='table-default'>\n <tr> \n <th class='text-left'>" . $langCourse . " ({$langCode})</th>\n <th class='text-left'>{$langTeacher}</th>\n <th class='text-left'>{$langKeywords}</th>\n </tr>"; foreach ($hits as $hit) { $course = Database::get()->querySingle("SELECT code, title, public_code, prof_names, keywords FROM course WHERE id = ?d", $hit->pkid); // search in-course: Commented out @ 2014-11-24 because too costly to run 11 index sub-queries for each hit result $urlParam = ''; //if (isset($_POST['search_terms']) && search_in_course($_POST['search_terms'], $hit->pkid, $anonymous)) { // $urlParam = '?from_search=' . urlencode($_POST['search_terms']); //} $tool_content .= "<tr><td>\n <a href='../../courses/" . q($course->code) . "/" . $urlParam . "'>" . q($course->title) . "\n </a> (" . q($course->public_code) . ")</td>\n <td>" . q($course->prof_names) . "</td>\n <td>" . q($course->keywords) . "</td></tr>"; } $tool_content .= "</table>"; draw($tool_content, 0);
$scales = array(); foreach ($_POST['scale_item_name'] as $key => $item_name) { $scales[$key]['scale_item_name'] = $item_name; $scales[$key]['scale_item_value'] = $_POST['scale_item_value'][$key]; } $serialized_scales = serialize($scales); if ($scale_id) { Database::get()->query("UPDATE grading_scale SET title = ?s, scales = ?s, course_id = ?d WHERE id = ?d", $title, $serialized_scales, $course_id, $_POST['grading_scale_id']); update_assignments_max_grade($scale_id); } else { Database::get()->query("INSERT INTO grading_scale (title, scales, course_id) VALUES (?s, ?s, ?d)", $title, $serialized_scales, $course_id); } redirect_to_home_page("modules/work/grading_scales.php?course=$course_code"); } else { Session::flashPost()->Messages($langFormErrors)->Errors($v->errors()); redirect_to_home_page("modules/work/grading_scales.php?course=$course_code&scale_id=$scale_id"); } } if (isset($_GET['scale_id'])) { load_js('bootstrap-validator'); $head_content .= " <script type='text/javascript'> $(function() { $('#addScale').on('click', function() { var rowCount = $('#scale_table tbody tr').length; $('#scale_table tbody').append( '<tr>'+ '<td class=\'form-group\'>'+ '<input type=\'text\' name=\'scale_item_name[' + rowCount +']\' class=\'form-control\' value=\'\' required>'+ '</td>'+ '<td class=\'form-group\'>'+
exit(); } if(!$objExercise->selectScore() && !$is_editor) { redirect_to_home_page("modules/exercise/index.php?course=$course_code"); } } if (isset($_SESSION['objExercise'][$exerciseId])) { $objExercise = $_SESSION['objExercise'][$exerciseId]; } if ($is_editor && isset($_GET['purgeAttempID'])) { $eurid = $_GET['purgeAttempID']; $objExercise->purgeAttempt($eurid); Session::Messages($langPurgeExerciseResultsSuccess); redirect_to_home_page("modules/exercise/results.php?course=$course_code&exerciseId=$exerciseId"); } $exerciseTitle = $objExercise->selectTitle(); $exerciseDescription = $objExercise->selectDescription(); $exerciseDescription_temp = nl2br(make_clickable($exerciseDescription)); $tool_content .= " <div class='table-responsive'> <table class='table-default'> <tr> <th>" . q_math($exerciseTitle) . "</th> </tr>"; if($exerciseDescription_temp) { $tool_content .= " <tr> <td>" . standard_text_escape($exerciseDescription_temp) . "</td>
$navigation[] = array('url' => "index.php?course={$course_code}", 'name' => $langExercices); if (isset($_GET['exerciseId'])) { $exerciseId = intval($_GET['exerciseId']); } // if the object is not in the session if (!isset($_SESSION['objExercise'][$exerciseId])) { // construction of Exercise $objExercise = new Exercise(); // if the specified exercise doesn't exist or is disabled if (!$objExercise->read($exerciseId) && !$is_editor) { $tool_content .= "<p>{$langExerciseNotFound}</p>"; draw($tool_content, 2); exit; } if (!$objExercise->selectScore() && !$is_editor) { redirect_to_home_page("modules/exercise/index.php?course={$course_code}"); } } if (isset($_SESSION['objExercise'][$exerciseId])) { $objExercise = $_SESSION['objExercise'][$exerciseId]; } $exerciseTitle = $objExercise->selectTitle(); $exerciseDescription = $objExercise->selectDescription(); $exerciseDescription_temp = nl2br(make_clickable($exerciseDescription)); $tool_content .= "\n<div class='table-responsive'>\n <table class='table-default'>\n <tr>\n <th>" . q($exerciseTitle) . "</th>\n </tr>"; if ($exerciseDescription_temp) { $tool_content .= "\n <tr>\n <td>" . standard_text_escape($exerciseDescription_temp) . "</td>\n </tr>"; } $tool_content .= "</table>\n</div><br>"; $status = isset($_GET['status']) ? intval($_GET['status']) : 0; $tool_content .= "<select class='form-control' style='margin:0 0 12px 0;' id='status_filtering'>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}' " . ($status == 0 ? 'selected' : '') . ">--- {$langCurrentStatus} ---</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_COMPLETED . "' " . ($status == 1 ? 'selected' : '') . ">{$langAttemptCompleted}</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_PENDING . "' " . ($status == 2 ? 'selected' : '') . ">{$langAttemptPending}</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_PAUSED . "' " . ($status == 3 ? 'selected' : '') . ">{$langAttemptPaused}</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_CANCELED . "' " . ($status == 4 ? 'selected' : '') . ">{$langAttemptCanceled}</option>\n </select>";
$objAnswer->cancel(); } else { // saves the answers into the data base $objAnswer->save(); // sets the total weighting of the question $objQuestion->updateWeighting($questionWeighting); $objQuestion->save($exerciseId); $editQuestion = $questionId; } } } if (!isset($setWeighting)) { if (isset($exerciseId)) { redirect_to_home_page("modules/exercise/admin.php?course={$course_code}&exerciseId={$exerciseId}"); } else { redirect_to_home_page("modules/exercise/question_pool.php?course={$course_code}"); } } } if (isset($_GET['modifyAnswers'])) { if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) { if (!isset($nbrAnswers)) { $nbrAnswers = $objAnswer->selectNbrAnswers(); $reponse = array(); $comment = array(); $weighting = array(); // initializing if ($answerType == MULTIPLE_ANSWER) { $correct = array(); } else { $correct = 0;
file_id = ?d" , $sid, $qssid, $qtitle, $file_id); } } } if (isset($_POST['oldssid'])) { $oldssids = array(); foreach ($_POST['oldssid'] as $key => $oldssid) { $oldssids[] = intval($oldssid); } if (count($oldssids)) { Database::get()->query('DELETE FROM ebook_subsection WHERE id IN (' . implode(', ', $oldssids) . ')'); } } Session::Messages($langEBookSectionsModified, 'alert-success'); redirect_to_home_page('modules/ebook/edit.php?course=' . $course_code . '&id=' . $ebook_id); } else { $info = Database::get()->querySingle("SELECT * FROM `ebook` WHERE course_id = ?d AND id = ?d", $course_id, $ebook_id); if (!$info) { $tool_content .= "<div class='alert alert-warning'>$langNoEBook</div>"; } else { $pageName = $langEBookEdit; $basedir = $webDir . '/courses/' . $course_code . '/ebook/' . $ebook_id; $k = 0; list($paths, $files, $file_ids, $id_map) = find_html_files(); $sections = Database::get()->queryArray("SELECT id, public_id, title FROM ebook_section WHERE ebook_id = ?d ORDER BY CONVERT(public_id, UNSIGNED), public_id", $info->id); if ($sections){
function create_restored_course(&$tool_content, $restoreThis, $course_code, $course_lang, $course_title, $course_desc, $course_vis, $course_prof) { global $webDir, $urlServer, $urlAppend, $langEnter, $langBack, $currentCourseCode; require_once 'modules/create_course/functions.php'; require_once 'modules/course_info/restorehelper.class.php'; require_once 'include/lib/fileManageLib.inc.php'; $new_course_code = null; $new_course_id = null; Database::get()->transaction(function() use (&$new_course_code, &$new_course_id, $restoreThis, $course_code, $course_lang, $course_title, $course_desc, $course_vis, $course_prof, $webDir, &$tool_content, $urlServer, $urlAppend) { $departments = array(); if (isset($_POST['department'])) { foreach ($_POST['department'] as $did) { $departments[] = intval($did); } } else { $minDep = Database::get()->querySingle("SELECT MIN(id) AS min FROM hierarchy"); if ($minDep) { $departments[0] = $minDep->min; } } $r = $restoreThis . '/html'; list($new_course_code, $new_course_id) = create_course($course_code, $course_lang, $course_title, $course_desc, $departments, $course_vis, $course_prof); if (!$new_course_code) { $tool_content = "<div class='alert alert-warning'>" . $GLOBALS['langError'] . "</div>"; draw($tool_content, 3); exit; } if (!file_exists($restoreThis)) { redirect_to_home_page('modules/course_info/restore_course.php'); } $config_data = unserialize(file_get_contents($restoreThis . '/config_vars')); // If old $urlAppend didn't end in /, add it if (substr($config_data['urlAppend'], -1) !== '/') { $config_data['urlAppend'] .= '/'; } $eclass_version = (isset($config_data['version'])) ? $config_data['version'] : null; $backupData = null; if (file_exists($restoreThis . '/backup.php')) { $backupData = parse_backup_php($restoreThis . '/backup.php'); $eclass_version = $backupData['eclass_version']; } $restoreHelper = new RestoreHelper($eclass_version); $course_file = $restoreThis . '/' . $restoreHelper->getFile('course'); if (file_exists($course_file)) { $course_dataArr = unserialize(file_get_contents($course_file)); $course_data = $course_dataArr[0]; // update course query $upd_course_sql = "UPDATE course SET keywords = ?s, doc_quota = ?f, video_quota = ?f, " . " group_quota = ?f, dropbox_quota = ?f, glossary_expand = ?d "; $upd_course_args = array( $course_data[$restoreHelper->getField('course', 'keywords')], floatval($course_data['doc_quota']), floatval($course_data['video_quota']), floatval($course_data['group_quota']), floatval($course_data['dropbox_quota']), intval($course_data[$restoreHelper->getField('course', 'glossary_expand')]) ); if (isset($course_data['home_layout']) and isset($course_data['course_image'])) { $upd_course_sql .= ', home_layout = ?d, course_image = ?s '; $upd_course_args[] = $course_data['home_layout']; $upd_course_args[] = $course_data['course_image']; } // Set keywords to '' if NULL if (!isset($upd_course_args[0])) { $upd_course_args[0] = ''; } // handle course weekly if exists if (isset($course_data['view_type']) && isset($course_data['start_date']) && isset($course_data['finish_date'])) { $upd_course_sql .= " , view_type = ?s, start_date = ?t, finish_date = ?t "; array_push($upd_course_args, $course_data['view_type'], $course_data['start_date'], $course_data['finish_date'] ); } $upd_course_sql .= " WHERE id = ?d "; array_push($upd_course_args, intval($new_course_id)); Database::get()->query($upd_course_sql, $upd_course_args); } $userid_map = array(); $user_file = $restoreThis . '/user'; if (file_exists($user_file)) { $cours_user = unserialize(file_get_contents($restoreThis . '/' . $restoreHelper->getFile('course_user'))); $userid_map = restore_users(unserialize(file_get_contents($user_file)), $cours_user, $departments, $restoreHelper); register_users($new_course_id, $userid_map, $cours_user, $restoreHelper); } $userid_map[0] = 0; $userid_map[-1] = -1; $coursedir = "${webDir}/courses/$new_course_code"; $videodir = "${webDir}/video/$new_course_code"; move_dir($r, $coursedir); if (is_dir($restoreThis . '/video_files')) { move_dir($restoreThis . '/video_files', $videodir); } course_index($new_course_code); $tool_content .= "<div class='alert alert-info'>" . $GLOBALS['langCopyFiles'] . " $coursedir</div>"; require_once 'upgrade/functions.php'; load_global_messages(); $url_prefix_map = array( $config_data['urlServer'] . 'modules/ebook/show.php/' . $course_data['code'] => $urlServer . 'modules/ebook/show.php/' . $new_course_code, $config_data['urlAppend'] . 'modules/ebook/show.php/' . $course_data['code'] => $urlAppend . 'modules/ebook/show.php/' . $new_course_code, $config_data['urlServer'] . 'modules/document/file.php/' . $course_data['code'] => $urlServer . 'modules/document/file.php/' . $new_course_code, $config_data['urlAppend'] . 'modules/document/file.php/' . $course_data['code'] => $urlAppend . 'modules/document/file.php/' . $new_course_code, $config_data['urlServer'] . 'courses/' . $course_data['code'] => $urlServer . 'courses/' . $new_course_code, $config_data['urlAppend'] . 'courses/' . $course_data['code'] => $urlAppend . 'courses/' . $new_course_code, $course_data['code'] => $new_course_code); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_3X) { restore_table($restoreThis, 'course_module', array('set' => array('course_id' => $new_course_id), 'delete' => array('id')), $url_prefix_map, $backupData, $restoreHelper); } else if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X) { create_modules($new_course_id); foreach (get_tabledata_from_parsed('accueil', $backupData, $restoreHelper) as $accueil) { Database::get()->query('UPDATE course_module SET visible = ?d WHERE course_id = ?d AND module_id = ?d', $accueil['visible'], $new_course_id, $accueil['id']); } } restore_table($restoreThis, 'announcement', array('set' => array('course_id' => $new_course_id), 'delete' => array('id', 'preview')), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'group_properties', array('set' => array('course_id' => $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); $group_map = restore_table($restoreThis, 'group', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'group_members', array('map' => array('group_id' => $group_map, 'user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Forums Restore $forum_category_map = restore_table($restoreThis, 'forum_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $forum_category_map[0] = 0; $forum_map = restore_table($restoreThis, 'forum', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id', 'map' => array('cat_id' => $forum_category_map)), $url_prefix_map, $backupData, $restoreHelper); $forum_map[0] = 0; $forum_topic_map = restore_table($restoreThis, 'forum_topic', array('return_mapping' => 'id', 'map' => array('forum_id' => $forum_map, 'poster_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); $forum_topic_map[0] = 0; $forum_post_options = array('return_mapping' => 'id', 'map' => array('topic_id' => $forum_topic_map, 'poster_id' => $userid_map)); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X) { $forum_post_options['set'] = array('post_text' => ''); } $forum_post_map = restore_table($restoreThis, 'forum_post', $forum_post_options, $url_prefix_map, $backupData, $restoreHelper); $forum_post_map[0] = 0; restore_table($restoreThis, 'forum_notify', array('set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map, 'cat_id' => $forum_category_map, 'forum_id' => $forum_map, 'topic_id' => $forum_topic_map), 'delete' => array('id')), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'forum_user_stats', array('set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); if ($restoreHelper->getBackupVersion() === RestoreHelper::STYLE_2X && isset($backupData) && is_array($backupData) && isset($backupData['query']) && is_array($backupData['query'])) { $postsText = get_tabledata_from_parsed('posts_text', $backupData, $restoreHelper); foreach ($postsText as $ptData) { if (array_key_exists($ptData['post_id'], $forum_post_map)) { Database::get()->query("UPDATE forum_post SET post_text = ?s WHERE id = ?d", $ptData['post_text'], intval($forum_post_map[$ptData['post_id']])); } } } $forumLastPosts = Database::get()->queryArray("SELECT DISTINCT last_post_id FROM forum WHERE course_id = ?d ", intval($new_course_id)); if (is_array($forumLastPosts) && count($forumLastPosts) > 0) { foreach ($forumLastPosts as $lastPost) { if (isset($forum_post_map[$lastPost->last_post_id])) { Database::get()->query("UPDATE forum SET last_post_id = ?d WHERE course_id = ?d AND last_post_id = ?d", intval($forum_post_map[$lastPost->last_post_id]), intval($new_course_id), intval($lastPost->last_post_id)); } } } $topicLastPosts = Database::get()->queryArray("SELECT DISTINCT last_post_id FROM forum_topic WHERE forum_id IN (SELECT id FROM forum WHERE course_id = ?d)", intval($new_course_id)); if (is_array($topicLastPosts) && count($topicLastPosts) > 0) { foreach ($topicLastPosts as $lastPost) { if (isset($forum_post_map[$lastPost->last_post_id])) { Database::get()->query("UPDATE forum_topic SET last_post_id = ?d WHERE last_post_id = ?d", intval($forum_post_map[$lastPost->last_post_id]), intval($lastPost->last_post_id)); } } } $parentPosts = Database::get()->queryArray("SELECT DISTINCT parent_post_id FROM forum_post WHERE topic_id IN (SELECT id FROM forum_topic WHERE forum_id IN (SELECT id FROM forum WHERE course_id = ?d))", intval($new_course_id)); if (is_array($parentPosts) && count($parentPosts) > 0) { foreach ($parentPosts as $parentPost) { if (isset($forum_post_map[$parentPost->parent_post_id])) { Database::get()->query("UPDATE forum_post SET parent_post_id = ?d WHERE parent_post_id = ?d", intval($forum_post_map[$parentPost->parent_post_id]), intval($parentPost->parent_post_id)); } } } // Forums Restore End // Glossary Restore $glossary_category_map = restore_table($restoreThis, 'glossary_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $glossary_category_map[0] = 0; restore_table($restoreThis, 'glossary', array('set' => array('course_id' => $new_course_id), 'delete' => array('id'), 'map' => array('category_id' => $glossary_category_map)), $url_prefix_map, $backupData, $restoreHelper); // Glossary Restore End $link_category_map = restore_table($restoreThis, 'link_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $link_category_map[0] = 0; $link_category_map[-1] = -1; $link_category_map[-2] = -2; $link_map = restore_table($restoreThis, 'link', array('set' => array('course_id' => $new_course_id), 'map' => array('category' => $link_category_map, 'user_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_map = restore_table($restoreThis, 'ebook', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); foreach ($ebook_map as $old_id => $new_id) { // new and old id might overlap as the map contains multiple values! rename("$coursedir/ebook/$old_id", "$coursedir/ebook/__during_restore__$new_id"); } foreach ($ebook_map as $old_id => $new_id) { // better to use an intermediary rename step rename("$coursedir/ebook/__during_restore__$new_id", "$coursedir/ebook/$new_id"); } $document_map = restore_table($restoreThis, 'document', array('set' => array('course_id' => $new_course_id), 'map_function' => 'document_map_function', 'map_function_data' => array(1 => $group_map, 2 => $ebook_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_section_map = restore_table($restoreThis, 'ebook_section', array('map' => array('ebook_id' => $ebook_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $ebook_subsection_map = restore_table($restoreThis, 'ebook_subsection', array('map' => array('section_id' => $ebook_section_map, 'file_id' => $document_map), 'delete' => array('file'), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); // Video $videocat_map = restore_table($restoreThis, 'video_category', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $videocat_map[''] = ''; $videocat_map[0] = 0; $video_map = restore_table($restoreThis, 'video', array( 'map' => array('category' => $videocat_map), 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $videolink_map = restore_table($restoreThis, 'videolink', array( 'map' => array('category' => $videocat_map), 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); // Dropbox $dropbox_map = restore_table($restoreThis, 'dropbox_msg', array('set' => array('course_id' => $new_course_id), 'map' => array('author_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'dropbox_attachment', array('map' => array('msg_id' => $dropbox_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'dropbox_index', array('map' => array('msg_id' => $dropbox_map, 'recipient_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Learning Path $lp_learnPath_map = restore_table($restoreThis, 'lp_learnPath', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'learnPath_id'), $url_prefix_map, $backupData, $restoreHelper); $lp_module_map = restore_table($restoreThis, 'lp_module', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'module_id'), $url_prefix_map, $backupData, $restoreHelper); $lp_asset_map = restore_table($restoreThis, 'lp_asset', array('map' => array('module_id' => $lp_module_map), 'return_mapping' => 'asset_id'), $url_prefix_map, $backupData, $restoreHelper); // update lp_module startAsset_id with new asset_id from map foreach ($lp_asset_map as $key => $value) { Database::get()->query("UPDATE lp_module SET `startAsset_id` = ?d " . "WHERE `course_id` = ?d " . "AND `startAsset_id` = ?d", intval($value), intval($new_course_id), intval($key)); } $lp_rel_learnPath_module_map = restore_table($restoreThis, 'lp_rel_learnPath_module', array('map' => array('learnPath_id' => $lp_learnPath_map, 'module_id' => $lp_module_map), 'return_mapping' => 'learnPath_module_id'), $url_prefix_map, $backupData, $restoreHelper); // update parent foreach ($lp_rel_learnPath_module_map as $key => $value) { Database::get()->query("UPDATE lp_rel_learnPath_module SET `parent` = ?d " . "WHERE `learnPath_id` IN (SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d) " . "AND `parent` = ?d", intval($value), intval($new_course_id), intval($key)); } restore_table($restoreThis, 'lp_user_module_progress', array('delete' => array('user_module_progress_id'), 'map' => array('user_id' => $userid_map, 'learnPath_module_id' => $lp_rel_learnPath_module_map, 'learnPath_id' => $lp_learnPath_map)), $url_prefix_map, $backupData, $restoreHelper); foreach ($lp_learnPath_map as $old_id => $new_id) { // new and old id might overlap as the map contains multiple values! $old_dir = "$coursedir/scormPackages/path_$old_id"; if (file_exists($old_dir) && is_dir($old_dir)) { rename($old_dir, "$coursedir/scormPackages/__during_restore__$new_id"); } } foreach ($lp_learnPath_map as $old_id => $new_id) { // better to use an intermediary rename step $tempLPDir = "$coursedir/scormPackages/__during_restore__$new_id"; if (file_exists($tempLPDir) && is_dir($tempLPDir)) { rename($tempLPDir, "$coursedir/scormPackages/path_$new_id"); } } // Wiki $wiki_map = restore_table($restoreThis, 'wiki_properties', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'wiki_acls', array('map' => array('wiki_id' => $wiki_map)), $url_prefix_map, $backupData, $restoreHelper); $wiki_pages_map = restore_table($restoreThis, 'wiki_pages', array('map' => array('wiki_id' => $wiki_map, 'owner_id' => $userid_map), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'wiki_pages_content', array('delete' => array('id'), 'map' => array('pid' => $wiki_pages_map, 'editor_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Blog if (file_exists("$restoreThis/blog_post")) { $blog_map = restore_table($restoreThis, 'blog_post', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); } // Comments if (file_exists("$restoreThis/comments")) { $comment_map = restore_table($restoreThis, 'comments', array('delete' => array('id'), 'map' => array('user_id' => $userid_map), 'map_function' => 'comments_map_function', 'map_function_data' => array($blog_map, $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); } //Abuse Report if (file_exists("$restoreThis/abuse_report")) { restore_table($restoreThis, 'abuse_report', array('delete' => array('id'), 'set' => array('course_id' => $new_course_id), 'map' => array('user_id' => $userid_map), 'map_function' => 'abuse_report_map_function', 'map_function_data' => array($forum_post_map, $comment_map, $link_map)), $url_prefix_map, $backupData, $restoreHelper); } // Rating if (file_exists("$restoreThis/rating")) { restore_table($restoreThis, 'rating', array('delete' => array('rate_id'), 'map' => array('user_id' => $userid_map), 'map_function' => 'ratings_map_function', 'map_function_data' => array($blog_map, $forum_post_map, $link_map, $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } if (file_exists("$restoreThis/rating_cache")) { restore_table($restoreThis, 'rating_cache', array('delete' => array('rate_cache_id'), 'map_function' => 'ratings_map_function', 'map_function_data' => array($blog_map, $forum_post_map, $link_map, $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } // Course_settings if (file_exists("$restoreThis/course_settings")) { restore_table($restoreThis, 'course_settings', array('set' => array('course_id' => $new_course_id)), $url_prefix_map, $backupData, $restoreHelper); } // Polls $poll_map = restore_table($restoreThis, 'poll', array('set' => array('course_id' => $new_course_id), 'map' => array('creator_id' => $userid_map), 'return_mapping' => 'pid', 'delete' => array('type')), $url_prefix_map, $backupData, $restoreHelper); $poll_question_map = restore_table($restoreThis, 'poll_question', array('map' => array('pid' => $poll_map), 'return_mapping' => 'pqid'), $url_prefix_map, $backupData, $restoreHelper); $poll_answer_map = restore_table($restoreThis, 'poll_question_answer', array('map' => array('pqid' => $poll_question_map), 'return_mapping' => 'pqaid'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'poll_answer_record', array('delete' => array('arid'), 'map' => array('pid' => $poll_map, 'qid' => $poll_question_map, 'aid' => $poll_answer_map, 'user_id' => $userid_map)), $url_prefix_map, $backupData, $restoreHelper); // Assignments if (!isset($group_map[0])) { $group_map[0] = 0; } $assignments_map = restore_table($restoreThis, 'assignment', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); $assignments_map[0] = 0; restore_table($restoreThis, 'assignment_submit', array('delete' => array('id'), 'map' => array('uid' => $userid_map, 'assignment_id' => $assignments_map, 'group_id' => $group_map)), $url_prefix_map, $backupData, $restoreHelper); // Agenda $agenda_map = restore_table($restoreThis, 'agenda', array( 'return_mapping' => 'id', 'set' => array('course_id' => $new_course_id) ), $url_prefix_map, $backupData, $restoreHelper); $agenda_map[0] = 0; // Exercises $exercise_map = restore_table($restoreThis, 'exercise', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $exercise_map[0] = 0; restore_table($restoreThis, 'exercise_user_record', array( 'delete' => array('eurid'), 'map' => array('eid' => $exercise_map, 'uid' => $userid_map) ), $url_prefix_map, $backupData, $restoreHelper); $question_category_map = restore_table($restoreThis, 'exercise_question_cats', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'question_cat_id' ), $url_prefix_map, $backupData, $restoreHelper); $question_category_map[0] = 0; $question_map = restore_table($restoreThis, 'exercise_question', array( 'set' => array('course_id' => $new_course_id), 'init' => array('category' => 0), 'map' => array('category' => $question_category_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_answer', array( 'delete' => array('id'), 'map' => array('question_id' => $question_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_answer_record', array( 'delete' => array('answer_record_id'), 'map' => array('question_id' => $question_map, 'eurid' => $userid_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'exercise_with_questions', array( 'map' => array('question_id' => $question_map, 'exercise_id' => $exercise_map) ), $url_prefix_map, $backupData, $restoreHelper); $sql = "SELECT asset.asset_id, asset.path FROM `lp_module` AS module, `lp_asset` AS asset WHERE module.startAsset_id = asset.asset_id AND course_id = ?d AND contentType = 'EXERCISE' AND path <> '' AND path IS NOT NULL"; $rows = Database::get()->queryArray($sql, intval($new_course_id)); if (is_array($rows) && count($rows) > 0) { foreach ($rows as $row) { Database::get()->query("UPDATE `lp_asset` SET path = ?s WHERE asset_id = ?d", $exercise_map[$row->path], intval($row->asset_id)); } } // Attendance $attendance_map = restore_table($restoreThis, 'attendance', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $attendance_activities_map = restore_table($restoreThis, 'attendance_activities', array( 'map' => array('attendance_id' => $attendance_map), 'map_function' => 'attendance_gradebook_activities_map_function', 'map_function_data' => array($assignments_map, $exercise_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'attendance_book', array( 'map' => array( 'attendance_activity_id' => $attendance_activities_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'attendance_users', array( 'map' => array( 'attendance_id' => $attendance_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Gradebook $gradebook_map = restore_table($restoreThis, 'gradebook', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); $gradebook_activities_map = restore_table($restoreThis, 'gradebook_activities', array( 'map' => array('gradebook_id' => $gradebook_map), 'map_function' => 'attendance_gradebook_activities_map_function', 'map_function_data' => array($assignments_map, $exercise_map), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'gradebook_book', array( 'map' => array( 'gradebook_activity_id' => $gradebook_activities_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'gradebook_users', array( 'map' => array( 'gradebook_id' => $gradebook_map, 'uid' => $userid_map ), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Notes restore_table($restoreThis, 'note', array( 'set' => array('reference_obj_course' => $new_course_id), 'map' => array('user_id' => $userid_map), 'map_function' => 'notes_map_function', 'map_function_data' => array($new_course_id, $agenda_map, $document_map, $link_map, $video_map, $videolink_map, $assignments_map, $exercise_map, $ebook_map, $lp_learnPath_map), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); // Units $unit_map = restore_table($restoreThis, 'course_units', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'unit_resources', array('delete' => array('id'), 'map' => array('unit_id' => $unit_map), 'map_function' => 'unit_map_function', 'map_function_data' => array($document_map, $link_category_map, $link_map, $ebook_map, $ebook_section_map, $ebook_subsection_map, $video_map, $videolink_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map) ), $url_prefix_map, $backupData, $restoreHelper); // Weekly $weekly_map = restore_table($restoreThis, 'course_weekly_view', array( 'set' => array('course_id' => $new_course_id), 'return_mapping' => 'id' ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'course_weekly_view_activities', array( 'delete' => array('id'), 'map' => array('course_weekly_view_id' => $weekly_map), 'map_function' => 'unit_map_function', 'map_function_data' => array($document_map, $link_category_map, $link_map, $ebook_map, $ebook_section_map, $ebook_subsection_map, $video_map, $videolink_map, $lp_learnPath_map, $wiki_map, $assignments_map, $exercise_map, $forum_map, $forum_topic_map) ), $url_prefix_map, $backupData, $restoreHelper); restore_table($restoreThis, 'course_description', array( 'set' => array('course_id' => $new_course_id), 'delete' => array('id') ), $url_prefix_map, $backupData, $restoreHelper); removeDir($restoreThis); // index course after restoring require_once 'modules/search/indexer.class.php'; Indexer::queueAsync(Indexer::REQUEST_REMOVEALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id); Indexer::queueAsync(Indexer::REQUEST_STOREALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id); }); // check/cleanup video files after restore transaction if ($new_course_code != null && $new_course_id != null) { $videodir = $webDir . "/video/" . $new_course_code; $videos = scandir($videodir); foreach ($videos as $videofile) { if (is_dir($videofile)) { continue; } $vlike = '/' . $videofile; if (!isWhitelistAllowed($videofile)) { unlink($videodir . "/" . $videofile); Database::get()->query("DELETE FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike); continue; } $vcnt = Database::get()->querySingle("SELECT count(id) AS count FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike)->count; if ($vcnt <= 0) { unlink($videodir . "/" . $videofile); } } $backUrl = $urlAppend . (isset($currentCourseCode)? "courses/$currentCourseCode/": 'modules/admin/'); $tool_content .= action_bar(array( array('title' => $langEnter, 'url' => $urlAppend . "courses/$new_course_code/", 'icon' => 'fa-arrow-right', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langBack, 'url' => $backUrl, 'icon' => 'fa-reply', 'level' => 'primary-label')), false); } }
if (isset($_POST['submit'])) { if (empty($_POST['password_form']) or empty($_POST['password_form1']) or empty($_POST['old_pass'])) { Session::Messages($langFieldsMissing); header($passLocation); exit; } if (count($error_messages = acceptable_password($_POST['password_form'], $_POST['password_form1'])) > 0) { Session::Messages($langPassTwo); header($passLocation); exit; } // all checks ok. Change password! $myrow = Database::get()->querySingle("SELECT password FROM user WHERE id= ?d", $_SESSION['uid']); $hasher = new PasswordHash(8, false); $new_pass = $hasher->HashPassword($_REQUEST['password_form']); if ($hasher->CheckPassword($_REQUEST['old_pass'], $myrow->password)) { Database::get()->query("UPDATE user SET password = ?s\n WHERE id = ?d", $new_pass, $_SESSION['uid']); Log::record(0, 0, LOG_PROFILE, array('uid' => $_SESSION['uid'], 'pass_change' => 1)); Session::Messages($langPassChanged, 'alert-success'); redirect_to_home_page('main/profile/display_profile.php'); exit; } else { Session::Messages($langPassOldWrong); redirect_to_home_page('main/profile/profile.php'); } } $tool_content .= action_bar(array(array('title' => $langBack, 'url' => 'display_profile.php', 'icon' => 'fa-reply', 'level' => 'primary-label'))); if (!isset($_POST['changePass'])) { $tool_content .= "<div class='form-wrapper'>\n <form class='form-horizontal' role='form' method='post' action='{$passUrl}'>\n <fieldset>\n <div class='form-group'>\n <label for='old_pass' class='col-sm-2 control-label'>{$langOldPass}: </label>\n <div class='col-sm-8'>\n\t <input type='password' class='form-control' id='old_pass' name='old_pass' value='' autocomplete='off'>\n </div>\n </div>\n <div class='form-group'>\n <label for='password_form' class='col-sm-2 control-label'>{$langNewPass1}: </label>\n <div class='col-sm-8'>\n\t <input type='password' class='form-control' id='password_form' name='password_form' value='' autocomplete='off'>\n </div>\n <div class='col-sm-2 text-center padding-thin'>\n <span id='result'></span>\n </div>\n </div>\n <div class='form-group'>\n <label for='password_form1' class='col-sm-2 control-label'>{$langNewPass2}: </label>\n <div class='col-sm-8'>\n <input type='password' class='form-control' id='password_form1' name='password_form1' value='' autocomplete='off'>\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-offset-2 col-sm-8'>\n <input type='submit' class='btn btn-primary' name='submit' value='{$langModify}'>\n <a href='display_profile.php' class='btn btn-default'>{$langCancel}</a>\n </div>\n </div>\n </fieldset>\n</form></div>"; } draw($tool_content, 1, null, $head_content);
// -------------------------------- // notify users // -------------------------------- $subject_notify = "{$logo} - {$langNewForumNotify}"; $category_id = forum_category($forum_id); $cat_name = category_name($category_id); $c = course_code_to_title($course_code); $name = uid_to_name($uid); $title = course_id_to_title($course_id); $forum_message = "-------- {$langBodyMessage} ({$langSender}: {$name})\n{$message}--------"; $plain_forum_message = q(html2text($forum_message)); $body_topic_notify = "{$langBodyForumNotify} {$langInForums} '" . q($forum_name) . "' \n {$langInCat} '" . q($cat_name) . "' {$langTo} {$langCourseS} '{$c}' <br /><br />" . q($forum_message) . "<br />\n <br />{$gunet}<br /><a href='{$urlServer}courses/{$course_code}'>{$urlServer}courses/{$course_code}</a>"; $plain_body_topic_notify = "{$langBodyForumNotify} {$langInForums} '" . q($forum_name) . "' {$langInCat} '" . q($cat_name) . "' {$langTo} {$langCourseS} '{$c}' \n\n{$plain_forum_message} \n\n{$gunet}\n<a href='{$urlServer}courses/{$course_code}'>{$urlServer}courses/{$course_code}</a>"; $linkhere = " <a href='{$urlServer}main/profile/emailunsubscribe.php?cid={$course_id}'>{$langHere}</a>."; $unsubscribe = "<br /><br />{$langNote}: " . sprintf($langLinkUnsubscribe, $title); $plain_body_topic_notify .= $unsubscribe . $linkhere; $body_topic_notify .= $unsubscribe . $linkhere; $sql = Database::get()->queryArray("SELECT DISTINCT user_id FROM forum_notify\n\t\t\tWHERE (forum_id = ?d OR cat_id = ?d)\n\t\t\tAND notify_sent = 1 AND course_id = ?d AND user_id != ?d", $forum_id, $category_id, $course_id, $uid); foreach ($sql as $r) { if (get_user_email_notification($r->user_id, $course_id)) { $emailaddr = uid_to_email($r->user_id); send_mail_multipart('', '', '', $emailaddr, $subject_notify, $plain_body_topic_notify, $body_topic_notify, $charset); } } // end of notification Session::Messages($langStored, 'alert-success'); redirect_to_home_page("modules/forum/viewforum.php?course={$course_code}&forum={$forum_id}"); } else { $tool_content .= "\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&topic={$topic}&forum={$forum_id}' method='post'>\n <fieldset>\n <div class='form-group'>\n <label for='subject' class='col-sm-2 control-label'>{$langSubject}:</label>\n <div class='col-sm-10'>\n <input type='text' name='subject' id='subject' class='form-control' maxlength='100'>\n </div>\n </div> \n <div class='form-group'>\n <label for='message' class='col-sm-2 control-label'>{$langBodyMessage}:</label>\n <div class='col-sm-10'>\n " . rich_text_editor('message', 14, 50, '') . "\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-10 col-sm-offset-2'>\n <input class='btn btn-primary' type='submit' name='submit' value='{$langSubmit}'>\n <a class='btn btn-default' href='viewforum.php?course={$course_code}&forum={$forum_id}'>{$langCancel}</a>\n </div>\n </div> \n\t</fieldset>\n\t</form>\n </div>"; } draw($tool_content, 2, null, $head_content);
$id = $q->lastInsertID; Log::record($course_id, MODULE_ID_GLOSSARY, $log_action, array('id' => $id, 'term' => $_POST['term'], 'definition' => $_POST['definition'], 'url' => $url, 'notes' => purify($_POST['notes']))); if ($q and $q->affectedRows) { invalidate_glossary_cache(); Session::Messages($success_message, 'alert-success'); } redirect_to_home_page("modules/glossary/index.php?course=$course_code"); } else { $new_or_modify = isset($_POST['id']) ? "&edit=$_POST[id]" : "&add=1"; Session::flashPost()->Messages($langFormErrors)->Errors($v->errors()); redirect_to_home_page("modules/glossary/index.php?course=$course_code$new_or_modify"); } } if (isset($_GET['delete'])) { $id = getDirectReference($_GET['delete']); $term = Database::get()->querySingle("SELECT term FROM glossary WHERE ID = ?d", $id)->term; $q = Database::get()->query("DELETE FROM glossary WHERE id = ?d AND course_id = ?d", $id, $course_id); invalidate_glossary_cache(); Log::record($course_id, MODULE_ID_GLOSSARY, LOG_DELETE, array('id' => $id, 'term' => $term)); if ($q and $q->affectedRows) { $tool_content .= "<div class='alert alert-success'>$langGlossaryDeleted</div><br />"; } draw($tool_content, 2, null, $head_content); exit;
$navigation = array(array("url" => "index.php?course={$course_code}", "name" => $langExercices), array("url" => "question_categories.php?course={$course_code}", "name" => $langQuestionCats)); $form_action_url = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}"; $form_action_url .= isset($_GET['modifyCat']) ? "&modifyCat=" . intval($_GET['modifyCat']) : "&newCat=yes"; if (isset($_GET['modifyCat'])) { $q_cat = Database::get()->querySingle("SELECT * FROM exercise_question_cats WHERE question_cat_id = ?d", $_GET['modifyCat']); } $questionCatName = Session::has('questionCatName') ? Session::get('questionCatName') : (isset($q_cat) ? $q_cat->question_cat_name : ''); $tool_content .= action_bar(array(array('title' => $langBack, 'level' => 'primary-label', 'icon' => 'fa-reply', 'url' => "question_categories.php?course={$course_code}"))); $tool_content .= "\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form' action='{$form_action_url}' method='post'>\n <div class='form-group " . (Session::getError('questionCatName') ? "has-error" : "") . "'>\n <label for='questionCatName' class='col-sm-2 control-label'>{$langTitle}:</label>\n <div class='col-sm-10'>\n <input name='questionCatName' type='text' class='form-control' id='questionCatName' placeholder='{$langTitle}' value='{$questionCatName}'>\n <span class='help-block'>" . Session::getError('questionCatName') . "</span>\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-10 col-sm-offset-2'>\n <input class='btn btn-primary' name='submitCat' type='submit' value='{$langSubmit}'>\n <a href='question_categories.php?course={$course_code}' class='btn btn-default'>{$langCancel}</a>\n </div>\n </div> \n </form>\n </div>"; } elseif (isset($_GET['deleteCat'])) { $q_cat_id = $_GET['deleteCat']; if (Database::get()->query("DELETE FROM exercise_question_cats WHERE question_cat_id = ?d AND course_id = ?d", $q_cat_id, $course_id)->affectedRows > 0) { Database::get()->query("UPDATE exercise_question SET category = ?d WHERE category = ?d AND course_id = ?d", 0, $q_cat_id, $course_id); Session::Messages($langDelCatSuccess, 'alert-success'); } redirect_to_home_page("modules/exercise/question_categories.php?course={$course_code}"); } else { $pageName = $langQuestionCats; $navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langExercices); $tool_content .= action_bar(array(array('title' => $langNewCat, 'level' => 'primary-label', 'icon' => 'fa-plus-circle', 'url' => "question_categories.php?course={$course_code}&newCat=yes", 'button-class' => 'btn-success'), array('title' => $langBack, 'level' => 'primary', 'icon' => 'fa-reply', 'url' => "index.php?course={$course_code}"))); $q_cats = Database::get()->queryArray("SELECT * FROM exercise_question_cats WHERE course_id = ?d", $course_id); if (count($q_cats) > 0) { $tool_content .= "\n <div class='table-responsive'>\n <table class='table-default'>\n <tbody>\n <tr>\n <th>{$langTitle}</th>\n <th class='text-center'>" . icon('fa-gears') . "</th>\n </tr> \n "; foreach ($q_cats as $q_cat) { $action_button = action_button(array(array('title' => $langEdit, 'url' => "question_categories.php?course={$course_code}&modifyCat={$q_cat->question_cat_id}", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "question_categories.php?course={$course_code}&deleteCat={$q_cat->question_cat_id}", 'icon' => 'fa-times', 'confirm' => $langQuestionCatDelConfirrm, 'class' => 'delete'))); $tool_content .= "\n <tr>\n <td>{$q_cat->question_cat_name}</td>\n <td class='option-btn-cell'>{$action_button}</td>\n </tr>"; } $tool_content .= " \n </tbody>\n </table>\n </div>"; } else { $tool_content .= "<div class='alert alert-warning'>{$langNoQuestionCats}</div>"; }
//delete page case "delete": if ($wiki_title != "__MainPage__" and $is_editor) { //only a teacher can delete a page if ($wikiStore->pageExists($wikiId, $wiki_title)) { $wikiPage->loadPage($wiki_title); if ($wikiPage->delete()) { Session::Messages($langWikiPageDeleted, 'alert-success'); redirect_to_home_page("modules/wiki/page.php?course={$course_code}&wikiId={$wikiId}&action=show"); } else { Session::Messages($langWikiDeletePageError, 'alert-danger'); redirect_to_home_page("modules/wiki/page.php?course={$course_code}&action=show&title=" . rawurlencode($wiki_title) . "&wikiId={$wikiId}"); } } else { Session::Messages($langWikiPageNotFound); redirect_to_home_page("modules/wiki/page.php?course={$course_code}&wikiId={$wikiId}&action=show"); } } break; // page preview // page preview case "preview": if (!isset($content)) { $content = ''; } $tool_content .= claro_disp_wiki_preview($wikiRenderer, $wiki_title, $content); $tool_content .= claro_disp_wiki_preview_buttons($wikiId, $wiki_title, $content, $changelog); break; // view page // view page case "show":
} Indexer::queueAsync(Indexer::REQUEST_REMOVEBYTOPIC, Indexer::RESOURCE_FORUMPOST, $topic_id); $number_of_topics = get_total_topics($forum_id); $num_topics = $number_of_topics - 1; if ($number_of_topics < 0) { $num_topics = 0; } Database::get()->query("DELETE FROM forum_topic WHERE id = ?d AND forum_id = ?d", $topic_id, $forum_id); Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_FORUMTOPIC, $topic_id); Database::get()->query("UPDATE forum SET num_topics = ?d, num_posts = num_posts-$number_of_posts WHERE id = ?d AND course_id = ?d", $num_topics, $forum_id, $course_id); Database::get()->query("DELETE FROM forum_notify WHERE topic_id = ?d AND course_id = ?d", $topic_id, $course_id); Session::Messages($langDeletedMessage, 'alert-success'); redirect_to_home_page("modules/forum/viewforum.php?course=$course_code&forum=$forum_id"); } // modify topic notification if (isset($_GET['topicnotify'])) { if (isset($_GET['topic_id'])) { $topic_id = intval($_GET['topic_id']); } $rows = Database::get()->querySingle("SELECT COUNT(*) AS count FROM forum_notify WHERE user_id = ?d AND topic_id = ?d AND course_id = ?d", $uid, $topic_id, $course_id); if ($rows->count > 0) { Database::get()->query("UPDATE forum_notify SET notify_sent = ?d WHERE user_id = ?d AND topic_id = ?d AND course_id = ?d", $_GET['topicnotify'], $uid, $topic_id, $course_id); } else { Database::get()->query("INSERT INTO forum_notify SET user_id = ?d, topic_id = $topic_id, notify_sent = 1, course_id = ?d", $uid, $course_id);
} if (isset($_GET['mod_pw'])) { header('Location: ' . bbb_join_moderator($_GET['meeting_id'], $_GET['mod_pw'], $_GET['att_pw'], $_SESSION['surname'], $_SESSION['givenname'])); } else { # Get session capacity $c = Database::get()->querySingle("SELECT sessionUsers FROM bbb_session where meeting_id=?s", $_GET['meeting_id']); $sess = Database::get()->querySingle("SELECT * FROM bbb_session WHERE meeting_id=?s", $_GET['meeting_id']); $serv = Database::get()->querySingle("SELECT * FROM bbb_servers WHERE id=?d", $sess->running_at); if ($c->sessionUsers > 0 && $c->sessionUsers < get_meeting_users($serv->server_key, $serv->api_url, $_GET['meeting_id'], $sess->mod_pw)) { $tool_content .= "<p class='noteit'><b>{$langNote}</b>:<br />{$langBBBMaxUsersJoinError}</p>"; break; } else { header('Location: ' . bbb_join_user($_GET['meeting_id'], $_GET['att_pw'], $_SESSION['surname'], $_SESSION['givenname'])); } } break; case 'import_video': publish_video_recordings($course_code, $_GET['id']); break; } } elseif (isset($_POST['new_bbb_session'])) { $startDate_obj = DateTime::createFromFormat('d-m-Y H:i', $_POST['start_session']); $start = $startDate_obj->format('Y-m-d H:i:s'); add_bbb_session($course_id, $_POST['title'], $_POST['desc'], $start, $_POST['type'], $_POST['status'], isset($_POST['notifyUsers']) ? '1' : '0', $_POST['minutes_before'], $_POST['external_users'], $_POST['record'], $_POST['sessionUsers']); Session::Messages($langBBBAddSuccessful, 'alert-success'); redirect_to_home_page("modules/bbb/index.php?course={$course_code}"); } else { bbb_session_details(); } add_units_navigation(TRUE); draw($tool_content, 2, null, $head_content);
$charset = 'Windows-1253'; } else { $charset = 'UTF-8'; } $full = isset($_GET['full']) && $_GET['full']; $crlf = "\r\n"; if (!isset($_GET['pid'])) { redirect_to_home_page(); } else { $pid = intval($_GET['pid']); } header("Content-Type: text/csv; charset={$charset}"); header("Content-Disposition: attachment; filename=pollresults.csv"); $p = Database::get()->querySingle("SELECT pid, anonymized FROM poll\n WHERE course_id = ?d AND pid = ?d ORDER BY pid", $course_id, $pid); if (!$p) { redirect_to_home_page("modules/questionnaire/index.php?course={$course_code}"); } $anonymized = $p->anonymized; $qlist = array(); if ($full) { $begin = true; $questions = Database::get()->queryArray("SELECT * FROM poll_question WHERE pid = ?d ORDER BY q_position", $pid); $users = Database::get()->queryArray("SELECT user_id FROM poll_answer_record WHERE pid = ?d ORDER BY user_id", $pid); foreach ($questions as $q) { if ($begin) { echo csv_escape($langUser), ';user_id;'; $begin = false; } else { echo ';'; } if ($q->qtype == QTYPE_LABEL) {
} @unlink($exportFileChat); redirect_to_home_page("modules/conference/messageList.php?course=$course_code"); } // add new line if (isset($_POST['chatLine']) and trim($_POST['chatLine']) != '') { if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error(); $chatLine = purify($_POST['chatLine']); $fchat = fopen($fileChatName, 'a'); if ($is_editor) { $nick = "<b>".q($nick)."</b>"; } fwrite($fchat, $timeNow . ' - ' . $nick . ' : ' . stripslashes($chatLine) . " !@#$ $uid \n"); fclose($fchat); redirect_to_home_page("modules/conference/messageList.php?course=$course_code"); } ?> <!DOCTYPE html> <html> <head> <base target="_parent"> <meta http-equiv="refresh" content="30; url=<?php echo $_SERVER['SCRIPT_NAME']; ?>" /> <title>Chat messages</title> <!-- jQuery --> <script src="<?php echo $urlServer;?>js/jquery-<?php echo JQUERY_VERSION; ?>.min.js"></script> <!-- Latest compiled and minified JavaScript --> <script src="<?php echo $urlServer;?>template/default/js/bootstrap.min.js"></script> <!-- Latest compiled and minified CSS -->