Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('includes/auth.php');
- require_once('includes/header.php');
- $global['photo_message'] = str_replace('%app_link%', $global['app_link'], $global['photo_message']);
- $global['maleBackgroundImages'] = array(
- 'images/m1.png',
- 'images/m2.png',
- 'images/m3.png',
- 'images/m4.png',
- 'images/m5.png',
- 'images/m6.png',
- 'images/m7.png',
- 'images/m8.png',
- 'images/m9.png',
- 'images/m10.png',
- 'images/m11.png',
- 'images/m12.png',
- 'images/m13.png',
- 'images/m14.png',
- 'images/m15.png'
- );
- $global['femaleBackgroundImages'] = array(
- 'images/f1.png',
- 'images/f2.png',
- 'images/f3.png',
- 'images/f4.png',
- 'images/f5.png',
- 'images/f6.png',
- 'images/f7.png',
- 'images/f8.png',
- 'images/f9.png',
- 'images/f10.png',
- 'images/f11.png',
- 'images/f12.png',
- 'images/f13.png',
- 'images/f14.png',
- 'images/f15.png'
- );
- $global['text'][0]['font'] = 'fonts/FEASFBRG.TTF';
- $global['text'][0]['font_size'] = 33;
- $global['text'][0]['color'] = array(
- 0,
- 0,
- 0
- );
- $global['text'][0]['x'] = -1;
- $global['text'][0]['y'] = 91;
- $global['text'][0]['text'] = array(
- "%name%"
- );
- $global['text'][1]['font'] = 'fonts/FEASFBRG.TTF';
- $global['text'][1]['font_size'] = 15;
- $global['text'][1]['color'] = array(
- 70,
- 70,
- 70
- );
- $global['text'][1]['x'] = -1;
- $global['text'][1]['y'] = 448;
- $global['text'][1]['text'] = array(
- "Which Celeb You Look Like?"
- );
- $global['profile_pic'] = true;
- $profile_pic_url = "https://graph.facebook.com/" . $userId . "/picture?type=large";
- $name = $userData['name'];
- $temp_file = md5(uniqid($userId, true)) . ".jpg";
- if ($userData['gender'] == 'male') {
- $picture = ImageCreateFromPNG($global['maleBackgroundImages'][array_rand($global['maleBackgroundImages'], 1)]);
- } else {
- $picture = ImageCreateFromPNG($global['femaleBackgroundImages'][array_rand($global['femaleBackgroundImages'], 1)]);
- }
- function curl_exec_follow($ch, &$maxredirect = null)
- {
- $mr = $maxredirect === null ? 5 : intval($maxredirect);
- if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0);
- curl_setopt($ch, CURLOPT_MAXREDIRS, $mr);
- } else {
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
- if ($mr > 0) {
- $newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- $rch = curl_copy_handle($ch);
- curl_setopt($rch, CURLOPT_HEADER, true);
- curl_setopt($rch, CURLOPT_NOBODY, true);
- curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
- curl_setopt($rch, CURLOPT_RETURNTRANSFER, true);
- do {
- curl_setopt($rch, CURLOPT_URL, $newurl);
- $header = curl_exec($rch);
- if (curl_errno($rch)) {
- $code = 0;
- } else {
- $code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
- if ($code == 301 || $code == 302) {
- preg_match('/Location:(.*?)\n/', $header, $matches);
- $newurl = trim(array_pop($matches));
- } else {
- $code = 0;
- }
- }
- } while ($code && --$mr);
- curl_close($rch);
- if (!$mr) {
- if ($maxredirect === null) {
- trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING);
- } else {
- $maxredirect = 0;
- }
- return false;
- }
- curl_setopt($ch, CURLOPT_URL, $newurl);
- }
- }
- return curl_exec($ch);
- }
- function get_url_after_redirect($url)
- {
- $res = array();
- $options = array(
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_HEADER => false,
- CURLOPT_USERAGENT => "spider",
- CURLOPT_AUTOREFERER => true,
- CURLOPT_CONNECTTIMEOUT => 120,
- CURLOPT_TIMEOUT => 120,
- CURLOPT_MAXREDIRS => 10
- );
- $ch = curl_init($url);
- curl_setopt_array($ch, $options);
- $content = curl_exec_follow($ch);
- $err = curl_errno($ch);
- $errmsg = curl_error($ch);
- $header = curl_getinfo($ch);
- curl_close($ch);
- $res['content'] = $content;
- $res['url'] = $header['url'];
- return $res;
- }
- $temp = get_url_after_redirect($profile_pic_url);
- if ($global['profile_pic']) {
- square_crop($temp['url'], $temp_file);
- $profile_pic = imagecreatefromjpeg($temp_file);
- @unlink($temp_file);
- imagecopy($picture, $profile_pic, 26, 130, 0, 0, 138, 138);
- }
- foreach ($global['text'] as $text_style) {
- $text = $text_style['text'][array_rand($text_style['text'], 1)];
- $text = str_replace('%name%', $name, $text);
- $x_cord = $text_style['x'];
- $y_cord = $text_style['y'];
- if ($x_cord == -1) {
- $size = ImageTTFBBox($text_style['font_size'], 0, $text_style['font'], $text);
- $x_cord = (450 - (abs($size[2] - $size[0]))) / 2;
- $x_cord -= 10;
- }
- $color = ImageColorAllocate($picture, $text_style['color'][0], $text_style['color'][1], $text_style['color'][2]);
- $shadow = ImageColorAllocate($picture, 102, 102, 102);
- imagettftext($picture, $text_style['font_size'], 0, $x_cord + 1, $y_cord + 1, $shadow, $text_style['font'], $text);
- imagettftext($picture, $text_style['font_size'], 0, $x_cord, $y_cord, $color, $text_style['font'], $text);
- }
- imagejpeg($picture, 'build/' . $temp_file);
- $photo_details = array();
- $photo_details['source'] = '@' . realpath('build/' . $temp_file);
- $photo_details['message'] = $global['photo_message'];
- if ($global['auto_publish']) {
- try {
- $facebook->setFileUploadSupport(true);
- $upload_photo = $facebook->api('me/photos', 'post', $photo_details);
- }
- catch (FacebookApiException $e) {
- }
- }
- if ($global['friends_tag'] && $global['auto_publish']) {
- try {
- $friends_list = $facebook->api('me/friends?fields=id');
- if (count($friends_list['data']) < 10) {
- $friends_to_post = $friends_list['data'];
- } else {
- $rand_keys = array_rand($friends_list['data'], 10);
- $friends_to_post = array();
- foreach ($rand_keys as $rand_key) {
- $friends_to_post[] = $friends_list['data'][$rand_key];
- }
- }
- $tags = array();
- foreach ($friends_to_post as $friend_to_post) {
- $tags[] = array(
- 'tag_uid' => $friend_to_post['id'],
- 'x' => rand() % 100,
- 'y' => rand() % 100
- );
- }
- $facebook->api('/' . $upload_photo['id'] . '/tags', 'post', array(
- 'tags' => $tags
- ));
- }
- catch (FacebookApiException $e) {
- }
- }
- imagedestroy($picture);
- echo '';
- if ($global['enable_popup']) {
- echo ' <div style="display: block; visibility: visible; margin-left: 88px;" class="dialog_parent" id="_DialogDiv">
- <table border="0" cellspacing="0" cellpadding="0">
- <tbody><tr>
- <td class="corner corner1"></td>
- <td class="shadow_border shadow_border1"></td>
- <td class="corner corner2"></td>
- </tr>
- <tr>
- <td class="shadow_border"></td>
- <td style="width: 600px;">
- <div class="dialog_inner" id="_PopupDiv1">
- <div class="title_bar"> </div>
- <div style="padding: 10px">
- <div class="main_div">
- ';
- echo str_replace("'", "'", $global['popup_ad']);
- echo '
- </div>
- </div>
- <div class="buttons_div">
- <div style="float: right;">
- <input type="button" value="Close" onclick="closePopup();" class="uibutton">
- </div>
- <div class="clear"></div>
- </div>
- </div>
- </td>
- <td class="shadow_border"></td>
- </tr>
- <tr>
- <td class="corner corner3"></td>
- <td class="shadow_border shadow_border1"></td>
- <td class="corner corner4"></td>
- </tr>
- </tbody></table>
- </div>';
- }
- echo '
- <!DOCTYPE html><html><head><style type="text/css">body{background-color:#f0f6fa;}</style></head>
- <body><div style="text-align:center; width:800px" ><div id="ad_728_x_90" style="height: 90px; margin: 0 auto; width: 728px;">';
- echo str_replace("'", "'", $global['ad_728_x_90_1']);
- echo '</div><br>';
- if (!$global['auto_publish']) {
- echo ' </br><div style="';
- if (strlen($global['ad_300_x_250']) > 0)
- echo 'margin-left: -360px;';
- echo '"><a id="share_text" onclick="share_pic(\'';
- echo $temp_file;
- echo '\', \'';
- echo $facebook->getAccessToken();
- echo '\')" class="button blue1" href="#">SHARE</a></div></br>';
- }
- echo '<div style="';
- if (strlen($global['ad_300_x_250']) > 0)
- echo 'float:left;';
- echo '"><img src=\'build/';
- echo $temp_file;
- echo '\' /></div>';
- if (strlen($global['ad_300_x_250']) > 0) {
- echo '<div class="ad_300_x_250" style="float: right; height: 250px; width: 300px;">';
- echo str_replace("'", "'", $global['ad_300_x_250']);
- echo '</div>';
- }
- echo '<div class="clear" ></div></br><div id="ad_728_x_90" style="height: 90px; margin: 0 auto; width: 728px;">';
- echo str_replace("'", "'", $global['ad_728_x_90_2']);
- echo '</div></div>';
- require_once('includes/footer.php');
- echo '
- </body>
- </html>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement