Advertisement
plas71k

decoded file

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