コード例 #1
0
ファイル: index.php プロジェクト: RichieDupes/PeoplePods
function check_for_users_and_content()
{
    $POD = new PeoplePod();
    $extra_people = $POD->getPeople(array('testcase' => 'testuser'));
    $extra_content = $POD->getContents(array('testcase' => 'testcontent'));
    while ($next = $extra_content->getNext()) {
        $next->delete(true);
    }
    while ($next_person = $extra_people->getNext()) {
        $POD->changeActor(array('id' => $next_person->id));
        $next_person->delete();
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: RichieDupes/PeoplePods
  	$totalMembers = $POD->getPeople(array('memberSince:lte'=>$today));  
	$membersToday = $POD->getPeople(array('lastVisit:gt'=>$today),'lastVisit desc',10);
	$membersJoined = $POD->getPeople(array('memberSince:gt'=>$today));
	$docsCreated = $POD->getContents(array('date:gt'=>$today));
	$newComments = $POD->getComments(array('date:gt'=>$today),'date desc',5);
	$total = $membersJoined->totalCount()  + $totalMembers->totalCount();
*/
$this_database_update = 0.9;
$last_version = $POD->libOptions('last_database_update');
if (!$last_version) {
    $last_version = 0;
}
// load each type of thing
// get total, total for today, total for the last week
// members, content, comments, files, groups
$members = $POD->getPeople(array('memberSince:gte' => date('Y-m-d') . ' 00:00:00'));
$stats['members_today'] = $members->totalCount();
$members = $POD->getPeople(array('memberSince:gte' => date('Y-m-d', strtotime('-7 days'))));
$stats['members_week'] = $members->totalCount();
$members = $POD->getPeople(array(), 'memberSince DESC', 10);
$stats['members_total'] = $members->totalCount();
$visitors = $POD->getPeople(array('lastVisit:gte' => date('Y-m-d') . ' 00:00:00'));
$stats['visits_today'] = $visitors->totalCount();
$visitors = $POD->getPeople(array('lastVisit:gte' => date('Y-m-d', strtotime('-7 days'))));
$stats['visits_week'] = $visitors->totalCount();
$visitors = $POD->getPeople(array('lastVisit:gte' => date('Y-m-d', strtotime('-30 days'))), 'lastVisit DESC', 10);
$stats['visits_total'] = $visitors->totalCount();
$content = $POD->getContents(array('date:gte' => date('Y-m-d') . ' 00:00:00'));
$stats['content_today'] = $content->totalCount();
$content = $POD->getContents(array('date:gte' => date('Y-m-d', strtotime('-7 days'))));
$stats['content_week'] = $content->totalCount();
コード例 #3
0
ファイル: search.php プロジェクト: RichieDupes/PeoplePods
    $result_mode = $_GET['result_mode'];
}
$mode = '';
$q = '';
if (isset($_GET['q'])) {
    $q = $_GET['q'];
}
if (isset($_GET['mode'])) {
    $mode = $_GET['mode'];
}
$offset = 0;
if (isset($_GET['offset'])) {
    $offset = $_GET['offset'];
}
if ($q) {
    $users = $POD->getPeople(array('nick:like' => "%{$q}%"));
    if ($users->count() == 1 && $result_mode == "fullscreen") {
        print header("Location: index.php?id=" . $users->getNext()->get('id'));
    } else {
        if ($users->count() == 0) {
            $message = "No user found";
        } else {
            $message = $users->count() . " members found";
        }
    }
    $mode = "search";
} else {
    if ($mode == "" || $mode == "last") {
        $users = $POD->getPeople(array('1' => 1), 'lastVisit DESC', 24, $offset);
        $title = "Recent Visitors";
        $mode = "last";
コード例 #4
0
ファイル: index.php プロジェクト: RichieDupes/PeoplePods
     $request_token_info = $oauth->getRequestToken('https://twitter.com/oauth/request_token');
     $_SESSION['twitter_token'] = $request_token_info['oauth_token'];
     $_SESSION['twitter_secret'] = $request_token_info['oauth_token_secret'];
     $_SESSION['twitter_state'] = 1;
     header('Location: https://twitter.com/oauth/authorize?oauth_token=' . $_SESSION['twitter_token']);
     exit;
 } else {
     if ($_SESSION['twitter_state'] == 1) {
         // State 1 - Handle callback from Twitter and get and store an access token
         $oauth->setToken($_GET['oauth_token'], $_SESSION['twitter_secret']);
         $access_token_info = $oauth->getAccessToken('https://twitter.com/oauth/access_token');
         $oauth->setToken($access_token_info['oauth_token'], $access_token_info['oauth_token_secret']);
         $oauth->fetch('https://twitter.com/account/verify_credentials.json');
         $json = json_decode($oauth->getLastResponse());
         if ($POD->isAuthenticated()) {
             $test = $POD->getPeople(array('twitter_token' => $access_token_info['oauth_token']));
             if ($test->count() == 0) {
                 $POD->currentUser()->addMeta('twitter_token', $access_token_info['oauth_token']);
                 $POD->currentUser()->addMeta('twitter_secret', $access_token_info['oauth_token_secret']);
                 $POD->currentUser()->addMeta('twitter_name', (string) $json->screen_name);
                 $POD->currentUser()->addMeta('twitter_id', (string) $json->id);
                 $POD->addMessage("You have successfully connected your Twitter account.");
             } else {
                 $POD->addMessage("Another account is already connected to the Twitter account you chose.");
             }
         } else {
             // is there a person with this twitter info already in the db?  if so, log her in!
             $user = $POD->getPeople(array('twitter_token' => $access_token_info['oauth_token']));
             if ($user->count() == 1) {
                 $user = $user->getNext();
                 // if so, and the user is logged out, log him in!
コード例 #5
0
ファイル: search.php プロジェクト: RichieDupes/PeoplePods
$POD = new PeoplePod(array('debug' => 0, 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_search')) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
if (isset($_GET['offset'])) {
    $offset = $_GET['offset'];
} else {
    $offset = 0;
}
$POD->tolog("DOING SEARCH");
if ($keyword = @$_GET['q']) {
    $docs = $POD->getContents(array('or' => array('headline:like' => "%{$keyword}%", 'body:like' => "%{$keyword}%")), null, 20, $offset);
} else {
    if ($keyword = @$_GET['p']) {
        $people = $POD->getPeople(array('or' => array('nick:like' => "%{$keyword}%", 'email:like' => "%{$keyword}%")), null, 20, $offset);
    }
}
$POD->tolog("DONE");
$POD->header('Search results for "' . $keyword . '"', '/feeds/search/' . $keyword);
?>
	<div class="column_8">


				<form method="get" action="<?php 
$POD->siteRoot();
?>
/search">
				<p>
					<label for="q">Search:</label>
					<input name="q" id="q" value="<?php 
コード例 #6
0
ファイル: index.php プロジェクト: RichieDupes/PeoplePods
                $options['flag.itemId'] = $user->get('id');
                $description = "People who flagged {$user->get('nick')} with the '" . $_GET['flag'] . "' flag";
            } else {
                $options['flag.itemId'] = $content->get('id');
                $description = "People who have flagged this content with the '" . $_GET['flag'] . "' flag";
            }
        } else {
            $options['flag.userId'] = $user->get('id');
            if ($_GET['type'] == "user") {
                $description = "People that {$user->get('nick')} flagged with the '" . $_GET['flag'] . "' flag";
            } else {
                $description = "Content that {$user->get('nick')} flagged with the '" . $_GET['flag'] . "' flag";
            }
        }
        if ($_GET['type'] == "user") {
            $results = $POD->getPeople($options, 'flag.date desc', 20, $offset);
        } else {
            $results = $POD->getContents($options, 'flag.date desc', 20, $offset);
        }
    }
} else {
    if (isset($_GET['flag']) && isset($_GET['type'])) {
        $options = array();
        $options['flag.name'] = $_GET['flag'];
        $description = '';
        if ($_GET['type'] == "user") {
            $description = "People flagged with the '" . $_GET['flag'] . "' flag";
        } else {
            $description = "Content flagged with the '" . $_GET['flag'] . "' flag";
        }
        if ($_GET['type'] == "user") {
コード例 #7
0
ファイル: index.php プロジェクト: RichieDupes/PeoplePods
    echo '<div class="info">Configuration required!</div>';
    echo '<p>To enable Facebook login, please set the Facebook API key and secret via the PeoplePods command center.</p>';
    echo '<P>To obtain the necessary details from Facebook, <a href="http://www.facebook.com/developers/">register your app</a>.</p>';
    $POD->footer();
    exit;
}
$user = null;
if (isset($_GET['code'])) {
    $code = $_GET['code'];
    $oauth_token = file_get_contents("https://graph.facebook.com/oauth/access_token?client_id=" . $key . "&redirect_uri=" . $POD->siteRoot(false) . "/facebook&client_secret=" . urlencode($secret) . "&code=" . urlencode($code));
    list($junk, $oauth_token) = explode("=", $oauth_token);
    // if authenticated, add to user
    // if not, new user time!
    if ($POD->isAuthenticated() && !$POD->currentUser()->facebook_token) {
        $user = $POD->currentUser();
        $test = $POD->getPeople(array('facebook_token' => $oauth_token));
        if ($test->count() == 0) {
            $user->addMeta('facebook_token', $oauth_token);
            $json = $user->getFacebookInfo();
            $user->set('fbuid', $json->id);
            $POD->addMessage("You have successfully connected your Facebook account.");
        } else {
            $POD->addMessage("Another account is already connected to the Facebook account you chose.");
        }
    } else {
        // is there a person with this facebook info already in the db?  if so, log her in!
        $user = $POD->getPeople(array('facebook_token' => $oauth_token));
        if ($user->count() == 1) {
            $user = $user->getNext();
            // if so, and the user is logged out, log him in!
            $days = 15;