示例#1
0
文件: index.php 项目: anukat2015/smob
<?php

parse_str($_SERVER['QUERY_STRING']);
require_once dirname(__FILE__) . '/lib/smob/SMOB.php';
if (!SMOBTools::check_config()) {
    $installer = new SMOBInstaller();
    $installer->go();
} else {
    require_once dirname(__FILE__) . "/config/config.php";
    // Follower / followings
    if ($a && $a == 'add') {
        $u = str_replace('http:/', 'http://', $u);
        // Add a new follower
        if ($t == 'follower') {
            // @TODO: has it sense that the user add a follower?. Then the follower should also be notified to add the current user as following
            // When the request comes from another user adding a following, the action is ran as there authentication is not needed
            $remote_user = SMOBTools::remote_user($u);
            if (!$remote_user) {
                die;
            }
            $local_user = SMOBTools::user_uri();
            $follow = "<{$remote_user}> sioc:follows <{$local_user}> . ";
            $local = "INSERT INTO <" . SMOB_ROOT . "data/followers> { {$follow} }";
            error_log("DEBUG: Added follower {$remote_user} with the query {$local}", 0);
            SMOBStore::query($local);
        } elseif ($t == 'following') {
            if (!SMOBAuth::check()) {
                die;
            }
            $remote_user = SMOBTools::remote_user($u);
            if (!$remote_user) {