index.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Index page of the admin tools
  5. * @package chamilo.admin
  6. */
  7. /**
  8. * Code
  9. */
  10. // Language files that need to be included.
  11. $language_file = array('admin', 'tracking','coursebackup');
  12. // Resetting the course id.
  13. $cidReset = true;
  14. // Including some necessary chamilo files.
  15. require_once '../inc/global.inc.php';
  16. require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php';
  17. // Setting the section (for the tabs).
  18. $this_section = SECTION_PLATFORM_ADMIN;
  19. // Access restrictions.
  20. api_protect_admin_script(true);
  21. $nameTools = get_lang('PlatformAdmin');
  22. // Displaying the header
  23. $message = '';
  24. if (api_is_platform_admin()) {
  25. if (is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php')) {
  26. $message = Display::return_message(get_lang('InstallDirAccessibleSecurityThreat'),'warning');
  27. }
  28. if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
  29. $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning');
  30. }
  31. /* ACTION HANDLING */
  32. if (!empty($_POST['Register'])) {
  33. register_site();
  34. $message = Display :: return_message(get_lang('VersionCheckEnabled'),'confirmation');
  35. }
  36. $keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
  37. }
  38. if (isset($_GET['msg']) && isset($_GET['type'])) {
  39. if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed')))
  40. switch($_GET['type']) {
  41. case 'error':
  42. $message = Display::return_message(get_lang($_GET['msg']), 'error');
  43. break;
  44. case 'confirmation':
  45. $message = Display::return_message(get_lang($_GET['msg']), 'confirm');
  46. }
  47. }
  48. $blocks = array();
  49. /* Users */
  50. $blocks['users']['icon'] = Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
  51. $blocks['users']['label'] = api_ucfirst(get_lang('Users'));
  52. if (api_is_platform_admin()) {
  53. $search_form = ' <form method="get" class="form-search" action="user_list.php">
  54. <input class="span3" type="text" name="keyword" value="">
  55. <button class="btn" type="submit">'.get_lang('Search').'</button>
  56. </form>';
  57. $blocks['users']['search_form'] = $search_form;
  58. $items = array(
  59. array('url'=>'user_list.php', 'label' => get_lang('UserList')),
  60. array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
  61. array('url'=>'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
  62. array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
  63. );
  64. if (api_get_setting('allow_social_tool') == 'true') {
  65. $items[] = array('url'=>'group_add.php', 'label' => get_lang('AddGroups'));
  66. $items[] = array('url'=>'group_list.php', 'label' => get_lang('GroupList'));
  67. }
  68. if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
  69. $items[] = array('url'=>'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
  70. }
  71. $items[] = array('url'=>'user_fields.php', 'label' => get_lang('ManageUserFields'));
  72. } else {
  73. $items = array(
  74. array('url'=>'user_list.php', 'label' => get_lang('UserList')),
  75. array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
  76. array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
  77. );
  78. }
  79. $items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
  80. $blocks['users']['items'] = $items;
  81. $blocks['users']['extra'] = null;
  82. if (api_is_platform_admin()) {
  83. /* Courses */
  84. $blocks['courses']['icon'] = Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
  85. $blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
  86. $search_form = ' <form method="get" class="form-search" action="course_list.php">
  87. <input class="span3" type="text" name="keyword" value="">
  88. <button class="btn" type="submit">'.get_lang('Search').'</button>
  89. </form>';
  90. $blocks['courses']['search_form'] = $search_form;
  91. $items = array();
  92. $items[] = array('url'=>'course_list.php', 'label' => get_lang('CourseList'));
  93. $items[] = array('url'=>'course_add.php', 'label' => get_lang('AddCourse'));
  94. if (api_get_setting('course_validation') == 'true') {
  95. $items[] = array('url'=>'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
  96. $items[] = array('url'=>'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
  97. $items[] = array('url'=>'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
  98. }
  99. $items[] = array('url'=>'course_export.php', 'label' => get_lang('ExportCourses'));
  100. $items[] = array('url'=>'course_import.php', 'label' => get_lang('ImportCourses'));
  101. $items[] = array('url'=>'course_category.php', 'label' => get_lang('AdminCategories'));
  102. $items[] = array('url'=>'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
  103. $items[] = array('url'=>'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
  104. //$items[] = array('url'=>'course_intro_pdf_import.php', 'label' => get_lang('ImportPDFIntroToCourses'));
  105. if (api_get_setting('gradebook_enable_grade_model') == 'true') {
  106. $items[] = array('url'=>'grade_models.php', 'label' => get_lang('GradeModel'));
  107. }
  108. if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
  109. $items[] = array('url'=>'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
  110. }
  111. $blocks['courses']['items'] = $items;
  112. $blocks['courses']['extra'] = null;
  113. /* Platform */
  114. $blocks['platform']['icon'] = Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
  115. $blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
  116. $search_form = ' <form method="get" action="settings.php" class="form-search">
  117. <input class="span3" type="text" name="search_field" value="" >
  118. <input type="hidden" value="search_setting" name="category">
  119. <button class="btn" type="submit">'.get_lang('Search').'</button>
  120. </form>';
  121. $blocks['platform']['search_form'] = $search_form;
  122. $items = array();
  123. $items[] = array('url'=>'settings.php', 'label' => get_lang('PlatformConfigSettings'));
  124. $items[] = array('url'=>'settings.php?category=Plugins','label' => get_lang('Plugins'));
  125. $items[] = array('url'=>'settings.php?category=Regions','label' => get_lang('Regions'));
  126. $items[] = array('url'=>'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
  127. $items[] = array('url'=> api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
  128. $items[] = array('url'=>'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
  129. $items[] = array('url'=>'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
  130. $items[] = array('url'=>'statistics/index.php', 'label' => get_lang('Statistics'));
  131. $items[] = array('url'=> api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php', 'label' => get_lang('Reports'));
  132. /* Event settings */
  133. if (api_get_setting('activate_email_template') == 'true') {
  134. $items[] = array('url'=>'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
  135. }
  136. if (!empty($_configuration['multiple_access_urls'])) {
  137. if (api_is_global_platform_admin()) {
  138. $items[] = array('url'=>'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
  139. }
  140. }
  141. if (api_get_setting('allow_reservation') == 'true') {
  142. $items[] = array('url'=>'../reservation/m_category.php', 'label' => get_lang('BookingSystem'));
  143. }
  144. if (api_get_setting('allow_terms_conditions') == 'true') {
  145. $items[] = array('url'=>'legal_add.php', 'label' => get_lang('TermsAndConditions'));
  146. }
  147. $blocks['platform']['items'] = $items;
  148. $blocks['platform']['extra'] = null;
  149. }
  150. /* Sessions */
  151. $blocks['sessions']['icon'] = Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
  152. $blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
  153. $search_form = ' <form method="GET" class="form-search" action="session_list.php">
  154. <input class="span3" type="text" name="keyword" value="">
  155. <button class="btn" type="submit">'.get_lang('Search').'</button>
  156. </form>';
  157. $blocks['sessions']['search_form'] = $search_form;
  158. $items = array();
  159. $items[] = array('url'=>'session_list.php', 'label' => get_lang('ListSession'));
  160. $items[] = array('url'=>'session_add.php', 'label' => get_lang('AddSession'));
  161. $items[] = array('url'=>'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
  162. $items[] = array('url'=>'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
  163. $items[] = array('url'=>'session_import_drh.php', 'label' => get_lang('ImportSessionDrhList'));
  164. if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
  165. $items[] = array('url'=>'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
  166. }
  167. $items[] = array('url'=>'session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
  168. $items[] = array('url'=>'../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
  169. if (api_is_platform_admin()) {
  170. if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { // option only visible in development mode. Enable through code if required
  171. $items[] = array('url'=>'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
  172. }
  173. $items[] = array('url'=>'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
  174. }
  175. $blocks['sessions']['items'] = $items;
  176. $blocks['sessions']['extra'] = null;
  177. /* Settings */
  178. if (api_is_platform_admin()) {
  179. $blocks['settings']['icon'] = Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_SMALL, false);
  180. $blocks['settings']['label'] = api_ucfirst(get_lang('System'));
  181. $items = array();
  182. $items[] = array('url'=>'special_exports.php', 'label' => get_lang('SpecialExports'));
  183. if (!empty($_configuration['db_admin_path'])) {
  184. $items[] = array('url'=>$_configuration['db_admin_path'], 'label' => get_lang('AdminDatabases').' ('.get_lang('DBManagementOnlyForServerAdmin').') ');
  185. }
  186. $items[] = array('url'=>'system_status.php', 'label' => get_lang('SystemStatus'));
  187. if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
  188. $items[] = array('url'=>'filler.php', 'label' => get_lang('DataFiller'));
  189. }
  190. $items[] = array('url'=>'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
  191. if (api_get_setting('server_type') === 'test') {
  192. $items[] = array('url'=>'system_management.php', 'label' => get_lang('SystemManagement'));
  193. }
  194. if (isset($_configuration['db_manager_enabled']) &&
  195. $_configuration['db_manager_enabled'] == true &&
  196. api_is_global_platform_admin()
  197. ) {
  198. $host = $_configuration['db_host'];
  199. $username = $_configuration['db_user'];
  200. $databaseName = $_configuration['main_database'];
  201. $items[] = array('url'=>"db.php?username=$username&db=$databaseName&server=$host", 'label' => get_lang('Database Manager'));
  202. }
  203. $blocks['settings']['items'] = $items;
  204. $blocks['settings']['extra'] = null;
  205. $blocks['settings']['search_form'] = null;
  206. /* Extensions */
  207. /*
  208. $blocks['extensions']['icon'] = Display::return_icon('visio_meeting.gif', get_lang('ConfigureExtensions'), array(), ICON_SIZE_SMALL, false);
  209. $blocks['extensions']['label'] = api_ucfirst(get_lang('ConfigureExtensions'));
  210. $items = array();
  211. $items[] = array('url'=>'configure_extensions.php?display=visio', 'label' => get_lang('Visioconf'));
  212. $items[] = array('url'=>'configure_extensions.php?display=ppt2lp', 'label' => get_lang('Ppt2lp'));
  213. //$items[] = array('url'=>'configure_extensions.php?display=ephorus', 'label' => get_lang('EphorusPlagiarismPrevention'));
  214. $items[] = array('url'=>'configure_extensions.php?display=search', 'label' => get_lang('SearchEngine'));
  215. $items[] = array('url'=>'configure_extensions.php?display=serverstats', 'label' => get_lang('ServerStatistics'));
  216. $items[] = array('url'=>'configure_extensions.php?display=bandwidthstats', 'label' => get_lang('BandWidthStatistics'));
  217. $blocks['extensions']['items'] = $items;
  218. */
  219. //Skills
  220. if (api_get_setting('allow_skills_tool') == 'true') {
  221. $blocks['skills']['icon'] = Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_SMALL, false);
  222. $blocks['skills']['label'] = get_lang('Skills');
  223. $items = array();
  224. //$items[] = array('url'=>'skills.php', 'label' => get_lang('SkillsTree'));
  225. $items[] = array('url'=>'skills_wheel.php', 'label' => get_lang('SkillsWheel'));
  226. $items[] = array('url'=>'skills_import.php', 'label' => get_lang('SkillsImport'));
  227. //$items[] = array('url'=>'skills_profile.php', 'label' => get_lang('SkillsProfile'));
  228. $items[] = array('url'=>api_get_path(WEB_CODE_PATH).'social/skills_ranking.php', 'label' => get_lang('SkillsRanking'));
  229. $items[] = array('url'=>'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks'));
  230. $blocks['skills']['items'] = $items;
  231. $blocks['skills']['extra'] = null;
  232. $blocks['skills']['search_form'] = null;
  233. }
  234. /* Chamilo.org */
  235. $blocks['chamilo']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
  236. $blocks['chamilo']['label'] = 'Chamilo.org';
  237. $items = array();
  238. $items[] = array('url'=>'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
  239. $items[] = array('url'=>'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
  240. $items[] = array('url'=>'../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
  241. $items[] = array('url'=>'../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
  242. $items[] = array('url'=>'../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
  243. $items[] = array('url'=>'../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
  244. $items[] = array('url'=>'../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
  245. $items[] = array('url'=>'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
  246. $items[] = array('url'=>'http://www.chamilo.org/en/providers', 'label' => get_lang('ChamiloOfficialServicesProviders'));
  247. $blocks['chamilo']['items'] = $items;
  248. $blocks['chamilo']['extra'] = null;
  249. $blocks['chamilo']['search_form'] = null;
  250. // Try to display a maximum before we check the chamilo version and all that.
  251. //session_write_close(); //close session to avoid blocking concurrent access
  252. //flush(); //send data to client as much as allowed by the web server
  253. //ob_flush();
  254. //Version check
  255. $blocks['version_check']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
  256. $blocks['version_check']['label'] = get_lang('VersionCheck');
  257. $blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';
  258. $blocks['version_check']['search_form'] = null;
  259. $blocks['version_check']['items'] = null;
  260. //$blocks['version_check']['class'] = '';
  261. }
  262. $admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
  263. $tpl = new Template();
  264. $tpl->assign('web_admin_ajax_url', $admin_ajax_url);
  265. $tpl->assign('blocks', $blocks);
  266. // The template contains the call to the AJAX version checker
  267. $admin_template = $tpl->get_template('admin/settings_index.tpl');
  268. $content = $tpl->fetch($admin_template);
  269. $tpl->assign('content', $content);
  270. $tpl->assign('message', $message);
  271. $tpl->display_one_col_template();
  272. /**
  273. * This setting changes the registration status for the campus
  274. *
  275. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  276. * @version August 2006
  277. *
  278. * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
  279. */
  280. function register_site() {
  281. $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  282. $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
  283. Database::query($sql);
  284. if ($_POST['donotlistcampus']) {
  285. $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
  286. Database::query($sql);
  287. }
  288. // Reload the settings.
  289. }
  290. // Note: version checking mechanism has now been moved to main/inc/ajax/admin.ajax.php