Esempio n. 1
0
    echo "</br>" . $sendid;
    echo "</br>" . $_GET['optin'];
    echo "</br>" . $_GET['optout'];
    echo "</br>" . $facebook->getUser() . "</br>";*/
    //echo $entry;
    $entry = $facebook->getUser() . ";" . $_GET['optin'] . ";" . $_GET['optout'] . ";" . $sendid . "\n";
    //Cookie for only one snapshot a week
    if ($_COOKIE["uid"] != $facebook->getUser()) {
        $surveylogfile = "/var/www/SocialSnapshot/survey.log";
        $fh = fopen($surveylogfile, 'a') or die("can't open surveyfile: contact mhuber@sba-research.org");
        fwrite($fh, $entry);
        fclose($fh);
        setcookie("uid", $facebook->getUser(), time() + 3600 * 24 * 7);
        exec("echo \"Hello " . $me['name'] . "!\nThank you for participating in our survey. Please allow up to 24 hours until your data is automatically fetched and you will receive a download link.\nBest, http://is.gd/snapshotsurvey\" | mail -s \"SocialSnapshot Survey\" " . $me['email']);
    }
    flushOutput();
    ?>

<?php 
} else {
    ?>
<h2>SocialSnapshot Survey</h2>
<h3>After adding the app, you will receive an Email with a link to download all your Facebook data.</h3>

<?php 
    if (isset($_GET['submit']) && isset($_GET['optin'])) {
        //Dirty JavaScript redirect
        echo "<script type=\"text/javascript\">";
        echo "window.location = \"{$loginUrl}\";";
        echo "</script>";
    }
Esempio n. 2
0
    $_getMaxLen = @ini_get('suhosin.get.max_value_length');
    $_postMaxLen = @ini_get('suhosin.post.max_value_length');
    $_reqMaxLen = @ini_get('suhosin.request.max_value_length');
    $_reqMaxVar = @ini_get('suhosin.request.max_varname_length');
    $_indPMV = $_postMaxVars < 4096 ? 2 : true;
    $_indRMV = $_reqMaxVars < 4096 ? 2 : true;
    $_indGML = $_getMaxLen < 2000 ? 2 : true;
    $_indPML = $_postMaxLen < 1000000 ? 2 : true;
    $_indRML = $_reqMaxLen < 1000000 ? 2 : true;
    $_indRMVL = $_reqMaxVar < 350 ? 2 : true;
    flushOutput("suhosin.post.max_vars (4096 or better recommended)...", $_indPMV, "Your value: {$_postMaxVars}. Can prevent some forms (especially in the ACP) from saving properly.");
    flushOutput("suhosin.request.max_vars (4096 or better recommended)...", $_indRMV, "Your value: {$_reqMaxVars}. Can prevent some forms (especially in the ACP) from saving properly.");
    flushOutput("suhosin.get.max_value_length (2000 or better recommended)...", $_indGML, "Your value: {$_postMaxLen}. Can prevent very long URLs from loading correctly.");
    flushOutput("suhosin.post.max_value_length (1000000 or better recommended)...", $_indPML, "Your value: {$_postMaxLen}. Can prevent very large posts or other form submissions from saving properly.");
    flushOutput("suhosin.request.max_value_length (1000000 or better recommended)...", $_indRML, "Your value: {$_reqMaxLen}. Can prevent very large posts or other form submissions from saving properly.");
    flushOutput("suhosin.request.max_varname_length (350 or better recommended)...", $_indRMVL, "Your value: {$_reqMaxVar}. Can prevent long friendly URLs from loading correctly.");
}
//-----------------------------------------
// Flush output function
//-----------------------------------------
function flushOutput($checking, $result, $errorText)
{
    print "<p>" . $checking;
    if ($result === 2) {
        print "<span class='warn'>WARNING</span><br /><span class='what-you-should-do'>{$errorText}</span>";
    } else {
        if (!$result) {
            print "<span class='fail'>FAIL</span><br /><span class='what-you-should-do'>{$errorText}</span>";
        } else {
            print "<span class='pass'>Pass</span>";
        }
Esempio n. 3
0
function readNode($facebook, $parent, $sendid)
{
    //echo "readNode()<br />";
    $connections = $parent->getConnections();
    echo "<pre>";
    while (Facebook::getQueue()->count() > 0) {
        $facebook->api_multi('GET', Connection::createEmptyArray(), array("Connection", "recursor"));
        $facebook->log(date("G:i:s D M j T Y") . " Returned into readNode(), " . Facebook::getQueue()->count() . " elements left, let's get back in there! Highest Level: " . Facebook::getQueue()->highestLevel());
        echo date("G:i:s D M j T Y") . " " . Facebook::getQueue()->count() . " elements left. Highest Level: " . Facebook::getQueue()->highestLevel() . "<br/>";
        if (Facebook::getQueue()->highestLevel() < 3 || Facebook::getQueue()->count() < 3) {
            $facebook->log("Finished. highestLevel: " . Facebook::getQueue()->highestLevel());
            $facebook->log("Finished " . date("G:i:s D M j T Y"));
            echo "</pre><h4>Finished " . date("G:i:s D M j T Y") . "</h4>";
            $remaining = print_r(Facebook::getQueue(), true);
            $facebook->log($remaining);
            break;
        }
        flushOutput();
    }
    // Compress the gathered socialsnapshot
    // Tar and compress the logfile and folder
    // Check if the token is valid (must not contain anything but alphanumeric plus _) and if the folder and logs for this run really exist
    if (0 != preg_match("/[^\\w]/", $sendid) || !file_exists("../tmp/folder" . $sendid) || !file_exists("../tmp/log" . $sendid)) {
        // Die otherwise
        die("Compression Failed: Could not find according socialsnapshot and log.");
    } else {
        exec("cd ../tmp && tar -hcjf ../tarballs/" . $sendid . ".tar.bz2 log" . $sendid . " folder" . $sendid . " > /dev/null");
        exec("touch ../tmp/" . $sendid . ".finished > /dev/null");
        exec("rm -r ../tmp/logsnapshot" . $sendid . " ../tmp/folder" . $sendid . " > /dev/null");
        exec("rm -r ../tmp/" . $facebook->getUnique() . " > /dev/null");
    }
    //If optional analyse script is available, run it
    $analysescript = "/opt/FBSnapshotLoader/scripts/analysesnapshot.sh";
    if (file_exists($analysescript)) {
        $installpath = realpath('../');
        $snapshotfile = realpath('../tarballs/' . $sendid . '.tar.bz2');
        $downloadurl = 'https://' . $_SERVER["HTTP_HOST"] . '/SocialSnapshot/downloads';
        $analysecommand = 'LANG=en_US.utf-8; ' . $analysescript . ' ' . $snapshotfile . ' ' . $downloadurl . ' ' . $installpath . ' > /dev/null 2>&1 &';
        //echo $analysecommand;
        exec($analysecommand);
    }
}