/modules/PNphpBB2/profile.php

https://gitlab.com/bulwye/reliquerunt · PHP · 174 lines · 99 code · 9 blank · 66 comment · 12 complexity · 43cf561adde4424e1aa58ed384f4448a MD5 · raw file

  1. <?php
  2. /***************************************************************************
  3. * profile.php
  4. * -------------------
  5. * begin : Saturday, Feb 13, 2001
  6. * copyright : (C) 2001 The phpBB Group
  7. * email : support@phpbb.com
  8. *
  9. * $Id: profile.php,v 1.2 2006/04/28 17:49:44 adrianc602 Exp $
  10. *
  11. *
  12. ***************************************************************************/
  13. /***************************************************************************
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. ***************************************************************************/
  21. // Begin PNphpBB2 Module
  22. if (!defined("LOADED_AS_MODULE")) {
  23. die ("You can't access this file directly...");
  24. }
  25. // global $pnconfig;
  26. $pntable = pnDBGetTables();
  27. $ModName = basename( dirname( __FILE__ ) );
  28. // End PNphpBB2 Module
  29. define('IN_PHPBB', true);
  30. // Begin PNphpBB2 Module
  31. // $phpbb_root_path = './';
  32. $phpbb_root_path = './modules/' . $ModName . '/';
  33. // End PNphpBB2 Module
  34. include($phpbb_root_path . 'extension.inc');
  35. include($phpbb_root_path . 'common.'.$phpEx);
  36. //
  37. // Start session management
  38. //
  39. $userdata = session_pagestart($user_ip, PAGE_PROFILE);
  40. init_userprefs($userdata);
  41. //
  42. // End session management
  43. //
  44. // session id check
  45. if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid']))
  46. {
  47. $sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
  48. }
  49. else
  50. {
  51. $sid = '';
  52. }
  53. // Begin PNphpBB2 Module
  54. if (!$userdata['session_logged_in'])
  55. {
  56. if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
  57. {
  58. $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
  59. $mode = htmlspecialchars($mode);
  60. }
  61. else
  62. {
  63. $mode = '';
  64. }
  65. if ( !empty($HTTP_GET_VARS[POST_USERS_URL]) && $HTTP_GET_VARS[POST_USERS_URL] <> ANONYMOUS )
  66. {
  67. $user_id = "&" . POST_USERS_URL . "=" . intval($HTTP_GET_VARS[POST_USERS_URL]);
  68. }
  69. else
  70. {
  71. $user_id = "";
  72. }
  73. redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=$mode" . $user_id, true));
  74. }
  75. // End PNphpBB2 Module
  76. //
  77. // Set default email variables
  78. //
  79. // Begin PNphpBB2 Module
  80. //$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
  81. //$script_name = ( $script_name != '' ) ? $script_name . '/profile.'.$phpEx : 'profile.'.$phpEx;
  82. //$server_name = trim($board_config['server_name']);
  83. //$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
  84. //$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
  85. //$server_url = $server_protocol . $server_name . $server_port . $script_name;
  86. // End PNphpBB2 Module
  87. // -----------------------
  88. // Page specific functions
  89. //
  90. function gen_rand_string($hash)
  91. {
  92. $rand_str = dss_rand();
  93. return ( $hash ) ? md5($rand_str) : substr($rand_str, 0, 8);
  94. }
  95. //
  96. // End page specific functions
  97. // ---------------------------
  98. //
  99. // Start of program proper
  100. //
  101. if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
  102. {
  103. $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
  104. $mode = htmlspecialchars($mode);
  105. if ( $mode == 'viewprofile' )
  106. {
  107. include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
  108. exit;
  109. }
  110. // Begin PNphpBB2 Module
  111. /* else if ( $mode == 'editprofile' || $mode == 'register' )
  112. {
  113. if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
  114. {
  115. redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
  116. }
  117. include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
  118. exit;
  119. }
  120. else if ( $mode == 'confirm' )
  121. {
  122. // Visual Confirmation
  123. if ( $userdata['session_logged_in'] )
  124. {
  125. exit;
  126. }
  127. include($phpbb_root_path . 'includes/usercp_confirm.'.$phpEx);
  128. exit;
  129. }
  130. else if ( $mode == 'sendpassword' )
  131. {
  132. include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
  133. exit;
  134. }
  135. else if ( $mode == 'activate' )
  136. {
  137. include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
  138. exit;
  139. }
  140. */
  141. else if ( $mode == 'editprofile' )
  142. {
  143. if ( !$userdata['session_logged_in'] )
  144. {
  145. redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
  146. }
  147. include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
  148. exit;
  149. }
  150. // End PNphpBB2 Module
  151. else if ( $mode == 'email' )
  152. {
  153. include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
  154. exit;
  155. }
  156. }
  157. redirect(append_sid("index.$phpEx", true));
  158. ?>