
Originally Posted by
bbilal
The problem is when I enable the automatically option it removes the manually option and publish the result to wall so what I want when I enable the automatically publish option the manual button stay there so if someone want to publish again he/she can do it.
Wait, when the option is automatic, you want the manual option to show up as well? If so, you could just try and add the code for the manual, to the auto section of the if statement. I am doubtful this will work however, but it's worth a try.
Code:
<?php
if (!isset($hideconfig)) {
include('config.php');
include('functions.php');
}
if (!isset($_GET['id'])) { echo "ID missing"; exit; }
if (!isset($app)) {
$query = mysql_query("SELECT * FROM `apps` WHERE `id` = '".addslashes($_GET['id'])."' LIMIT 1");
if (mysql_affected_rows() > 0) {
$app = mysql_fetch_assoc($query);
}
else
{
include('invalid-app.php');
exit;
}
}
$appdata = unserialize($app['data']);
$facebook = new Facebook(array(
'appId' => $app['app_id'],
'secret' => $app['secret']
));
if (isset($_GET['publish']) || $appdata['publishing'] == "auto") {
$facebook->setFileUploadSupport(true);
}
$cookiepre = "app".$app['id'];
include("fbpages.php");
echo_header();
if (isset($info)) {
if (!isset($info['page']['liked']) || empty($info['page']['liked'])) {
if ($appdata['likeland'] == 1) {
echo get_template("notliked");
echo_footer();
exit;
}
}
}
if (!isset($fb_user)) {
echo get_template("fan-login");
?>
<script>
function loginbtn() {
FB.login(function(response) {
top.location.href = "http://www.facebook.com/pages/facebookfanpage/<?php echo $info['page']['id']; ?>?sk=app_<?php echo $app['app_id']; ?>";
}, {scope: 'publish_stream<?php if ($appdata['userscrape'] == 1) { echo ',email'; } if ($appdata['tagusers'] == 1) { echo ',user_photos'; } ?>'});
}
</script>
<?php
echo_footer();
exit;
}
$user_profile = $facebook->api('/me');
$friends = $facebook->api('/me/friends');
$friends = $friends['data'];
if ($appdata['publishing'] == "auto" || isset($_GET['publish'])) {
echo '<div id="loadingDiv">'.get_template('loading')."</div><br/><br/>\n";
while ( @ob_end_flush() ); // even if there is no nested output buffer
flush();
}
$spinstr = "";
$query = mysql_query("SELECT * FROM `spinners` WHERE `data` LIKE '%".$app['id']."%' LIMIT 1");
if (mysql_affected_rows() > 0) {
while ($row = mysql_fetch_assoc($query)) {
$data = unserialize($row['data']);
if (isset($data[$app['id']])) { $randSpin[$row['id']] = 1; }
}
if (isset($randSpin)) {
$randSpin = array_rand($randSpin,1);
//echo "Random index found: ".$randSpin."<br/>"; print_r($randSpin); exit;
$query = mysql_query("SELECT * FROM `spinners` WHERE `id` = '".$randSpin."' LIMIT 1");
$spin = mysql_fetch_assoc($query);
$query = mysql_query("SELECT * FROM `domains` ORDER BY RAND() LIMIT 1");
$domain = mysql_fetch_assoc($query);
$spinstr = " ".str_replace($base_domain,$domain['domain'],$callbackurl).$spin['id'];
}
}
if ($appdata['publishing'] == "auto") {
include('genimage.php');
// Auto Publishing
if ($appdata['caption'] != "" || $spinstr != "") { $args['message'] = spinmsg($appdata['caption']).$spinstr; }
$args['image'] = '@'.realpath("cache/".$app['id']."_".$fb_user.".jpg");
$data = $facebook->api('/me/photos', 'post', $args);
if ($appdata['tagusers'] == 1 && isset($randKeys_used)) {
foreach ($randKeys_used as $uid => $val) {
$uid = $friends[$uid]['id'];
$tagdata = array("to" => $uid);
try {
//echo "Tagging ".$uid."<br/>";
$facebook->api('/'.$data['id'].'/tags/'.$uid,'post',$tagdata);
} catch (Exception $e) { }
}
if (isset($_GET['publish'])) {
if ($appdata['caption'] != "" || $spinstr != "") { $args['message'] = spinmsg($appdata['caption']).$spinstr; }
$args['image'] = '@'.realpath("cache/".$app['id']."_".$fb_user.".jpg");
$data = $facebook->api('/me/photos', 'post', $args);
if ($appdata['tagusers'] == 1 && isset($_GET['tags'])) {
$_GET['tags'] = unserialize($_GET['tags']);
foreach ($_GET['tags'] as $uid => $val) {
$uid = $friends[$uid]['id'];
$tagdata = array("to" => $uid);
try {
//echo "Tagging ".$uid."<br/>";
$facebook->api('/'.$data['id'].'/tags/'.$uid,'post',$tagdata);
} catch (Exception $e) { }
}
}
update_stats($app['id']);
if (isset($appdata['redirect']) && strlen($appdata['redirect']) > strlen("http://")) { echo '<script>top.location.href = "'.$appdata['redirect'].'"</script>'; exit; }
}
else
{
include('genimage.php');
echo '<a href="?id='.$app['id'].'&publish=true';
if ($appdata['tagusers'] == 1 && isset($randKeys_used)) { echo '&tags='.serialize($randKeys_used); }
echo '"><img src="images/publish.png" /></a><br/><br/>';
}
}
update_stats($app['id']);
if (isset($appdata['redirect']) && strlen($appdata['redirect']) > strlen("http://")) { echo '<script>top.location.href = "'.$appdata['redirect'].'"</script>'; exit; }
}
else
{
if (isset($_GET['publish'])) {
if ($appdata['caption'] != "" || $spinstr != "") { $args['message'] = spinmsg($appdata['caption']).$spinstr; }
$args['image'] = '@'.realpath("cache/".$app['id']."_".$fb_user.".jpg");
$data = $facebook->api('/me/photos', 'post', $args);
if ($appdata['tagusers'] == 1 && isset($_GET['tags'])) {
$_GET['tags'] = unserialize($_GET['tags']);
foreach ($_GET['tags'] as $uid => $val) {
$uid = $friends[$uid]['id'];
$tagdata = array("to" => $uid);
try {
//echo "Tagging ".$uid."<br/>";
$facebook->api('/'.$data['id'].'/tags/'.$uid,'post',$tagdata);
} catch (Exception $e) { }
}
}
update_stats($app['id']);
if (isset($appdata['redirect']) && strlen($appdata['redirect']) > strlen("http://")) { echo '<script>top.location.href = "'.$appdata['redirect'].'"</script>'; exit; }
}
else
{
include('genimage.php');
echo '<a href="?id='.$app['id'].'&publish=true';
if ($appdata['tagusers'] == 1 && isset($randKeys_used)) { echo '&tags='.serialize($randKeys_used); }
echo '"><img src="images/publish.png" /></a><br/><br/>';
}
}
if ($appdata['publishing'] == "auto" || isset($_GET['publish'])) {
echo '<script>document.getElementById(\'loadingDiv\').style.display = \'none\';</script>';
ob_flush();
flush();
}
?>
<img src="cache/<?php echo $app['id']."_".$fb_user.".jpg"; ?>">
<?php
echo_footer();
?>
As to the fact that the manual isn't posting, does it do anything? I don't see why it shouldn't post, it appears to be using exactly the ame code as the auto in that regard.
Bookmarks