$language_file=array('admin','tracking'); // resetting the course id $cidReset=true; // including some necessary dokeos files require('../inc/global.inc.php'); require_once(api_get_path(LIBRARY_PATH).'security.lib.php'); // setting the section (for the tabs) $this_section=SECTION_PLATFORM_ADMIN; // Access restrictions api_protect_admin_script(true); $nameTools = get_lang('PlatformAdmin'); // setting breadcrumbs $interbreadcrumb[] = array('url' => 'index.php', 'name' => $nameTools); // setting the name of the tool $tool_name=get_lang("PlatformAdmin"); // Displaying the header Display::display_header($nameTools); if(api_is_platform_admin()): if(is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php')) { Display::display_normal_message(get_lang('InstallDirAccessibleSecurityThreat')); } /* ============================================================================== ACTION HANDLING ============================================================================== */ if ($_POST['Register']) { register_site(); Display :: display_confirmation_message(get_lang('VersionCheckEnabled')); } /* ============================================================================== MAIN SECTION ============================================================================== */ $keyword_url = Security::remove_XSS($_GET['keyword']); ?>

, Ghent University * @version august 2006 * @todo have a 6monthly re-registration */ function version_check() { // The site has not been registered yet if (get_setting('registered')=='false' OR get_setting('registered') == false ) { $return = ''; $return .= '
'; $return .= get_lang('VersionCheckExplanation'); $return .= ' Do not display my campus in the list of Dokeos platforms'; $return .= ''; $return .= '
'; } else { // The site has been registered already but is seriously out of date (registration date + 15552000 seconds) if ((get_setting('registered') + 15552000) > mktime()) { $return = 'It has been a long time since about your campus has been updated on Dokeos.com'; $return .= '
'; $return .= ''; $return .= '
'; } else { $return = 'site registered. '; $return .= check_dokeos_version2(); } } return $return; } /** * This setting changes the registration status for the campus * * @author Patrick Cool , Ghent University * @version August 2006 * * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also. */ function register_site() { // Database Table Definitions $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); // the SQL statment $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'"; $result = api_sql_query($sql); // if ($_POST['donotlistcampus']) { $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'"; $result = api_sql_query($sql); } // reload the settings } /** * Check if the current installation is up to date * The code is borrowed from phpBB and slighlty modified * @author The phpBB Group (the code) * @author Patrick Cool , Ghent University (the modifications) * @copyright (C) 2001 The phpBB Group * @return language string with some layout (color) */ function check_dokeos_version2() { global $_configuration; $dokeos_version = trim($_configuration['dokeos_version']); // the dokeos version of your installation if (ini_get('allow_url_fopen')==1) { // the number of courses $sql="SELECT count(code) FROM ".Database::get_main_table(TABLE_MAIN_COURSE); $result=api_sql_query($sql); $row = Database::fetch_array($result); $number_of_courses = $row[0]; // the number of users $sql="SELECT count(user_id) FROM ".Database::get_main_table(TABLE_MAIN_USER); $result=api_sql_query($sql); $row = Database::fetch_array($result); $number_of_users = $row[0]; $version_url= 'http://www.dokeos.com/version.php?url='.urlencode(api_get_path(WEB_PATH)).'&campus='.urlencode(api_get_setting('siteName')).'&contact='.urlencode(api_get_setting('emailAdministrator')).'&version='.urlencode($dokeos_version).'&numberofcourses='.urlencode($number_of_courses).'&numberofusers='.urlencode($number_of_users).'&donotlistcampus='.api_get_setting('donotlistcampus').'&organisation='.urlencode(api_get_setting('Institution')).'&adminname='.urlencode(api_get_setting('administratorName').' '.api_get_setting('administratorSurname')); $handle=@fopen($version_url,'r'); $version_info=trim(@fread($handle, 1024)); if ($dokeos_version<>$version_info) { $output='
' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' Dokeos '.$version_info.'. '.get_lang('YourVersionIs').' Dokeos '.$dokeos_version. '. '.str_replace('http://www.dokeos.com','http://www.dokeos.com',get_lang('PleaseVisitDokeos')).''; } else { $output = '
'.get_lang('VersionUpToDate').': Dokeos '.$version_info.''; } } else { $output = '' . get_lang('AllowurlfopenIsSetToOff') . ''; } return $output; } /** * Check if the current installation is up to date * The code is borrowed from phpBB and slighlty modified * @author The phpBB Group (the code) * @author Patrick Cool , Ghent University (the modifications) * @copyright (C) 2001 The phpBB Group * @return language string with some layout (color) * @deprecated For some reason this code adds a 9 in front and a 0 at the end of what normally gets displayed by the http://www.dokeos.com/version.php page (instead of version.txt) . That's why I chose to use fopen which requires however that allow_url_open is set to true */ function check_dokeos_version() { global $_configuration; // the dokeos version of your installation $dokeos_version = $_configuration['dokeos_version']; if ($fsock = @fsockopen('www.dokeos.com', 80, $errno, $errstr)) { @fputs($fsock, "GET /version.php HTTP/1.1\r\n"); @fputs($fsock, "HOST: www.dokeos.com\r\n"); @fputs($fsock, "Connection: close\r\n\r\n"); $get_info = false; while (!@feof($fsock)) { if ($get_info) { $version_info .= @fread($fsock, 1024); } else { if (@fgets($fsock, 1024) == "\r\n") { $get_info = true; } } } @fclose($fsock); if (trim($dokeos_version)<>trim($version_info)) { $output='' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' Dokeos '.$version_info.'. '.get_lang('YourVersionIs').' Dokeos '.$dokeos_version. '. '.str_replace('http://www.dokeos.com','http://www.dokeos.com',get_lang('PleaseVisitDokeos')).''; } else { $output = ''.get_lang('VersionUpToDate').': Dokeos '.$version_info.''; } } else { if ($errstr) { $output = '' . get_lang('ConnectSocketError') . ': '. $errstr . ''; } else { $output = '' . get_lang('SocketFunctionsDisabled') . ''; } } return $output; } /* ============================================================================== FOOTER ============================================================================== */ Display::display_footer(); ?>