model.inc.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?php
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # This file is part of DotClear.
  4. # Copyright (c) 2004 Olivier Meunier and contributors. All rights
  5. # reserved.
  6. #
  7. # DotClear is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # DotClear is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with DotClear; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. # ***** END LICENSE BLOCK *****
  22. # Création du haut de la page du backend
  23. function openPage($title='',$head='')
  24. {
  25. global $myMenu, $mySubMenu, $auth;
  26. commonHeaders();
  27. echo
  28. '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.
  29. ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
  30. '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.DC_LANG.'" lang="'.DC_LANG.'">'."\n".
  31. "<head>\n".
  32. ' <title>'.$title.' - '.dc_blog_name.' - DotClear '.DC_VERSION.'</title>'."\n".
  33. ' <style type="text/css">'."\n".
  34. ' @import "style/default.css";'."\n".
  35. " </style>\n".
  36. ' <script type="text/javascript" src="js/tools.js"></script>'."\n".
  37. $head.
  38. "</head>\n".
  39. "<body>\n";
  40. $myMenu->addItem(
  41. __('Entries'),'index.php','',
  42. (preg_match('/^index.php|poster.php|images.php|trackback.php$/',basename($_SERVER['PHP_SELF']))),
  43. true,'menuBillets');
  44. $myMenu->addItem(
  45. __('Comments'),'comments.php','',
  46. (preg_match('/^comment/',basename($_SERVER['PHP_SELF']))),
  47. true,'menuComments');
  48. $myMenu->addItem(
  49. __('Categories'),'cat_list.php','',
  50. (preg_match('/^cat/',basename($_SERVER['PHP_SELF']))),
  51. $auth->userLevel(5),'menuCategories');
  52. $myMenu->addItem(
  53. __('Editors'),'redac_list.php','',
  54. (preg_match('/^redac/',basename($_SERVER['PHP_SELF']))),
  55. $auth->userLevel(9),'menuUsers');
  56. $myMenu->addItem(
  57. __('Preferences'),'user_prefs.php','',
  58. (basename($_SERVER['PHP_SELF']) == 'user_prefs.php'),
  59. true,'menuPref');
  60. $myMenu->addItem(
  61. __('Tools'),'tools.php','',
  62. (basename($_SERVER['PHP_SELF']) == 'tools.php'),
  63. $auth->userLevel(9),'menuTools');
  64. echo
  65. '<div id="header">'."\n".
  66. $myMenu->draw()."\n".
  67. '</div>'."\n".
  68. '<div id="main">'."\n".
  69. $mySubMenu->draw()."\n".
  70. '<div id="content">'."\n".
  71. '<ul class="user-info">'.
  72. '<li class="ui-name">'.$_SESSION['sess_user_cn'].'</li>'.
  73. '<li class="ui-logout"><a href="index.php?logout=1">'.__('logout').'</a></li>'.
  74. '</ul>'.
  75. "\n";
  76. if(!empty($_GET['msg']))
  77. {
  78. echo '<p class="message">'.strip_tags($_GET['msg']).'</p>';
  79. }
  80. }
  81. function closePage()
  82. {
  83. global $con;
  84. echo
  85. "</div>\n".
  86. '<hr class="hidden clear" />'."\n".
  87. "</div>\n".
  88. '<p id="footer"><a href="http://www.dotclear.net/"><img '.
  89. 'src="images/dotclear_pw.png" alt="dotclear blog" /></a></p>'."\n";
  90. # URL de la page avec sessions
  91. /*
  92. if (defined('DEBUG') && DEBUG)
  93. {
  94. $page_uri = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  95. $valid_separator = (strpos($page_uri,'?')) ? '&' : '?';
  96. $page_uri = $t_uri = $page_uri.$valid_separator.session_name().'='.session_id();
  97. $page_uri = htmlspecialchars('http://'.$page_uri);
  98. echo '<p>'.$page_uri.'</p>';
  99. }
  100. //*/
  101. echo '</body></html>';
  102. if (isset($_SESSION)) {
  103. session_write_close();
  104. }
  105. if (!empty($con) && is_object($con)) {
  106. $con->close();
  107. }
  108. }
  109. /*
  110. Popup
  111. */
  112. function openPopup($title='',$encoding='')
  113. {
  114. commonHeaders($encoding);
  115. echo
  116. '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.
  117. ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
  118. '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.DC_LANG.'" lang="'.DC_LANG.'">'."\n".
  119. "<head>\n".
  120. '<title>'.$title.' - DotClear</title>'."\n".
  121. '<link rel="stylesheet" type="text/css" href="style/default.css" />'."\n".
  122. '<script type="text/javascript" src="js/tools.js"> </script>'."\n".
  123. "</head>\n".
  124. '<body class="popup">'."\n".
  125. '<div id="main">'."\n".
  126. '<div id="content">'."\n";
  127. }
  128. function closePopup()
  129. {
  130. global $con;
  131. echo
  132. "</div>\n".
  133. '<p class="small center clear"><a href="#" onclick="window.close();">'.__('Close this window').'</a></p>'."\n".
  134. "</div>\n".
  135. '<div id="footer"><img src="images/dotclear_pw.png" alt="dotclear blog" /></div>'."\n".
  136. "</body>\n".
  137. "</html>\n";
  138. # Fermeture de la connexion
  139. if (isset($_SESSION)) {
  140. session_write_close();
  141. }
  142. if (!empty($con) && is_object($con)) {
  143. $con->close();
  144. }
  145. }
  146. function commonHeaders($encoding='')
  147. {
  148. if ($encoding == '') {
  149. $encoding = dc_encoding;
  150. }
  151. header('Content-Type: text/html; charset='.$encoding);
  152. header('Content-Script-Type: text/javascript');
  153. header('Content-Style-Type: text/css');
  154. header('Content-Language: '.DC_LANG);
  155. }
  156. function helpLink($section,$id='',$str='<img src="images/ico_help.png" alt="(?)"/>')
  157. {
  158. $id = (trim($id)!='') ? '#'.$id : '';
  159. return
  160. '<a href="popuphelp.php?p='.$section.$id.'" onclick="popup(this.href); '.
  161. 'return false;">'.$str.'</a>';
  162. }
  163. ?>