Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

questions.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?
  2. if (!check_perms("users_mod")) {
  3. error(404);
  4. }
  5. Text::$TOC = true;
  6. define('QUESTIONS_PER_PAGE', 25);
  7. list($Page, $Limit) = Format::page_limit(QUESTIONS_PER_PAGE);
  8. $DB->query("
  9. SELECT
  10. uq.ID,
  11. uq.Question,
  12. uq.UserID,
  13. uq.Date,
  14. (
  15. SELECT COUNT(1)
  16. FROM staff_answers AS sa
  17. WHERE sa.QuestionID = uq.ID
  18. ) AS Responses
  19. FROM user_questions AS uq
  20. WHERE uq.ID NOT IN
  21. (
  22. SELECT siq.QuestionID
  23. FROM staff_ignored_questions AS siq
  24. WHERE siq.UserID = '$LoggedUser[ID]'
  25. )
  26. AND uq.ID NOT IN
  27. (
  28. SELECT sq.QuestionID
  29. FROM staff_answers AS sq
  30. WHERE sq.UserID = '$LoggedUser[ID]'
  31. )
  32. ORDER BY uq.Date DESC
  33. LIMIT $Limit");
  34. $Questions = $DB->to_array();
  35. $DB->query("
  36. SELECT COUNT(1)
  37. FROM user_questions");
  38. list($TotalQuestions) = $DB->next_record();
  39. View::show_header('Ask the Staff', 'questions,bbcode');
  40. if ($TotalQuestions > QUESTIONS_PER_PAGE) {
  41. ?>
  42. <div class="linkbox">
  43. <?
  44. $Pages = Format::get_pages($Page, $TotalQuestions, QUESTIONS_PER_PAGE);
  45. echo $Pages;
  46. ?>
  47. </div>
  48. <? } ?>
  49. <div class="thin">
  50. <div class="header">
  51. <h2>User Questions</h2>
  52. <h3><?=number_format($TotalQuestions)?> questions asked; <?=number_format(count($Questions))?> left to answer</h3>
  53. </div>
  54. <div class="linkbox">
  55. <a class="brackets" href="questions.php?action=answers">View staff answers</a>
  56. <a class="brackets" href="questions.php?action=popular_questions">Popular questions</a>
  57. </div>
  58. <? foreach($Questions as $Question) { ?>
  59. <div id="question<?=$Question['ID']?>" class="box box2">
  60. <div class="head">
  61. <span>
  62. <a class="post_id" href="questions.php#question<?=$Question['ID']?>">#<?=$Question['ID']?></a>
  63. <?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['Date'])?>
  64. </span>
  65. <span style="float: right;">
  66. <? if ($Question['Responses'] > 0) { ?>
  67. <a href="#" id="<?=$Question['ID']?>" class="view_responses brackets"><?=$Question['Responses'] == 1 ? ("View " . $Question['Responses'] . " response") : ("View " . $Question['Responses'] . " responses")?></a>
  68. -
  69. <? } ?>
  70. <form class="hidden" id="delete_<?=$Question['ID']?>" method="post" action="">
  71. <input type="hidden" name="action" value="take_remove_question" />
  72. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  73. <input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
  74. </form>
  75. <a href="#" onclick="if (confirm('Are you sure?') == true) { $('#delete_<?=$Question['ID']?>').raw().submit(); } return false;" class="brackets">Delete</a>
  76. -
  77. <a href="#" id="<?=$Question['ID']?>" class="brackets ignore_link">Ignore</a>
  78. -
  79. <a href="#" id="<?=$Question['ID']?>" class="answer_link brackets">Answer</a>
  80. </span>
  81. </div>
  82. <div class="pad">
  83. <?=Text::full_format($Question['Question'])?>
  84. </div>
  85. </div>
  86. <div id="answer<?=$Question['ID']?>" class="hidden center box pad">
  87. <? new TEXTAREA_PREVIEW("replybox_" . $Question['ID'], "replybox_" . $Question['ID'], '', 40, 8); ?>
  88. <input type="submit" class="submit submit_button" id="<?=$Question['ID']?>" value="Answer" />
  89. </div>
  90. <? } ?>
  91. </div>
  92. <?
  93. View::show_footer();