dokeos-admin
[ class tree: dokeos-admin ] [ index: dokeos-admin ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php // $Id: index.php 15344 2008-05-20 22:47:40Z juliomontoya $
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2004-2008 Dokeos SPRL
  7.     Copyright (c) 2003 Ghent University (UGent)
  8.     Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9.     Copyright (c) Olivier Brouckaert
  10.  
  11.     For a full list of contributors, see "credits.txt".
  12.     The full license can be read in "license.txt".
  13.  
  14.     This program is free software; you can redistribute it and/or
  15.     modify it under the terms of the GNU General Public License
  16.     as published by the Free Software Foundation; either version 2
  17.     of the License, or (at your option) any later version.
  18.  
  19.     See the GNU General Public License for more details.
  20.  
  21.     Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
  22. ==============================================================================
  23. */
  24. /**
  25. ==============================================================================
  26. *    Index of the admin tools
  27. *
  28. *    @package dokeos.admin
  29. ==============================================================================
  30. */
  31. // name of the language file that needs to be included <br />
  32. $language_file=array('admin','tracking');
  33.  
  34. // resetting the course id
  35. $cidReset=true;
  36.  
  37. // including some necessary dokeos files
  38. require('../inc/global.inc.php');
  39. require_once(api_get_path(LIBRARY_PATH).'security.lib.php');
  40.  
  41. // setting the section (for the tabs)
  42. $this_section=SECTION_PLATFORM_ADMIN;
  43.  
  44. // Access restrictions
  45. $nameTools get_lang('PlatformAdmin');
  46.  
  47. // setting breadcrumbs
  48. $interbreadcrumb[array('url' => 'index.php''name' => $nameTools);
  49.  
  50. // setting the name of the tool
  51. $tool_name=get_lang('PlatformAdmin');
  52.  
  53. // Displaying the header
  54. Display::display_header($nameTools);
  55.  
  56.  
  57. if(is_dir(api_get_path(SYS_CODE_PATH).'install/'&& is_readable(api_get_path(SYS_CODE_PATH).'install/index.php'))
  58. {
  59.     Display::display_normal_message(get_lang('InstallDirAccessibleSecurityThreat'));
  60. }
  61. /*
  62. ==============================================================================
  63.         ACTION HANDLING
  64. ==============================================================================
  65. */
  66. if (!empty($_POST['Register']))
  67. {
  68.     register_site();
  69.     Display :: display_confirmation_message(get_lang('VersionCheckEnabled'));
  70. }
  71.  
  72. /*
  73. ==============================================================================
  74.         MAIN SECTION
  75. ==============================================================================
  76. */
  77. $keyword_url Security::remove_XSS((empty($_GET['keyword'])?'':$_GET['keyword']));
  78. ?>
  79.  
  80. <div class="admin_section">
  81. <h4><img src="../img/members.gif" border="0" style="vertical-align: middle;" alt="" /> <?php echo ucfirst(get_lang('Users'))?></h4>
  82.     <ul><li style="list-style-type:none"><form method="get" action="user_list.php">
  83.  
  84.     <input type="text" name="keyword" value="<?php echo $keyword_url?>"/>
  85.     <input type="submit" value="<?php echo get_lang('Search')?>"/>
  86.     </form></li>
  87.     <li>
  88. <a href="user_list.php?search=advanced"><?php echo ucfirst(get_lang('AdvancedSearch'))?></a>
  89.  
  90. </li>
  91. <li><a href="user_list.php"><?php echo get_lang('UserList'?></a></li>
  92. <li><a href="user_add.php"><?php echo get_lang('AddUsers'?></a></li>
  93. <li><a href="user_export.php"><?php echo get_lang('ExportUserListXMLCSV'?></a></li>
  94. <li><a href="user_import.php"><?php echo get_lang('ImportUserListXMLCSV'?></a></li>
  95. <li><a href="user_fields.php"><?php echo get_lang('ManageUserFields')?></a></li>
  96. </ul>
  97. </div>
  98.  
  99. <div class="admin_section">
  100. <h4><img src="../img/course.gif" border="0" style="vertical-align: middle;" alt="" /> <?php echo ucfirst(get_lang('Courses'))?></h4>
  101.     <ul><li style="list-style-type:none"><form method="get" action="course_list.php">
  102.  
  103.     <input type="text" name="keyword" value="<?php echo $keyword_url?>"/>
  104.     <input type="submit" value="<?php echo get_lang('Search')?>"/>
  105.     </form></li>
  106.     <li>
  107.     <a href="course_list.php?search=advanced"><?php echo ucfirst(get_lang('AdvancedSearch'))?></a>
  108.  
  109. </li>
  110. <li><a href="course_list.php"><?php echo get_lang('CourseList'?></a></li>
  111. <li><a href="course_add.php"><?php echo get_lang('AddCourse'?></a></li>
  112. <li><a href="course_import.php"><?php echo get_lang('AddCourse').' CSV'?></a></li>
  113. <!--<li><a href="course_virtual.php"><?php //echo get_lang('AdminManageVirtualCourses') ?></a></li>-->
  114. <li><a href="course_category.php"><?php echo get_lang("AdminCategories")?></a></li>
  115. <li><a href="subscribe_class2course.php"><?php echo get_lang('AddClassesToACourse')?></a></li>
  116. <li><a href="subscribe_user2course.php"><?php echo get_lang('AddUsersToACourse')?></a></li>
  117. <li><a href="course_user_import.php"><?php echo get_lang('AddUsersToACourse').' CSV'?></a></li>
  118. </ul>
  119. </div>
  120.  
  121. <div class="admin_section">
  122.  <h4>
  123.   <img src="../img/settings.gif" border="0" style="vertical-align: middle;" alt="" />
  124.   <?php echo ucfirst(get_lang('Platform'))?>
  125.  </h4>
  126.  <ul>
  127.   <li><a href="settings.php"><?php echo get_lang('DokeosConfigSettings'?></a></li>
  128.   <li><a href="system_announcements.php"><?php echo get_lang('SystemAnnouncements'?></a></li>
  129.   <li><a href="languages.php"><?php echo get_lang('Languages')?></a></li>
  130.   <li><a href="configure_homepage.php"><?php echo get_lang('ConfigureHomePage')?></a></li>
  131.   <li><a href="statistics/index.php"><?php echo get_lang('ToolName')?> </a></li>
  132.   <?php if(!empty($phpMyAdminPath))?>
  133.   <li><a href="<?php echo $phpMyAdminPath?>" target="_blank"><?php echo get_lang("AdminDatabases")?></a><br />(<?php echo get_lang("DBManagementOnlyForServerAdmin")?>)</li>
  134.   <?php endif?>
  135.  </ul>
  136. </div>
  137.  
  138. <?php
  139. endif;
  140.  
  141. if(api_get_setting('use_session_mode')=='true')
  142. {
  143. ?>
  144.  
  145. <div class="admin_section">
  146.  <h4>
  147.   <img src="../img/agenda.gif" border="0" align="absmiddle" alt="" />
  148.   <?php echo get_lang('Sessions'?>
  149.  </h4>
  150.  <ul>
  151.  <li style="list-style-type:none"><form method="POST" action="session_list.php">
  152.     <input type="text" name="keyword" value="<?php echo $keyword_url?>"/>
  153.     <input type="submit" value="<?php echo get_lang('Search')?>"/>
  154.     </form>
  155. </li>
  156.   <li><a href="session_list.php"><?php echo get_lang('ListSession'?></a></li>
  157.   <li><a href="session_add.php"><?php echo get_lang('AddSession'?></a></li>
  158.   <li><a href="session_import.php"><?php echo get_lang('ImportSessionListXMLCSV'?></a></li>
  159.   <li><a href="session_export.php"><?php echo get_lang('ExportSessionListXMLCSV'?></a></li>
  160.   </ul>
  161.   <br /><br />
  162. </div>
  163.  
  164. <?php
  165. }
  166. {
  167. ?>
  168.  
  169. <div class="admin_section">
  170. <h4><img src="../img/group.gif" border="0" style="vertical-align: middle;" alt="" /> <?php echo ucfirst(get_lang('AdminClasses'))?></h4>
  171. <ul>
  172. <li style="list-style-type:none"><form method="get" action="class_list.php">
  173.  
  174.     <input type="text" name="keyword" value="<?php echo $keyword_url?>"/>
  175.     <input type="submit" value="<?php echo get_lang('Search')?>"/>
  176.     </form>
  177. </li>
  178. <li><a href="class_list.php"><?php echo get_lang('ClassList')?></a></li>
  179. <li><a href="class_add.php"><?php echo get_lang('AddClasses')?></a></li>
  180. <li><a href="class_import.php"><?php echo get_lang('ImportClassListCSV')?></a></li>
  181. <li><a href="class_user_import.php"><?php echo get_lang('AddUsersToAClass')?> CSV</a></li>
  182. </ul>
  183. <br />
  184. <br />
  185. </div>
  186. <?php
  187. }
  188. ?>
  189.  
  190.  
  191.  
  192. <?php
  193. ?>
  194.  
  195.  
  196. <div class="admin_section">
  197.  <h4>
  198.   <img src="../img/visio_meeting.gif" border="0" style="vertical-align: middle;" alt="" />
  199.   <?php echo ucfirst(get_lang('ConfigureExtensions'))?>
  200.  </h4>
  201.  <ul>
  202.   <li><a href="configure_extensions.php?display=visio"><?php echo get_lang('Visioconf')?></a></li>
  203.   <li><a href="configure_extensions.php?display=ppt2lp"><?php echo get_lang('Ppt2lp')?></a></li>
  204.   <li><a href="configure_extensions.php?display=ephorus"><?php echo get_lang('EphorusPlagiarismPrevention')?></a></li>
  205.   <li><a href="configure_extensions.php?display=search"><?php echo get_lang('SearchEngine')?></a></li>
  206.   <li><a href="configure_extensions.php?display=serverstats"><?php echo get_lang('ServerStatistics')?></a></li>
  207.   <li><a href="configure_extensions.php?display=bandwidthstats"><?php echo get_lang('BandWidthStatistics')?></a></li>
  208.   </ul>
  209. </div>
  210. <?php
  211.     if(isset($extAuthSource&& isset($extAuthSource['ldap']&& count($extAuthSource['ldap'])>0){
  212.     ?>
  213.     <!-- dynamic ldap code --> 
  214.     <div class="admin_section">
  215.      <h4><img src="../img/members.gif" border="0" style="vertical-align: middle;" alt="LDAP" />LDAP</h4>
  216.      <ul>
  217.       <li><a href="ldap_users_list.php"><?php echo get_lang('ImportLDAPUsersIntoPlatform');?></a></li>
  218.       <li><a href="ldap_import_students.php"><?php echo get_lang('ImportLDAPUsersIntoCourse');?></a></li>
  219.       <li><a href="ldap_import_students_to_session.php"><?php echo get_lang('ImportLDAPUsersIntoSession');?></a></li>
  220.       <!--li><a href="ldap_users_synchro.php"><?php echo get_lang('LDAPSynchroImportUsersAndStepsInSessions');?></a></li-->
  221.      </ul>
  222.     </div>
  223.     <!-- dynamic ldap code -->
  224.     <?php 
  225.     }
  226. ?>
  227. <div class="admin_section">
  228.  <h4>
  229.   <img src="../img/dokeos.gif" border="0" style="vertical-align: middle;" alt="" />
  230.   <?php echo "dokeos.com"?>
  231.  </h4>
  232.  <ul>
  233.   <li><a href="http://www.dokeos.com/"><?php echo get_lang('DokeosHomepage')?></a></li>
  234.   <li><a href="http://www.dokeos.com/forum/"><?php echo get_lang('DokeosForum')?></a></li>  
  235.   <li><a href="http://www.dokeos.com/extensions/"><?php echo get_lang('DokeosExtensions')?></a></li>
  236.   <li>
  237.   <?php
  238.   //try to display a maximum before we check the dokeos version and all that
  239.       session_write_close()//close session to avoid blocking concurrent access
  240.     flush()//send data to client as much as allowed by the web server
  241.     //ob_flush();
  242.     echo get_lang('VersionCheck').': '.version_check();
  243.   ?>
  244.   </li>
  245.  </ul>
  246. </div>
  247. <?php
  248. }
  249.  
  250. /**
  251.  * Displays either the text for the registration or the message that the installation is (not) up to date
  252.  *
  253.  * @return string html code
  254.  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  255.  * @version august 2006
  256.  * @todo have a 6monthly re-registration
  257.  */
  258. function version_check()
  259. {
  260.     $tbl_settings Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  261.     $sql 'SELECT selected_value FROM  '.$tbl_settings.' WHERE variable="registered" ';
  262.     $result api_sql_query($sql,__FILE__,__LINE__);
  263.     $row=Database::fetch_array($result,'ASSOC');
  264.                                 
  265.     // The site has not been registered yet
  266.     //if (api_get_setting('registered')=='false')
  267.     
  268.     $return '';
  269.     if ($row['selected_value']=='false')
  270.     {    
  271.         $return .= '<form action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
  272.         $return .= get_lang('VersionCheckExplanation');
  273.         $return .= '<input type="checkbox" name="donotlistcampus" value="1" id="checkbox" /> Do not display my campus in the list of Dokeos platforms';
  274.         $return .= '<input type="submit" name="Register" value="Enable Version Check" id="register" />';
  275.         $return .= '</form>';
  276.     }
  277.     else
  278.     {
  279.         // The site has been registered already but is seriously out of date (registration date + 15552000 seconds)
  280.         /*
  281.         if ((api_get_setting('registered') + 15552000) > mktime())
  282.         {
  283.             $return = 'It has been a long time since about your campus has been updated on Dokeos.com';
  284.             $return .= '<form action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
  285.             $return .= '<input type="submit" name="Register" value="Enable Version Check" id="register" />';
  286.             $return .= '</form>';
  287.         }
  288.         else
  289.         {
  290.         */
  291.         $return 'site registered. ';
  292.         $return .= check_dokeos_version2();
  293.         //}
  294.     }
  295.     return $return;
  296. }
  297.  
  298. /**
  299.  * This setting changes the registration status for the campus
  300.  *
  301.  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  302.  * @version August 2006
  303.  *
  304.  * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
  305.  */
  306. function register_site()
  307. {
  308.     // Database Table Definitions
  309.     $tbl_settings Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  310.  
  311.     // the SQL statment
  312.     $sql "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
  313.     $result api_sql_query($sql,__FILE__,__LINE__);
  314.  
  315.     //
  316.     if ($_POST['donotlistcampus'])
  317.     {
  318.         $sql "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
  319.         $result api_sql_query($sql,__FILE__,__LINE__);
  320.     }
  321.  
  322.     // reload the settings
  323. }
  324.  
  325. /**
  326. * Check if the current installation is up to date
  327. * The code is borrowed from phpBB and slighlty modified
  328. @author The phpBB Group <support@phpbb.com> (the code)
  329. @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
  330. @copyright (C) 2001 The phpBB Group
  331. @return language string with some layout (color)
  332. */
  333. {
  334.     global $_configuration;
  335.     $dokeos_version trim($_configuration['dokeos_version'])// the dokeos version of your installation
  336.  
  337.     if (ini_get('allow_url_fopen')==1)
  338.     {
  339.         // the number of courses
  340.         $sql="SELECT count(code) FROM ".Database::get_main_table(TABLE_MAIN_COURSE);
  341.         $result=api_sql_query($sql,__FILE__,__LINE__);
  342.         $row Database::fetch_array($result);
  343.         $number_of_courses $row[0];
  344.  
  345.         // the number of users
  346.         $sql="SELECT count(user_id) FROM ".Database::get_main_table(TABLE_MAIN_USER);
  347.         $result=api_sql_query($sql,__FILE__,__LINE__);
  348.         $row Database::fetch_array($result);
  349.         $number_of_users $row[0];
  350.  
  351.         $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'));
  352.         $handle=@fopen($version_url,'r');
  353.         $version_info=trim(@fread($handle1024));
  354.  
  355.         if ($dokeos_version<>$version_info)
  356.         {
  357.             $output='<br /><span style="color:red">' get_lang('YourVersionNotUpToDate''. '.get_lang('LatestVersionIs').' <b>Dokeos '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Dokeos '.$dokeos_version'</b>. '.str_replace('http://www.dokeos.com','<a href="http://www.dokeos.com">http://www.dokeos.com</a>',get_lang('PleaseVisitDokeos')).'</span>';
  358.         }
  359.         else
  360.         {
  361.             $output '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Dokeos '.$version_info.'</span>';
  362.         }
  363.     }
  364.     else
  365.     {
  366.         $output '<span style="color:red">' get_lang('AllowurlfopenIsSetToOff''</span>';
  367.     }
  368.     return $output;
  369. }
  370.  
  371. /**
  372. * Check if the current installation is up to date
  373. * The code is borrowed from phpBB and slighlty modified
  374. @author The phpBB Group <support@phpbb.com> (the code)
  375. @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
  376. @copyright (C) 2001 The phpBB Group
  377. @return language string with some layout (color)
  378. @deprecated     For some reason this code adds a 9 in front and a 0 at the end of what normally gets displayed by
  379.                 the http://www.dokeos.com/version.php page (instead of version.txt) . That's why I chose to use fopen which requires however
  380.                 that allow_url_open is set to true
  381. */
  382. {
  383.     global $_configuration// the dokeos version of your installation
  384.     $dokeos_version $_configuration['dokeos_version'];
  385.  
  386.     if ($fsock @fsockopen('www.dokeos.com'80$errno$errstr))
  387.     {
  388.         @fputs($fsock"GET /version.php HTTP/1.1\r\n");
  389.         @fputs($fsock"HOST: www.dokeos.com\r\n");
  390.         @fputs($fsock"Connection: close\r\n\r\n");
  391.  
  392.         $get_info false;
  393.         while (!@feof($fsock))
  394.         {
  395.             if ($get_info)
  396.             {
  397.                 $version_info .= @fread($fsock1024);
  398.             }
  399.             else
  400.             {
  401.                 if (@fgets($fsock1024== "\r\n")
  402.                 {
  403.                     $get_info true;
  404.                 }
  405.             }
  406.         }
  407.         @fclose($fsock);
  408.  
  409.         if (trim($dokeos_version)<>trim($version_info))
  410.         {
  411.             $output='<span style="color:red">' get_lang('YourVersionNotUpToDate''. '.get_lang('LatestVersionIs').' <b>Dokeos '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Dokeos '.$dokeos_version'</b>. '.str_replace('http://www.dokeos.com','<a href="http://www.dokeos.com">http://www.dokeos.com</a>',get_lang('PleaseVisitDokeos')).'</span>';
  412.         }
  413.         else
  414.         {
  415.             $output '<span style="color:green">'.get_lang('VersionUpToDate').': Dokeos '.$version_info.'</span>';
  416.         }
  417.     }
  418.     else
  419.     {
  420.         if ($errstr)
  421.         {
  422.             $output '<span style="color:red">' get_lang('ConnectSocketError'': '$errstr '</span>';
  423.         }
  424.         else
  425.         {
  426.             $output '<span>' get_lang('SocketFunctionsDisabled''</span>';
  427.         }
  428.     }
  429.     return $output;
  430. }
  431. /*
  432. ==============================================================================
  433.         FOOTER
  434. ==============================================================================
  435. */
  436. ?>

Documentation generated on Thu, 12 Jun 2008 13:49:39 -0500 by phpDocumentor 1.4.1