Advertisement
plas71k

Master-Gg-decoded_file

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