Advertisement
Guest User

Untitled

a guest
Oct 8th, 2013
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. // Initialise common code.
  2. if ( isset( $_SERVER['MW_COMPILED'] ) ) {
  3. require ( 'core/includes/WebStart.php' );
  4. } else {
  5. require ( __DIR__ . '/includes/WebStart.php' );
  6. }
  7.  
  8.  
  9. function getChanges() {
  10. //Database query...
  11. $dbr = wfGetDB( DB_SLAVE );
  12. $res = $dbr->query("SELECT * FROM `wiki_recentchanges` ORDER BY rc_id DESC LIMIT 0,5");
  13.  
  14. $changes = array();
  15. while ($row = $dbr->fetchRow($res)) {
  16. $changes[] = $row;
  17. }
  18.  
  19. return array(
  20. 'changes' => $changes
  21. );
  22. }
  23.  
  24.  
  25. switch ($_REQUEST['action']) {
  26. case 'recent':
  27. case 'changes':
  28. $response = getChanges();
  29. break;
  30.  
  31. default:
  32. $response = array('error' => 'Unknown action');
  33. }
  34.  
  35.  
  36. $response = json_encode($response);
  37. echo $response;
  38. die();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement