config error:".__FILE__."
set or "); else { $orderKey = array ("keyCourse", "keyTools", "keyTime"); } } /* ============================================================================== LOGIN ============================================================================== */ if ($_GET["submitAuth"] == 1) { echo "Attempted breakin - sysadmins notified."; session_destroy(); die(); } if ($_POST["submitAuth"]) { // To ensure legacy compatibility, we set the following variables. // But they should be removed at last. $uid = $_uid; $lastname = $_user['lastName']; $firstname = $_user['firstName']; $email = $_user['mail']; $status = $uData['status']; if (isset ($_uid)) { $sqlLastLogin = "SELECT UNIX_TIMESTAMP(login_date) FROM $track_login_table WHERE login_user_id = '$_uid' ORDER BY login_date DESC LIMIT 1"; $resLastLogin = api_sql_query($sqlLastLogin, __FILE__, __LINE__); if (!$resLastLogin) if (mysql_num_rows($resLastLogin) > 0) { $user_last_login_datetime = mysql_fetch_array($resLastLogin); $user_last_login_datetime = $user_last_login_datetime[0]; api_session_register('user_last_login_datetime'); } mysql_free_result($resLastLogin); event_login(); if (api_is_platform_admin()) { // decode all open event informations and fill the track_c_* tables include (api_get_path(LIBRARY_PATH)."stats.lib.inc.php"); decodeOpenInfos(); } } } // end login -- if($submit) else { // only if login form was not sent because if the form is sent the user was // already on the page. event_open(); } /* ----------------------------------------------------------- Header include the HTTP, HTML headers plus the top banner ----------------------------------------------------------- */ $help = "Clar"; Display :: display_header('', $help); /* ============================================================================== FUNCTIONS display_anonymous_right_menu() display_anonymous_course_list() display_login_form() handle_login_failed() display_lost_password_info() ============================================================================== */ /* ----------------------------------------------------------- Display functions ----------------------------------------------------------- */ /** * Displays the right-hand menu for anonymous users: * login form, useful links, help section * Warning: function defines globals * @version 1.0.1 */ function display_anonymous_right_menu() { global $loginFailed, $_plugins; $platformLanguage = api_get_setting('platformLanguage'); $_uid = api_get_user_id(); if ( !(isset($_uid) && $_uid) ) // only display if the user isn't logged in { api_display_language_form(); display_login_form(); if ($loginFailed) handle_login_failed(); if (api_get_setting('allow_lostpassword') == 'true' OR api_get_setting('allow_registration') == 'true') { echo ''; } api_plugin('loginpage_menu'); } /*** hide right menu "general" and other parts on anonymous right menu *****/ echo "
", "".get_lang("MenuGeneral").""; echo "'; echo '
'; if ($_uid) { api_plugin('campushomepage_menu'); } /**** use this comment to hide notice file section from right menu **** echo '
'; // includes for any files to be displayed below anonymous right menu if(!file_exists('home/home_notice_'.$user_selected_language.'.html')) { include ('home/home_notice.html'); } else { include('home/home_notice_'.$user_selected_language.'.html'); } echo '
'; **** end of hide various right menu items on anonymous right menu ****/ } /** * Reacts on a failed login: * displays an explanation with * a link to the registration form. * * @version 1.0.1 */ function handle_login_failed() { switch ($_GET['error']) { case '': $message = get_lang("InvalidId"); if (api_is_self_registration_allowed()) { $message = get_lang("InvalidForSelfRegistration"); } break; case 'account_expired': $message=get_lang('AccountExpired'); break; case 'account_inactive': $message=get_lang('AccountInactive'); break; case 'user_password_incorrect': $message=get_lang('InvalidId'); break; } echo "
".$message."
"; } /** * Adds a form to let users login * @version 1.1 */ function display_login_form() { $form = new FormValidator('formLogin'); $form->addElement('static',null,null,get_lang('UserName')); $form->addElement('text','login','',array('size'=>15)); $form->addElement('static',null,null,get_lang('Pass')); $form->addElement('password','password','',array('size'=>15)); $form->addElement('submit','submitAuth',get_lang('Ok')); $form->display(); } /** * Displays a link to the lost password section */ function display_lost_password_info() { echo "
  • ".get_lang("LostPassword")."
  • "; } /** * Display list of courses in a category. * (for anonymous users) * * Warning: this function defines globals. * @version 1.0 */ function display_anonymous_course_list() { //init global $coursesRepositoryWeb; $web_course_path = api_get_path(WEB_COURSE_PATH); $category = $_GET["category"]; $main_course_table = Database :: get_main_table(MAIN_COURSE_TABLE); $main_category_table = Database :: get_main_table(MAIN_CATEGORY_TABLE); $platformLanguage = api_get_setting('platformLanguage'); //get list of courses in category $category $sql_get_course_list = "SELECT * FROM $main_course_table cours WHERE category_code = '".$category."' ORDER BY UPPER(visual_code)"; //removed: AND cours.visibility='".COURSE_VISIBILITY_OPEN_WORLD."' $sql_result_courses = api_sql_query($sql_get_course_list, __FILE__, __LINE__); while ($course_result = mysql_fetch_array($sql_result_courses)) { $course_list[] = $course_result; } $sqlGetSubCatList = " SELECT t1.name,t1.code,t1.parent_id,t1.children_count,COUNT(DISTINCT t3.code) AS nbCourse FROM $main_category_table t1 LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id LEFT JOIN $main_course_table t3 ON (t3.category_code=t1.code AND t3.visibility='".COURSE_VISIBILITY_OPEN_WORLD."') WHERE t1.parent_id ". (empty ($category) ? "IS NULL" : "='$category'")." GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos"; $resCats = api_sql_query($sqlGetSubCatList, __FILE__, __LINE__); $thereIsSubCat = FALSE; if (mysql_num_rows($resCats) > 0) { $htmlListCat = "

    ".get_lang("CatList")."

    "."\n"; } echo $htmlTitre; if ($thereIsSubCat) echo $htmlListCat; while ($categoryName = mysql_fetch_array($resCats)) { echo "

    ", $categoryName['name'], "

    \n"; } $numrows = mysql_num_rows($sql_result_courses); if ($numrows > 0) { if ($thereIsSubCat) echo "
    \n"; echo "

    ", get_lang("CourseList"), "

    \n", "\n"; } else { // echo "
    ",get_lang('_No_course_publicly_available'),"
    \n"; } if ($category != "") { echo "

    ", "<< ", get_lang("BackToHomePage"), "", "

    \n"; } } function category_has_open_courses($category) { $main_course_table = Database :: get_main_table(MAIN_COURSE_TABLE); $sql_query = "SELECT * FROM $main_course_table WHERE category_code='$category'"; $sql_result = api_sql_query($sql_query, __FILE__, __LINE__); while ($course = mysql_fetch_array($sql_result)) { if ($is_allowed_anonymous_access) return true; //at least one open course } return false; } /* ============================================================================== MAIN CODE ============================================================================== */ echo '
    '; /* ----------------------------------------------------------------------------- Plugins for loginpage_main AND campushomepage_main ----------------------------------------------------------------------------- */ if (!$_uid) { api_plugin('loginpage_main'); } else { api_plugin('campushomepage_main'); } if (!empty ($_GET['include']) && !strstr($_GET['include'], '/') && strstr($_GET['include'], '.html')) { include ('./home/'.$_GET['include']); $pageIncluded = true; } else { if(!file_exists('home/home_news_'.$user_selected_language.'.html')) { include ('home/home_top.html'); } else { include('home/home_top_'.$user_selected_language.'.html'); } } // Display System announcements $announcement = $_GET['announcement'] ? $_GET['announcement'] : -1; SystemAnnouncementManager :: display_announcements(VISIBLE_GUEST, $announcement); // Display courses and category list if (!$pageIncluded) { // echo '
     
    '; echo '
    '; if (DISPLAY_COURSES_TO_ANONYMOUS_USERS) { display_anonymous_course_list(); } echo '
    '; /* echo '
    '; if(!file_exists('home/home_news_'.$user_selected_language.'.html')) { include ('home/home_news.html'); } else { include('home/home_news_'.$user_selected_language.'.html'); } echo '
    '; */ } echo '
    '; // Right Menu // language form, login section + useful weblinks echo ''; /* ============================================================================== FOOTER ============================================================================== */ Display :: display_footer(); ?>