Ejemplo n.º 1
0
    } else {
        if (isset($_POST['id'])) {
            $doc = $POD->getContent(array('id' => $_POST['id']));
        }
    }
}
if (!$doc->success()) {
    header("Status: 404 Not Found");
    echo "404 Not Found";
    exit;
}
if (isset($_POST['comment'])) {
    // this is a request to post a comment
    $comment = $doc->addComment($_POST['comment']);
    if (!$comment || !$comment->success()) {
        $POD->addMessage("Couldn't add comment! " . $doc->error());
    } else {
        header("Location: " . $doc->get('permalink') . "#" . $comment->get('id'));
        exit;
    }
}
if (isset($_GET['vote'])) {
    // this is a request to vote
    if ($POD->isAuthenticated()) {
        if (!$POD->currentUser()->getVote($doc)) {
            $doc->vote($_GET['vote']);
        }
    }
}
$POD->header($doc->get('headline'));
$doc->output($output_template);
Ejemplo n.º 2
0
    header("Location: " . $POD->siteRoot(false));
    exit;
}
$max = 10;
$offset = 0;
if (isset($_GET['offset'])) {
    $offset = $_GET['offset'];
}
if ($_POST) {
    $group = $POD->getGroup();
    $group->set('groupname', $_POST['groupname']);
    $group->set('description', $_POST['description']);
    $group->set('type', $_POST['type']);
    $group->save();
    if (!$group->success()) {
        $POD->addMessage("Your group was not created! " . $group->error());
    } else {
        $POD->addMessage("Your new group, " . $group->permalink('groupname', true) . " is ready! ");
    }
}
if (isset($_GET['q'])) {
    $header = "Group Search";
    $groups = $POD->getGroups(array('or' => array('groupname:like' => '%' . $_GET['q'] . '%', 'description:like' => '%' . $_GET['q'] . '%')), 'g.date DESC', $max, $offset);
} else {
    if ($POD->isAuthenticated()) {
        $header = "My Groups";
        $groups = $POD->getGroups(array('mem.userId' => $POD->currentUser()->get('id')), 'mem.date DESC', $max, $offset);
        if ($groups->totalCount() == 0) {
            $header = "Newish Groups";
            $groups = $POD->getGroups(array('type' => 'public'), 'g.date DESC', $max, $offset);
        }
Ejemplo n.º 3
0
*
* Documentation for this pod can be found here:
* http://peoplepods.net/readme/messaging
/**********************************************/
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'login', 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_profiles')) {
    header("Location: " . $POD->libOptions('serverRoot'));
    exit;
}
if (@$_POST['account'] != '') {
    $POD->currentUser()->set('nick', $_POST['nick']);
    //$POD->currentUser()->set('email',$_POST['email']);
    $POD->currentUser()->save();
    if (!$POD->currentUser()->success()) {
        $POD->addMessage($POD->currentUser()->error());
    } else {
        $POD->addMessage("Your settings have been updated.");
        foreach ($_FILES as $filename => $file) {
            $POD->currentUser()->addFile($filename, $file);
            if (!$POD->currentUser()->success()) {
                $POD->addMessage('An error occured while attaching your file: ' . $POD->currentUser()->error());
            }
        }
        $POD->currentUser()->files()->fill();
        // now we'll add any meta fields that have been passed in.
        // we do this by looking for anything with a field name starting with meta_
        // so if you want to add a meta field called foo to your content
        // you'll pass in the value via meta_foo
        foreach ($_POST as $key => $value) {
            if (preg_match("/^meta_(.*)/", $key, $match)) {
Ejemplo n.º 4
0
        $POD = new PeoplePod(array('authSecret' => $NEWUSER->get('authSecret')));
        $redir = true;
        // now we'll add any meta fields that have been passed in.
        // we do this by looking for anything with a field name starting with meta_
        // so if you want to add a meta field called foo to your content
        // you'll pass in the value via meta_foo
        foreach ($_POST as $key => $value) {
            if (preg_match("/^meta_(.*)/", $key, $match)) {
                $key = $match[1];
                // add the field.
                // the third parameter is no_html, set it to true to strip html, or false to allow html
                $NEWUSER->addMeta($key, $value, true);
            }
        }
    } else {
        $POD->addMessage($NEWUSER->error());
    }
}
// create a temporary empty user to output the form
$p = $POD->getPerson();
$redirect = null;
if (@$_POST['redirect'] || @$_GET['redirect']) {
    $redirect = $_POST['redirect'] ? $_POST['redirect'] : $_GET['redirect'];
    $p->set('redirect', $redirect);
}
$invite_code = null;
if (@$_POST['code'] || @$_GET['code']) {
    $invite_code = $_POST['code'] ? $_POST['code'] : $_GET['code'];
    if ($invite_deets = $POD->isValidInvite($invite_code)) {
        $p->set('code', $invite_code, false);
        $p->set('invited_by', $POD->getPerson(array('id' => $invite_deets['userId'])), false);
Ejemplo n.º 5
0
if (!($key && $secret)) {
    $POD->header('Configuration Required');
    echo '<div class="info">Configuration required!</div>';
    echo '<p>To enable Twitter login, please set the Twitter API key and secret via the PeoplePods command center.</p>';
    echo '<P>To obtain the necessary details from Twitter, <a href="https://dev.twitter.com/apps">register your app</a>.</p>';
    $POD->footer();
    exit;
}
// we need to make sure sessions are on so we can store the twitter codes
session_start();
if (isset($_GET['remove'])) {
    $POD->currentUser()->addMeta('twitter_name', null);
    $POD->currentUser()->addMeta('twitter_secret', null);
    $POD->currentUser()->addMeta('twitter_token', null);
    $POD->currentUser()->addMeta('twitter_id', null);
    $POD->addMessage("Your Twitter account has been removed.");
}
$access_token_info = array();
if (@$_GET['mode'] == 'verify') {
    if ($_SESSION['twitter_state'] == 1 && !isset($_GET['oauth_token'])) {
        $_SESSION['twitter_state'] = 0;
    }
    try {
        $oauth = new OAuth($key, $secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
        $oauth->enableDebug();
        // This will generate debug output in your error_log
        if ($_SESSION['twitter_state'] == 0) {
            // State 0 - Generate request token and redirect user to Twitter to authorize
            $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'];
Ejemplo n.º 6
0
		// quit
		// delete
		// remove document
		if ($_GET['command'] == "members") {
			$template = "member_manager"; 
		} 
		
		if ($_GET['command'] == "delete") { 
		
			if ($_POST['confirm']==md5($POD->currentUser()->get('memberSince'))) { 
				$group->delete();
				if ($group->success()) {
					header("Location: " . $POD->siteRoot(false) . "/groups");
					exit;
				} else {
					$POD->addMessage("Group delete failed! " . $group->error());
				}
			}		
		}		
		if ($_GET['command'] == "edit") { 
			
			// if there is a _POST, this is an edit save
			// if not, this is an edit get
			
			if ($_POST) { 		
				$group->set('groupname',$_POST['groupname']);
				$group->set('description',$_POST['description']);				
				$group->set('type',$_POST['type']);
				$group->save();
				
				if (!$group->success()) { 
Ejemplo n.º 7
0
* Documentation for this pod can be found here:
* http://peoplepods.net/readme
/**********************************************/
include_once "../../lib/Core.php";
$POD = new PeoplePod(array('authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_authentication_login')) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
$redirect_after_login = false;
if ($_POST) {
    // if we have a form being submitted, handle the login
    if (@$_POST['email'] && @$_POST['password']) {
        $POD = new PeoplePod(array('authSecret' => md5($_POST['email'] . $_POST['password'])));
        if (!$POD->success()) {
            $POD->addMessage($POD->error());
        }
        if (!$POD->isAuthenticated()) {
            $POD->addMessage("Oops!  We could not log you in using that email address and password.");
        } else {
            $days = 15;
            if ($_POST['remember_me']) {
                $days = 100;
            }
            setcookie('pp_auth', $POD->currentUser()->get('authSecret'), time() + 86400 * $days, "/");
            $redirect_after_login = true;
        }
    }
}
if ($redirect_after_login) {
    // if we logged in correctly, we redirect to the homepage of the site, or to any url passed in as a parameter
Ejemplo n.º 8
0
include_once "content_type.php";
// this defines some variables for use within this pod
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'verified', 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions("enable_contenttype_{$content_type}_add")) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
// by default, this script will redirect to the homepage of the site.
// this can be changed by passing in an alternative via the redirect parameter
$redirect = $POD->siteRoot(false);
if ($_POST) {
    if (isset($_POST['id'])) {
        $content = $POD->getContent(array('id' => $_POST['id']));
        if (!$content->success()) {
            $POD->addMessage($content->error());
        }
        if (!$content->isEditable()) {
            $POD->addMessage("Access Denied");
        }
    } else {
        $content = $POD->getContent();
    }
    if (isset($_POST['headline'])) {
        $content->set('headline', $_POST['headline']);
    }
    if (isset($_POST['body'])) {
        $content->set('body', $_POST['body']);
    }
    if (isset($_POST['link'])) {
        $content->set('link', $_POST['link']);
Ejemplo n.º 9
0
* Documentation for this pod can be found here:
* http://peoplepods.net/readme
/**********************************************/
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('lockdown' => 'verified', 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_invite')) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
$max_allowed_invites = 5;
if ($_POST) {
    // send invites.
    for ($i = 1; $i <= $max_allowed_invites; $i++) {
        if (isset($_POST["email{$i}"]) && $_POST["email{$i}"] != '') {
            $POD->currentUser()->sendInvite($_POST["email{$i}"], $_POST['message'], @$_POST['group']);
            $POD->addMessage("Invites sent!");
        }
    }
}
$POD->header('Send Invites');
?>
	<form method="post" action="<?php 
$POD->siteRoot();
?>
/invite" class="valid" id="invite">
		
	
	<div class="column_6">
	
				<h1>Send Invites</h1>
Ejemplo n.º 10
0
        }
    }
}
if ($POD->isAuthenticated()) {
    $POD->currentUser()->expireAlertsAbout($doc);
}
if (!$doc->success()) {
    header("Status: 404 Not Found");
    echo "404 Not Found";
    exit;
}
if (isset($_POST['comment'])) {
    // this is a request to post a comment
    $comment = $doc->addComment($_POST['comment']);
    if (!$comment || !$comment->success()) {
        $POD->addMessage("Couldn't add comment! " . $doc->error());
    } else {
        header("Location: " . $doc->get('permalink') . "#" . $comment->get('id'));
        exit;
    }
}
if (isset($_GET['vote'])) {
    // this is a request to vote
    if ($POD->isAuthenticated()) {
        if (!$POD->currentUser()->getVote($doc)) {
            $doc->vote($_GET['vote']);
        }
    }
}
if (@$_GET['msg']) {
    $POD->addMessage(strip_tags($_GET['msg']));
Ejemplo n.º 11
0
* Displays a welcome page for non-members
* as defined in my_theme/people/welcome.php

* Documentation for this pod can be found here:
* http://peoplepods.net/readme
/**********************************************/
include_once "../../PeoplePods.php";
if ($_POST) {
    $lockdown = 'verified';
} else {
    $lockdown = null;
}
$POD = new PeoplePod(array('debug' => 0, 'lockdown' => $lockdown, 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_dashboard')) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
if (@$_GET['msg']) {
    $POD->addMessage(htmlspecialchars(strip_tags($_GET['msg'])));
}
$POD->header();
if ($POD->isAuthenticated()) {
    if (!isset($_GET['replies'])) {
        $POD->currentUser()->output('dashboard');
    } else {
        $POD->currentUser()->output('dashboard_replies');
    }
} else {
    $POD->getPerson()->output('welcome');
}
$POD->footer();
Ejemplo n.º 12
0
/**********************************************/
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'verified', 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_private_messaging')) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
$inbox = $POD->getInbox();
$username = $_GET['username'];
$user = $POD->getPerson(array('stub' => $username));
if (!$user->success()) {
    header("Status: 404 Not Found");
    echo "404 Not Found";
    exit;
}
$thread = $inbox->newThread($user->get('id'));
if (isset($_POST['message'])) {
    $thread->reply(strip_tags($_POST['message']));
}
if (isset($_GET['clear'])) {
    $thread->clear();
    if (!$thread->success()) {
        $POD->addMessage("Conversation could not be cleared! " . $thread->error());
    } else {
        $POD->addMessage("Conversation cleared.");
    }
}
$POD->header('Conversation with ' . $user->get('nick'));
$thread->output();
$thread->markAsRead();
$POD->footer();
Ejemplo n.º 13
0
*
* Documentation for this pod can be found here:
* http://peoplepods.net/readme/messaging
/**********************************************/
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'login', 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_profiles')) {
    header("Location: " . $POD->libOptions('serverRoot'));
    exit;
}
if (@$_POST['email'] != '') {
    $POD->currentUser()->set('nick', $_POST['nick']);
    $POD->currentUser()->set('email', $_POST['email']);
    $POD->currentUser()->save();
    if (!$POD->currentUser()->success()) {
        $POD->addMessage($POD->currentUser()->error());
    } else {
        $POD->addMessage("Your settings have been updated.");
        foreach ($_FILES as $filename => $file) {
            $POD->currentUser()->addFile($filename, $file);
            if (!$POD->currentUser()->success()) {
                $POD->addMessage('An error occured while attaching your file: ' . $POD->currentUser()->error());
            }
        }
        $POD->currentUser()->files()->fill();
        // now we'll add any meta fields that have been passed in.
        // we do this by looking for anything with a field name starting with meta_
        // so if you want to add a meta field called foo to your content
        // you'll pass in the value via meta_foo
        foreach ($_POST as $key => $value) {
            if (preg_match("/^meta_(.*)/", $key, $match)) {
Ejemplo n.º 14
0
<?php

include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'authSecret' => @$_COOKIE['pp_auth']));
$key = $POD->libOptions('fb_connect_api');
$secret = $POD->libOptions('fb_connect_secret');
// we need to make sure sessions are on so we can store the twitter codes
session_start();
if (isset($_GET['rfb'])) {
    $POD->currentUser()->removeMeta('facebook_token');
    $POD->currentUser()->removeMeta('fbuid');
    $POD->addMessage("Your Facebook account has been removed.");
}
$display = 'page';
if (strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "Android")) {
    //	$display='touch';
}
if (!($key && $secret)) {
    $POD->header('Configuration Required');
    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