login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Beveiliging > PHPBB E-mail Protection (msn)

PHPBB E-mail Protection (msn)

Auteur: Wim - 05 april 2005 - 13:19 - Gekeurd door: XenoX - Hits: 8056 - Aantal punten: (0 stemmen)




Hallo iedereen,

Voor een forum heb ik een paar aanpassingen aangebracht aan de sourcecode van het bekende PHPBB forum.

De wijzigingen zijn van versie 2.0.13, de huidige versie dus (@ 05/04/2005)

Enkel het bestand hieronder is aangepast. Dit kan je op hetvolgende pad terugvinden:
./includes/usercp_viewprofile.php

Hierbij is regel 156 veranderd. Toch raad ik je aan om het volledige onderstaande script over te nemen, wegens het (perongeluk) niet mee kopiëren van sommige tekens (voornamelijk eerste en laatste), of evt. (wat bijna uitgesloten is ;)) een (kleine) fout in de sima source code.

Greetz,
Wim Mariën

Code:
  1. <?php
  2. # Bewerkt door Wim Mariën
  3. #
  4. # Dit script vervangt het @-teken in het MSN adres door ' [at] ', en een . door ' [dot] '
  5. # E-mail adres protection is niet nodig, omdat dit achter een mail-form zit.
  6.  
  7. /***************************************************************************
  8.  * usercp_viewprofile.php
  9.  * -------------------
  10.  * begin : Saturday, Feb 13, 2001
  11.  * copyright : (C) 2001 The phpBB Group
  12.  * email : support@phpbb.com
  13.  *
  14.  * $Id: usercp_viewprofile.php,v 1.5.2.3 2004/11/18 17:49:45 acydburn Exp $
  15.  *
  16.  *
  17.  ***************************************************************************/
  18.  
  19. /***************************************************************************
  20.  *
  21.  * This program is free software; you can redistribute it and/or modify
  22.  * it under the terms of the GNU General Public License as published by
  23.  * the Free Software Foundation; either version 2 of the License, or
  24.  * (at your option) any later version.
  25.  *
  26.  *
  27.  ***************************************************************************/
  28.  
  29. if ( !defined('IN_PHPBB') )
  30. {
  31. die("Hacking attempt");
  32. }
  33.  
  34. if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
  35. {
  36. message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
  37. }
  38. $profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
  39.  
  40. $sql = "SELECT *
  41. FROM " . RANKS_TABLE . "
  42. ORDER BY rank_special, rank_min";
  43. if ( !($result = $db->sql_query($sql)) )
  44. {
  45. message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
  46. }
  47.  
  48. $ranksrow = array();
  49. while ( $row = $db->sql_fetchrow($result) )
  50. {
  51. $ranksrow[] = $row;
  52. }
  53. $db->sql_freeresult($result);
  54.  
  55. //
  56. // Output page header and profile_view template
  57. //
  58. $template->set_filenames(array(
  59. 'body' => 'profile_view_body.tpl')
  60. );
  61. make_jumpbox('viewforum.'.$phpEx);
  62.  
  63. //
  64. // Calculate the number of days this user has been a member ($memberdays)
  65. // Then calculate their posts per day
  66. //
  67. $regdate = $profiledata['user_regdate'];
  68. $memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
  69. $posts_per_day = $profiledata['user_posts'] / $memberdays;
  70.  
  71. // Get the users percentage of total posts
  72. if ( $profiledata['user_posts'] != 0 )
  73. {
  74. $total_posts = get_db_stat('postcount');
  75. $percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
  76. }
  77. else
  78. {
  79. $percentage = 0;
  80. }
  81.  
  82. $avatar_img = '';
  83. if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
  84. {
  85. switch( $profiledata['user_avatar_type'] )
  86. {
  87. case USER_AVATAR_UPLOAD:
  88. $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
  89. break;
  90. case USER_AVATAR_REMOTE:
  91. $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
  92. break;
  93. case USER_AVATAR_GALLERY:
  94. $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
  95. break;
  96. }
  97. }
  98.  
  99. $poster_rank = '';
  100. $rank_image = '';
  101. if ( $profiledata['user_rank'] )
  102. {
  103. for($i = 0; $i < count($ranksrow); $i++)
  104. {
  105. if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
  106. {
  107. $poster_rank = $ranksrow[$i]['rank_title'];
  108. $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
  109. }
  110. }
  111. }
  112. else
  113. {
  114. for($i = 0; $i < count($ranksrow); $i++)
  115. {
  116. if ( $profiledata['user_posts'] >= $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] )
  117. {
  118. $poster_rank = $ranksrow[$i]['rank_title'];
  119. $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
  120. }
  121. }
  122. }
  123.  
  124. $temp_url = append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=" . $profiledata['user_id']);
  125. $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
  126. $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
  127.  
  128. if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN )
  129. {
  130. $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL .'=' . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email'];
  131.  
  132. $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
  133. $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
  134. }
  135. else
  136. {
  137. $email_img = '&nbsp;';
  138. $email = '&nbsp;';
  139. }
  140.  
  141. $www_img = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '&nbsp;';
  142. $www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : '&nbsp;';
  143.  
  144. if ( !empty($profiledata['user_icq']) )
  145. {
  146. $icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
  147. $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
  148. $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '">' . $lang['ICQ'] . '</a>';
  149. }
  150. else
  151. {
  152. $icq_status_img = '&nbsp;';
  153. $icq_img = '&nbsp;';
  154. $icq = '&nbsp;';
  155. }
  156.  
  157. $aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '&nbsp;';
  158. $aim = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '&nbsp;';
  159.  
  160. $msn_img = ( $profiledata['user_msnm'] ) ? str_replace("@", " [at] ", str_replace(".", " [dot] ", $profiledata['user_msnm'])) : '&nbsp;';
  161. $msn = $msn_img;
  162.  
  163. $yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
  164. $yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
  165.  
  166. $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&amp;showresults=posts");
  167. $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
  168. $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
  169.  
  170. //
  171. // Generate page
  172. //
  173. $page_title = $lang['Viewing_profile'];
  174. include($phpbb_root_path . 'includes/page_header.'.$phpEx);
  175.  
  176. if (function_exists('get_html_translation_table'))
  177. {
  178. $u_search_author = urlencode(strtr($profiledata['username'], array_flip(get_html_translation_table(HTML_ENTITIES))));
  179. }
  180. else
  181. {
  182. $u_search_author = urlencode(str_replace(array('&amp;', '&#039;', '&quot;', '&lt;', '&gt;'), array('&', "'", '"', '<', '>'), $profiledata['username']));
  183. }
  184.  
  185. $template->assign_vars(array(
  186. 'USERNAME' => $profiledata['username'],
  187. 'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
  188. 'POSTER_RANK' => $poster_rank,
  189. 'RANK_IMAGE' => $rank_image,
  190. 'POSTS_PER_DAY' => $posts_per_day,
  191. 'POSTS' => $profiledata['user_posts'],
  192. 'PERCENTAGE' => $percentage . '%',
  193. 'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
  194. 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
  195.  
  196. 'SEARCH_IMG' => $search_img,
  197. 'SEARCH' => $search,
  198. 'PM_IMG' => $pm_img,
  199. 'PM' => $pm,
  200. 'EMAIL_IMG' => $email_img,
  201. 'EMAIL' => $email,
  202. 'WWW_IMG' => $www_img,
  203. 'WWW' => $www,
  204. 'ICQ_STATUS_IMG' => $icq_status_img,
  205. 'ICQ_IMG' => $icq_img,
  206. 'ICQ' => $icq,
  207. 'AIM_IMG' => $aim_img,
  208. 'AIM' => $aim,
  209. 'MSN_IMG' => $msn_img,
  210. 'MSN' => $msn,
  211. 'YIM_IMG' => $yim_img,
  212. 'YIM' => $yim,
  213.  
  214. 'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;',
  215. 'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : '&nbsp;',
  216. 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',
  217. 'AVATAR_IMG' => $avatar_img,
  218.  
  219. 'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
  220. 'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
  221. 'L_AVATAR' => $lang['Avatar'],
  222. 'L_POSTER_RANK' => $lang['Poster_rank'],
  223. 'L_JOINED' => $lang['Joined'],
  224. 'L_TOTAL_POSTS' => $lang['Total_posts'],
  225. 'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
  226. 'L_CONTACT' => $lang['Contact'],
  227. 'L_EMAIL_ADDRESS' => $lang['Email_address'],
  228. 'L_EMAIL' => $lang['Email'],
  229. 'L_PM' => $lang['Private_Message'],
  230. 'L_ICQ_NUMBER' => $lang['ICQ'],
  231. 'L_YAHOO' => $lang['YIM'],
  232. 'L_AIM' => $lang['AIM'],
  233. 'L_MESSENGER' => $lang['MSNM'],
  234. 'L_WEBSITE' => $lang['Website'],
  235. 'L_LOCATION' => $lang['Location'],
  236. 'L_OCCUPATION' => $lang['Occupation'],
  237. 'L_INTERESTS' => $lang['Interests'],
  238.  
  239. 'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . $u_search_author),
  240.  
  241. 'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
  242. );
  243.  
  244. $template->pparse('body');
  245.  
  246. include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
  247.  
  248. ?>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (7)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.063s