Advertisement
FrayxRulez

Untitled

Nov 18th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.05 KB | None | 0 0
  1. <?php
  2.     include "wns.php";
  3.    
  4.     $mode = $_GET["mode"];
  5.     $channel = base64_decode($_GET["channel"]);
  6.     $body = file_get_contents('php://input');
  7.     $xml = simplexml_load_string($body);
  8.    
  9.     file_put_contents("log.txt", $body . "\n\n", FILE_APPEND | LOCK_EX);
  10.     //file_put_contents("log.txt", $channel . "\n\n", FILE_APPEND | LOCK_EX);
  11.    
  12.     $text2 = $xml->xpath('//wp:Text2');
  13.     $param = $xml->xpath('//wp:Param');
  14.    
  15.     if ($text2 != null && $param != null)
  16.     {
  17.         list($user, $message) = explode(":", $text2[0], 2);
  18.        
  19.         $param = substr($param[0], 17);
  20.         parse_str($param, $arguments);
  21.         $uid = $arguments["uid"];
  22.         $tid = $arguments["unified_tid"];
  23.        
  24.         if ($mode == "lite")
  25.             $header = '<toast activationType="protocol" launch="fbmessenger://user?recipientId='. $uid .'">';
  26.         else
  27.             $header = '<toast>';
  28.        
  29.         $xml = $header .
  30.                '  <audio src="ms-appx:///Assets/Sounds/locationOn.wav"/>'.
  31.                '  <visual>'.
  32.                '    <binding template="ToastGeneric">'.
  33.                '      <image placement="appLogoOverride" src="http://graph.facebook.com/'. $uid .'/picture?type=square"/>'.
  34.                '      <text>'. $user .'</text>'.
  35.                '      <text>'. $message .'</text>'.
  36.                '    </binding>'.
  37.                '  </visual>'.
  38.                '  <actions>'.
  39.                '    <input id="UserId" type="text" defaultInput="'. $uid .'" hint-visible="false" />'.
  40.                '    <input id="ThreadId" type="text" defaultInput="'. $tid .'" hint-visible="false" />'.
  41.                '    <input id="QuickMessage" type="text" placeholderContent="Type a message..." />'.
  42.                '    <action activationType="background" arguments="QuickReply" hint-inputId="QuickMessage" content="" imageUri="ms-appx:///Assets/Toast/QuickReply.png"/>'.
  43.                '    <action activationType="background" arguments="QuickLike" content="Like" imageUri="ms-appx:///Assets/Toast/QuickLike.png"/>'.
  44.                '    <action activationType="background" arguments="QuickMute" content="Mute" imageUri=""/>'.
  45.                '  </actions>'.
  46.                '</toast>';
  47.        
  48.         $notif = new WPN("suca", "suca");
  49.         $result = $notif->post_push($channel, $xml, WPNTypesEnum::Toast);
  50.     }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement