BioTorrents.de’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.

clear_cache.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. if (!check_perms('users_mod') || !check_perms('admin_clear_cache')) {
  3. error(403);
  4. }
  5. View::show_header('Clear a cache key');
  6. // Make sure the form was sent
  7. if (!empty($_GET['key'])) {
  8. $Keys = array_map('trim', preg_split('/\s+/', $_GET['key']));
  9. }
  10. if (isset($Keys) && $_GET['type'] === 'clear') {
  11. foreach ($Keys as $Key) {
  12. if (preg_match('/(.*?)(\d+)\.\.(\d+)$/', $Key, $Matches) && is_number($Matches[2]) && is_number($Matches[3])) {
  13. for ($i = $Matches[2]; $i <= $Matches[3]; $i++) {
  14. $Cache->delete_value($Matches[1].$i);
  15. }
  16. } else {
  17. $Cache->delete_value($Key);
  18. }
  19. }
  20. echo '<div class="save_message">Key(s) ' . implode(', ', array_map('display_str', $Keys)) . ' cleared!</div>';
  21. }
  22. $MultiKeyTooltip = 'Enter cache keys delimited by any amount of whitespace.';
  23. ?>
  24. <div class="header">
  25. <h2>Clear a cache key</h2>
  26. </div>
  27. <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">
  28. <tr class="tooltip" title="<?=$MultiKeyTooltip?>">
  29. <td>Keys</td>
  30. <td>
  31. <form class="manage_form" name="cache" method="get" action="">
  32. <input type="hidden" name="action" value="clear_cache" />
  33. <select name="type">
  34. <option value="view">View</option>
  35. <option value="clear">Clear</option>
  36. </select>
  37. <textarea type="text" name="key" id="key"
  38. class="inputtext"><?=((isset($_GET['key']) && (isset($_GET['submit']))) ? display_str($_GET['key']) : '')?></textarea>
  39. <input type="submit" name="submit" class="submit" />
  40. </form>
  41. </td>
  42. </tr>
  43. </table>
  44. <?php
  45. if (isset($Keys) && $_GET['type'] === 'view') {
  46. ?>
  47. <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center" style="margin-top: 1em;">
  48. <?php
  49. foreach ($Keys as $Key) {
  50. ?>
  51. <tr>
  52. <td>
  53. <?=display_str($Key)?>
  54. </td>
  55. <td>
  56. <pre>
  57. <?php var_dump($Cache->get_value($Key)); ?>
  58. </pre>
  59. </td>
  60. </tr>
  61. <?php
  62. } ?>
  63. </table>
  64. <?php
  65. }
  66. View::show_footer();