0
我收到了我的Facebook應用程序提醒,其中說:「您的應用程序在拒絕權限請求後反覆將用戶重定向到登錄對話框,請更新您的應用程序以符合我們的平臺政策,用戶體驗。」登錄對話框循環警報對於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>";
}
?>
感謝