index.php 17 KB

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