shim.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?PHP
  2. error_reporting(E_ALL);
  3. ini_set('display_errors', '1');
  4. $encriptKeyToUse = "key from Config.php (created while installation)";
  5. function base64_url_encode($input){
  6. return strtr(base64_encode($input), '+/=', '-_,');
  7. }
  8. function base64_url_decode($input){
  9. return base64_decode(strtr($input, '-_,', '+/='));
  10. }
  11. define("IN_MYBB", 1);
  12. define("NO_ONLINE", 1);
  13. require_once "./global.php";
  14. ob_start();
  15. if(!isset($_GET['op'])){
  16. if(isset($_GET['txt'])){
  17. header('Content-type: text/plain');
  18. }elseif(!isset($_GET['textmode'])){
  19. header('Content-type: text/javascript');
  20. }
  21. if($mybb->user['username']=="" || $mybb->user['isbannedgroup']){
  22. $nick = "Guest";
  23. $signature = "";
  24. }else{
  25. $nick = $mybb->user['username'];
  26. $signature = base64_url_encode(mcrypt_encrypt ( MCRYPT_RIJNDAEL_256 , $encriptKeyToUse , $nick , MCRYPT_MODE_ECB));
  27. }
  28. }
  29. ob_end_clean();
  30. if(isset($_GET['op'])){
  31. header('Content-type: text/plain');
  32. $id = $_GET['u'];
  33. $user = get_user((int) $id);
  34. if (base64_url_decode($_GET['nick'])==$user['username']){
  35. echo $user['usergroup'];
  36. }
  37. }else{
  38. if(isset($_GET['txt'])){
  39. echo $signature."\n".$nick."\n".$mybb->user['uid'];
  40. }elseif(isset($_GET['textmode'])){
  41. header('Location: http://chat.forum.acr.victorz.ca/textmode.php?login&nick='.urlencode($nick).'&sig='.urlencode($signature).'&id='.$mybb->user['uid']);
  42. }else{
  43. echo "signCallback('$signature','$nick','".$mybb->user['uid']."');";
  44. }
  45. }
  46. ?>