diff --git a/main/auth/course_description.php b/main/auth/course_description.php deleted file mode 100755 index d5661d2468..0000000000 --- a/main/auth/course_description.php +++ /dev/null @@ -1,48 +0,0 @@ -id] = $description; - } - - // Function that displays the details of the course description in html. - return CourseManager::get_details_course_description_html($descriptions, api_get_system_encoding(), false); -} - -echo show_course_description(); diff --git a/main/auth/courses.php b/main/auth/courses.php index 61feb7896b..5a63ab9dbe 100755 --- a/main/auth/courses.php +++ b/main/auth/courses.php @@ -15,7 +15,7 @@ */ // Names of the language file that needs to be included. -$language_file = array ('courses', 'registration'); +$language_file = array ('courses', 'registration'); // Delete the globals['_cid'], we don't need it here. $cidReset = true; // Flag forcing the 'current course' reset @@ -495,7 +495,7 @@ function display_subscribe_to_courses($courses) { // block course description echo "\t\t"; $icon_title = get_lang('CourseDetails') . ' - ' . $course['title']; - echo "".Display::return_icon('synthese_view.gif', $icon_title).""; + echo "".Display::return_icon('synthese_view.gif', $icon_title).""; echo "\t\t"; } @@ -858,7 +858,7 @@ function display_courses_in_category($user_category_id, $showicons) { // block course description echo "\t\t"; $icon_title = get_lang('CourseDetails') . ' - ' . $course['title']; - echo "".Display::return_icon('synthese_view.gif', $icon_title).""; + echo "".Display::return_icon('synthese_view.gif', $icon_title).""; echo "\t\t"; } diff --git a/main/auth/generate_api_key.inc.php b/main/auth/generate_api_key.inc.php deleted file mode 100755 index 8851bb9634..0000000000 --- a/main/auth/generate_api_key.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - -
-
-
- -
-
\ No newline at end of file diff --git a/main/auth/lostPassword.php b/main/auth/lostPassword.php index af47b57d80..8d1dc6b8af 100755 --- a/main/auth/lostPassword.php +++ b/main/auth/lostPassword.php @@ -1,5 +1,5 @@ '; if (isset ($_GET['reset']) && isset ($_GET['id'])) { - - $msg = reset_password($_GET["reset"], $_GET["id"], true); + $msg = Login::reset_password($_GET["reset"], $_GET["id"], true); $msg1= ''.get_lang('Back').''; echo '

'.$msg1.'
'; @@ -59,6 +58,7 @@ if (isset ($_GET['reset']) && isset ($_GET['id'])) { if ($form->validate()) { $values = $form->exportValues(); + $user = $values['user']; $email = $values['email']; @@ -74,8 +74,8 @@ if (isset ($_GET['reset']) && isset ($_GET['id'])) { FROM ".$tbl_user." WHERE ( username = '".Database::escape_string($user)."' $condition ) "; - $result = Database::query($query); - $num_rows = Database::num_rows($result); + $result = Database::query($query); + $num_rows = Database::num_rows($result); if ($result && $num_rows > 0) { if ($num_rows > 1) { @@ -88,9 +88,9 @@ if (isset ($_GET['reset']) && isset ($_GET['id'])) { $user = Database::fetch_array($result); } if ($userPasswordCrypted != 'none') { - handle_encrypted_password($user, $by_username); + Login::handle_encrypted_password($user, $by_username); } else { - send_password_to_user($user, $by_username); + Login::send_password_to_user($user, $by_username); } } else { Display::display_error_message(get_lang('NoUserAccountWithThisEmailAddress')); @@ -100,12 +100,10 @@ if (isset ($_GET['reset']) && isset ($_GET['id'])) { echo '

'.$msg.'
'; } else { - echo '

'; echo get_lang('EnterEmailUserAndWellSendYouPassword'); echo '

'; $form->display(); } } - -Display :: display_footer(); +Display :: display_footer(); \ No newline at end of file diff --git a/main/auth/lost_password.lib.php b/main/auth/lost_password.lib.php deleted file mode 100755 index c7fe7dee70..0000000000 --- a/main/auth/lost_password.lib.php +++ /dev/null @@ -1,210 +0,0 @@ -, Ghent University - */ -/* -function get_email_headers() { - $emailHeaders = "From: \"".addslashes(api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS))."\" <".api_get_setting('emailAdministrator').">\n"; - $emailHeaders .= "Reply-To: ".api_get_setting('emailAdministrator')."\n"; - $emailHeaders .= "Return-Path: ".api_get_setting('emailAdministrator')."\n"; - $emailHeaders .= "X-Sender: ".api_get_setting('emailAdministrator')."\n"; - $emailHeaders .= "X-Mailer: PHP / ".phpversion()."\n"; - $emailHeaders .= "Content-Type: text/plain;\n\tcharset=\"".api_get_system_encoding()."\"\n"; - $emailHeaders .= "Mime-Version: 1.0"; - return $emailHeaders; -} -*/ - -/** - * Enter description here... - * - * @param unknown_type $user - * @param boolean $reset - * @param boolean $by_username - * @return unknown - * @author Olivier Cauberghe , Ghent University - */ -function get_user_account_list($user, $reset = false, $by_username = false) { - global $_configuration; - $portal_url = $_configuration['root_web']; - if ($_configuration['multiple_access_urls']) { - $access_url_id = api_get_current_access_url_id(); - if ($access_url_id != -1 ) { - $url = api_get_access_url($access_url_id); - $portal_url = $url['url']; - } - } - - if ($reset) { - - if ($by_username) { - - $secret_word = get_secret_word($user['email']); - if ($reset) { - $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$user['uid']; - } else { - $reset_link = get_lang('Pass')." : $user[password]"; - } - $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.''; - - if ($user_account_list) { - $user_account_list = "\n------------------------\n" . $user_account_list; - } - - } else { - - foreach ($user as $this_user) { - $secret_word = get_secret_word($this_user['email']); - if ($reset) { - $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$this_user['uid']; - } else { - $reset_link = get_lang('Pass')." : $this_user[password]"; - } - $user_account_list[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$this_user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.''; - } - - if ($user_account_list) { - $user_account_list = implode("\n------------------------\n", $user_account_list); - } - } - - } else { - - if (!$by_username) { - $user = $user[0]; - } - $reset_link = get_lang('Pass')." : $user[password]"; - $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.''; - - } - return $user_account_list; -} - -/** - * This function sends the actual password to the user - * - * @param unknown_type $user - * @author Olivier Cauberghe , Ghent University - */ -function send_password_to_user($user, $by_username = false) { - - global $_configuration; - /* - $emailHeaders = get_email_headers(); // Email Headers - */ - $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT - - if ($by_username) { // Show only for lost password - $user_account_list = get_user_account_list($user, false, $by_username); // BODY - $email_to = $user['email']; - } else { - $user_account_list = get_user_account_list($user); // BODY - $email_to = $user[0]['email']; - } - - $portal_url = $_configuration['root_web']; - if ($_configuration['multiple_access_urls']) { - $access_url_id = api_get_current_access_url_id(); - if ($access_url_id != -1 ) { - $url = api_get_access_url($access_url_id); - $portal_url = $url['url']; - } - } - - $email_body = get_lang('YourAccountParam')." ".$portal_url."\n\n$user_account_list"; - // SEND MESSAGE - $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); - $email_admin = api_get_setting('emailAdministrator'); - - if (@api_mail('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) { - Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed')); - } else { - $message = get_lang('SystemUnableToSendEmailContact').' '.Display :: encrypted_mailto_link(api_get_setting('emailAdministrator'), get_lang('PlatformAdmin')).".

"; - } -} - -/** - * Enter description here... - * - * @param unknown_type $user - * @param bool $by_username - * @return unknown - * - * @author Olivier Cauberghe , Ghent University - */ -function handle_encrypted_password($user, $by_username = false) { - - global $_configuration; - - /* - $emailHeaders = get_email_headers(); // Email Headers - */ - $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT - - if ($by_username) { // Show only for lost password - $user_account_list = get_user_account_list($user, true, $by_username); // BODY - $email_to = $user['email']; - } else { - $user_account_list = get_user_account_list($user, true); // BODY - $email_to = $user[0]['email']; - } - - $secret_word = get_secret_word($email_to); - $email_body = get_lang('DearUser')." :\n".get_lang('password_request')."\n\n"; - $email_body .= "-----------------------------------------------\n".$user_account_list."\n-----------------------------------------------\n\n"; - $email_body .= get_lang('PasswordEncryptedForSecurity'); - $email_body .= "\n\n".get_lang('Formula').",\n".get_lang('PlataformAdmin'); - $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); - $email_admin = api_get_setting('emailAdministrator'); - - if (@api_mail('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) { - Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed')); - } else { - $message = get_lang('SystemUnableToSendEmailContact').' '.Display :: encrypted_mailto_link(api_get_setting('emailAdministrator'), get_lang('PlatformAdmin')).".

"; - Display::display_error_message($message, false); - } -} - -/** - * Enter description here... - * @author Olivier Cauberghe , Ghent University - */ -function get_secret_word($add) { - global $_configuration; - return $secret_word = md5($_configuration['security_key'].$add); -} - -/** - * Enter description here... - * @author Olivier Cauberghe , Ghent University - */ -function reset_password($secret, $id, $by_username = false) { - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); - $id = intval($id); - $sql = "SELECT user_id AS uid, lastname AS lastName, firstname AS firstName, username AS loginName, password, email FROM ".$tbl_user." WHERE user_id=$id"; - $result = Database::query($sql); - $num_rows = Database::num_rows($result); - - if ($result && $num_rows > 0) { - $user = Database::fetch_array($result); - } else { - return 'Could not reset password.'; // TODO: This message has to be translated. - } - - if (get_secret_word($user['email']) == $secret) { // OK, secret word is good. Now change password and mail it. - $user['password'] = api_generate_password(); - $crypted = $user['password']; - $crypted = api_get_encrypted_password($crypted); - $sql = "UPDATE ".$tbl_user." SET password='$crypted' WHERE user_id=$id"; - $result = Database::query($sql); - return send_password_to_user($user, $by_username); - } else { - return 'Not allowed.'; // TODO: This message has to be translated. - } -} diff --git a/main/auth/profile.php b/main/auth/profile.php index ac830070da..f480d930cf 100755 --- a/main/auth/profile.php +++ b/main/auth/profile.php @@ -60,7 +60,7 @@ function generate_open_id_form() { beforeSend: function(objeto) { /*$("#div_api_key").html("Loading...");*/ }, type: "POST", - url: "../auth/generate_api_key.inc.php", + url: "'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=generate_api_key", data: "num_key_id="+"", success: function(datos) { $("#div_api_key").html(datos); diff --git a/main/exercice/admin.php b/main/exercice/admin.php index bfe2a4006c..c2c4e730e1 100755 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -423,6 +423,7 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) Display::display_header($nameTools,'Exercise'); + $show_quiz_edition = true; if (isset($exerciseId) && !empty($exerciseId)) { $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); @@ -438,8 +439,6 @@ if (isset($exerciseId) && !empty($exerciseId)) { echo '
'; echo Display::return_icon('preview.gif', get_lang('Preview')).''.get_lang('Preview').''; - - if ($show_quiz_edition) { echo Display::return_icon('edit.gif', get_lang('ModifyExercise')).''.get_lang('ModifyExercise').''; } else { diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 7d955a9207..6f52f86052 100755 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -801,7 +801,7 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) { echo ''.Display::return_icon('csv.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').''; echo '' . Display :: return_icon('excel.gif', get_lang('ExportAsXLS')) . get_lang('ExportAsXLS') . ''; //echo ''.Display::return_icon('synthese_view.gif',$alt).$alt.''; - echo '' . Display :: return_icon('quiz.gif', get_lang('BackToExercisesList')) . get_lang('BackToExercisesList') . ''; + echo '' . Display :: return_icon('message_reply_forum.png', get_lang('GoBackToQuestionList')) . get_lang('GoBackToQuestionList') . ''; echo '
'; echo ''; echo ''; @@ -820,7 +820,7 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) { } else { //the student view if ($show == 'result') { - echo '' . Display :: return_icon('quiz.gif', get_lang('BackToExercisesList')) . get_lang('BackToExercisesList') . ''; + echo '' . Display :: return_icon('message_reply_forum.png', get_lang('GoBackToQuestionList')) . get_lang('GoBackToQuestionList') . ''; } else { echo '' . Display :: return_icon('show_test_results.gif', get_lang('Results')) . get_lang('Results') . ''; } @@ -908,8 +908,8 @@ if ($show == 'test') { <?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?> - <?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?> - <?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?> + ')) return false;"><?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?> + ')) return false;" ><?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?> validate()) { $objExercise -> processCreation($form); if ($form -> getSubmitValue('edit') == 'true') { header('Location:exercice.php?message=ExerciseEdited&'.api_get_cidreq()); + exit; } else { header('Location:admin.php?message=ExerciseAdded&exerciseId='.$objExercise->id); + exit; } } else { /********************* @@ -174,14 +175,17 @@ if ($form -> validate()) { } if (!empty($gradebook) && $gradebook=='view') { - $interbreadcrumb[]= array ( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], - 'name' => get_lang('Gradebook') - ); + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('Gradebook')); } $nameTools=get_lang('ExerciseManagement'); - $interbreadcrumb[] = array ("url"=>"exercice.php", "name"=> get_lang('Exercices')); - Display::display_header($nameTools,"Exercise"); + $interbreadcrumb[] = array ("url"=>'exercice.php', 'name'=> get_lang('Exercices')); + Display::display_header($nameTools,get_lang('Exercise')); + + echo ''; + + if ($objExercise->feedbacktype==1) Display::display_normal_message(get_lang("DirectFeedbackCantModifyTypeQuestion")); if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { diff --git a/main/exercice/hotpotatoes.php b/main/exercice/hotpotatoes.php index 8fadf6fe04..b85976fa6c 100755 --- a/main/exercice/hotpotatoes.php +++ b/main/exercice/hotpotatoes.php @@ -1,26 +1,8 @@ '; + echo '' . Display :: return_icon('message_reply_forum.png', get_lang('GoBackToQuestionList')) . get_lang('GoBackToQuestionList') . ''; + echo '
'; if ($finish==2) //if we are in the img upload process { diff --git a/main/exercice/question_create.php b/main/exercice/question_create.php index 747477accc..a19f0772ea 100755 --- a/main/exercice/question_create.php +++ b/main/exercice/question_create.php @@ -1,40 +1,15 @@ - "exercice.php","name" => get_lang('Exercices') // Tool name $nameTools=get_lang('AddQuestionToExercise'); - - // The form $form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq()); // form title @@ -76,8 +49,7 @@ $tbl_exercices = Database :: get_course_table(TABLE_QUIZ_TEST); $sql = "SELECT id,title,type,description, results_disabled FROM $tbl_exercices WHERE active<>'-1' ORDER BY title ASC"; $result = Database::query($sql); $exercises['-'] = '-'.get_lang('SelectExercice').'-'; -while ($row = Database :: fetch_array($result)) -{ +while ($row = Database :: fetch_array($result)) { $exercises[$row['id']] = $row['title']; } $form->addElement('select', 'exercice', get_lang('Exercice'), $exercises); @@ -92,28 +64,25 @@ $form->addRule('exercice', ''.get_lang('YouHaveToSelectAT $form->registerRule('validquestiontype', 'callback', 'check_question_type'); $form->addRule('question_type_hidden', get_lang('InvalidQuestionType'), 'validquestiontype'); - - -if ($form->validate()) -{ +if ($form->validate()) { $values = $form->exportValues(); //echo 'form validates'; //print_r($values); - foreach (Question::$questionTypes as $question_type_id => $question_type_class_and_name) - { - if (get_lang($question_type_class_and_name[1]) == $values['question_type_hidden']) - { + foreach (Question::$questionTypes as $question_type_id => $question_type_class_and_name) { + if (get_lang($question_type_class_and_name[1]) == $values['question_type_hidden']) { $answer_type = $question_type_id; } } - header('Location: admin.php?exerciseId='.$values['exercice'].'&newQuestion=yes&answerType='.$answer_type); -} -else -{ + exit; +} else { // header Display::display_header($nameTools); + + echo ''; // displaying the form $form->display(); @@ -121,20 +90,12 @@ else // footer Display::display_footer(); } - - ?> - - -