PageRenderTime 50ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/footer.php

https://github.com/gencer/fluxbb
PHP | 222 lines | 155 code | 49 blank | 18 comment | 53 complexity | a580d128e1fc05b3fe158d7e2e5b3f71 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * Copyright (C) 2008-2012 FluxBB
  4. * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
  5. * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  6. */
  7. // Make sure no one attempts to run this script "directly"
  8. if (!defined('PUN'))
  9. exit;
  10. $tpl_temp = trim(ob_get_contents());
  11. $tpl_main = str_replace('<pun_main>', $tpl_temp, $tpl_main);
  12. ob_end_clean();
  13. // END SUBST - <pun_main>
  14. // START SUBST - <pun_footer>
  15. ob_start();
  16. ?>
  17. <div id="brdfooter" class="block">
  18. <h2><span><?php echo $lang->t('Board footer') ?></span></h2>
  19. <div class="box">
  20. <?php
  21. if (isset($footer_style) && ($footer_style == 'viewforum' || $footer_style == 'viewtopic') && $is_admmod)
  22. {
  23. echo "\t\t".'<div id="modcontrols" class="inbox">'."\n";
  24. if ($footer_style == 'viewforum')
  25. {
  26. echo "\t\t\t".'<dl>'."\n";
  27. echo "\t\t\t\t".'<dt><strong>'.$lang->t('Mod controls').'</strong></dt>'."\n";
  28. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;p='.$p.'">'.$lang->t('Moderate forum').'</a></span></dd>'."\n";
  29. echo "\t\t\t".'</dl>'."\n";
  30. }
  31. else if ($footer_style == 'viewtopic')
  32. {
  33. echo "\t\t\t".'<dl>'."\n";
  34. echo "\t\t\t\t".'<dt><strong>'.$lang->t('Mod controls').'</strong></dt>'."\n";
  35. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;tid='.$id.'&amp;p='.$p.'">'.$lang->t('Moderate topic').'</a></span></dd>'."\n";
  36. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;move_topics='.$id.'">'.$lang->t('Move topic').'</a></span></dd>'."\n";
  37. if ($cur_topic['closed'] == '1')
  38. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;open='.$id.'">'.$lang->t('Open topic').'</a></span></dd>'."\n";
  39. else
  40. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;close='.$id.'">'.$lang->t('Close topic').'</a></span></dd>'."\n";
  41. if ($cur_topic['sticky'] == '1')
  42. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'">'.$lang->t('Unstick topic').'</a></span></dd>'."\n";
  43. else
  44. echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&amp;stick='.$id.'">'.$lang->t('Stick topic').'</a></span></dd>'."\n";
  45. echo "\t\t\t".'</dl>'."\n";
  46. }
  47. echo "\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'."\n";
  48. }
  49. ?>
  50. <div id="brdfooternav" class="inbox">
  51. <?php
  52. echo "\t\t\t".'<div class="conl">'."\n";
  53. // Display the "Jump to" drop list
  54. if ($pun_config['o_quickjump'] == '1')
  55. {
  56. $quickjump = $cache->remember('quickjump', function() use ($db) {
  57. $quickjump = array();
  58. // Generate the quick jump cache for all groups
  59. $query = $db->select(array('gid' => 'g.g_id'), 'groups AS g');
  60. $query->where = 'g.g_read_board = 1';
  61. $params = array();
  62. $result = $query->run($params);
  63. unset ($query, $params);
  64. $query_forums = $db->select(array('cid' => 'c.id AS cid', 'cat_name' => 'c.cat_name', 'fid' => 'f.id AS fid', 'forum_name' => 'f.forum_name', 'redirect_url' => 'f.redirect_url'), 'categories AS c');
  65. $query_forums->innerJoin('f', 'forums AS f', 'c.id = f.cat_id');
  66. $query_forums->leftJoin('fp', 'forum_perms AS fp', 'fp.forum_id = f.id AND fp.group_id = :group_id');
  67. $query_forums->where = 'fp.read_forum IS NULL OR fp.read_forum = 1';
  68. $query_forums->order = array('cposition' => 'c.disp_position ASC', 'cid' => 'c.id ASC', 'fposition' => 'f.disp_position ASC');
  69. foreach ($result as $cur_group)
  70. {
  71. $params = array(':group_id' => $cur_group['g_id']);
  72. $quickjump[$cur_group['g_id']] = $query_forums->run($params);
  73. unset ($params);
  74. }
  75. unset ($result, $query_forums);
  76. return $quickjump;
  77. });
  78. if (!empty($quickjump[$pun_user['g_id']]))
  79. {
  80. ?>
  81. <form id="qjump" method="get" action="viewforum.php">
  82. <div>
  83. <label>
  84. <span><?php echo $lang->t('Jump to') ?><br /></span>
  85. <select name="id" onchange="window.location=('viewforum.php?id='+this.options[this.selectedIndex].value)">
  86. <?php
  87. $cur_category = 0;
  88. foreach ($quickjump[$pun_user['g_id']] as $cur_forum)
  89. {
  90. if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
  91. {
  92. if ($cur_category)
  93. echo "\t\t\t\t\t\t\t\t".'</optgroup>'."\n";
  94. echo "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n";
  95. $cur_category = $cur_forum['cid'];
  96. }
  97. $redirect_tag = ($cur_forum['redirect_url'] != '') ? ' &gt;&gt;&gt;' : '';
  98. echo "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"'. (isset($forum_id) && $forum_id == $cur_forum['fid'] ? ' selected="selected"' : '').'>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n";
  99. }
  100. ?>
  101. </optgroup>
  102. </select>
  103. <input type="submit" value="<?php echo $lang->t('Go') ?>" accesskey="g" />
  104. </label>
  105. </div>
  106. </form>
  107. <?php
  108. }
  109. }
  110. echo "\t\t\t".'</div>'."\n";
  111. ?>
  112. <div class="conr">
  113. <?php
  114. // If no footer style has been specified, we use the default (only copyright/debug info)
  115. $footer_style = isset($footer_style) ? $footer_style : NULL;
  116. if ($footer_style == 'index')
  117. {
  118. if ($pun_config['o_feed_type'] == '1')
  119. echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&amp;type=rss">'.$lang->t('RSS active topics feed').'</a></span></p>'."\n";
  120. else if ($pun_config['o_feed_type'] == '2')
  121. echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&amp;type=atom">'.$lang->t('Atom active topics feed').'</a></span></p>'."\n";
  122. }
  123. else if ($footer_style == 'viewforum')
  124. {
  125. if ($pun_config['o_feed_type'] == '1')
  126. echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&amp;fid='.$forum_id.'&amp;type=rss">'.$lang->t('RSS forum feed').'</a></span></p>'."\n";
  127. else if ($pun_config['o_feed_type'] == '2')
  128. echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&amp;fid='.$forum_id.'&amp;type=atom">'.$lang->t('Atom forum feed').'</a></span></p>'."\n";
  129. }
  130. else if ($footer_style == 'viewtopic')
  131. {
  132. if ($pun_config['o_feed_type'] == '1')
  133. echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&amp;tid='.$id.'&amp;type=rss">'.$lang->t('RSS topic feed').'</a></span></p>'."\n";
  134. else if ($pun_config['o_feed_type'] == '2')
  135. echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&amp;tid='.$id.'&amp;type=atom">'.$lang->t('Atom topic feed').'</a></span></p>'."\n";
  136. }
  137. ?>
  138. <p id="poweredby"><?php echo $lang->t('Powered by', '<a href="http://fluxbb.org/">FluxBB</a>'.(($pun_config['o_show_version'] == '1') ? ' '.$pun_config['o_cur_version'] : '')) ?></p>
  139. </div>
  140. <div class="clearer"></div>
  141. </div>
  142. </div>
  143. </div>
  144. <?php
  145. // Display debug info (if enabled/defined)
  146. if (defined('PUN_DEBUG'))
  147. {
  148. echo '<p id="debugtime">[ ';
  149. // Calculate script generation time
  150. $time_diff = sprintf('%.3f', get_microtime() - $pun_start);
  151. $queries = $db->getExecutedQueries();
  152. echo $lang->t('Querytime', $time_diff, count($queries));
  153. if (function_exists('memory_get_usage'))
  154. {
  155. echo ' - '.$lang->t('Memory usage', file_size(memory_get_usage()));
  156. if (function_exists('memory_get_peak_usage'))
  157. echo ' '.$lang->t('Peak usage', file_size(memory_get_peak_usage()));
  158. }
  159. echo ' ]</p>'."\n";
  160. }
  161. // End the transaction
  162. $db->commitTransaction();
  163. // Display executed queries (if enabled)
  164. if (defined('PUN_SHOW_QUERIES'))
  165. display_saved_queries();
  166. $tpl_temp = trim(ob_get_contents());
  167. $tpl_main = str_replace('<pun_footer>', $tpl_temp, $tpl_main);
  168. ob_end_clean();
  169. // END SUBST - <pun_footer>
  170. // Close the db connection (and free up any result data)
  171. unset ($db);
  172. // Spit out the page
  173. exit($tpl_main);