我收到有关我的 Facebook 应用程序的警报,上面写着“您的应用程序在人们拒绝权限请求后反复将他们重定向到登录对话框。请更新您的应用程序,使其符合我们的平台政策,以提供出色的用户体验。”
任何人都可以帮我修复它。这是代码
<?php
if (!empty($_GET['i'])) {
session_start();
$_SESSION['imguris'] = $_GET['i'];
}
require( '../../../../wp-load.php' );
$toptions = get_option('sample_theme_options');
if (!empty($toptions['fbappid']) && !empty($toptions['fbapisecret'])) {
$fbconfig['appid' ] = $toptions['fbappid'];
$fbconfig['secret'] = $toptions['fbapisecret'];
$fbconfig['baseurl'] = get_bloginfo('template_url')."/fb/index.php";
//print_r($fbconfig);
if (isset($_GET['request_ids'])){
}
$user = null; //facebook user uid
try{
include_once "facebook.php";
}
catch(Exception $o){
error_log($o);
}
$facebook = new t_Facebook(array(
'appId' => $fbconfig['appid'],
'secret' => $fbconfig['secret'],
'cookie' => true,
));
$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(array(
'scope' => 'publish_stream',
'redirect_uri' => $fbconfig['baseurl'])
);
function d($d){
echo '<pre>';
print_r($d);
echo '</pre>';
}
if (!$user) { ?>
<script type="text/javascript">
window.top.location.href="<?php echo $loginUrl; ?>";
</script>
<?php } ?>
<?php if ($user){
if (isset($_SESSION['imguris'])) {
$imguri = str_replace(get_option('home'), "", $_SESSION['imguris']);
$imguri = '../../../../'.$imguri;
$facebook->setFileUploadSupport(true);
$args = array('message' => $toptions['covtitle']);
$args['image'] = '@' . realpath($imguri);
try {
$data = $facebook->api('/'.$user.'/photos', 'post', $args);
//print_r($data);
} catch (t_FacebookApiException $e) {
//d($e);
}
if (isset($data['id'])) {
if (isset($toptions['instructionsurl'])) {
$redir = $toptions['instructionsurl'];
} else {
$redir = get_option('home');
}
echo "<script type='text/javascript'> window.top.location.href='".$redir."'; </script>";
}
}
}
} else {
if (isset($toptions['instructionsurl'])) {
$redir = $toptions['instructionsurl'];
} else {
$redir = get_option('home');
}
echo "<script type='text/javascript'> window.top.location.href='".$redir."'; </script>";
}
?>
谢谢