Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/facebook.../admin
File: authorization.php
<?php
[0] Fix | Delete
if( !defined('ABSPATH') ){ exit();}
[1] Fix | Delete
$app_id = get_option('xyz_fbap_application_id');
[2] Fix | Delete
$app_secret = get_option('xyz_fbap_application_secret');
[3] Fix | Delete
$redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
[4] Fix | Delete
// if(is_ssl()===false)
[5] Fix | Delete
// $redirecturl=preg_replace("/^http:/i", "https:", $redirecturl);
[6] Fix | Delete
$my_url=urlencode($redirecturl);
[7] Fix | Delete
if(isset($_POST) && isset($_POST['fb_auth'] ))
[8] Fix | Delete
{
[9] Fix | Delete
ob_clean();
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
if ( xyz_fbap_is_session_started() === FALSE ) session_start();
[13] Fix | Delete
[14] Fix | Delete
$code="";
[15] Fix | Delete
if(isset($_REQUEST['code']))
[16] Fix | Delete
$code = $_REQUEST["code"];
[17] Fix | Delete
[18] Fix | Delete
if(isset($_POST['fb_auth']))
[19] Fix | Delete
{
[20] Fix | Delete
if (! isset( $_REQUEST['_wpnonce'] )
[21] Fix | Delete
|| ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'xyz_fbap_fb_auth_nonce' )
[22] Fix | Delete
) {
[23] Fix | Delete
[24] Fix | Delete
wp_nonce_ays( 'xyz_fbap_fb_auth_nonce' );
[25] Fix | Delete
[26] Fix | Delete
exit();
[27] Fix | Delete
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
$xyz_fbap_session_state = md5(uniqid(rand(), TRUE));
[31] Fix | Delete
setcookie("xyz_fbap_session_state",$xyz_fbap_session_state,"0","/");
[32] Fix | Delete
[33] Fix | Delete
$dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
[34] Fix | Delete
. $app_id . "&redirect_uri=" . $my_url . "&state="
[35] Fix | Delete
. $xyz_fbap_session_state . "&scope=email,public_profile,pages_read_engagement,pages_manage_posts,pages_show_list,business_management";
[36] Fix | Delete
[37] Fix | Delete
header("Location: " . $dialog_url);
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
[41] Fix | Delete
if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_COOKIE['xyz_fbap_session_state'] === $_REQUEST['state'])) {
[42] Fix | Delete
[43] Fix | Delete
$token_url = "https://graph.facebook.com/".XYZ_FBAP_FB_API_VERSION."/oauth/access_token?"
[44] Fix | Delete
. "client_id=" . $app_id . "&redirect_uri=" . $my_url
[45] Fix | Delete
. "&client_secret=" . $app_secret . "&code=" . $code;
[46] Fix | Delete
[47] Fix | Delete
$params = null;$access_token="";
[48] Fix | Delete
$response = wp_remote_get($token_url,array('sslverify'=> (get_option('xyz_fbap_peer_verification')=='1') ? true : false));
[49] Fix | Delete
[50] Fix | Delete
if(is_array($response))
[51] Fix | Delete
{
[52] Fix | Delete
if(isset($response['body']))
[53] Fix | Delete
{
[54] Fix | Delete
$params= json_decode($response['body']);
[55] Fix | Delete
if(isset($params->access_token))
[56] Fix | Delete
$access_token = $params->access_token;
[57] Fix | Delete
// parse_str($response['body'], $params);
[58] Fix | Delete
// if(isset($params['access_token']))
[59] Fix | Delete
// $access_token = $params['access_token'];
[60] Fix | Delete
}
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
if($access_token!="")
[64] Fix | Delete
{
[65] Fix | Delete
[66] Fix | Delete
update_option('xyz_fbap_fb_token',$access_token);
[67] Fix | Delete
update_option('xyz_fbap_af',0);
[68] Fix | Delete
[69] Fix | Delete
$offset=0;$limit=100;$data=array();
[70] Fix | Delete
//$fbid=get_option('xyz_fbap_fb_id');
[71] Fix | Delete
do
[72] Fix | Delete
{
[73] Fix | Delete
$result1="";$pagearray1="";
[74] Fix | Delete
$pp=wp_remote_get("https://graph.facebook.com/".XYZ_FBAP_FB_API_VERSION."/me/accounts?access_token=$access_token&limit=$limit&offset=$offset",array('sslverify'=> (get_option('xyz_fbap_peer_verification')=='1') ? true : false));
[75] Fix | Delete
[76] Fix | Delete
if(is_array($pp))
[77] Fix | Delete
{
[78] Fix | Delete
$result1=$pp['body'];
[79] Fix | Delete
$pagearray1 = json_decode($result1);
[80] Fix | Delete
if(isset($pagearray1->data) && is_array($pagearray1->data))
[81] Fix | Delete
$data = array_merge($data, $pagearray1->data);
[82] Fix | Delete
}
[83] Fix | Delete
else
[84] Fix | Delete
break;
[85] Fix | Delete
$offset += $limit;
[86] Fix | Delete
// if(!is_array($pagearray1->paging))
[87] Fix | Delete
// break;
[88] Fix | Delete
// }while(array_key_exists("next", $pagearray1->paging));
[89] Fix | Delete
}while(isset($pagearray1->paging->next));
[90] Fix | Delete
$count=0;
[91] Fix | Delete
if (!empty($data))
[92] Fix | Delete
$count=count($data);
[93] Fix | Delete
$fbap_pages_ids1=get_option('xyz_fbap_pages_ids');
[94] Fix | Delete
$fbap_pages_ids0=array();$newpgs="";
[95] Fix | Delete
if($fbap_pages_ids1!="")
[96] Fix | Delete
$fbap_pages_ids0=explode(",",$fbap_pages_ids1);
[97] Fix | Delete
[98] Fix | Delete
$fbap_pages_ids=array();$profile_flg=0;
[99] Fix | Delete
if (!empty($fbap_pages_ids0)){
[100] Fix | Delete
for($i=0;$i<count($fbap_pages_ids0);$i++)
[101] Fix | Delete
{
[102] Fix | Delete
if($fbap_pages_ids0[$i]!="-1")
[103] Fix | Delete
$fbap_pages_ids[$i]=trim(substr($fbap_pages_ids0[$i],0,strpos($fbap_pages_ids0[$i],"-")));
[104] Fix | Delete
else{
[105] Fix | Delete
$fbap_pages_ids[$i]=$fbap_pages_ids0[$i];$profile_flg=1;
[106] Fix | Delete
}
[107] Fix | Delete
}}
[108] Fix | Delete
for($i=0;$i<$count;$i++)
[109] Fix | Delete
{
[110] Fix | Delete
if(in_array($data[$i]->id, $fbap_pages_ids))
[111] Fix | Delete
$newpgs.=$data[$i]->id."-".$data[$i]->access_token.",";
[112] Fix | Delete
}
[113] Fix | Delete
$newpgs=rtrim($newpgs,",");
[114] Fix | Delete
if($profile_flg==1)
[115] Fix | Delete
{
[116] Fix | Delete
if($newpgs!="")
[117] Fix | Delete
$newpgs=$newpgs.",-1";
[118] Fix | Delete
else
[119] Fix | Delete
$newpgs=-1;
[120] Fix | Delete
}
[121] Fix | Delete
update_option('xyz_fbap_pages_ids',$newpgs);
[122] Fix | Delete
[123] Fix | Delete
$url = 'https://graph.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/me?access_token='.$access_token;
[124] Fix | Delete
$contentget=wp_remote_get($url,array('sslverify'=> (get_option('xyz_fbap_peer_verification')=='1') ? true : false));$page_id='';
[125] Fix | Delete
if(is_array($contentget))
[126] Fix | Delete
{
[127] Fix | Delete
$result1=$contentget['body'];
[128] Fix | Delete
$pagearray = json_decode($result1);
[129] Fix | Delete
$page_id=$pagearray->id;
[130] Fix | Delete
}
[131] Fix | Delete
update_option('xyz_fbap_fb_numericid',$page_id);
[132] Fix | Delete
header("Location:".admin_url('admin.php?page=facebook-auto-publish-settings&auth=1'));
[133] Fix | Delete
}
[134] Fix | Delete
else
[135] Fix | Delete
{
[136] Fix | Delete
$xyz_fbap_af=get_option('xyz_fbap_af');
[137] Fix | Delete
[138] Fix | Delete
if($xyz_fbap_af==1){
[139] Fix | Delete
header("Location:".admin_url('admin.php?page=facebook-auto-publish-settings&msg=3'));
[140] Fix | Delete
exit();
[141] Fix | Delete
}
[142] Fix | Delete
}
[143] Fix | Delete
}
[144] Fix | Delete
else {
[145] Fix | Delete
//header("Location:".admin_url('admin.php?page=facebook-auto-publish-settings&msg=2'));
[146] Fix | Delete
//exit();
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
[150] Fix | Delete
?>
[151] Fix | Delete
[152] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function