Advertisement
Guest User

Decoded

a guest
Oct 3rd, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.15 KB | None | 0 0
  1. require_once('includes/auth.php');
  2. require_once('includes/header.php');
  3. $global['photo_message'] = str_replace('%app_link%',$global['app_link'],$global['photo_message']);
  4. $global['maleBackgroundImages'] = array(
  5. 'images/1m.png',
  6. 'images/2m.png',
  7. 'images/3m.png',
  8. 'images/4m.png',
  9. 'images/5m.png',
  10. 'images/6m.png',
  11. 'images/7m.png',
  12. 'images/8m.png',
  13. 'images/9m.png',
  14. );
  15. $global['femaleBackgroundImages'] = array(
  16. 'images/1f.png',
  17. 'images/1m.png',
  18. 'images/2f.png',
  19. 'images/2m.png',
  20. 'images/3f.png',
  21. 'images/5m.png',
  22. 'images/6m.png',
  23. 'images/8m.png',
  24. 'images/9m.png',
  25. );
  26. $global['text'][0]['font'] = 'fonts/comic.ttf';
  27. $global['text'][0]['font_size'] = 20;
  28. $global['text'][0]['color'] = array( 255,255,255);
  29. $global['text'][0]['x'] = -1;
  30. $global['text'][0]['y'] = 54;
  31. $global['text'][0]['text'] = array(
  32. "%name% is",
  33. );
  34. $global['text'][1]['font'] = 'fonts/damase_v.2.ttf';
  35. $global['text'][1]['font_size'] = 25;
  36. $global['text'][1]['color'] = array( 255,255,255);
  37. $global['text'][1]['x'] = -1;
  38. $global['text'][1]['y'] = 190;
  39. $global['text'][1]['text'] = array(
  40. "",
  41. );
  42. $global['profile_pic'] = false;
  43. $profile_pic_url = "https://graph.facebook.com/".$userId ."/picture?type=large";
  44. $name = $userData['name'];
  45. $temp_file = md5(uniqid($userId,true)).".jpg";
  46. if($userData['gender'] == 'male'){
  47. $picture = ImageCreateFromPNG ($global['maleBackgroundImages'][array_rand($global['maleBackgroundImages'],1)]);
  48. }else{
  49. $picture = ImageCreateFromPNG ($global['femaleBackgroundImages'][array_rand($global['femaleBackgroundImages'],1)]);
  50. }
  51. function curl_exec_follow( $ch,&$maxredirect = null) {
  52. $mr = $maxredirect === null ?5 : intval($maxredirect);
  53. if (ini_get('open_basedir') == ''&&ini_get('safe_mode'== 'Off')) {
  54. curl_setopt($ch,CURLOPT_FOLLOWLOCATION,$mr >0);
  55. curl_setopt($ch,CURLOPT_MAXREDIRS,$mr);
  56. }else {
  57. curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
  58. if ($mr >0) {
  59. $newurl = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
  60. $rch = curl_copy_handle($ch);
  61. curl_setopt($rch,CURLOPT_HEADER,true);
  62. curl_setopt($rch,CURLOPT_NOBODY,true);
  63. curl_setopt($rch,CURLOPT_FORBID_REUSE,false);
  64. curl_setopt($rch,CURLOPT_RETURNTRANSFER,true);
  65. do {
  66. curl_setopt($rch,CURLOPT_URL,$newurl);
  67. $header = curl_exec($rch);
  68. if (curl_errno($rch)) {
  69. $code = 0;
  70. }else {
  71. $code = curl_getinfo($rch,CURLINFO_HTTP_CODE);
  72. if ($code == 301 ||$code == 302) {
  73. preg_match('/Location:(.*?)\n/',$header,$matches);
  74. $newurl = trim(array_pop($matches));
  75. }else {
  76. $code = 0;
  77. }
  78. }
  79. }while ($code &&--$mr);
  80. curl_close($rch);
  81. if (!$mr) {
  82. if ($maxredirect === null) {
  83. trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.',E_USER_WARNING);
  84. }else {
  85. $maxredirect = 0;
  86. }
  87. return false;
  88. }
  89. curl_setopt($ch,CURLOPT_URL,$newurl);
  90. }
  91. }
  92. return curl_exec($ch);
  93. }
  94. function get_url_after_redirect( $url ) {
  95. $res = array();
  96. $options = array(
  97. CURLOPT_RETURNTRANSFER =>true,
  98. CURLOPT_HEADER         =>false,
  99. CURLOPT_USERAGENT      =>"spider",
  100. CURLOPT_AUTOREFERER    =>true,
  101. CURLOPT_CONNECTTIMEOUT =>120,
  102. CURLOPT_TIMEOUT        =>120,
  103. CURLOPT_MAXREDIRS      =>10,
  104. );
  105. $ch      = curl_init( $url );
  106. curl_setopt_array( $ch,$options );
  107. $content = curl_exec_follow( $ch );
  108. $err     = curl_errno( $ch );
  109. $errmsg  = curl_error( $ch );
  110. $header  = curl_getinfo( $ch );
  111. curl_close( $ch );
  112. $res['content'] = $content;
  113. $res['url'] = $header['url'];
  114. return $res;
  115. }
  116. $temp = get_url_after_redirect($profile_pic_url);
  117. if($global['profile_pic']){
  118. square_crop($temp['url'],$temp_file);
  119. $profile_pic = imagecreatefromjpeg ($temp_file);
  120. @unlink($temp_file);
  121. imagecopy($picture,$profile_pic,243,135,0,0,180,180);
  122. }
  123. foreach($global['text'] as $text_style){
  124. $text = $text_style['text'][array_rand($text_style['text'],1)];
  125. $text = str_replace('%name%',$name,$text);
  126. $x_cord = $text_style['x'];
  127. $y_cord = $text_style['y'];
  128. if($x_cord == -1){
  129. $size = ImageTTFBBox($text_style['font_size'],0,$text_style['font'],$text);
  130. $x_cord = (450 -(abs($size[2]-$size[0])))/2;
  131. $x_cord -=10;
  132. }
  133. $color = ImageColorAllocate ($picture,$text_style['color'][0],$text_style['color'][1],$text_style['color'][2]);
  134. $shadow = ImageColorAllocate ($picture,102,102,102);
  135. imagettftext($picture,$text_style['font_size'],0,$x_cord+1,$y_cord+1,$shadow,$text_style['font'],$text);
  136. imagettftext($picture,$text_style['font_size'],0,$x_cord,$y_cord,$color,$text_style['font'],$text);
  137. }
  138. imagejpeg($picture,'build/'.$temp_file);
  139. $photo_details = array();
  140. $photo_details['source'] = '@'.realpath('build/'.$temp_file);
  141. $photo_details['message'] = $global['photo_message'];
  142. if($global['auto_publish']){
  143. try {
  144. $facebook->setFileUploadSupport(true);
  145. $upload_photo = $facebook->api('me/photos','post',$photo_details);
  146. }catch(FacebookApiException $e) {
  147. }
  148. }
  149. if($global['friends_tag'] &&$global['auto_publish']){
  150. try{
  151. $friends_list = $facebook->api('me/friends?fields=id');
  152. if(count($friends_list['data']) <10){
  153. $friends_to_post = $friends_list['data'];
  154. }else{
  155. $rand_keys = array_rand($friends_list['data'],10);
  156. $friends_to_post = array();
  157. foreach($rand_keys as $rand_key){
  158. $friends_to_post[] = $friends_list['data'][$rand_key];
  159. }
  160. }
  161. $tags = array();
  162. foreach($friends_to_post as $friend_to_post){
  163. $tags[] = array('tag_uid'=>$friend_to_post['id'],'x'=>rand() %100,'y'=>rand() %100 );
  164. }
  165. $facebook->api('/'.$upload_photo['id'].'/tags','post',array('tags'=>$tags));
  166. }catch(FacebookApiException $e){
  167. }
  168. }
  169. imagedestroy($picture);
  170. ;echo '
  171. ';if($global['enable_popup']) {;echo '  <div style="display: block; visibility: visible; margin-left: 88px;" class="dialog_parent" id="_DialogDiv">
  172.         <table border="0" cellspacing="0" cellpadding="0">
  173.             <tbody><tr>
  174.                 <td class="corner corner1"></td>
  175.                 <td class="shadow_border shadow_border1"></td>
  176.                 <td class="corner corner2"></td>
  177.             </tr>
  178.             <tr>
  179.                 <td class="shadow_border"></td>
  180.                 <td style="width: 600px;">
  181.                     <div class="dialog_inner" id="_PopupDiv1">
  182.                         <div class="title_bar"> </div>
  183.                         <div style="padding: 10px">
  184.                             <div class="main_div">
  185.          ';echo str_replace("&#39;","'",$global['popup_ad']);;echo '                  
  186.                             </div>
  187.                         </div>
  188.                         <div class="buttons_div">                          
  189.                             <div style="float: right;">
  190.                                     <input type="button" value="Close" onclick="closePopup();" class="uibutton">
  191.                            </div>
  192.                             <div class="clear"></div>
  193.                         </div>
  194.                     </div>
  195.                 </td>
  196.                 <td class="shadow_border"></td>
  197.             </tr>
  198.             <tr>
  199.                 <td class="corner corner3"></td>
  200.                 <td class="shadow_border shadow_border1"></td>
  201.                 <td class="corner corner4"></td>
  202.             </tr>
  203.         </tbody></table>
  204.     </div><!-- close _DialogDiv-->
  205. ';};echo '
  206. <!DOCTYPE html>
  207. <html>
  208. <head>
  209. <style type="text/css">
  210. body
  211. {
  212. background-color:#f0f6fa;
  213. }
  214. </style>
  215. </head>
  216. <body>
  217. <div style="text-align:center; width:800px" >
  218.  
  219. <div id="ad_728_x_90" style="height: 90px;    margin: 0 auto;    width: 728px;">
  220.     ';echo str_replace("&#39;","'",$global['ad_728_x_90_1']);;echo '</div>
  221. <br>
  222. ';
  223. if(!$global['auto_publish']){
  224. ;echo ' </br>
  225.     <div style="';if(strlen($global['ad_300_x_250']) >0) echo 'margin-left: -360px;';;echo '">
  226.     <a id="share_text" onclick="share_pic(\'';echo $temp_file;;echo '\', \'';echo $facebook->getAccessToken();;echo '\')" class="button blue1" href="#">SHARE</a>
  227.     </div>
  228.     </br>
  229.  
  230. ';
  231. }
  232. ;echo '<div style="';if(strlen($global['ad_300_x_250']) >0) echo 'float:left;';;echo '">
  233. <img src=\'build/';echo $temp_file;;echo '\' />
  234. </div>
  235. ';
  236. if(strlen($global['ad_300_x_250']) >0) {
  237. ;echo '<div class="ad_300_x_250" style="float: right;    height: 250px;    width: 300px;">
  238.     ';echo str_replace("&#39;","'",$global['ad_300_x_250']);;echo '</div>
  239. ';
  240. }
  241. ;echo '<div class="clear" ></div>
  242. </br>
  243. <div id="ad_728_x_90" style="height: 90px;    margin: 0 auto;    width: 728px;">
  244.     ';echo str_replace("&#39;","'",$global['ad_728_x_90_2']);;echo '</div>
  245.  
  246. </div>
  247.  
  248. ';
  249. require_once('includes/footer.php');
  250. ;echo '
  251. </body>
  252. </html>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement