Example #1
0
function setupUser()
{
    include_once dirname(__FILE__) . '/../config/config.php';
    $foaf_uri = $_GET['foaf_uri'];
    $twitter_read = $_GET['twitter_read'] == 'on' ? 1 : 0;
    $twitter_post = $_GET['twitter_post'] == 'on' ? 1 : 0;
    $twitter_login = $_GET['twitter_login'];
    $twitter_pass = $_GET['twitter_pass'];
    $auth = $_GET['auth'];
    if ($foaf_uri) {
        if (!SMOBTools::checkFoaf($foaf_uri)) {
            print "<p>An error occurred with your FOAF URI. <b>Please ensure that it dereferences to an RDF file and that this file contains information about your URI.<b><br/>You will have to <a href='{$smob_root}'>restart the install process<a/></p>";
            unlink(dirname(__FILE__) . '/../config/config.php');
            die;
        }
    } else {
        if (!$foaf_uri) {
            $foaf_uri = SMOB_ROOT . 'me#id';
            $username = $_GET['username'];
            $depiction = $_GET['depiction'];
            $profile = "\nINSERT INTO <" . SMOB_ROOT . "/profile> {\t\t\t\n<{$foaf_uri}> a foaf:Person ; \n\tfoaf:name \"{$username}\" ;\n\tfoaf:depiction <{$depiction}> .\n}";
            SMOBStore::query($profile);
        }
    }
    $config = "\ndefine('FOAF_URI', '{$foaf_uri}');\n\ndefine('TWITTER_READ', '{$twitter_read}');\ndefine('TWITTER_POST', '{$twitter_post}');\n\ndefine('TWITTER_USER', '{$twitter_login}');\ndefine('TWITTER_PASS', '{$twitter_pass}');\n\ndefine('AUTH', '{$auth}');\n\t\t\n?>";
    $f = fopen(dirname(__FILE__) . '/../config/config.php', 'a');
    fwrite($f, $config);
    fclose($f);
    print "<p>Enjoy, you can now access your <a href='.'>SMOB Hub</a> !<br/>\n\tLog-in using the 'Authenticate' link and start writing microblog po.<br/>\n\tAlso, be sure to restrict access to the <code>config/</code> directory.</p>";
}