header.inc.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script displays the Chamilo header.
  5. * @package chamilo.include
  6. */
  7. /* HEADERS SECTION */
  8. // Server mode indicator.
  9. /*
  10. if (api_is_platform_admin()) {
  11. if (api_get_setting('server_type') == 'test') {
  12. error_reporting(E_ALL);
  13. $mtime = microtime();
  14. $mtime = explode(" ",$mtime);
  15. $mtime = $mtime[1] + $mtime[0];
  16. $starttime = $mtime;
  17. $_SESSION['page_start_time_execution'] = $starttime;
  18. }
  19. }*/
  20. header('Content-Type: text/html; charset='.api_get_system_encoding());
  21. //show the X-Powered-By header so that parsers can find it
  22. global $_configuration;
  23. header('X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'],0,1));
  24. $navigator_info = api_get_navigator();
  25. //ie6 fix
  26. if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
  27. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix_tilebg.js" type="text/javascript" language="javascript"></script>';
  28. }
  29. // Include here the script ASCIIMathML.js if you want to show mathematical formulas and graphics
  30. // not only in the "Documents" tool, but elsewhere in the system. This setting is related to the
  31. // online editor's plugins 'asciimath' and 'asciisvg'.
  32. if (api_get_setting('include_asciimathml_script') == 'true') {
  33. $htmlHeadXtra[] = api_get_js('asciimath/ASCIIMathML.js');
  34. }
  35. if (isset($httpHeadXtra) && $httpHeadXtra) {
  36. foreach ($httpHeadXtra as & $thisHttpHead) {
  37. header($thisHttpHead);
  38. }
  39. }
  40. // Get language iso-code for this page - ignore errors
  41. $document_language = api_get_language_isocode();
  42. $course_title = $_course['name'];
  43. $title_list[] = api_get_setting('Institution');
  44. $title_list[] = api_get_setting('siteName');
  45. if (!empty($course_title)) {
  46. $title_list[] = $course_title;
  47. }
  48. if ($nameTools != '') {
  49. $title_list[] = $nameTools;
  50. }
  51. $title_string = '';
  52. for($i=0; $i<count($title_list);$i++) {
  53. $title_string .=$title_list[$i];
  54. if (isset($title_list[$i+1])) {
  55. $item = trim($title_list[$i+1]);
  56. if (!empty($item))
  57. $title_string .=' - ';
  58. }
  59. }
  60. /*
  61. * HTML HEADER
  62. */
  63. ?>
  64. <!DOCTYPE html
  65. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  66. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  67. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
  68. <head>
  69. <title>
  70. <?php
  71. echo Security::remove_XSS($title_string);
  72. ?>
  73. </title>
  74. <style type="text/css" media="screen, projection">
  75. /*<![CDATA[*/
  76. <?php
  77. $platform_theme = api_get_setting('stylesheets');
  78. $my_style = api_get_visual_theme();
  79. global $show_learn_path;
  80. if ($show_learn_path) {
  81. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CSS_PATH).$my_style.'/learnpath.css"/>';
  82. }
  83. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/dtree/dtree.css" />'; //will be moved
  84. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/dtree/dtree.js" type="text/javascript"></script>'; //will be moved
  85. //Base CSS
  86. echo '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
  87. //Default CSS
  88. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/default.css";';
  89. //Course CSS
  90. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/course.css";';
  91. // enabling page to load extra css from correct theme
  92. if (isset($htmlCSSXtra) && $htmlCSSXtra) {
  93. foreach ($htmlCSSXtra as & $css)
  94. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/'.$css.'";'."\n";
  95. }
  96. if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
  97. echo 'img, div { behavior: url('.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix.htc) } ';
  98. }
  99. ?>
  100. /*]]>*/
  101. </style>
  102. <style type="text/css" media="print">
  103. /*<![CDATA[*/
  104. <?php
  105. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/print.css";';
  106. ?>
  107. /*]]>*/
  108. </style>
  109. <script src="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/jquery.min.js" type="text/javascript" ></script>
  110. <script src="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/chosen/chosen.jquery.min.js" type="text/javascript" ></script>
  111. <script src="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/thickbox.js" type="text/javascript" ></script>
  112. <link rel="stylesheet" href="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/thickbox.css" type="text/css" media="projection, screen" />
  113. <link rel="stylesheet" href="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/chosen/chosen.css" type="text/css" media="projection, screen" />
  114. <link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
  115. <link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/courses.php" title="<?php echo api_htmlentities(get_lang('OtherCourses'), ENT_QUOTES); ?>" />
  116. <link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/profile.php" title="<?php echo api_htmlentities(get_lang('ModifyProfile'), ENT_QUOTES); ?>" />
  117. <link href="http://www.chamilo.org/documentation.php" rel="Help" />
  118. <link href="http://www.chamilo.org/team.php" rel="Author" />
  119. <link href="http://www.chamilo.org" rel="Copyright" />
  120. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
  121. <meta name="Generator" content="<?php echo $_configuration['software_name'].' '.substr($_configuration['system_version'],0,1);?>" />
  122. <script src= "<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/jquery.menu.js" type="text/javascript"></script>
  123. <script type="text/javascript">
  124. //<![CDATA[
  125. // This is a patch for the "__flash__removeCallback" bug, see FS#4378.
  126. if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.userAgent.toLowerCase().indexOf( 'opera' ) == -1 ) ) {
  127. window.attachEvent( 'onunload', function() {
  128. window['__flash__removeCallback'] = function ( instance, name ) {
  129. try {
  130. if ( instance ) {
  131. instance[name] = null ;
  132. }
  133. } catch ( flashEx ) {
  134. }
  135. } ;
  136. });
  137. }
  138. //]]>
  139. </script>
  140. <?php
  141. if (api_get_setting('accessibility_font_resize') == 'true') {
  142. echo '<script src= "'.api_get_path(WEB_LIBRARY_PATH).'javascript/fontresize.js" type="text/javascript"></script>';
  143. }
  144. if (isset($htmlHeadXtra) && $htmlHeadXtra) {
  145. foreach ($htmlHeadXtra as & $this_html_head) {
  146. echo $this_html_head;
  147. }
  148. }
  149. if (isset($htmlIncHeadXtra) && $htmlIncHeadXtra) {
  150. foreach ($htmlIncHeadXtra as & $this_html_head) {
  151. include($this_html_head);
  152. }
  153. }
  154. // The following include might be subject to a setting proper to the course or platform.
  155. include api_get_path(LIBRARY_PATH).'javascript/email_links.lib.js.php';
  156. $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />';
  157. if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) {
  158. $access_url_id = api_get_current_access_url_id();
  159. if ($access_url_id != -1) {
  160. $url_info = api_get_access_url($access_url_id);
  161. $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
  162. $clean_url = replace_dangerous_char($url);
  163. $clean_url = str_replace('/', '-', $clean_url);
  164. $clean_url .= '/';
  165. $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path
  166. //we create the new dir for the new sites
  167. if (is_file($homep.'favicon.ico')) {
  168. $favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />';
  169. }
  170. }
  171. }
  172. echo $favico;
  173. if (!api_is_platform_admin()) {
  174. $extra_header = trim(api_get_setting('header_extra_content'));
  175. if (!empty($extra_header)) {
  176. echo $extra_header;
  177. }
  178. }
  179. ?>
  180. </head>
  181. <body dir="<?php echo api_get_text_direction(); ?>" <?php
  182. if (defined('CHAMILO_HOMEPAGE') && CHAMILO_HOMEPAGE)
  183. echo 'onload="javascript: if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
  184. <div class="skip">
  185. <ul>
  186. <li><a href="#menu"><?php echo get_lang('WCAGGoMenu'); ?></a></li>
  187. <li><a href="#content" accesskey="2"><?php echo get_lang('WCAGGoContent'); ?></a></li>
  188. </ul>
  189. </div>
  190. <?php
  191. // Banner
  192. require_once api_get_path(INCLUDE_PATH).'banner.inc.php';