PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/simple-forum/forum/sf-page-components.php

https://bitbucket.org/crypticrod/sr_wp_code
PHP | 1797 lines | 1477 code | 228 blank | 92 comment | 447 complexity | ad020fe42c92f942aa3c206269abba4b 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. Forum General Page Rendering Routines
  5. $LastChangedDate: 2011-06-05 09:16:54 -0700 (Sun, 05 Jun 2011) $
  6. $Rev: 6253 $
  7. */
  8. if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
  9. die('Access Denied');
  10. }
  11. # = SUCCESS/FAILURE MESSAGING==================
  12. if(!function_exists('sf_render_queued_message')):
  13. function sf_render_queued_message()
  14. {
  15. $out = '';
  16. $message = get_sfnotice('sfmessage');
  17. if(!empty($message))
  18. {
  19. $out = sf_message($message);
  20. delete_sfnotice();
  21. }
  22. return $out;
  23. }
  24. endif;
  25. # = FORUM LOCKDOWN STRIP ======================
  26. if(!function_exists('sf_render_lockdown')):
  27. function sf_render_lockdown()
  28. {
  29. $out = '<div class="sfmessagestrip">';
  30. $out.= '<img src="'.SFRESOURCES.'locked.png" alt="" />'."\n";
  31. $out.= __("This Forum is Currently Locked - Access is Read Only", "sforum").'</div>'."\n";
  32. return $out;
  33. }
  34. endif;
  35. # = ADMIN STRIP ===============================
  36. if(!function_exists('sf_render_admin_strip')):
  37. function sf_render_admin_strip($source, $pageview, $newposts)
  38. {
  39. global $current_user, $sfvars, $sfglobals;
  40. $out = '';
  41. if($current_user->forumadmin || $current_user->moderator)
  42. {
  43. $fixed = $sfglobals['member']['admin_options']['sfbarfix'];
  44. if($fixed)
  45. {
  46. $out.= '<div id="sfadminstripfixed">';
  47. } else {
  48. $out.= '<div id="sfadminstrip">';
  49. }
  50. if($current_user->forumadmin)
  51. {
  52. $out.= sf_render_admin_quicklinks($source, $pageview);
  53. }
  54. if(($source == 'forum' || $source == 'inbox') && $sfglobals['admin']['sfqueue'])
  55. {
  56. $out.= '<div id="sfpostnumbers">';
  57. $out.= sf_get_waiting_url($newposts, $pageview, $sfglobals['member']['admin_options']['sfshownewadmin']);
  58. $out.= '</div>';
  59. }
  60. # need to close this div differently depending on fixed bar or not - this is for fixed = false
  61. if(!$fixed)
  62. {
  63. $out.= '</div>';
  64. }
  65. }
  66. if($fixed)
  67. {
  68. $out.= '<div id="sfadminpostlistfixed"></div>';
  69. # This closes div if bar is fixed
  70. $out.= '</div>';
  71. } else {
  72. $out.= '<div id="sfadminpostlist"></div>';
  73. }
  74. return $out;
  75. }
  76. endif;
  77. # = LOGIN STRIP ===============================
  78. if(!function_exists('sf_render_login_strip')):
  79. function sf_render_login_strip($source, $pageview, $button)
  80. {
  81. global $sfvars, $current_user, $sfglobals;
  82. $sflogin = array();
  83. $sflogin = sf_get_option('sflogin');
  84. $out = '';
  85. $textbelow = '';
  86. $out.= '<div class="sfloginstrip">'."\n";
  87. $out.= '<div class="inline_edit" id="sfthisuser">'.$current_user->ID.'</div>';
  88. $out.= '<table cellpadding="1" cellspacing="0"><tr>'."\n";
  89. if($sflogin['sfshowavatar'])
  90. {
  91. $out.= '<td rowspan="2" width="45">';
  92. if ($current_user->member) $type = 'user';
  93. if ($current_user->forumadmin) $type='admin';
  94. if ($current_user->guest) $type = 'guest';
  95. $useremail = '';
  96. if (isset($current_user->user_email)) $useremail = sf_filter_email_display($current_user->user_email);
  97. $guestemail = '';
  98. if (isset($current_user->guestemail)) $guestemail = sf_filter_email_display($current_user->guestemail);
  99. $out.= sf_render_avatar($type, $current_user->ID, $useremail, $guestemail, false, '40', true);
  100. $out.= '</td>';
  101. }
  102. $out.= '<td class="sfusercell">'."\n";
  103. # User Name
  104. if($current_user->guest)
  105. {
  106. # need to check posting permissions in all forums to decide on guest posting message for group pageview
  107. if ($pageview == 'group')
  108. {
  109. if ($sfglobals['permissions'])
  110. {
  111. $checked = array(); # set up array to only check each forum id once to save time
  112. foreach ($sfglobals['permissions'] as $perm)
  113. {
  114. if (!isset($checked[$perm->forum_id]))
  115. {
  116. $permissions = sf_get_permissions(array('Can start new topics', 'Can reply to topics'), $perm->forum_id);
  117. $current_user->sfaddnew |= $permissions['Can start new topics'];
  118. $current_user->sfreply |= $permissions['Can reply to topics'];
  119. $checked[$perm->forum_id] = 1; # mark this forum id as checked
  120. }
  121. }
  122. }
  123. }
  124. # Not logged in - might be a guest - so, do we allow guest posters?
  125. if(!$current_user->sfaddnew && !$current_user->sfreply)
  126. {
  127. if($pageview == 'pm')
  128. {
  129. $out.= '<strong>'.__("You must be logged in to use Private Messaging", "sforum").'</strong>'."\n";
  130. } else {
  131. $out.= '<strong>'.__("You must be logged in to post", "sforum").'</strong>'."\n";
  132. }
  133. } else {
  134. # So - Guests are allowed but could this be a registered user not yet logged in?
  135. if($current_user->offmember)
  136. {
  137. $out.= sprintf(__('Welcome back <strong>%s</strong>', "sforum"), $current_user->offmember);
  138. $textbelow = __("Please login if you intend posting", "sforum");
  139. } else {
  140. # So a genuine Guest - have they been here before?
  141. $out.= __("Current User: <strong>Guest</strong>", "sforum")."\n";
  142. if(!empty($current_user->guestname))
  143. {
  144. $out.= ': <strong>'.$current_user->guestname.'</strong>'."\n";
  145. if((!empty($current_user->lastvisit)) && ($current_user->lastvisit > 0))
  146. {
  147. $textbelow = __("Last Post", "sforum").': '.date_i18n(SFDATES, $current_user->lastvisit)."\n";
  148. }
  149. } else {
  150. if($sflogin['sfshowreg'])
  151. {
  152. $textbelow = '<strong>'.__("Please consider registering", "sforum").'</strong>'."\n";
  153. }
  154. }
  155. }
  156. }
  157. } else {
  158. $out.= sprintf(__("Logged in as <strong> %s </strong>", "sforum"), sf_filter_name_display($current_user->display_name))."\n";
  159. if(!empty($current_user->lastvisit)) $textbelow = __("Last Visit", "sforum").': '.date_i18n(SFDATES, $current_user->lastvisit)."\n";
  160. }
  161. $sfmemberopts = sf_get_option('sfmemberopts');
  162. if (($pageview == 'forum' || $pageview == 'topic') && $sfmemberopts['sfviewperm'])
  163. {
  164. $out.= sf_render_user_permissions();
  165. }
  166. $out.= '</td>'."\n";
  167. # Login/Register icons
  168. $out.= '<td class="sflogincell">'."\n";
  169. $out.= sf_render_custom_icons();
  170. if($current_user->guest)
  171. {
  172. if($sflogin['sfshowlogin'])
  173. {
  174. if($sflogin['sfinlogin'])
  175. {
  176. $out.= '<a class="sficon" onclick="sfjtoggleLayer(\'sfloginform\');"><img src="'.SFRESOURCES.'login.png" alt="" title="'.esc_attr(__("Login", "sforum")).'" />'.sf_render_icons("Login").'</a>'."\n";
  177. } else {
  178. $out.= '<a class="sficon" href="'.$sflogin['sfloginurl'].'");"><img src="'.SFRESOURCES.'login.png" alt="" title="'.esc_attr(__("Login", "sforum")).'" />'.sf_render_icons("Login").'</a>'."\n";
  179. }
  180. if (TRUE == get_option('users_can_register') && !$sfglobals['lockdown'])
  181. {
  182. if($sflogin['sfshowreg'])
  183. {
  184. $sfpolicy = sf_get_option('sfpolicy');
  185. if($sfpolicy['sfregtext'] ? $regurl=SFREGPOLICY : $regurl=$sflogin['sfregisterurl']);
  186. $out.= '<a class="sficon" href="'.$regurl.'"><img src="'.SFRESOURCES.'register.png" alt="" title="'.esc_attr(__("Register", "sforum")).'" />'.sf_render_icons("Register").'</a>'."\n";
  187. }
  188. }
  189. $sfmemberopts = sf_get_option('sfmemberopts');
  190. if ($sfmemberopts['sfshowmemberlist'] && !$sfmemberopts['sflimitmemberlist'] && $current_user->sfmemberlist)
  191. {
  192. $out.= '<a class="sficon" href="'.SFMEMBERLIST.'"><img src="'.SFRESOURCES.'members-display.png" alt="" title="'.esc_attr(__("Membership List", "sforum")).'" />'.sf_render_icons("Members").'</a>'."\n";
  193. }
  194. }
  195. } else {
  196. if($sflogin['sfshowlogin'])
  197. {
  198. $out.= '<a class="sficon" href="'.wp_nonce_url($sflogin['sflogouturl'], 'log-out').'"><img src="'.SFRESOURCES.'logout.png" alt="" title="'.esc_attr(__("Logout", "sforum")).'" />'.sf_render_icons("Logout").'</a>'."\n";
  199. }
  200. $sfmemberopts = sf_get_option('sfmemberopts');
  201. if ($sfmemberopts['sfshowmemberlist'] && ($current_user->sfmemberlist))
  202. {
  203. $out.= '<a class="sficon" href="'.SFMEMBERLIST.'"><img src="'.SFRESOURCES.'members-display.png" alt="" title="'.esc_attr(__("Membership List", "sforum")).'" />'.sf_render_icons("Members").'</a>'."\n";
  204. }
  205. $out.= '<a class="sficon" href="'.sf_build_profile_formlink($current_user->ID).'"><img src="'.SFRESOURCES.'profile.png" alt="" title="'.esc_attr(__("Profile", "sforum")).'" />'.sf_render_icons("Profile").'</a>'."\n";
  206. }
  207. $out.= '</td></tr><tr>';
  208. $out.= '<td class="sfusercell">'.$textbelow.'</td>';
  209. $out.= '<td class="sflogincell">'."\n";
  210. $out.='<div id="sfinboxcount">';
  211. $out.= sf_render_sub_count();
  212. $out.= sf_render_watch_count();
  213. $out.= sf_render_inbox_count();
  214. $out.= '</div>';
  215. $out.= '</td>'."\n";
  216. $out.= '</tr></table>'."\n";
  217. $out.= '</div>'."\n";
  218. $out.= sf_process_hook('sf_hook_post_loginstrip', '');
  219. return $out;
  220. }
  221. endif;
  222. # = LOGIN FORM ==+=============================
  223. if(!function_exists('sf_render_login_form')):
  224. function sf_render_login_form()
  225. {
  226. global $current_user;
  227. $sflogin=array();
  228. $sflogin=sf_get_option('sflogin');
  229. $out = '';
  230. if($current_user->guest && $sflogin['sfshowlogin'] && $sflogin['sfinlogin'])
  231. {
  232. $out.= sf_inline_login_form();
  233. }
  234. return $out;
  235. }
  236. endif;
  237. # = Subscription Count ==============================
  238. if(!function_exists('sf_render_sub_count')):
  239. function sf_render_sub_count()
  240. {
  241. global $current_user, $sfglobals;
  242. $out='';
  243. # Subscription Count and Button
  244. if ($current_user->sfsubscriptions)
  245. {
  246. $scount = 0;
  247. $unreadclass='sfrednumberzero';
  248. $list = $sfglobals['member']['subscribe'];
  249. if (!empty($list))
  250. {
  251. foreach ($list as $topicid)
  252. {
  253. if (sf_is_in_users_newposts($topicid))
  254. {
  255. $scount++;
  256. $unreadclass='sfrednumber';
  257. }
  258. }
  259. }
  260. $site = SFHOMEURL."index.php?sf_ahah=watch-subs&action=subs";
  261. $out.= '<span><a rel="nofollow" class="sficon" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, reflow: true, width: 700} )"><img class="sfalignright" src="'. SFRESOURCES .'subscribed.png" alt="" title="'.__("Review Subscribed Topics", "sforum").'" /><span id="sfunreadsub" class="'.$unreadclass.' sfalignright" title="'.esc_attr(__("New Posts in Subscribed Topics", "sforum")).'">'.$scount.'</span></a></span>';
  262. }
  263. return $out;
  264. }
  265. endif;
  266. # = Watch Count ==============================
  267. if(!function_exists('sf_render_watch_count')):
  268. function sf_render_watch_count()
  269. {
  270. global $current_user, $sfglobals;
  271. $out='';
  272. # Watched Count and Button
  273. if ($current_user->sfwatch)
  274. {
  275. $wcount = 0;
  276. $unreadclass='sfrednumberzero';
  277. $list = $sfglobals['member']['watches'];
  278. if (!empty($list))
  279. {
  280. foreach ($list as $topicid)
  281. {
  282. if (sf_is_in_users_newposts($topicid))
  283. {
  284. $wcount++;
  285. $unreadclass='sfrednumber';
  286. }
  287. }
  288. }
  289. $spacerimg = '<img class="sfalignright" src="'. SFRESOURCES .'spacer.png" alt="" />';
  290. $site = SFHOMEURL."index.php?sf_ahah=watch-subs&action=watch";
  291. $out.= '<span><a rel="nofollow" class="sficon" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, reflow: true, width: 700} )">'.$spacerimg.'<img class="sfalignright" src="'. SFRESOURCES .'watching.png" alt="" title="'.esc_attr(__("Review Watched Topics", "sforum")).'" /><span id="sfunreadwatch" class="'.$unreadclass.' sfalignright" title="'.esc_attr(__("New Posts in Watched Topics", "sforum")).'">'.$wcount.'</span></a></span>';
  292. }
  293. return $out;
  294. }
  295. endif;
  296. # = Inbox Count ==============================
  297. if(!function_exists('sf_render_inbox_count')):
  298. function sf_render_inbox_count()
  299. {
  300. global $current_user, $sfglobals;
  301. $out = '';
  302. if ($current_user->sfusepm)
  303. {
  304. #Inbox Count and Button
  305. $new = sf_get_pm_inbox_new_count($current_user->ID);
  306. if(!$new) $new=0;
  307. # Do we show inbox icon?
  308. $unreadclass='sfrednumber';
  309. if($new == 0) $unreadclass='sfrednumberzero';
  310. $spacerimg = '<img class="sfalignright" src="'. SFRESOURCES .'spacer.png" alt="" />';
  311. $url = SFURL."private-messaging/inbox/";
  312. $out.= '<span><a class="sficon" href="'.$url.'">'.$spacerimg.'<img class="sfalignright" src="'. SFRESOURCES .'goinbox.png" alt="" title="'.esc_attr(__("Go To Inbox", "sforum")).'" /><span id="sfunreadpm" class="'.$unreadclass.' sfalignright" title="'.esc_attr(__("New PMs", "sforum")).'">'.$new.'</span></a></span>';
  313. }
  314. return $out;
  315. }
  316. endif;
  317. # = CUSTOM ICONS ==============================
  318. if(!function_exists('sf_render_custom_icons')):
  319. function sf_render_custom_icons()
  320. {
  321. global $sfglobals;
  322. $out = '';
  323. for($x=0; $x<3; $x++)
  324. {
  325. if(!empty($sfglobals['custom'][$x]['cuslink']))
  326. {
  327. $out.= '<a class="sficon" href="'.$sfglobals["custom"][$x]["cuslink"].'"><img src="'.esc_url(SFCUSTOMURL.$sfglobals["custom"][$x]["cusicon"]).'" alt="" />'.sf_filter_title_display($sfglobals["custom"][$x]["custext"]).'</a>'."\n";
  328. }
  329. }
  330. return $out;
  331. }
  332. endif;
  333. # = SEARCH BAR ================================
  334. if(!function_exists('sf_render_searchbar')):
  335. function sf_render_searchbar($pageview)
  336. {
  337. global $sfvars, $sfglobals;
  338. $out ='<div class="sfmessagestrip">'."\n";
  339. $out.='<table><tr>'."\n";
  340. if($sfglobals['display']['search']['searchtop'] || $sfglobals['display']['search']['searchbottom'])
  341. {
  342. $out.= '<td width="105">';
  343. $out.= '<div id="sftopsearch">';
  344. if($pageview != 'inbox')
  345. {
  346. $out.= '<a class="sficon" onclick="sfjtoggleLayer(\'sfsearchform\');"><img class="sficon" src="'.SFRESOURCES.'search.png" alt="" title="'.esc_attr(__("Search", "sforum")).'" />'.sf_render_icons("Search").'</a>'."\n";
  347. $out.= '</div>';
  348. $out.= '</td>'."\n";
  349. if($pageview == 'topic')
  350. {
  351. # If search mode - display link to return to search results
  352. if($sfvars['searchpage'])
  353. {
  354. $out.= '<td>'.sf_get_forum_search_url().'<img class="sficon" src="'.SFRESOURCES.'results.png" alt="" title="'.esc_attr(__("Return to Search Results", "sforum")).'" />'.sf_render_icons("Return to Search Results").'</a>'."\n";
  355. $out.= '</td>'."\n";
  356. }
  357. }
  358. } else {
  359. $out.= '<a class="sficon" href="#forumbottom"><img src="'.SFRESOURCES.'bottom.png" alt="" title="'.esc_attr(__("go to bottom", "sforum")).'" /></a>'."\n";
  360. $out.= '</div>';
  361. $out.= '</td>'."\n";
  362. }
  363. }
  364. if($sfglobals['display']['quicklinks']['qltop'] || $sfglobals['display']['quicklinks']['qlbottom'])
  365. {
  366. $out.= '<td>'."\n";
  367. $out.= '<div id="sftopql">';
  368. # QuickLinks
  369. $out.= sf_render_forum_quicklinks();
  370. if ($sfglobals['display']['quicklinks']['qlcount'] > 0)
  371. {
  372. $out.= '<div id="sfqlposts">';
  373. $out.= sf_render_newpost_quicklinks($sfglobals['display']['quicklinks']['qlcount']);
  374. $out.= '</div>';
  375. }
  376. $out.= '</div>';
  377. $out.= '</td>'."\n";
  378. }
  379. $out.='</tr></table></div>'."\n";
  380. return $out;
  381. }
  382. endif;
  383. # = SEARCH BAR ================================
  384. if(!function_exists('sf_render_searchform')):
  385. function sf_render_searchform($pageview)
  386. {
  387. global $sfvars, $sfglobals;
  388. $out = '';
  389. if($sfglobals['display']['search']['searchtop'] || $sfglobals['display']['search']['searchbottom'])
  390. {
  391. # get status set if forum
  392. $statusset = '';
  393. if($pageview == 'forum')
  394. {
  395. $statusset = sf_get_topic_status_set($sfvars['forumid']);
  396. }
  397. # Dislay search bar
  398. $out.= sf_searchbox($pageview, $statusset);
  399. }
  400. return $out;
  401. }
  402. endif;
  403. # = BREADCRUMB STRIP ==========================
  404. if(!function_exists('sf_render_breadcrumbs')):
  405. function sf_render_breadcrumbs($forumslug, $topicslug, $page)
  406. {
  407. global $sfvars, $post, $sfglobals, $current_user;
  408. $out = '';
  409. if ($sfglobals['display']['breadcrumbs']['showcrumbs'] || ($current_user->member && $sfglobals['display']['unreadcount']['unread']))
  410. {
  411. $out.= '<div class="sfmessagestrip sfbreadcrumbs">'."\n";
  412. $out.= '<table><tr>'."\n";
  413. }
  414. if ($sfglobals['display']['breadcrumbs']['showcrumbs'])
  415. {
  416. $out.= '<td valign="middle"><p>';
  417. $xtree = 0;
  418. $tree='';
  419. $treespace = '';
  420. if ($sfglobals['display']['breadcrumbs']['tree'])
  421. {
  422. $tree = '<br />';
  423. $treespace = '<span class="treespace"></span>';
  424. $xtree = 0;
  425. }
  426. $arr = '<img src="'.SFRESOURCES.'arrowr.png" alt="" />'."\n";
  427. # Home link
  428. if ($sfglobals['display']['breadcrumbs']['showhome'] &&
  429. !(get_option('page_on_front') == sf_get_option('sfpage') && get_option('show_on_front') == 'page'))
  430. {
  431. $out.= '<a class="sficon sfpath" href="'.$sfglobals['display']['breadcrumbs']['homepath'].'">'.$arr.__("Home", "sforum").'</a>'."\n";
  432. $xtree++;
  433. }
  434. # Group View link (front forum page)
  435. $out.= $tree.str_repeat($treespace, $xtree).'<a class="sficon sfpath" href="'.trailingslashit(SFURL).'">'.$arr.$post->post_title.'</a>'."\n";
  436. $xtree++;
  437. if ($sfglobals['display']['breadcrumbs']['showgroup'])
  438. {
  439. if (isset($_GET['group']))
  440. {
  441. $groupid = sf_esc_int($_GET['group']);
  442. if (sf_group_exists($groupid))
  443. {
  444. $group = sf_get_group_record($groupid);
  445. }
  446. } else if (isset($sfvars['forumslug'])) {
  447. $group = sf_get_group_record_from_slug($sfvars['forumslug']);
  448. }
  449. if ($group)
  450. {
  451. $out.= $tree.str_repeat($treespace, $xtree).'<a class="sficon sfpath" href="'.sf_build_qurl('group='.$group->group_id).'">'.$arr.sf_filter_title_display($group->group_name).'</a>'."\n";
  452. $xtree++;
  453. }
  454. }
  455. # Parent Forum Links if current forum is a sub-forum
  456. if(isset($sfvars['parentforumid']))
  457. {
  458. $forumnames = array_reverse($sfvars['parentforumname']);
  459. $forumslugs = array_reverse($sfvars['parentforumslug']);
  460. for($x=0; $x<count($forumnames); $x++)
  461. {
  462. $out.= $tree.str_repeat($treespace, $xtree).'<a class="sficon sfpath" href="'.sf_build_url($forumslugs[$x], '', 0, 0).'">'.$arr.sf_filter_title_display($forumnames[$x]).'</a>'."\n";
  463. $xtree++;
  464. }
  465. }
  466. # Forum link (Paren or Child forum)
  467. if(!empty($sfvars['forumslug']) && $sfvars['forumslug'] != 'all')
  468. {
  469. # if showing a topic then check the return page of forum in sfsettings...
  470. $returnpage = 1;
  471. if(!empty($sfvars['topicslug'])) $returnpage = sf_pop_topic_page($sfvars['forumid']);
  472. $forumname = $sfvars['forumname'];
  473. $out.= $tree.str_repeat($treespace, $xtree).'<a class="sficon sfpath" href="'.sf_build_url($sfvars['forumslug'], '', $returnpage, 0).'">'.$arr.sf_filter_title_display($forumname).'</a>'."\n";
  474. $xtree++;
  475. }
  476. # Topic lnk
  477. if(!empty($sfvars['topicslug']))
  478. {
  479. $topicname = $sfvars['topicname'];
  480. $out.= $tree.str_repeat($treespace, $xtree).'<a class="sficon sfpath" href="'.sf_build_url($sfvars['forumslug'], $sfvars['topicslug'], 1, 0).'">'.$arr.sf_filter_title_display($topicname).'</a>'."\n";
  481. }
  482. $out.= '</p></td>';
  483. }
  484. # Mark all as read
  485. if($current_user->member && $sfglobals['display']['unreadcount']['unread'] == true)
  486. {
  487. if($sfglobals['member']['newposts']['topics'][0] == 0)
  488. {
  489. $unreads = 0;
  490. } else {
  491. $unreads = count($sfglobals['member']['newposts']['topics']);
  492. }
  493. if($unreads==1 ? $label=__("Topic with", "sforum") : $label=__("Topics with", "sforum"));
  494. $out.= '<td valign="top" nowrap="nowrap"><span class="sfalignright sfunreadcount"><b>'.$unreads.'</b> '.$label.'&nbsp;<br />'.__("unread posts", "sforum").'</span></td>';
  495. if($unreads > 0 && $sfglobals['display']['unreadcount']['markall'])
  496. {
  497. $out.= '<td width="25" valign="top"><a href="'.SFURL.'newposts/"><img class="sfalignright" src="'.SFRESOURCES.'topics-started.png" alt="" title="'.esc_attr(__("Most Recent Topics With Unread Posts", "sforum")).'" /></a></td>';
  498. $out.= '<td width="25" valign="top"><a href="'.SFMARKREAD.'"><img class="sfalignright" src="'.SFRESOURCES.'mark-read.png" alt="" title="'.esc_attr(__("Mark All As Read", "sforum")).'" />'.sf_render_icons('Mark All Read').'</a></td>';
  499. }
  500. }
  501. if ($sfglobals['display']['breadcrumbs']['showcrumbs'] || ($current_user->member && $sfglobals['display']['unreadcount']['unread']))
  502. {
  503. # Go To Bottom link
  504. $out.= '<td valign="top" width="40">';
  505. $out.= '<span class="sfalignright"><a class="sficon" href="#forumbottom"><img src="'.SFRESOURCES.'bottom.png" alt="" title="'.esc_attr(__("go to bottom", "sforum")).'" /></a></span>'."\n";
  506. $out.= '</td>';
  507. }
  508. if ($sfglobals['display']['breadcrumbs']['showcrumbs'] || ($current_user->member && $sfglobals['display']['unreadcount']['unread']))
  509. {
  510. $out.= '</tr></table>'."\n";
  511. $out.= '</div>'."\n";
  512. }
  513. $out.= sf_process_hook('sf_hook_post_breadcrumbs', '');
  514. return $out;
  515. }
  516. endif;
  517. # = PAGED TOPIC NAVIGATION SUPPORT ============
  518. if(!function_exists('sf_pn_next')):
  519. function sf_pn_next($cpage, $search, $totalpages, $baseurl, $pnshow, $list=false)
  520. {
  521. if($pnshow == 0) $pnshow=4;
  522. $start = ($cpage - $pnshow);
  523. if($start < 1) $start = 1;
  524. $end = ($cpage - 1);
  525. $out='';
  526. if($start > 1)
  527. {
  528. $out.= sf_pn_url($cpage, 1, $search, $baseurl, 'None', $list);
  529. $out.= sf_pn_url($cpage, $cpage-1, $search, $baseurl, 'Previous', $list);
  530. }
  531. if($end > 0)
  532. {
  533. for($i = $start; $i <= $end; $i++)
  534. {
  535. $out.= sf_pn_url($cpage, $i, $search, $baseurl, 'None', $list);
  536. }
  537. } else {
  538. $end = 0;
  539. }
  540. return $out;
  541. }
  542. endif;
  543. # = PAGED TOPIC NAVIGATION SUPPORT ============
  544. if(!function_exists('sf_pn_previous')):
  545. function sf_pn_previous($cpage, $search, $totalpages, $baseurl, $pnshow, $list=false)
  546. {
  547. if($pnshow == 0) $pnshow=4;
  548. $start = ($cpage + 1);
  549. $end = ($cpage + $pnshow);
  550. if($end > $totalpages) $end = $totalpages;
  551. $out='';
  552. if($start <= $totalpages)
  553. {
  554. for($i = $start; $i <= $end; $i++)
  555. {
  556. $out.= sf_pn_url($cpage, $i, $search, $baseurl, 'None', $list);
  557. }
  558. if($end < $totalpages)
  559. {
  560. $out.= sf_pn_url($cpage, $cpage+1, $search, $baseurl, 'Next', $list);
  561. $out.= sf_pn_url($cpage, $totalpages, $search, $baseurl, 'None', $list);
  562. }
  563. } else {
  564. $start = 0;
  565. }
  566. return $out;
  567. }
  568. endif;
  569. # = PAGED TOPIC NAVIGATION SUPPORT ============
  570. if(!function_exists('sf_pn_url')):
  571. function sf_pn_url($cpage, $thispage, $search, $baseurl, $arrow='None', $list=false)
  572. {
  573. $out='';
  574. if ($search)
  575. {
  576. $out.= $baseurl . '&amp;search='.$thispage;
  577. } else {
  578. if ($thispage > 1)
  579. {
  580. $out.= trailingslashit($baseurl . 'page-'.$thispage);
  581. } else {
  582. $out.= $baseurl;
  583. }
  584. }
  585. Switch ($arrow)
  586. {
  587. case 'None':
  588. $out.= '">'.$thispage.'</a>';
  589. break;
  590. case 'Previous':
  591. $out.= '" class="sfpointer"><img src="'.SFRESOURCES.'arrowl.png" alt="" /></a>'."\n";
  592. break;
  593. case 'Next':
  594. $out.= '" class="sfpointer"><img src="'.SFRESOURCES.'arrowr.png" alt="" /></a>'."\n";
  595. break;
  596. }
  597. return $out;
  598. }
  599. endif;
  600. # = VIEW HEADER TABLE =========================
  601. if(!function_exists('sf_render_main_header_table')):
  602. function sf_render_main_header_table($view, $itemid, $title, $desc, $icon, $forumlock=false, $showadd=false, $topiclock=false, $blogpostid=0, $pmview='inbox', $cansendpm=true, $forums=0, $statusset=0, $statusflag=0, $messagecount=0)
  603. {
  604. global $sfvars, $current_user, $sfglobals;
  605. $out = '<div class="sfheading">';
  606. $out.= '<table><tr>'."\n";
  607. $out.= '<td class="sficoncell"><img class="" src="'.esc_url($icon).'" alt="" /></td>'."\n";
  608. switch($view)
  609. {
  610. case 'group':
  611. $title = sf_filter_title_display($title);
  612. $out.= '<td><div class="sftitle"><p>'.$title.'</p></div>';
  613. if ($sfglobals['display']['groups']['description'])
  614. {
  615. $out.= '<div class="sfdescription">'.$desc.'</div>';
  616. }
  617. $out.= '</td>'."\n";
  618. # dont display group rss icon if all forum rss feeds are disabled
  619. $rss_display = 0;
  620. if ($forums)
  621. {
  622. foreach ($forums as $forum)
  623. {
  624. if ($forum['forum_rss_private'] == 0)
  625. {
  626. $rss_display = 1;
  627. break;
  628. }
  629. }
  630. }
  631. if ($rss_display)
  632. {
  633. $rssurl= sf_get_group_rss_url($itemid);
  634. $out.= '<td class="sfadditemcell"><a class="sficon" rel="nofollow" href="'.$rssurl.'"><img src="'.SFRESOURCES.'feedgroup.png" alt="" title="'.esc_attr(__("Group RSS", "sforum")).'" />'.sf_render_icons('Group RSS').'&nbsp;</a></td>'."\n";
  635. }
  636. break;
  637. case 'forum':
  638. case 'subs':
  639. case 'watches':
  640. $title = sf_filter_title_display($title);
  641. $out.= '<td><div class="sftitle"><p>'.$title.'</p></div>'."\n";
  642. if ($sfvars['searchpage'])
  643. {
  644. $out.= ' - '.__("Search Results", "sforum").'<br />'.sf_deconstruct_search_for_display($sfvars['searchvalue'], $sfvars['searchtype'])."\n";
  645. if($sfvars['searchresults'] == 1 ? $mat = __("Match Found", "sforum") : $mat = __("Matches Found", "sforum"));
  646. $out.= '('.$sfvars['searchresults'].' '.$mat.')';
  647. }
  648. if ($sfglobals['display']['forums']['description'])
  649. {
  650. $out.= '<div class="sfdescription">'.$desc.'</div>';
  651. }
  652. $out.= '</td>'."\n";
  653. $out.= '<td class="sfadditemcell">'."\n";
  654. if ($showadd)
  655. {
  656. if($sfglobals['display']['pagelinks']['ptop']==false && $current_user->sfaddnew) {
  657. if ($current_user->offmember)
  658. {
  659. $sflogin = sf_get_option('sflogin');
  660. $out.= '<a class="sficon" href="'.esc_url($sflogin['sfloginurl'].'&amp;redirect_to='.urlencode($_SERVER['REQUEST_URI'])).'"><img src="'.SFRESOURCES.'login.png" alt="" title="'.esc_attr(__("Login", "sforum")).'" />'.sf_render_icons("Login").'</a>'."\n";
  661. } elseif($sfglobals['display']['pagelinks']['ptop']==false && $current_user->sfaddnew) {
  662. # show add topic here if pagelinks strip is hidden
  663. $out.= '<a class="sficon" onclick="sfjOpenEditor(\'sfpostform\','.$sfglobals['editor']['sfeditor'].',\'topic\');"><img src="'.SFRESOURCES.'addtopic.png" alt="" title="'.esc_attr(__("Add a New Topic", "sforum")).'" />'.sf_render_icons("Add a New Topic").'</a>'."\n";
  664. }
  665. }
  666. } else {
  667. if ($forumlock)
  668. {
  669. $out.= '<img class="sficon" src="'.SFRESOURCES.'locked.png" alt="" title="'.esc_attr(__("Forum Locked", "sforum")).'" />'.sf_render_icons("Forum Locked")."\n";
  670. }
  671. }
  672. if ($view == 'subs')
  673. {
  674. $out.= '<form action="'.SFURL.'" method="get" name="sf-endallsubs">';
  675. $out.= '<input type="hidden" class="sfhiddeninput" name="userid" id="userid" value="'.$current_user->ID.'" />';
  676. $out.= '<input type="submit" class="sfcontrol" name="endallsubs" value="'.sf_split_button_label(esc_attr(__("Remove All Subscriptions", "sforum")), 3).'" />'."\n";
  677. $out.= '</form>';
  678. }
  679. if ($view == 'watches')
  680. {
  681. $out.= '<form action="'.SFURL.'" method="get" name="sf-endallwatches">';
  682. $out.= '<input type="hidden" class="sfhiddeninput" name="userid" id="userid" value="'.$current_user->ID.'" />';
  683. $out.= '<input type="submit" class="sfcontrol" name="endallwatches" value="'.sf_split_button_label(esc_attr(__("Remove All Watches", "sforum")), 3).'" />'."\n";
  684. $out.= '</form>';
  685. }
  686. $out.= '</td>'."\n";
  687. break;
  688. case 'subforum':
  689. $title = sf_filter_title_display($title);
  690. $out.= '<td><div class="sftitle"><p>'.$title;
  691. $out.= '<br />'.__("Sub-Forums", "sforum");
  692. $out.= '</p></div></td>'."\n";
  693. break;
  694. case 'topic':
  695. $title = sf_filter_title_display($title);
  696. $out.= '<td><div class="sftitle"><p>'.$title;
  697. if (function_exists('sf_forum_show_blog_link'))
  698. {
  699. if($blogpostid != 0)
  700. {
  701. $out.= '<br />'.sf_forum_show_blog_link($blogpostid);
  702. }
  703. }
  704. $out.= '</p></div>'."\n";
  705. if ($sfglobals['display']['posts']['topicstatushead'])
  706. {
  707. $out.= sf_render_topic_statusflag($statusset, $statusflag, 'ts-header', 'ts-upheader', 'left');
  708. }
  709. $out.= '</td>';
  710. $out.= '<td class="sfadditemcell">'."\n";
  711. # Display reply to post link if alowed - or locked icon if topic locked
  712. if ((!$topiclock) || ($current_user->forumadmin))
  713. {
  714. if ($showadd)
  715. {
  716. if($current_user->offmember)
  717. {
  718. $sflogin = sf_get_option('sflogin');
  719. $out.= '<a class="sficon" href="'.esc_url($sflogin['sfloginurl'].'&amp;redirect_to='.urlencode($_SERVER['REQUEST_URI'])).'"><img src="'.SFRESOURCES.'login.png" alt="" title="'.esc_attr(__("Login", "sforum")).'" />'.sf_render_icons("Login").'</a>'."\n";
  720. } elseif($sfglobals['display']['pagelinks']['ptop']==false && $current_user->sfaddnew) {
  721. # show add topic here if pagelinks strip is hidden
  722. if($current_user->sfaddnew)
  723. {
  724. $url = sf_build_url($sfvars['forumslug'], '', 1, 0).sf_add_get().'new=topic';
  725. $out.= '<a class="sficon" href="'.$url.'"><img src="'.SFRESOURCES.'addtopic.png" alt="" title="'.esc_attr(__("Add a New Topic", "sforum")).'" />'.sf_render_icons("Add a New Topic").'</a>'."\n";
  726. }
  727. if ($current_user->sfreply && $sfvars['displaymode'] == 'posts')
  728. {
  729. $out.= '<a class="sficon" onclick="sfjOpenEditor(\'sfpostform\','.$sfglobals['editor']['sfeditor'].',\'post\');"><img src="'.SFRESOURCES.'addpost.png" alt="" title="'.esc_attr(__("Reply to Post", "sforum")).'" />'.sf_render_icons("Reply to Post").'</a>'."\n";
  730. }
  731. }
  732. }
  733. } else {
  734. $out.= '<img class="sficon" src="'.SFRESOURCES.'locked.png" alt="" title="'.esc_attr(__("Topic Locked", "sforum")).'" />'.sf_render_icons("Topic Locked")."\n";
  735. }
  736. if ($sfglobals['display']['topics']['print'])
  737. {
  738. $out.= '<div class="sfalignright">'.sf_render_topic_printicon($sfvars['topicid']).'</div>';
  739. }
  740. $out.= '</td>'."\n";
  741. break;
  742. case 'searchall':
  743. $out.= '<td><p>'.__("Search All Forums", "sforum").'<br />'.sf_deconstruct_search_for_display($sfvars['searchvalue'], $sfvars['searchtype'])."\n";
  744. if ($sfvars['searchresults'] == 1 ? $mat = __("Match Found", "sforum") : $mat = __("Matches Found", "sforum"));
  745. $out.= '('.$sfvars['searchresults'].' '.$mat.')</p></td>'."\n";
  746. break;
  747. case 'list':
  748. $title = sf_filter_title_display($title);
  749. $out.= '<td><div class="sftitle"><p>'.$title.'</p></div><div class="sfdescription">'.$desc.'</div></td>'."\n";
  750. $out.= '<td><img class="sfalignright" src="'. SFRESOURCES .'spacer.png" alt="" /><a class="sficon sfalignright" href="'.SFURL.'"><img src="'.SFRESOURCES.'goforum.png" alt="" title="'.esc_attr(__("Return to forum", "sforum")).'" />'.sf_render_icons("Return to forum").'</a></td>'."\n";
  751. break;
  752. }
  753. $out.= '</tr></table></div>'."\n";
  754. return $out;
  755. }
  756. endif;
  757. # = LAST VISIT/POST ICON LEGEND ===============
  758. if(!function_exists('sf_render_forum_icon_legend')):
  759. function sf_render_forum_icon_legend()
  760. {
  761. global $current_user;
  762. $out = '<span class="sficonkey"><small>';
  763. if ($current_user->lastvisit > 0)
  764. {
  765. if ($current_user->member)
  766. {
  767. $mess = __("since your last visit", "sforum");
  768. } else {
  769. $mess = __("since you last posted", "sforum");
  770. }
  771. $out.= '<img src="'. SFRESOURCES .'topickey.png" alt="" />&nbsp;&nbsp;'.__("New Posts", "sforum").'&nbsp;'.$mess.'&nbsp;&nbsp;'."\n";
  772. }
  773. if ($current_user->member)
  774. {
  775. $out.= '<img src="'. SFRESOURCES .'topickeyuser.png" alt="" />&nbsp;&nbsp;'.__("Topics you have posted in", "sforum")."\n";
  776. }
  777. $out.= '&nbsp;</small></span>';
  778. return $out;
  779. }
  780. endif;
  781. # = RENDER PAGE LINKS (IN ENTRIES) ============
  782. if(!function_exists('sf_render_inline_pagelinks')):
  783. function sf_render_inline_pagelinks($forumslug, $topicslug, $postcount, $searchparam='')
  784. {
  785. global $sfvars, $sfglobals;
  786. $postpage=$sfglobals['display']['posts']['perpage'];
  787. if($postpage >= $postcount) return '';
  788. $out='';
  789. $out.= '<table class="sfrowstatus">';
  790. $out.= '<tr>';
  791. $totalpages=($postcount / $postpage);
  792. if(!is_int($totalpages)) $totalpages=intval($totalpages)+1;
  793. $sfpnshow = $sfglobals['display']['posts']['numpagelinks'];
  794. if($sfpnshow == 0) $sfpnshow = 5;
  795. if($totalpages > $sfpnshow)
  796. {
  797. $maxcount=$sfpnshow;
  798. } else {
  799. $maxcount=$totalpages;
  800. }
  801. if($sfvars['searchpage'] != 0)
  802. {
  803. if($searchparam == 'SA')
  804. {
  805. $ret = '&amp;ret=all';
  806. } else {
  807. $ret = '';
  808. }
  809. }
  810. if((isset($sfvars['page'])) && $sfvars['page'] <> 1)
  811. {
  812. $xtp = '&amp;xtp='.$sfvars['page'];
  813. } else {
  814. $xtp = '';
  815. }
  816. for($x = 1; $x <= $maxcount; $x++)
  817. {
  818. $out.= '<td class="sfrowpages"><a href="'.sf_build_url($forumslug, $topicslug, $x, 0);
  819. if (isset($sfvars['searchvalue']) && $sfvars['searchvalue'] != '')
  820. {
  821. if(strpos(SFURL, '?') === false)
  822. {
  823. $out.= '?value';
  824. } else {
  825. $out.= '&amp;value';
  826. }
  827. $out.= '='.$sfvars['searchvalue'].'&amp;type='.$sfvars['searchtype'].'&amp;include='.$sfvars['searchinclude'].'&amp;search='.$sfvars['searchpage'].$ret;
  828. }
  829. $out.= '">'.$x.'</a></td>'."\n";
  830. $sep = '| ';
  831. }
  832. if($totalpages > $sfpnshow)
  833. {
  834. $out.= '<td class="nobg"><img src="'.SFRESOURCES.'pagelink.png" alt="" /></td>';
  835. $out.= '<td><a href="'.sf_build_url($forumslug, $topicslug, $totalpages, 0);
  836. if($sfvars['searchvalue'] != '')
  837. {
  838. if(strpos(SFURL, '?') === false)
  839. {
  840. $out.= '?value';
  841. } else {
  842. $out.= '&amp;value';
  843. }
  844. $out.= '='.$sfvars['searchvalue'].'&amp;type='.$sfvars['searchtype'].'&amp;include='.$sfvars['searchinclude'].'&amp;search='.$sfvars['searchpage'].$ret;
  845. }
  846. $out.= '">'.$totalpages.'</a></td>'."\n";
  847. }
  848. $out.= '</tr>';
  849. $out.= '</table>';
  850. return $out;
  851. }
  852. endif;
  853. if(!function_exists('sf_render_topic_statusflag')):
  854. function sf_render_topic_statusflag($statusset, $statusflag, $boxid, $updateid, $alignment)
  855. {
  856. global $sfglobals;
  857. if ($statusset == 0) return;
  858. $out = '';
  859. if($statusflag != 0)
  860. {
  861. # topic status is active
  862. $topicstatusflag = sf_get_topic_status_flag($statusset, $statusflag);
  863. } else {
  864. $topicstatusflag = __('No Status Selected', 'sforum');
  865. }
  866. if($alignment == 'left')
  867. {
  868. $out.= '<span class="sfalignleft" id="'.$boxid.'">';
  869. $out.= '<img class="sfalignleft" src="'.SFRESOURCES.'small-status.png" alt="" />';
  870. $out.= '<span id="'.$updateid.'" class="sfstatusitem sfalignleft">'.$topicstatusflag.'</span>';
  871. } else {
  872. $out.= '<span class="sfalignright" id="'.$boxid.'">';
  873. $out.= '<img class="sfalignleft" src="'.SFRESOURCES.'small-status.png" alt="" />';
  874. $out.= '<span id="'.$updateid.'" class="sfstatusitem sfalignright">'.$topicstatusflag.'</span>';
  875. }
  876. $out.= '</span>';
  877. return $out;
  878. }
  879. endif;
  880. # = FIRST/LAST POST CELLS =====================
  881. if(!function_exists('sf_render_first_last_post_cell')):
  882. function sf_render_first_last_post_cell($forumslug, $topicslug, $item, $alt, $title='')
  883. {
  884. global $sfglobals;
  885. $postuser='';
  886. $postdate='';
  887. $posttime='';
  888. # if there is a 'proxy' element then use that as forum id (will be last post in a subforum)
  889. # Will ONLY be available from Group View forum listing
  890. if(array_key_exists('proxy', $item))
  891. {
  892. $forumslug = $item['proxy_slug'];
  893. }
  894. if($sfglobals['display']['firstlast']['user'])
  895. {
  896. $poster = sf_build_name_display($item['user_id'], sf_filter_name_display($item['display_name']));
  897. if(empty($poster)) $poster = sf_filter_name_display($item['guest_name']);
  898. $postuser = ' '.__("by", "sforum").'<br />'.$poster;
  899. }
  900. if($sfglobals['display']['firstlast']['date'])
  901. {
  902. $postdate = sf_date('d', $item['post_date']);
  903. }
  904. if($sfglobals['display']['firstlast']['time'])
  905. {
  906. $posttime = sf_date('t',$item['post_date']);
  907. }
  908. if (empty($item['post_tip'])) $item['post_tip'] = '';
  909. if ($title == '')
  910. {
  911. $out = '<td class="sfuserdetails '.$alt.'">';
  912. $out.= '<p>'.$postdate."<br />".$posttime;
  913. $out.= $postuser.'<br />'.sf_get_post_url($forumslug, $topicslug, $item['post_id'], $item['post_index'], $title, $item['post_tip']).'</p></td>'."\n";
  914. } else {
  915. $out = '<td class="sfuserdetailswide '.$alt.'">';
  916. if (isset($sfglobals['display']['forums']['showtitletop']) && $sfglobals['display']['forums']['showtitletop'])
  917. {
  918. $out.= '<p>'.sf_get_post_url($forumslug, $topicslug, $item['post_id'], $item['post_index'], $title, $item['post_tip']).'<br />'.$postdate."<br />".$posttime;
  919. $out.= $postuser.'</p></td>'."\n";
  920. } else {
  921. $out.= '<p>'.$postdate."<br />".$posttime;
  922. $out.= $postuser.'<br />'.sf_get_post_url($forumslug, $topicslug, $item['post_id'], $item['post_index'], $title, $item['post_tip']).'</p></td>'."\n";
  923. }
  924. }
  925. return $out;
  926. }
  927. endif;
  928. function sf_render_sub_forum_entry_row($subforums, $alt)
  929. {
  930. global $sfglobals, $current_user;
  931. $out = '';
  932. $icon = SFRESOURCES.'subforum.png';
  933. $out.= '<tr>';
  934. $out.= '<td colspan="5" class="sfsubforum '.$alt.'">';
  935. $subs = count($subforums);
  936. if ($subs == 1 ? $label=__("Subforum", "sforum") : $label=__("Subforums", "sforum"));
  937. $out.= '<div class="sfrowtitle">';
  938. $out.= '<p><img src="'.$icon.'" alt="" />&nbsp;'.$label.':&nbsp;'."\n";
  939. $first = true;
  940. foreach ($subforums as $subforum)
  941. {
  942. if(!$first) $out.= ' | ';
  943. $first=false;
  944. $out.= sf_render_forum_title($subforum['forum_slug'], sf_filter_title_display($subforum['forum_name'])).' ('.$subforum['topic_count'].')'."\n";
  945. # New Post Icon
  946. if ($sfglobals['display']['forums']['newposticon'] && $current_user->member && is_array($sfglobals['member']['newposts']['forums']))
  947. {
  948. if (in_array($subforum['forum_id'], $sfglobals['member']['newposts']['forums']))
  949. {
  950. $out.= '<img src="'.SFRESOURCES.'small-post.png" alt="" title="'.esc_attr(__("New Posts", "sforum")).'" />';
  951. }
  952. }
  953. }
  954. $out.= '</p>';
  955. $out.= '</div>';
  956. $out.= '</td></tr>';
  957. return $out;
  958. }
  959. # = BOTTOM ICON (RRS) STRIP ===================
  960. if(!function_exists('sf_render_bottom_iconstrip')):
  961. function sf_render_bottom_iconstrip($view, $user='', $cansendpm='')
  962. {
  963. global $sfvars, $current_user, $sfglobals;
  964. $rssopt = sf_get_option('sfrss');
  965. $out = '<div class="sfmessagestrip">'."\n";
  966. $out.= '<table cellpadding="0" cellspacing="0"><tr><td width="45%">'."\n";
  967. # RSS
  968. $rss_display = 1;
  969. if ($view != 'inbox' && $view !='sentbox')
  970. {
  971. switch($view)
  972. {
  973. case 'all':
  974. # dont display icon for private rss feeds
  975. $forums = sf_get_forums_all();
  976. if ($forums)
  977. {
  978. $rss_display = 0;
  979. foreach ($forums as $forum)
  980. {
  981. if ($forum->forum_rss_private == 0)
  982. {
  983. $rss_display = 1;
  984. break;
  985. }
  986. }
  987. }
  988. $url = sf_get_option('sfallRSSurl');
  989. if(empty($url))
  990. {
  991. if ($rssopt['sfrssfeedkey'] && isset($sfglobals['member']['feedkey']))
  992. $url = sf_build_qurl('xfeed=all', 'feedkey='.$sfglobals['member']['feedkey']);
  993. else
  994. $url = sf_build_qurl('xfeed=all');
  995. }
  996. $icon='feedall.png';
  997. $text= __('All RSS', 'sforum');
  998. break;
  999. case 'forum':
  1000. if($sfvars['error']==false)
  1001. {
  1002. # dont display icon for private rss feeds
  1003. $forum = sf_get_forum_record($sfvars['forumid']);
  1004. if ($forum->forum_rss_private) $rss_display = 0;
  1005. $url = sf_get_forum_rss_url($sfvars['forumid'], $sfvars['forumslug']);
  1006. $icon='feedforum.png';
  1007. $text=__('Forum RSS', 'sforum');
  1008. }
  1009. break;
  1010. case 'topic':
  1011. if($sfvars['error']==false)
  1012. {
  1013. # dont display icon for private rss feeds
  1014. $forum = sf_get_forum_record($sfvars['forumid']);
  1015. if ($forum->forum_rss_private) $rss_display = 0;
  1016. if ($rssopt['sfrssfeedkey'])
  1017. $url = sf_build_qurl('forum='.$sfvars['forumslug'], 'topic='.$sfvars['topicslug'], 'xfeed=topic', 'feedkey='.$sfglobals['member']['feedkey']);
  1018. else
  1019. $url = sf_build_qurl('forum='.$sfvars['forumslug'], 'topic='.$sfvars['topicslug'], 'xfeed=topic');
  1020. $icon='feedtopic.png';
  1021. $text=__('Topic RSS', 'sforum');
  1022. }
  1023. break;
  1024. }
  1025. if($sfvars['error']==false && $rss_display)
  1026. {
  1027. $out.= '<a class="sficon sfalignleft" rel="nofollow" href="'.$url.'"><img src="'.SFRESOURCES.$icon.'" alt="" title="'.esc_attr($text).'" />'.sf_render_icons($text).'</a>'."\n";
  1028. $out.= '<img class="sficon sfalignleft" src="'.SFRESOURCES.'spacer.png" alt="" title="" />';
  1029. }
  1030. }
  1031. # Subscribe
  1032. if($sfvars['error']==false && $view != 'inbox')
  1033. {
  1034. if ($current_user->member && $current_user->sfsubscriptions && $view=='topic' && !$sfglobals['lockdown'])
  1035. {
  1036. if (sf_is_subscribed($current_user->ID, $sfvars['topicid']))
  1037. {
  1038. $out.= '<a class="sficon sfalignleft" href="'.sf_build_qurl('forum='.$sfvars['forumid'], 'topic='.$sfvars['topicid'],'sf-endsub=user').'"><img src="'.SFRESOURCES.'unsubscribe.png" alt="" title="'.esc_attr(__("End Topic Subscription", "sforum")).'" />'.sf_render_icons("Unsubscribe").'</a>'."\n";
  1039. } else {
  1040. $out.= '<a class="sficon sfalignleft" href="'.sf_build_qurl('forum='.$sfvars['forumid'], 'topic='.$sfvars['topicid'],'sf-subscribe=user').'"><img src="'.SFRESOURCES.'subscribe.png" alt="" title="'.esc_attr(__("Subscribe", "sforum")).'" />'.sf_render_icons("Subscribe").'</a>'."\n";
  1041. }
  1042. $out.= '<img class="sficon sfalignleft" src="'.SFRESOURCES.'spacer.png" alt="" title="" />';
  1043. }
  1044. }
  1045. # Watch
  1046. if($sfvars['error']==false && $view != 'inbox')
  1047. {
  1048. if ($current_user->member && $current_user->sfwatch && $view=='topic' && !$sfglobals['lockdown'])
  1049. {
  1050. if (sf_is_watching($current_user->ID, $sfvars['topicid']))
  1051. {
  1052. $out.= '<a class="sficon sfalignleft" href="'.sf_build_qurl('forum='.$sfvars['forumid'], 'topic='.$sfvars['topicid'],'sf-endwatch=user').'"><img src="'.SFRESOURCES.'watchoff.png" alt="" title="'.esc_attr(__("End Topic Watch", "sforum")).'" />'.sf_render_icons("End Topic Watch").'</a>'."\n";
  1053. } else {
  1054. $out.= '<a class="sficon sfalignleft" href="'.sf_build_qurl('forum='.$sfvars['forumid'], 'topic='.$sfvars['topicid'],'sf-watch=user').'"><img src="'.SFRESOURCES.'watchon.png" alt="" title="'.esc_attr(__("Watch Topic", "sforum")).'" />'.sf_render_icons("Watch Topic").'</a>'."\n";
  1055. }
  1056. }
  1057. }
  1058. $out.='</td><td align="center">';
  1059. # Go to top button
  1060. $out.= '<a href="#forumtop"><img class="sficon" src="'.SFRESOURCES.'top.png" alt="" title="'.esc_attr(__("go to top", "sforum")).'" /></a><br />'."\n";
  1061. # Dummy cell here - might be of some use in the future!
  1062. $out.='</td><td class="sflogincell" width="45%">';
  1063. # PM buttons on bottom strip
  1064. if ($view == 'inbox' || $view == 'sentbox')
  1065. {
  1066. $sfpm = array();
  1067. $sfpm = sf_get_option('sfpm');
  1068. if ($cansendpm && (!$sfpm['sfpmlimitedsend'] || $current_user->forumadmin))
  1069. {
  1070. $out.= '<a class="sficon sfalignright" onclick="sfjtoggleLayer(\'sfpostform\');"><img src="'.SFRESOURCES.'compose.png" alt="" title="'.esc_attr(__("Compose PM", "sforum")).'" />'.sf_render_icons("Compose PM").'</a>';
  1071. }
  1072. if ($view == 'sentbox')
  1073. {
  1074. $url = SFURL."private-messaging/inbox/";
  1075. $out.= '<a class="sficon sfalignright" href="'.$url.'"><img src="'.SFRESOURCES.'goinbox.png" alt="" title="'.esc_attr(__("Go To Inbox", "sforum")).'" />&nbsp;'.sf_render_icons("Go To Inbox").'</a>'."\n";
  1076. } else {
  1077. $url = SFURL."private-messaging/sentbox/";
  1078. $out.= '<a class="sficon sfalignright" href="'.$url.'"><img src="'.SFRESOURCES.'gosentbox.png" alt="" title="'.esc_attr(__("Go To Sentbox", "sforum")).'" />&nbsp;'.sf_render_icons("Go To Sentbox").'</a>'."\n";
  1079. }
  1080. $out.= '<img class="sfalignright" src="'. SFRESOURCES .'spacer.png" alt="" /><a class="sficon sfalignright" href="'.SFURL.'"><img src="'.SFRESOURCES.'goforum.png" alt="" title="'.esc_attr(__("Return to forum", "sforum")).'" />'.sf_render_icons("Return to forum").'</a>'."\n";
  1081. }
  1082. $out.='</td></tr></table>';
  1083. $out.='</div>'."\n";
  1084. $out.= sf_process_hook('sf_hook_post_rss_strip', '');
  1085. return $out;
  1086. }
  1087. endif;
  1088. # = STATISTICS STRIP ==========================
  1089. if(!function_exists('sf_render_stats')):
  1090. function sf_render_stats()
  1091. {
  1092. global $sfglobals;
  1093. $out = '';
  1094. if($sfglobals['display']['stats']['showstats'])
  1095. {
  1096. $tz=get_option('timezone_string');
  1097. if(empty($tz)) $tz = 'UTC '.get_option('gmt_offset');
  1098. if($tz ? $w=2 : $w=4);
  1099. $out.= '<br /><table id="sfstatstrip">'."\n";
  1100. $out.= '<tr class="sfstatsheader">';
  1101. $out.= '<th colspan="'.$w.'"><p>'.sprintf(__("About the %s Forum", "sforum"), get_bloginfo('name')).'</p></th>';
  1102. if($tz)
  1103. {
  1104. $out.= '<th colspan="'.$w.'"><p class="sfalignright"><strong>'.__("Forum Timezone: ", "sforum").'</strong>'.$tz.'</p></th>';
  1105. }
  1106. $out.= '</tr>'."\n";
  1107. $out.= '<tr class="sfstatsdata">'."\n";
  1108. $out.= sf_render_online_stats();
  1109. $out.= sf_render_forum_stats();
  1110. $stats = sf_get_post_stats();
  1111. $out.= sf_render_member_stats($stats).'</tr>';
  1112. $out.= sf_render_newusers();
  1113. $out.= sf_render_ownership($stats);
  1114. $out.= '</table><br />'."\n";
  1115. $out.= sf_process_hook('sf_hook_post_stats', '');
  1116. }
  1117. return $out;
  1118. }
  1119. endif;
  1120. # = STATISTICS STRIP SUPPORT ROUTINE===========
  1121. if(!function_exists('sf_render_online_stats')):
  1122. function sf_render_online_stats($dashboard=false)
  1123. {
  1124. global $wpdb, $sfglobals, $sfvars, $current_user;
  1125. $out='';
  1126. $browse='';
  1127. $online = sf_get_online_total();
  1128. $members = sf_get_members_online();
  1129. $max = sf_update_max_online($online);
  1130. if($sfglobals['display']['stats']['mostusers'] || $sfglobals['display']['stats']['online'] || $dashboard)
  1131. {
  1132. $out.= '<td class="sfstatsonline">'."\n";
  1133. $guests = 0;
  1134. $label = ' '.__("Guests", "sforum");
  1135. # Most users online
  1136. if($sfglobals['display']['stats']['mostusers'] || $dashboard)
  1137. {
  1138. $out.= '<p><span><span class="sfstatsmaxtitle"><strong>'.__("Most Users Ever Online", "sforum").': </strong></span>'."\n";
  1139. $out.= '<span class="sfstatsmaxdata">'.$max.'</span></span></p>'."\n";
  1140. }
  1141. # Current members online
  1142. if($sfglobals['display']['stats']['online'] || $dashboard)
  1143. {
  1144. if(($members || $online && ($online > count($members))))
  1145. {
  1146. $out.= '<p><span><span class="sfstatsonlinecurrent"><strong>'.__("Currently Online", "sforum").': </strong></span>'."\n";
  1147. }
  1148. if ($members)
  1149. {
  1150. $firstonline = true;
  1151. $firstbrowsing = true;
  1152. $out.= '<span class="sfstatsonlineuser">';
  1153. foreach ($members as $user)
  1154. {
  1155. $opts = sf_get_member_item($user->trackuserid, 'user_options');
  1156. $sfmemberopts = sf_get_option('sfmemberopts');
  1157. if ($current_user->forumadmin || !$sfmemberopts['sfhidestatus'] || !$opts['hidestatus'])
  1158. {
  1159. if(!$firstonline) $out.= ', ';
  1160. $out.= sf_build_name_display($user->trackuserid, sf_filter_name_display($user->display_name), true);
  1161. $firstonline = false;
  1162. # Set up the members browsing curent item list while here
  1163. if(($sfvars['pageview']=='forum' && $user->forum_id==$sfvars['forumid']) || ($sfvars['pageview']=='topic' && $user->topic_id==$sfvars['topicid']))
  1164. {
  1165. if(!$firstbrowsing) $browse.= ', ';
  1166. $browse.= sf_build_name_display($user->trackuserid, sf_filter_name_display($user->display_name), true);
  1167. $firstbrowsing = false;
  1168. }
  1169. }
  1170. }
  1171. $out.= '</span>'."\n";
  1172. }
  1173. # And guest count on line
  1174. if($online && ($online > count($members)))
  1175. {
  1176. $guests = ($online - count($members));
  1177. if ($guests == 1)
  1178. {
  1179. $glabel = ' '.__("Guest", "sforum");
  1180. } else {
  1181. $glabel = $label;
  1182. }
  1183. $out.= '<br /><span class="sfstatsonlineguest">'.$guests.$glabel.'</span>'."\n";
  1184. }
  1185. if(($members || $online && ($online > count($members))))
  1186. {
  1187. $out.= '</span></p>'."\n";
  1188. }
  1189. # Members and guests browsing?
  1190. $guestbrowsing = sf_guests_browsing();
  1191. if($browse || $guestbrowsing)
  1192. {
  1193. $type = ucfirst($sfvars['pageview']);
  1194. $type = __($type, "sforum");
  1195. $out.= '<p><span><span class="sfstatsonlinecurrent"><strong>'.sprintf(__("Currently Browsing this %s", "sforum"), $type).': </strong></span>'."\n";
  1196. }
  1197. if($browse)
  1198. {
  1199. $out.= '<span class="sfstatsonlineuser">'.$browse.'</span>';
  1200. }
  1201. if($guestbrowsing != 0)
  1202. {
  1203. if ($guestbrowsing == 1)
  1204. {
  1205. $glabel = ' '.__("Guest", "sforum");
  1206. } else {
  1207. $glabel = $label;
  1208. }
  1209. $out.='<br /><span class="sfstatsonlineguest">'.$guestbrowsing.$glabel.'</span>'."\n";
  1210. }
  1211. if($browse || $guestbrowsing)
  1212. {
  1213. $out.= '</span></p>'."\n";
  1214. }
  1215. }
  1216. $out.= '</td>'."\n";
  1217. }
  1218. return $out;
  1219. }
  1220. endif;
  1221. # = STATISTICS STRIP SUPPORT ROUTINE===========
  1222. if(!function_exists('sf_render_forum_stats')):
  1223. function sf_render_forum_stats($dashboard=false)
  1224. {
  1225. global $sfglobals;
  1226. $out='';
  1227. if($sfglobals['display']['stats']['forumstats'] || $dashboard)
  1228. {
  1229. $cnt = sf_get_stats_counts();
  1230. $out = '<td class="sfstatscounts">'."\n";
  1231. $out.= '<p class="sfstatstitle"><strong>'.__("Forum Stats: ", "sforum").'</strong></p>'."\n";
  1232. $out.= '<p><span class="sfstatsgroups">'.__("Groups: ", "sforum").$cnt->groups.'</span><br />'."\n";
  1233. $out.= '<span class="sfstatsforums">'.__("Forums: ", "sforum").$cnt->forums.'</span><br />'."\n";
  1234. $out.= '<span class="sfstatstopics">'.__("Topics: ", "sforum").$cnt->topics.'</span><br />'."\n";
  1235. $out.= '<span class="sfstatsposts">'.__("Posts: ", "sforum").$cnt->posts.'</span></p>'."\n";
  1236. $out.= '</td>'."\n";
  1237. }
  1238. return $out;
  1239. }
  1240. endif;
  1241. # = STATISTICS STRIP SUPPORT ROUTINE===========
  1242. if(!function_exists('sf_render_member_stats')):
  1243. function sf_render_member_stats($stats, $dashboard=false)
  1244. {
  1245. global $sfglobals;
  1246. $out='';
  1247. if($sfglobals['display']['stats']['memberstats'] || $dashboard)
  1248. {
  1249. $sfcontrols = sf_get_option('sfcontrols');
  1250. $out = '<td class="sfstatsmembers">'."\n";
  1251. $out.= '<p class="sfstatsmembership"><strong>'.__("Membership:", "sforum").'</strong></p>'."\n";
  1252. $out.= '<p>';
  1253. $membercount = $sfcontrols['membercount'];
  1254. if(empty($membercount)) $membercount = 0;
  1255. if($membercount != 0)
  1256. {
  1257. if ($membercount == 1)
  1258. {
  1259. $out.= '<span class="sfstatsmembercount">'.__("There is 1 Member", "sforum").'</span><br />'."\n";
  1260. } else {
  1261. $out.= '<span class="sfstatsmembercount">'.sprintf(__("There are %s Members", "sforum"), $membercount).'</span><br />'."\n";
  1262. }
  1263. }
  1264. $guestcount = $sfcontrols['guestcount'];
  1265. if(empty($guestcount)) $guestcount = 0;
  1266. if($guestcount != 0)
  1267. {
  1268. if ($guestcount == 1)
  1269. {
  1270. $out.='<span class="sfstatsguestcount">'.__("There has been 1 Guest", "sforum").'</span><br />'."\n";
  1271. } else {
  1272. $out.='<span class="sfstatsguestcount">'.sprintf(__("There have been %s Guests", "sforum"), $guestcount).'</span><br />'."\n";
  1273. }
  1274. }
  1275. $out.= '</p>';
  1276. $out.= '<p>';
  1277. $admins = 0;
  1278. $mods = 0;
  1279. if($stats)
  1280. {
  1281. foreach($stats as $stat)
  1282. {
  1283. if($stat->admin) $admins++;
  1284. if($stat->moderator) $mods++;
  1285. }
  1286. }
  1287. if($admins != 0)
  1288. {
  1289. if ($admins == 1)
  1290. {
  1291. $out.='<span class="sfstatsadmincount">'.__("There is 1 Admin", "sforum").'</span><br />'."\n";
  1292. } else {
  1293. $out.='<span class="sfstatsadmincount">'.sprintf(__("There are %s Admins", "sforum"), $admins).'</span><br />'."\n";
  1294. }
  1295. }
  1296. if($mods != 0)
  1297. {
  1298. if ($mods == 1)
  1299. {
  1300. $out.='<span class="sfstatsmodcount">'.__("There is 1 Moderator", "sforum").'</span>'."\n";
  1301. } else {
  1302. $out.='<span class="sfstatsmodcount">'.sprintf(__("There are %s Moderators", "sforum"), $mods).'</span>'."\n";
  1303. }
  1304. }
  1305. $out.= '</p></td>';
  1306. }
  1307. if($sfglobals['display']['stats']['topposters'] || $dashboard)
  1308. {
  1309. if ($stats)
  1310. {
  1311. $out.= '<td class="sfstatstop">'."\n";
  1312. $out.= '<p><strong>'.__("Top Posters:", "sforum").'</strong></p>'."\n";
  1313. $done = 0;
  1314. $out.= '<p>';
  1315. foreach ($stats as $stat)
  1316. {
  1317. if($stat->admin == false && $stat->moderator == false && $stat->posts > 0)
  1318. {
  1319. $out.= '<span class="sfstatstopname">'.sf_build_name_display($stat->user_id, sf_filter_name_display($stat->display_name), true).' - '.$stat->posts.'</span><br />';
  1320. $done++;
  1321. }
  1322. }
  1323. $out.= '</p></td>'."\n";
  1324. }
  1325. }
  1326. return $out;
  1327. }
  1328. endif;
  1329. # = STATISTICS STRIP NEW USERS================
  1330. if(!function_exists('sf_render_newusers')):
  1331. function sf_render_newusers()
  1332. {
  1333. global $sfglobals;
  1334. $out = '';
  1335. if($sfglobals['display']['stats']['newusers'])
  1336. {
  1337. $sfcontrols=sf_get_option('sfcontrols');
  1338. $newuserlist = $sfcontrols['newuserlist'];
  1339. if($newuserlist)
  1340. {
  1341. $out.= '<tr class="sfstatsnew"><td colspan="4">';
  1342. $done = false;
  1343. $out.= '<p class="sfstatsadmins">';
  1344. foreach($newuserlist as $user)
  1345. {
  1346. if($done == false)
  1347. {
  1348. $out.= '<strong>'.__("Recent New Members: ", "sforum").'</strong>';
  1349. } else {
  1350. $out.= ', ';
  1351. }
  1352. $out.= sf_build_name_display($user['id'], sf_filter_name_display($user['name']), true);
  1353. $done = true;
  1354. }
  1355. $out.='</p></td></tr>';
  1356. }
  1357. }
  1358. return $out;
  1359. }
  1360. endif;
  1361. # = STATISTICS STRIP ADMIN/MODS================
  1362. if(!function_exists('sf_render_ownership')):
  1363. function sf_render_ownership($stats, $dashboard=false)
  1364. {
  1365. global $sfglobals;
  1366. $out = '';
  1367. if($sfglobals['display']['stats']['admins'] || $dashboard)
  1368. {
  1369. if($stats)
  1370. {
  1371. $out.= '<tr class="sfstatsfooter"><td colspan="4">';
  1372. $done = false;
  1373. $out.= '<p class="sfstatsadmins">';
  1374. foreach($stats as $stat)
  1375. {
  1376. if($stat->admin == true)
  1377. {
  1378. if($done == false)
  1379. {
  1380. $out.= '<strong>'.__("Administrators: ", "sforum").'</strong>';
  1381. } else {
  1382. $out.= ', ';
  1383. }
  1384. $label = __("Posts", "sforum");
  1385. if ($stat->posts < 0) $stat->posts = 0;
  1386. if ($stat->posts == 1) $label = __("Post", "sforum");
  1387. $out.= sf_build_name_display($stat->user_id, sf_filter_name_display($stat->display_name), true).' ('.$stat->posts.' '.$label.')';
  1388. $done = true;
  1389. }
  1390. }
  1391. $out.='</p>';
  1392. $done = false;
  1393. $out.= '<p class="sfstatsmods">';
  1394. foreach($stats as $stat)
  1395. {
  1396. if($stat->moderator == true)
  1397. {
  1398. if($done == false)
  1399. {
  1400. $out.= '<strong>'.__("Moderators: ", "sforum").'</strong>';
  1401. } else {
  1402. $out.= ', ';
  1403. }
  1404. $label = __("Posts", "sforum");
  1405. if ($stat->posts < 0) $stat->posts = 0;
  1406. if ($stat->posts == 1) $label = __("Post", "sforum");
  1407. $out.= sf_build_name_display($stat->user_id, sf_filter_name_display($stat->display_name), true).' ('.$stat->posts.' '.$label.')';
  1408. $done = true;
  1409. }
  1410. }
  1411. $out.='</p></td></tr>';
  1412. }
  1413. }
  1414. return $out;
  1415. }
  1416. endif;
  1417. # = FORUM QUICKLINKS ==========================
  1418. if(!function_exists('sf_render_forum_quicklinks')):
  1419. function sf_render_forum_quicklinks()
  1420. {
  1421. $out = sf_render_group_forum_select(true, true, true, true);
  1422. return $out;
  1423. }
  1424. endif;
  1425. # = LATEST POST QUICKLINKS ====================
  1426. if(!function_exists('sf_render_newpost_quicklinks')):
  1427. function sf_render_newpost_quicklinks($show)
  1428. {
  1429. global $current_user;
  1430. $space = '&nbsp;&nbsp;';
  1431. $sfposts = sf_get_users_new_post_list($show);
  1432. if($sfposts)
  1433. {
  1434. $sfposts = sf_combined_new_posts_list($sfposts, true);
  1435. # just return if viewable posts is empty
  1436. if ($sfposts == '') return '';
  1437. $out = '<select class="sfquicklinks sfcontrol" name="sfquicklinksPost" id="sfquicklinksPost" size="1" onchange="javascript:sfjchangeURL(this)">'."\n";
  1438. $out.= '<option>'.__("New/Recently Updated Topics", "sforum").'</option>'."\n";
  1439. $thisforum = 0;
  1440. $group = false;
  1441. if($sfposts)
  1442. {
  1443. foreach($sfposts as $sfpost)
  1444. {
  1445. if($sfpost['forum_id'] != $thisforum)
  1446. {
  1447. if($group)
  1448. {
  1449. $out.= '</optgroup>';
  1450. }
  1451. $name = sf_filter_title_display($sfpost['forum_name']);
  1452. if(strlen($name) > 35) $name = substr($name, 0, 35).'...';
  1453. $out.= '<optgroup class="sflist" label="'.$space.sf_create_name_extract(sf_filter_title_display($sfpost['forum_name'])).'">'."\n";
  1454. $thisforum = $sfpost['forum_id'];
  1455. $group = true;
  1456. }
  1457. $topicicon = '&nbsp;&nbsp;';
  1458. $class = '';
  1459. if($current_user->member && $current_user->ID != $sfpost['user_id'])
  1460. {
  1461. if($current_user->forumadmin || $current_user->moderator)
  1462. {
  1463. if($sfpost['post_status'] == 1)
  1464. {
  1465. $topicicon = '&bull;';
  1466. $class = 'class="sfmod"';
  1467. } elseif(sf_is_in_users_newposts($sfpost['topic_id']))
  1468. {
  1469. $topicicon = '&bull;';
  1470. $class = 'class="sfnew"';
  1471. }
  1472. } else {
  1473. if($current_user->member)
  1474. {
  1475. if(sf_is_in_users_newposts($sfpost['topic_id']))
  1476. {
  1477. $topicicon = '&bull;';
  1478. $class = 'class="sfnew"';
  1479. }
  1480. } else {
  1481. if(($current_user->lastvisit > 0) && ($current_user->lastvisit < $sfpost['udate']))
  1482. {
  1483. $topicicon = '&bull;';
  1484. $class = 'class="sfnew"';
  1485. }
  1486. }
  1487. }
  1488. }
  1489. $name = sf_filter_title_display($sfpost['topic_name']);
  1490. if(strlen($name) > 35) $name = substr($name, 0, 35).'...';
  1491. $out.='<option '.$class.' value="'.sf_build_url($sfpost['forum_slug'], $sfpost['topic_slug'], 0, $sfpost['post_id'], $sfpost['post_index']).'">'.$topicicon.sf_create_name_extract(sf_filter_title_display($sfpost['topic_name'])).'</option>'."\n";
  1492. }
  1493. }
  1494. $out.= '</optgroup>';
  1495. $out.='</select>'."\n";
  1496. }
  1497. return $out;
  1498. }
  1499. endif;
  1500. # = ADMINS QUICKLINKS =========================
  1501. if(!function_exists('sf_render_admin_quicklinks')):
  1502. function sf_render_admin_quicklinks($source, $pageview)
  1503. {
  1504. $site = SFHOMEURL."index.php?sf_ahah=adminlinks&action=manage";
  1505. $out = '<a rel="nofollow" class="sficon sfalignright sfquickadmin" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, width: 250, height: 450, anchor: \'top\'} )"><img src="'.SFRESOURCES.'manage.png" alt="" />'.sf_render_icons("Manage").'</a>';
  1506. return $out;
  1507. }
  1508. endif;
  1509. function sf_render_user_permissions()
  1510. {
  1511. global $sfvars, $current_user;
  1512. $site = SFHOMEURL."index.php?sf_ahah=permissions&forum=".$sfvars['forumid']."&forumname=".$sfvars['forumname']."&user=".$current_user->ID."&displayname=".$current_user->display_name;
  1513. $out = '<a rel="nofollow" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, width: 650, height: 570, anchor: \'top\'} )"><img src="'.SFRESOURCES.'user-permissions.png" alt="" title="'.esc_attr(__("Your Permissions", "sforum")).'"/></a>';
  1514. return $out;
  1515. }
  1516. # = VERSION/ACKNOWLEDGEMENT STRIP =============
  1517. function sf_render_version_strip()
  1518. {
  1519. /*--------------------------------------------------------------------------------------------
  1520. This plugin is provided free for anyone to use. We have spent an enormous amount of my time
  1521. and, indeed, money, creating, maintaining, and continuing development of this software.
  1522. The least that you, the user, could do to recognise that, is to leave this copyright strip
  1523. in place which at the very least enables a link back to our site. Thank you.
  1524. --------------------------------------------------------------------------------------------*/
  1525. $out = '';
  1526. $sfpolicy = sf_get_option('sfpolicy');
  1527. $width=' width="100%"';
  1528. if($sfpolicy['sfreglink'] && $sfpolicy['sfprivlink'])
  1529. {
  1530. $width=' width="33%"';
  1531. } else {
  1532. if($sfpolicy['sfreglink'] || $sfpolicy['sfprivlink'])
  1533. {
  1534. $width=' width="50%"';
  1535. }
  1536. }
  1537. $out.= '<div id="sfversion">';
  1538. $out.= '<table width="100%"><tr>';
  1539. # Registration Policy
  1540. if($sfpolicy['sfreglink'])
  1541. {
  1542. $site = SFHOMEURL."index.php?sf_ahah=regpolicy&popup=reg";
  1543. $out.= '<td'.$width.'>';
  1544. $out.= '<a rel="nofollow" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, reflow: true, width: 500} )">'.esc_attr(__("Registration Policy", "sforum")).'&nbsp;&nbsp;<img class="sficon" src="'.SFRESOURCES.'documents.png" alt="" title="'.esc_attr(__("Registration Policy", "sforum")).'" /></a>';
  1545. $out.= '</td>';
  1546. }
  1547. # Version
  1548. $site = SFHOMEURL."index.php?sf_ahah=acknowledge";
  1549. $out.= '<td'.$width.'>&copy; '.SFPLUGHOME;
  1550. $out.= '&nbsp;&nbsp;<a rel="nofollow" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, reflow: true, width: 650} )"><img class="sficon" src="'.SFRESOURCES.'information.png" alt="" title="'.esc_attr(__("Acknowledgements", "sforum")).'" /></a>';
  1551. $out.= '</td>';
  1552. # Privacy Policy
  1553. if($sfpolicy['sfprivlink'])
  1554. {
  1555. $site = SFHOMEURL."index.php?sf_ahah=privpolicy&popup=priv";
  1556. $out.= '<td'.$width.'>';
  1557. $out.= '<a rel="nofollow" href="'.$site.'" onclick="return hs.htmlExpand(this, { objectType: \'ajax\', preserveContent: true, reflow: true, width: 500} )">'.esc_attr(__("Privacy Policy", "sforum")).'&nbsp;&nbsp;<img class="sficon" src="'.SFRESOURCES.'documents.png" alt="" title="'.esc_attr(__("Privacy Policy", "sforum")).'" /></a>';
  1558. $out.= '</td>';
  1559. }
  1560. $out.= '</tr></table>';
  1561. $out.= '</div><br />'."\n";
  1562. return $out;
  1563. }
  1564. function sf_render_topic_printicon($topicid)
  1565. {
  1566. $out = '<a class="sficon" href="javascript:void(0);" onclick="javscript:jQuery(\'#topic-'.$topicid.'\').jqprint({debug:true}); return false;"><img src="'.SFRESOURCES.'print.png" alt="" title="'.esc_attr(__("Print This Topic", "sforum")).'"/>'.sf_render_icons("Print this Topic").'</a>';
  1567. return $out;
  1568. }
  1569. ?>