PageRenderTime 65ms CodeModel.GetById 35ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/simple-forum/messaging/sf-pm-components.php

https://bitbucket.org/crypticrod/sr_wp_code
PHP | 569 lines | 335 code | 68 blank | 166 comment | 52 complexity | ff97be7256adfbb4669e8b444162fc93 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.1, GPL-3.0, LGPL-2.0, AGPL-3.0
  1. <?php
  2. /*
  3. Simple:Press
  4. PM Rendering Routines
  5. $LastChangedDate: 2011-04-26 19:22:16 -0700 (Tue, 26 Apr 2011) $
  6. $Rev: 5983 $
  7. */
  8. if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
  9. die('Access Denied');
  10. }
  11. # ------------------------------------------------------------------
  12. # sf_render_pm_table()
  13. #
  14. # Main rendering loop of PM table
  15. # $view: Set to 'inbox' or 'sentbox'
  16. # $threads The PM data array
  17. # $messagecount Total number of all messages in this view
  18. # $cansendpm True/False - can current user send PMs
  19. # ------------------------------------------------------------------
  20. function sf_render_pm_table($view, $threads, $messagecount, $cansendpm)
  21. {
  22. $out = '';
  23. $threadindex = 0;
  24. if($threads)
  25. {
  26. foreach ($threads as $thread)
  27. {
  28. $out.= sf_render_pm_thread($threadindex, $view, $thread, $cansendpm);
  29. $threadindex = $threadindex + 2;
  30. }
  31. }
  32. return $out;
  33. }
  34. # ------------------------------------------------------------------
  35. # sf_render_pm_preview()
  36. #
  37. # Main rendering loop of PM table
  38. # $view: Set to 'inbox' or 'sentbox'
  39. # $threads The PM data array
  40. # $messagecount Total number of all messages in this view
  41. # $cansendpm True/False - can current user send PMs
  42. # ------------------------------------------------------------------
  43. function sf_render_pm_preview($view, $threads, $messagecount, $cansendpm)
  44. {
  45. global $sfscript;
  46. $out = '';
  47. $out.= '<div class="sfheading" id="sfpmbuttons"></div>';
  48. $out.= '<div class="sfpmcontent" id="sfpminfo"></div>';
  49. $out.= '<div class="sfpmcontent" id="sfpmmsg"></div>';
  50. if ($threads)
  51. {
  52. $gif= SFADMINIMAGES.'working.gif';
  53. $site = SFHOMEURL."index.php?sf_ahah=pm-manage";
  54. $msgid = $threads[0]['messages'][0]['message_id'];
  55. $status = $threads[0]['messages'][0]['message_status'];
  56. $slug = $threads[0]['slug'];
  57. # inline script to populate first message - held in global
  58. $sfscript = '
  59. <script type="text/javascript">
  60. jQuery(document).ready(function() {
  61. sfjgetPMText(\''.$gif.'\', \''.$site.'\', \''.$msgid.'\', \''.$view.'\', \''.$status.'\');
  62. var thread = document.getElementById("pm-'.$slug.'");
  63. jQuery("#messagediv-'.$slug.'").toggle("slow");
  64. thread.className = "sfpmshow";
  65. });
  66. </script>';
  67. add_action( 'wp_footer', 'sfjs_display_start_PM' );
  68. }
  69. return $out;
  70. }
  71. # # inline script to populate first message - held in global
  72. function sfjs_display_start_PM() {
  73. global $sfscript;
  74. echo $sfscript;
  75. }
  76. # ------------------------------------------------------------------
  77. # sf_render_pm_outer_header_row()
  78. #
  79. # Man headings in the 'thread' (outer) table
  80. # $view: Set to 'inbox' or 'sentbox'
  81. # $messagecount Total number of all messages in this view
  82. # ------------------------------------------------------------------
  83. function sf_render_pm_outer_header_row($view, $messagecount)
  84. {
  85. global $current_user, $sfglobals;
  86. $delete='';
  87. # dont allow deletion if forum locked down
  88. if ($messagecount > 0 && !$sfglobals['lockdown'])
  89. {
  90. $pmitem = sf_localise_boxname($view);
  91. $msg = sprintf(esc_js(__("Are you sure you want to empty your %s?", "sforum")), $pmitem);
  92. $site = SFHOMEURL."index.php?sf_ahah=pm-manage&pmdelall=".$view."&amp;owner=".$current_user->ID;
  93. $delete = '<input type="button" class="sfxcontrol" name="deleteall" id="deleteall" tabindex="0" value="'.__("Delete All", "sforum").'" onclick="javascript: if(confirm(\''.$msg.'\')) {sfjdeleteMassPM(\''.$site.'\');}" />';
  94. }
  95. if($view == 'inbox')
  96. {
  97. $out = '<tr><th width="125">'.__("From", "sforum").'</th><th align="left">'.__("Title", "sforum").'</th><th align="center" width="95">'.__("Date", "sforum").'</th><th width="40">'.__("Thread", "sforum").'</th><th width="125">'.$delete.'</th></tr>'."\n";
  98. } else {
  99. $out = '<tr><th width="125">'.__("To", "sforum").'</th><th align="left">'.__("Title", "sforum").'</th><th align="center" width="95">'.__("Date", "sforum").'</th><th width="40">'.__("Thread", "sforum").'</th><th width="125">'.$delete.'</th></tr>'."\n";
  100. }
  101. return $out;
  102. }
  103. # ------------------------------------------------------------------
  104. # sf_render_pm_thread()
  105. #
  106. # Main rendering loop of individual PM thread
  107. # $threadindex The table row index
  108. # $view Set to 'inbox' or 'sentbox'
  109. # $thread The PM thread data array
  110. # $cansendpm True/False - can current user send PMs
  111. # ------------------------------------------------------------------
  112. function sf_render_pm_thread($threadindex, $view, $thread, $cansendpm)
  113. {
  114. global $sfglobals;
  115. $out = '';
  116. $alt = '';
  117. # Is there an unread (inbox view) and get last message date and sender (inbox) or recopient (sentbox)
  118. $read_status = 1;
  119. foreach($thread['messages'] as $message)
  120. {
  121. if($message['message_status'] == '0') $read_status = 0;
  122. $sent_date = $message['sent_date'];
  123. if($view == 'inbox')
  124. {
  125. $sender_id = $message['from_id'];
  126. } else {
  127. $sender_id = $message['to_id'];
  128. $read_status = 1;
  129. }
  130. $sender_name = sf_filter_name_display($message['display_name']);
  131. }
  132. if($read_status == 0)
  133. {
  134. $out.= '<tr class="sfpmunread" id="pm-'.$thread['slug'].'">'."\n";
  135. } else {
  136. $out.= '<tr class="sfpmread" id="pm-'.$thread['slug'].'">'."\n";
  137. }
  138. $out.= '<td width="175" class="pmuserinfo '.$alt.'">';
  139. $poster = __("user", "sforum");
  140. if ($message['admin']) $poster = __("admin", "sforum");
  141. $out.= sf_render_avatar($poster, $sender_id, sf_filter_email_display($message['user_email']), '', false, 25);
  142. $out.= '<p>';
  143. $out.= sf_render_pm_sender($sender_id, $sender_name, $read_status, $cansendpm)."\n";
  144. $out.= '<br /><small>'.$poster.'</small>';
  145. $out.= '</p>';
  146. $out.= "</td>\n";
  147. $out.= '<td class="'.$alt.'">'.sf_render_pm_thread_title($threadindex, sf_filter_title_display($thread['title']), $read_status, $thread['slug']).'</td>'."\n";
  148. $out.= '<td width="85" class="'.$alt.'" align="center">'.sf_render_sent_date($sent_date).'</td>'."\n";
  149. $out.= '<td width="55" class="'.$alt.'" align="center" id="pm-'.$thread['slug'].'count'.'">'.count($thread['messages']).'</td>'."\n";
  150. $out.= '<td width="50" class="'.$alt.'">'.sf_render_pm_delete_thread($threadindex, $view, $thread['slug']).'</td>'."\n";
  151. $out.= '</tr>'."\n";
  152. if ($alt == '') $alt = 'sfalt'; else $alt = '';
  153. $out.= sf_render_pm_messages($view, $thread, $threadindex, $cansendpm);
  154. return $out;
  155. }
  156. # ------------------------------------------------------------------
  157. # sf_render_pm_messages()
  158. #
  159. # Main rendering loop of individual PM message
  160. # $view Set to 'inbox' or 'sentbox'
  161. # $thread The PM thread data array
  162. # $cansendpm True/False - can current user send PMs
  163. # ------------------------------------------------------------------
  164. function sf_render_pm_messages($view, $thread, $threadindex, $cansendpm)
  165. {
  166. global $current_user, $wpdb;
  167. $out = '';
  168. $out.='<tr class="sfadminrow" id="messagerow-'.$thread['slug'].'">'."\n";
  169. $out.='<td class="sfadminrow" colspan="5">'."\n";
  170. $out.='<div id="messagediv-'.$thread['slug'].'" class="inline_edit">'."\n";
  171. $out.= '<table class="sfpmtable" id="sfmessagetable-'.$thread['slug'].'" cellspacing="0" border="1">'."\n";
  172. $messageindex = 0;
  173. foreach($thread['messages'] as $message)
  174. {
  175. if($message['message_status'] == '0')
  176. {
  177. $out.= '<tr class="sfpmunread" id="message-'.$message['message_id'].'">';
  178. } else {
  179. $out.= '<tr class="sfpmread" id="message-'.$message['message_id'].'">';
  180. }
  181. $out.= '<td width="18" valign="middle">'.sf_render_pm_status_icon($message['message_status'], $message['is_reply']).'</td>';
  182. if($view == 'inbox')
  183. {
  184. $out.= '<td width="172" valign="middle">'.sf_render_pm_sender($message['from_id'], sf_filter_name_display($message['display_name']), $message['message_status'], $cansendpm).'</td>'."\n";
  185. } else {
  186. $out.= '<td width="172" valign="middle">'.sf_render_pm_sender($message['to_id'], sf_filter_name_display($message['display_name']), $message['message_status'], $cansendpm).'</td>'."\n";
  187. }
  188. $out.= '<td valign="middle">'.sf_render_pm_message_title(sf_filter_title_display($thread['title']), $message['is_reply'], $message['message_status'], $message['message_id'], $thread['slug'], $view).'</td>'."\n";
  189. $out.= '<td width="90" valign="middle" align="center">'.sf_render_sent_date($message['sent_date']).'</td>'."\n";
  190. if($view == 'inbox')
  191. {
  192. $out.= '<td width="50" ></td>';
  193. } else {
  194. $out.= '<td width="50" ></td>';
  195. }
  196. $out.= '<td width="50" valign="middle">'.sf_render_pm_delete_message($messageindex, $threadindex, $view, $message['message_id'], $thread['slug']).'</td>';
  197. $out.= '</tr>';
  198. $messageindex++;
  199. }
  200. $out.= '</table>';
  201. $out.= '</div>';
  202. $out.= '</td>';
  203. $out.= '</tr>';
  204. return $out;
  205. }
  206. # ------------------------------------------------------------------
  207. # sf_render_pm_inner_header_row()
  208. #
  209. # Sub-heading of inner message table
  210. # $view Set to 'inbox' or 'sentbox'
  211. # ------------------------------------------------------------------
  212. function sf_render_pm_inner_header_row($view)
  213. {
  214. if($view == 'inbox')
  215. {
  216. $out = '<tr><th width="18"></th><th align="left" width="160"></th><th></th><th width="85"></th><th width="50"></th><th width="50"></th></tr>';
  217. } else {
  218. $out = '<tr><th width="18"></th><th align="left" width="'.$size.'">'.__("To", "sforum").'</th><th>'.__("Title", "sforum").'</th><th width="100">'.__("Date Sent", "sforum").'</th><th width="50"></th><th width="50"></th></tr>';
  219. }
  220. return $out;
  221. }
  222. # ------------------------------------------------------------------
  223. # sf_render_pm_sender()
  224. #
  225. # Display sender data and link to 'compose new'
  226. # $sender_id: ID of the user who sent the message
  227. # $sender_name Display ame of the user who sent the message
  228. # $read_status 0 = read - 1 = unread
  229. # $cansendpm True/False - can current user send PMs
  230. # ------------------------------------------------------------------
  231. function sf_render_pm_sender($sender_id, $sender_name, $read_status, $cansendpm)
  232. {
  233. global $sfglobals;
  234. $out = '';
  235. $reply = 0;
  236. $editor = $sfglobals['editor']['sfeditor'];
  237. $title = '';
  238. $class=' sfread';
  239. if($read_status == 0) $class='';
  240. if($cansendpm)
  241. {
  242. $out.= '<a class="sfpmentry'.$class.'" onclick="sfjsendPMTo(\''.$sender_id.'\', \''.addslashes($sender_name).'\', \''.$title.'\', \''.$reply.'\', \'\', \''.$editor.'\');" title="'.__("Send Message To Member", "sforum").'">'.stripslashes($sender_name).'</a>';
  243. } else {
  244. $out.= $sender_name;
  245. }
  246. return $out;
  247. }
  248. # ------------------------------------------------------------------
  249. # sf_render_pm_thread_title()
  250. #
  251. # Dislay message title with link to expand thread
  252. # $threadindex The table row index
  253. # $title: Ttle of the message thread
  254. # $read_status 0 = read - 1 = unread
  255. # $slug ID of messages row to open oin click
  256. # ------------------------------------------------------------------
  257. function sf_render_pm_thread_title($threadindex, $title, $read_status, $slug)
  258. {
  259. $out = '';
  260. $class=' sfread';
  261. if($read_status == 0) $class='';
  262. $out.= '<table class="sf-pmtitle"><tr>';
  263. $out.= '<td class="sf-pmtitle">';
  264. $out.= '<a class="sfpmentry'.$class.'" onclick="sfjtoggleThread(this, \'messagediv-'.$slug.'\', \''.$threadindex.'\');" title="'.__("Open/Close Thread", "sforum").'">';
  265. $out.= '<img id="pmopener'.$threadindex.'" src="'.SFRESOURCES.'pm-open-thread.png" alt="" title="'.__("Open/Close Thread", "sforum").'"/>';
  266. $out.= '</a>'."\n";
  267. $out.= '</td>';
  268. $out.= '<td class="sf-pmtitle">';
  269. $out.= '<a class="sfpmentry'.$class.'" onclick="sfjtoggleThread(this, \'messagediv-'.$slug.'\', \''.$threadindex.'\');" title="'.__("Open/Close Thread", "sforum").'">';
  270. $out.= $title;
  271. $out.= '</a>'."\n";
  272. $out.= '</td>';
  273. $out.= '</tr></table>';
  274. return $out;
  275. }
  276. # ------------------------------------------------------------------
  277. # sf_render_pm_message_title()
  278. #
  279. # Dislay message title with link to expand thread
  280. # $title: Ttle of the message thread
  281. # $read_status 0 = read - 1 = unread
  282. # $msgid ID of the message
  283. # $slug ID of messages row to open on click
  284. # $view Set to 'inbox' or 'sentbox'
  285. # ------------------------------------------------------------------
  286. function sf_render_pm_message_title($title, $is_reply, $read_status, $msgid, $slug, $view)
  287. {
  288. $out = '';
  289. $gif= SFADMINIMAGES.'working.gif';
  290. $site = SFHOMEURL."index.php?sf_ahah=pm-manage";
  291. $class=' sfread';
  292. if($read_status == 0) $class='';
  293. if($is_reply ? $re="Re: " : $re="");
  294. $out.= '<a class="sfpmentry'.$class.'" onclick="sfjgetPMText(\''.$gif.'\', \''.$site.'\', \''.$msgid.'\', \''.$view.'\', \''.$read_status.'\')" title="'.__("View Message", "sforum").'">'.$re.$title.'</a>';
  295. return $out;
  296. }
  297. # ------------------------------------------------------------------
  298. # sf_render_sent_date()
  299. #
  300. # Dislay message sent date
  301. # $sent_date Date message was sent
  302. # ------------------------------------------------------------------
  303. function sf_render_sent_date($sent_date)
  304. {
  305. $out = '<small>'.sf_date('d', $sent_date).'<br />'.sf_date('t', $sent_date).'</small>';
  306. return $out;
  307. }
  308. # ------------------------------------------------------------------
  309. # sf_render_pm_status_icon()
  310. #
  311. # Delete thread button
  312. # $status unread=0 or read-1
  313. # $is_reply true of a reply message
  314. # ------------------------------------------------------------------
  315. function sf_render_pm_status_icon($status, $is_reply)
  316. {
  317. if($is_reply) $status='2';
  318. switch($status)
  319. {
  320. case '0':
  321. $icon = 'pmunread.png';
  322. $title= __("Unread Message", "sforum");
  323. break;
  324. case '1':
  325. $icon = 'pmread.png';
  326. $title= __("Read Message", "sforum");
  327. break;
  328. case '2':
  329. $icon = 'pmreplied.png';
  330. $title= __("Replied To Message", "sforum");
  331. break;
  332. }
  333. $out = '<img src="'.SFRESOURCES.$icon.'" alt="" title="'.$title.'" />';
  334. return $out;
  335. }
  336. # ------------------------------------------------------------------
  337. # sf_render_pm_reply_message()
  338. #
  339. # Remders the 'Reply button on inbox view
  340. # $msgid ID of the message
  341. # $sender_id: ID of the user who sent the message
  342. # $sender_name Display ame of the user who sent the message
  343. # $title Message title
  344. # $read_status 0 = read - 1 = unread
  345. # $cansendpm True/False - can current user send PMs
  346. # ------------------------------------------------------------------
  347. function sf_render_pm_reply_message($msgid, $sender_id, $sender_name, $title, $read_status, $cansendpm, $idlist, $namelist, $slug)
  348. {
  349. global $sfglobals;
  350. $editor = $sfglobals['editor']['sfeditor'];
  351. $out = '';
  352. $reply = 1;
  353. if($cansendpm)
  354. {
  355. $title = esc_sql($title);
  356. $out.= '<input type="button" id="pmreply-'.$msgid.'" class="sfxcontrol" name="pmreply-'.$msgid.'" value="'.__("Reply", "sforum").'" onclick="sfjsendPMTo(\''.$sender_id.'\', \''.esc_js($sender_name).'\', \''.esc_js($title).'\', \''.$reply.'\', \''.$slug.'\', \''.$editor.'\');" />';
  357. if(!empty($idlist))
  358. {
  359. $idlist = $idlist.','.$sender_id;
  360. $namelist = $namelist.','.$sender_name;
  361. $out.= '<input type="button" id="pmreplyall-'.$msgid.'" class="sfxcontrol" name="pmreplyall-'.$msgid.'" value="'.__("Reply All", "sforum").'" onclick="sfjsendPMTo(\''.$idlist.'\', \''.esc_js($namelist).'\', \''.esc_js($title).'\', \''.$reply.'\', \''.$slug.'\', \''.$editor.'\');" />';
  362. }
  363. }
  364. return $out;
  365. }
  366. # ------------------------------------------------------------------
  367. # sf_render_pm_quote_message()
  368. #
  369. # Remders the 'Reply button on inbox vien
  370. # $msgid ID of message being quoted
  371. # $sender_id: ID of the user who sent the message
  372. # $sender_name Display ame of the user who sent the message
  373. # $title Title of the message
  374. # $read_status 0 = read - 1 = unread
  375. # $cansendpm True/False - can current user send PMs
  376. # ------------------------------------------------------------------
  377. function sf_render_pm_quote_message($msgid, $sender_id, $sender_name, $title, $read_status, $cansendpm, $idlist, $namelist, $slug)
  378. {
  379. global $sfglobals;
  380. $editor = $sfglobals['editor']['sfeditor'];
  381. $out = '';
  382. $reply = 1;
  383. if($cansendpm)
  384. {
  385. $title = esc_sql($title);
  386. $intro = '&lt;p&gt;'.$sender_name.' '.__("said:", "sforum").'&lt;/p&gt;';
  387. $out.= '<input type="button" id="pmquote-'.$msgid.'" class="sfxcontrol" name="pmquote-'.$msgid.'" value="'.__("Quote", "sforum").'" onclick="sfjquotePM(\''.$sender_id.'\', \'sfpm'.$msgid.'\', \''.esc_js($intro).'\', '.$editor.', \''.esc_js($sender_name).'\', \''.esc_js($title).'\', \''.$reply.'\', \''.$slug.'\');" />';
  388. if(!empty($idlist))
  389. {
  390. $idlist = $idlist.','.$sender_id;
  391. $namelist = $namelist.','.$sender_name;
  392. $out.= '<input type="button" id="pmquoteall-'.$msgid.'" class="sfxcontrol" name="pmquoteall-'.$msgid.'" value="'.__("Quote All", "sforum").'" onclick="sfjquotePM(\''.$idlist.'\', \'sfpm'.$msgid.'\', \''.esc_js($intro).'\', '.$editor.', \''.esc_js($namelist).'\', \''.esc_js($title).'\', \''.$reply.'\', \''.$slug.'\');" />';
  393. }
  394. }
  395. return $out;
  396. }
  397. # ------------------------------------------------------------------
  398. # sf_render_pm_forward_message()
  399. #
  400. # Renders the Forward button on inbox vien
  401. # $msgid ID of message being quoted
  402. # $title Title of the message
  403. # $read_status 0 = read - 1 = unread
  404. # $cansendpm True/False - can current user send PMs
  405. # ------------------------------------------------------------------
  406. function sf_render_pm_forward_message($msgid, $sender_name, $title, $read_status, $cansendpm, $slug)
  407. {
  408. global $sfglobals;
  409. $editor = $sfglobals['editor']['sfeditor'];
  410. $out = '';
  411. $reply = 1;
  412. if($cansendpm)
  413. {
  414. $title = esc_sql($title);
  415. $intro = '&lt;p&gt;'.$sender_name.' '.__("said:", "sforum").'&lt;/p&gt;';
  416. $out.= '<input type="button" id="pmforward-'.$msgid.'" class="sfxcontrol" name="pmforward-'.$msgid.'" value="'.__("Forward", "sforum").'" onclick="sfjquotePM(\'\', \'sfpm'.$msgid.'\', \''.esc_js($intro).'\', '.$editor.', \'\', \''.esc_js($title).'\', \''.$reply.'\', \''.$slug.'\');" />';
  417. }
  418. return $out;
  419. }
  420. # ------------------------------------------------------------------
  421. # sf_render_pm_mark_unread()
  422. #
  423. # Renders the Reply button on inbox vien
  424. # $msgid ID of message being quoted
  425. # $sender_id: ID of the user who sent the message
  426. # ------------------------------------------------------------------
  427. function sf_render_pm_mark_unread($msgid, $sender_id)
  428. {
  429. $out = '';
  430. $out = '<div id="sfpmmsg-'.$msgid.'" style="float:right"></div>';
  431. $msgurl = SFHOMEURL."index.php?sf_ahah=pm-manage&amp;pmmarkunread=1&amp;msgid=".$msgid;
  432. $text = esc_js(__('Marked Unread', 'sforum'));
  433. $out.= '<input type="button" id="pmmark-'.$msgid.'" class="sfxcontrol" name="pmmark-'.$msgid.'" value="'.__("Mark Unread", "sforum").'" onclick="sfjmarkUnread(\''.$msgurl.'\', \''.$msgid.'\', \''.$text.'\')" />';
  434. return $out;
  435. }
  436. # ------------------------------------------------------------------
  437. # sf_render_pm_delete_thread()
  438. #
  439. # Delete thread button
  440. # $threadindex Table row index
  441. # $view Set to 'inbox' or 'sentbox'
  442. # $slug The outer table row slug
  443. # ------------------------------------------------------------------
  444. function sf_render_pm_delete_thread($threadindex, $view, $slug)
  445. {
  446. global $sfglobals;
  447. if (!$sfglobals['lockdown'])
  448. {
  449. $threadurl = SFHOMEURL."index.php?sf_ahah=pm-manage&pmdelthread=".$slug."&amp;pmaction=".$view;
  450. $out = '<input type="button" class="sfxcontrol" name="deletethread" id="pm-'.$slug.'delthread'.'" tabindex="0" value="'.__("Delete Thread", "sforum").'" onclick="sfjdeleteThread(this, \''.$threadurl.'\', \''.$threadindex.'\', \'messagediv-'.$slug.'\');" />';
  451. }
  452. return $out;
  453. }
  454. # ------------------------------------------------------------------
  455. # sf_render_pm_delete_message()
  456. #
  457. # Remders the 'Delete button on inbox vien
  458. # $
  459. # $
  460. # $
  461. # $
  462. # ------------------------------------------------------------------
  463. function sf_render_pm_delete_message($messageindex, $threadindex, $view, $msgid, $slug)
  464. {
  465. global $sfglobals;
  466. if (!$sfglobals['lockdown'])
  467. {
  468. $messageurl = SFHOMEURL."index.php?sf_ahah=pm-manage&pmdelmsg=".$msgid."&amp;pmaction=".$view;
  469. $threadurl = SFHOMEURL."index.php?sf_ahah=pm-manage&pmdelthread=".$slug."&amp;pmaction=".$view;
  470. $out = '<input type="button" class="sfxcontrol" name="deletemessage'.$msgid.'" id="deletemessage'.$msgid.'" tabindex="0" value="'.__("Delete Message", "sforum").'" onclick="sfjdeletePM(this, \''.$messageurl.'\', \''.$threadurl.'\', \''.$messageindex.'\', \''.$threadindex.'\', \'messagediv-'.$slug.'\', \''.$slug.'\');" />';
  471. }
  472. return $out;
  473. }
  474. # ------------------------------------------------------------------
  475. # sf_render_pm_inbox_warning()
  476. #
  477. # Remders warning message regarding inbox size
  478. # $message The appropriate message to display
  479. # ------------------------------------------------------------------
  480. function sf_render_pm_inbox_warning($message)
  481. {
  482. $out = '<div class="sfmessagestrip sfpmalert"><p>'.$message.'</p></div>';
  483. return $out;
  484. }
  485. # ------------------------------------------------------------------
  486. # sf_localise_boxname()
  487. #
  488. # Localises box name 'inbox' and 'sentbox' used as parameters
  489. # $box The English name of the box
  490. # ------------------------------------------------------------------
  491. function sf_localise_boxname($box)
  492. {
  493. $box = ucfirst($box);
  494. if($box == "Inbox")
  495. {
  496. return __("Inbox", "sforum");
  497. } else {
  498. return __("Sentbox", "sforum");
  499. }
  500. }
  501. ?>