我正在使用托管在我的服务器上的脚本来创建一些Facebook粉丝的帖子。我是应用程序的管理员,但不是创建者。创建脚本的人不再支持脚本......
编辑:通过停止工作我的意思是 - 脚本后端上传的过程一如既往地运行,但是在Facebook中没有生成已经过时的帖子。没有...通常所有图像都应该在粉丝专页的计划帖子部分中列出。我找不到错误。该应用也未被阻止。
当前的应用(facebook 2.0 API)使用了manage_pages和publish_pages的提交。当我访问应用程序并尝试上传图像时,应用程序的fb输入对话框显示在消息:
之后提交登录审核 以下某些权限尚未获得Facebook批准使用。
我提交了针对该应用的评论,并针对每次提交获得以下答案:
代表“publish_pages”& “manage_pages”:
您的应用需要获得当前功能的许可。您可能需要申请其他授权,或者您可以将public_profile用于其使用,您需要单独的授权。
您的评论员的注释:
您管理的应用不需要任何扩展权限。应用管理员以及在“应用设置”页面中列为“角色”的任何帐户都可以访问所有权限,而无需提交审核。如果您的应用的用户/客户正在使用权限来增强他们在应用中的体验,则您只需要提交以供审核
我已经尝试了十几个教程,即publish_action提交等等 - 没有运气或没有足够的知识。也许是第二个:)
这是脚本的index.php :(非常感谢任何帮助!)
<?php
define('PATH', dirname(__file__));
session_start();
if(!isset($_SESSION['logged']) || $_SESSION['logged']!=true){
header("Location: login.php");
exit(0);
}
require_once(PATH . '/lang.php');
require_once(PATH . '/config.php');
require_once(PATH . '/createDatabase.php');
if(isset($_GET['id']) && is_numeric($_GET['id'])){
$db->delete("pages", "ID", $_GET['id']);
echo '<script type="text/javascript">
<!--
window.location = "index.php"
//-->
</script>';
exit(0);
}
require_once(PATH . '/header.php');
if (isset($_POST['rss'])) {
if(strlen($_POST['rss'])>5){
$db->insert("rss",array('url' => strip_tags($_POST['rss'])));
}
}
if(!function_exists('curl_init')){
echo '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorcurl'] . '
</div>';
exit(0);
}
if(!isset($idApp) || $idApp == ""){
echo '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorappid'] . '
</div>';
exit(0);
}
if(!isset($appSecret) || $appSecret == ""){
echo '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorappsecret'] . '
</div>';
exit(0);
}
if(!isset($canvasUrl) || $canvasUrl == ""){
echo '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorcanvas'] . '
</div>';
exit(0);
}
if(!isset($folder) || $folder == ""){
echo '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorfolder'] . '
</div>';
exit(0);
}
if(isset($_FILES["zip_file"]["name"])) {
$filename = $_FILES["zip_file"]["name"];
$source = $_FILES["zip_file"]["tmp_name"];
$type = $_FILES["zip_file"]["type"];
$name = explode(".", $filename);
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
foreach($accepted_types as $mime_type) {
if($mime_type == $type) {
$okay = true;
break;
}
}
$continue = strtolower($name[1]) == 'zip' ? true : false;
if(!$continue) {
$message = '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorzip'] . '
</div>';
}
$target_path = PATH . "/" . $folder . "/" .$filename; // change this to the correct site path
if(move_uploaded_file($source, $target_path)) {
$zip = new ZipArchive();
$x = $zip->open($target_path);
if ($x === true) {
$zip->extractTo(PATH . "/" . $folder . "/"); // change this to the correct site path
$zip->close();
unlink($target_path);
}
$message = '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['successzip'] . '
</div>';
} else {
$message = '<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
' . $l['errorupload'] . '
</div>';
}
}
if(isset($_POST['deleteFolder'])){
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
if(is_dir(PATH . '/' . $_POST['deleteFolder'])){
rrmdir(PATH . '/' . $_POST['deleteFolder']);
}
}
?>
<div class="container-fluid">
<div class="row-fluid">
<hr>
<div id="tab" class="nav nav-pills pull-right" data-toggle="buttons-radio">
<a href="index.php#price2" onclick="window.location='index.php'" class="btn btn-large btn-info active" data-toggle="tab"><?php echo $l['config'];?></a>
<a href="#features2" class="btn btn-large btn-info" data-toggle="tab"><?php echo $l['pages'];?></a>
<a href="#requests2" class="btn btn-large btn-info" data-toggle="tab"><?php echo $l['posts'];?></a>
<a href="#folders" class="btn btn-large btn-info" data-toggle="tab"><?php echo $l['folders'];?></a>
<a href="#live" class="btn btn-large btn-info" data-toggle="tab"><?php echo $l['liveposts'];?></a>
<a href="logout.php" class="btn btn-large btn-info" onclick="window.location='logout.php'" data-toggle="tab"><?php echo $l['logout'];?></a>
</div>
<br clear="all" />
<div class="tab-content">
<div class="tab-pane active" id="prices2">
<br>
<div class="alert alert-info"><?php echo $l['configinfo'];?></div>
<p class="lead"><?php echo $l['config'];?></p>
<!--Body content-->
<legend><?php echo $l['configproblems'];?></legend>
<?php
if (count($db->selectAll("config"))>0) {
echo '<button class="btn btn-success">' . $l['youhavetoken'] . '</button>';
echo '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $idApp. '&scope=manage_pages,publish_pages&response_type=token&redirect_uri=' . $canvasUrl . '"><button class="btn btn-info">' . $l['renewtoken'] . '</button></a>';
} else {
echo '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $idApp. '&scope=manage_pages,publish_pages&response_type=token&redirect_uri=' . $canvasUrl . '"><button class="btn btn-info">' . $l['gettoken'] . '</button></a>';
}
?>
</div>
<div class="tab-pane" id="features2">
<br>
<div class="alert alert-info">
<?php echo $l['pagesinfo'];?>
</div>
<p class="lead"><?php echo $l['pages'];?></p>
<form class="form-horizontal" method="POST">
<fieldset>
<!-- Form Name -->
<legend><?php echo $l['addpages'];?></legend>
<!-- Text input-->
<div class="control-group">
<label class="control-label" for="page"><?php echo $l['pageurl'];?></label>
<div class="controls">
<input id="page" name="page" type="text" placeholder="https://www.facebook.com/your-page-url" class="input-xlarge" required="">
<p class="help-block"><?php echo $l['pageurl'];?></p>
</div>
</div>
<!-- Button -->
<div class="control-group">
<label class="control-label" for="add"></label>
<div class="controls">
<button id="add" name="add" class="btn btn-success"><?php echo $l['add'];?></button>
</div>
</div>
</fieldset>
</form>
<?php
if (isset($_POST['page'])) {
$resultToken = $db->selectAll("config");
if(isset($resultToken[0]['token']))
$token = $resultToken[0]['token'];
function getSslPage($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$info = json_decode(getSslPage('https://graph.facebook.com/' . $_POST['page'] . '?access_token=' . $token));
if(isset( $info->name)){
$album = json_decode(getSslPage('https://graph.facebook.com/' . $info->id . '/albums?fields=id&access_token=' . $token));
$fotoAlbum = "";
foreach ($album->data as $key => $value) {
if($fotoAlbum=="" || @$album->data[$key]->name == "Timeline Photos"){
$fotoAlbum = @$album->data[$key]->id;
}
}
$db->insert("pages",array('ID' => $info->id , 'url' => $info->name, 'idalbum' => $fotoAlbum));
unset($_POST);
}
}
$result = $db->selectAll("pages");
if(!empty($result)){
echo '<table class="table table-striped" id="example">
<thead>
<tr>
<td>' . $l['name'] . '</td>
<td>' . $l['id'] . '</td>
<td>' . $l['open'] . '</td>
<td>' . $l['delete'] . '</td>
</tr>
</thead>
<tbody>';
foreach ($result as $value){
echo '<tr><td>' , $value['url'] , '</td><td>' , $value['ID'] , '</td><td><a target="_blank" href="https://www.facebook.com/' , $value['ID'] , '">' . $l['open'] . '</a></td><td><a href="?id=' , $value['ID'] , '">' . $l['delete'] . '</a></td></tr>';
}
echo '</tbody></table>';
}
?>
</div>
<div class="tab-pane" id="folders">
<br>
<div class="alert alert-info"><?php echo $l['foldersinfo'];?></div>
<p class="lead"><?php echo $l['folders'];?></p>
<legend><?php echo $l['uploadzipfolders'];?></legend>
<?php if(isset($message)) echo "<p>$message</p>"; ?>
<form enctype="multipart/form-data" method="post" action="">
<label><?php echo $l['choosezip'];?>: <input type="file" name="zip_file" /></label>
<br />
<input type="submit" name="submit" value="<?php echo $l['upload'];?>" />
</form>
<legend><?php echo $l['deletefolder'];?></legend>
<form method="post" action="">
<select id="deleteFolder" name="deleteFolder" class="input-xlarge" required>
<?php
$folders = glob(PATH . '/' . $folder . "/*", GLOB_ONLYDIR );
foreach ($folders as $subfolder){
$subfolder = explode('/', $subfolder);
echo '<option value="' , $folder , '/', $subfolder[count($subfolder)-1] , '">' , $folder , '/', $subfolder[count($subfolder)-1] , '/' , '</option>';
}
?>
</select><br />
<input type="submit" name="submit" value="<?php echo $l['deletefolder'];?>" />
</form>
<legend><?php echo $l['uploadimagestofolder'];?></legend>
<select id="puthere" name="puthere" class="input-xlarge" required>
<?php
echo '<option value="' , $folder , '">' , $folder , ' (root) </option>';
$folders = glob(PATH . '/' . $folder . "/*", GLOB_ONLYDIR );
foreach ($folders as $subfolder){
$subfolder = explode('/', $subfolder);
echo '<option value="' , $folder , '/', $subfolder[count($subfolder)-1] , '">' , $folder , '/', $subfolder[count($subfolder)-1] , '/' , '</option>';
}
?>
</select>
<div id="file-uploader-demo1">
<noscript>
<p><?php echo $l['enablejavascript'];?></p>
<!-- or put a simple form for upload here -->
</noscript>
</div>
<div class="qq-upload-extra-drop-area"><?php echo $l['dropfiles'];?></div>
</div>
<div class="tab-pane" id="live">
<div class="alert alert-info"><?php echo $l['rssinfo'];?></div>
<form class="form-horizontal" method="POST">
<fieldset>
<!-- Form Name -->
<legend><?php echo $l['addyourrss'];?></legend>
<!-- Text input-->
<div class="control-group">
<label class="control-label" for="page"><?php echo $l['rssurl'];?></label>
<div class="controls">
<input id="rss" name="rss" type="text" placeholder="https://www.something.com/rss" class="input-xlarge" required="">
<p class="help-block"><?php echo $l['rssurl'];?></p>
</div>
</div>
<!-- Button -->
<div class="control-group">
<label class="control-label" for="add"></label>
<div class="controls">
<button id="add" name="add" class="btn btn-success"><?php echo $l['add'];?></button>
</div>
</div>
</fieldset>
</form>
<legend><?php echo $l['startpostlive'];?></legend>
<?php echo $l['startpostlive'];?>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['pickyourrss'];?></label>
<div class="controls">
<select id="urlRss" name="urlRss" class="input-xlarge" multiple required>
<?php
$result = $db->selectAll("rss");
if(!empty($result)){
foreach ($result as $value){
echo '<option value="' , $value['url'] , '">' , $value['url'] , '</option>';
}
}
?>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['pages'];?></label>
<div class="controls">
<select id="pageRss" name="pageRss" class="input-xlarge" multiple required>
<?php
$result = $db->selectAll("pages");
if(!empty($result)){
foreach ($result as $value){
echo '<option value="' , $value['ID'] , '">' , $value['url'] , '</option>';
}
}
?>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['timetocheck'];?></label>
<div class="controls">
<select id="timeRss" name="timeRss" class="input-xlarge" required>
<option value="5">5 <?php echo $l['minutes'];?></option>
<option value="10">10 <?php echo $l['minutes'];?></option>
<option value="15">15 <?php echo $l['minutes'];?></option>
<option value="20">20 <?php echo $l['minutes'];?></option>
<option value="30">30 <?php echo $l['minutes'];?></option>
<option value="45">45 <?php echo $l['minutes'];?></option>
<option value="60">60 <?php echo $l['minutes'];?></option>
</select>
</div>
</div>
<button id="startRss" name="startRss" class="btn btn-success"><?php echo $l['startposting'];?></button>
<button id="stopRss" name="stopRss" class="btn btn-info" style="display:none" onClick="window.location.reload()"><?php echo $l['stopposting'];?></button>
<div id="postsDone"></div>
</div>
<div class="tab-pane" id="requests2">
<br>
<p class="lead"><?php echo $l['posts'];?></p>
<form class="form-horizontal" onsubmit="return false;" id="formPosts">
<fieldset>
<div class="alert alert-info"><?php echo $l['postsinfo'];?></div>
<!-- Form Name -->
<legend><?php echo $l['generateposts'];?></legend>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['folder'];?></label>
<div class="controls">
<select id="subfolder" name="subfolder" class="input-xlarge" required>
<?php
echo '<option value="' , $folder , '">' , $folder , ' (root) </option>';
$folders = glob(PATH . '/' . $folder . "/*", GLOB_ONLYDIR );
foreach ($folders as $subfolder){
$subfolder = explode('/', $subfolder);
echo '<option value="' , $folder , '/', $subfolder[count($subfolder)-1] , '">' , $folder , '/', $subfolder[count($subfolder)-1] , '/' , '</option>';
}
?>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['pages'];?></label>
<div class="controls">
<select id="page" name="page[]" class="input-xlarge" multiple required>
<?php
$result = $db->selectAll("pages");
if(!empty($result)){
foreach ($result as $value){
echo '<option value="' , $value['ID'] , '">' , $value['url'] , '</option>';
}
}
?>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['usefilename'];?></label>
<div class="controls">
<select id="useimagename" name="useimagename" class="input-xlarge" required>
<?php
echo '<option value="0">' , $l['no'] , '</option>';
echo '<option value="1">' , $l['yes'] , '</option>';
?>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="control-group">
<label class="control-label"><?php echo $l['deletefiles'];?></label>
<div class="controls">
<select id="deletefiles" name="deletefiles" class="input-xlarge" required>
<?php
echo '<option value="0">' , $l['no'] , '</option>';
echo '<option value="1">' , $l['yes'] , '</option>';
?>
</select>
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="control-group">
<label class="control-label"><?php echo $l['numberofposts'];?></label>
<div class="controls">
<label class="radio inline">
<input type="radio" name="numposts" value="10" checked="checked">
10
</label>
<label class="radio inline">
<input type="radio" name="numposts" value="25">
25
</label>
<label class="radio inline">
<input type="radio" name="numposts" value="50">
50
</label>
<label class="radio inline">
<input type="radio" name="numposts" value="100">
100
</label>
<label class="radio inline">
<input type="radio" name="numposts" value="250">
250
</label>
<label class="radio inline">
<input type="radio" name="numposts" value="500">
500
</label>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php echo $l['timefirstpost'];?></label>
<div class="controls">
<div id="datetimepicker1" class="input-append date">
<input data-format="dd/MM/yyyy hh:mm:ss" type="text" id="dataehora" name="dataehora" required></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar">
</i>
</span>
</div>
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="control-group">
<label class="control-label"><?php echo $l['timebettweenpost'];?></label>
<div class="controls">
<label class="radio inline">
<input type="radio" name="time" value="2m">
2 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="3m">
3 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="5m" checked="checked">
5 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="10m">
10 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="15m">
15 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="20m">
20 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="30m">
30 <?php echo $l['minutes'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="1h">
1 <?php echo $l['hours'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="2h">
2 <?php echo $l['hours'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="3h">
3 <?php echo $l['hours'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="4h">
4 <?php echo $l['hours'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="5h">
5 <?php echo $l['hours'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="6h">
6 <?php echo $l['hours'];?>
</label>
<label class="radio inline">
<input type="radio" name="time" value="12h">
12 <?php echo $l['hours'];?>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php echo $l['maxpostsperday'];?></label>
<div class="controls">
<div>
<input type="text" id="postsperday" name="postsperday"></input>
</div>
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="control-group">
<label class="control-label"><?php echo $l['from'];?></label>
<div class="controls">
<label class="radio inline">
<input type="radio" name="from" value="folder" checked="checked">
<?php echo $l['randomimages'];?>
</label>
<label class="radio inline">
<input type="radio" name="from" value="file">
<?php echo $l['file'];?>
</label>
</div>
</div>
<!-- Button -->
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<button id="generatePosts" name="singlebutton" class="btn btn-success"><?php echo $l['generate'];?></button>
</div>
</div>
</fieldset>
</form>
<div class="progress progress-striped active" style="display:none">
<div class="bar" style="width: 0%;"></div>
</div>
<div id="defaultText" style="display:none">
<input type="text" val="" class="text" />
<select class="input-xlarge" required>
<?php
echo '<option value="0">' , $l['begginingempty'] , '</option>';
echo '<option value="1">' , $l['endempty'] , '</option>';
echo '<option value="2">' , $l['begginingall'] , '</option>';
echo '<option value="3">' , $l['endall'] , '</option>';
?>
</select>
<button name="singlebutton" class="btn btn-success addDescription"><?php echo $l['add']; ?></button>
</div>
<ul class="thumbnails" id="listaposts">
</ul>
<br clear="all" />
<div class="alert alert-success sucessoPost" style="display:none">
<button type="button" class="close" data-dismiss="alert">×</button>
<?php echo $l['successposts'];?>
</div>
<div class="options" style="display:none">
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<?php echo $l['dontclose'];?>
</div>
<hr>
<button id="postall" name="singlebutton" class="btn btn-success"><?php echo $l['postall'];?></button>
<a onClick="window.location.reload()" name="singlebutton" class="btn btn-error"><?php echo $l['deleteall'];?></a>
</div>
</div>
</div>
</div>
</div>
<?php
require_once(PATH . '/footer.php');
?>