Esempio n. 1
0
 function testTagFields()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->set('nick', 'test');
     $user->save();
     $POD->changeActor(array('id' => $user->id));
     //log in as user
     $user2 = $POD->getPerson();
     $user2->email = '*****@*****.**';
     //create user
     $user2->password = '******';
     $user2->set('nick', 'test2');
     $user2->save();
     $user2->sendMessage('hi user2');
     sleep(2);
     $user2->sendMessage('hi again user2');
     $POD->changeActor(array('id' => $user2->id));
     $inbox = $POD->getInbox();
     $this->assertTrue($inbox);
     $thread = $inbox->newThread($user->id);
     $this->assertNotNull($thread->MESSAGES);
     $messages = $thread->messages();
     $this->assertEqual($thread->unreadCount(), 2);
     $this->assertEqual($messages->count(), 2);
     $first_message = $messages->getNext();
     $this->assertEqual($first_message->to()->get('id'), $user2->id);
     $this->assertEqual($first_message->from()->get('id'), $user->id);
     $thread->markAsRead();
     $this->assertEqual($thread->unreadCount(), 0);
     $this->assertEqual($thread->recipient()->get('id'), $user->id);
     $second_message = $messages->getNext();
     $thread->reply('hello to you');
     $this->assertTrue($thread->success());
     $POD->changeActor(array('id' => $user->id));
     $inbox = $POD->getInbox();
     $thread = $inbox->newThread($user2->id);
     $this->assertEqual($thread->unreadCount(), 1);
     $messages = $thread->messages();
     $this->assertEqual($messages->count(), 3);
     $messages->reset();
     $message = $messages->getNext();
     $this->assertEqual($message->message, 'hi user2');
     ///Test fields of message object//////
     $this->assertNotNull($message->id);
     $this->assertEqual($message->userId, $user->id);
     $this->assertEqual($message->fromId, $user->id);
     $this->assertEqual($message->targetUserId, $user2->id);
     $this->assertNotNull($message->date);
     $this->assertEqual($message->status, 'read');
     ///////////////////////////////////
     $POD->changeActor(array('id' => $user->id));
     $user->delete();
     $POD->changeActor(array('id' => $user2->id));
     $user2->delete();
 }
Esempio n. 2
0
 function CreateBaseContent()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->nick = 'test';
     $user->addMeta('testcase', 'testuser');
     // add a new field
     $user->save();
     $user2 = $POD->getPerson();
     $user2->email = '*****@*****.**';
     //create user
     $user2->password = '******';
     $user2->nick = 'test2';
     $user2->addMeta('testcase', 'testuser');
     // add a new field
     $user2->save();
     $user3 = $POD->getPerson();
     $user3->email = '*****@*****.**';
     //create user
     $user3->password = '******';
     $user3->nick = 'test3';
     $user3->addMeta('testcase', 'testuser');
     // add a new field
     $user3->save();
     $POD->changeActor(array('id' => $user->id));
     //log in as test
     $content = $POD->getContent();
     $content->set('headline', 'first headline');
     $content->set('type', 'same type');
     $content->addMeta('testcase', 'testcontent');
     // add a new field
     $content->save();
     $content2 = $POD->getContent();
     $content2->set('headline', 'second headline');
     $content2->set('type', 'same type');
     $content2->addMeta('testcase', 'testcontent');
     // add a new field
     $content2->save();
     $content3 = $POD->getContent();
     $content3->set('headline', 'second headline');
     $content3->set('type', 'different type');
     $content3->addMeta('testcase', 'testcontent');
     // add a new field
     $content3->save();
     return $POD;
 }
Esempio n. 3
0
 function test_File_fields()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson(array('nick' => 'admin'));
     $POD->changeActor(array('id' => $user->id));
     $most_recent = $POD->getFiles(array('userId' => $user->get('id')));
     $file = $most_recent->getNext();
     $this->assertIsA($file, 'File');
     $this->assertTrue($file->isImage());
     $creator = $file->creator();
     $this->assertIsA($creator, 'Person');
     $owner = $file->owner();
     $this->assertIsA($owner, 'Person');
     $this->assertTrue($file->get('userId'), $user->id);
     $this->assertEqual($file->get('extension'), 'jpg');
     $this->assertNotNull($file->get('id'));
     $this->assertNotNull($file->get('contentId'));
     $this->assertEqual($file->get('original_name'), 'darwin.jpg');
     $this->assertNull($file->get('description'));
     //should this be initialized to null?
     $this->assertEqual($file->get('mime_type'), 'image/jpeg');
     $this->assertNotNull($file->get('date'));
     $this->assertNotNull($file->get('minutes'));
     $parent_content = $file->parent();
     $this->assertIsA($parent_content, 'Content');
     $this->assertEqual($parent_content->get('headline'), 'Darwin');
     //now attempt to get a file by means of getFile()
     $new_file = $POD->getFile(array('id' => $file->get('id')));
     $this->assertIsA($new_file, 'File');
 }
Esempio n. 4
0
 function testTagFields()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = 'ben+test@e';
     //create user
     $user->password = '******';
     $user->set('nick', 'test');
     $user->save();
     $POD->changeActor(array('id' => $user->id));
     //log in as user
     $content = $POD->getContent();
     $content->set('headline', 'this is the headline');
     $content->set('type', 'this is the type');
     $content->save();
     $this->assertFalse($content->hasTag('foo'));
     $content->addTag('foo');
     $content->save();
     $this->assertTrue($content->hasTag('foo'));
     $tags = $content->tags();
     $tag = $tags->getNext();
     $this->assertIsA($tag, 'Tag');
     /// test of fields //////////////////////
     $this->assertNotNull($tag->id);
     $this->assertEqual($tag->value, 'foo');
     $this->assertNotNull($tag->get('date'));
     ////////////////////////////////////////
     $content->removeTag('nonexistant');
     $this->assertFalse($content->success());
     // should not be able to remove a tag that does not exist
     $tag_count = $content->tags()->count();
     $this->assertEqual($tag_count, 1);
     $content->removeTag('foo');
     $tag_count = $content->tags()->count();
     $this->assertEqual($tag_count, 0);
     $string = "foo bar baz";
     $content->tagsFromString($string);
     $tag_count = $content->tags()->count();
     $this->assertEqual($tag_count, 3);
     $string = $content->tagsAsString();
     $this->assertEqual($string, "foo bar baz");
     $content->addTag("");
     $this->assertEqual($tag_count, 3);
     $string = $content->tagsAsString();
     $this->assertEqual($string, "foo bar baz ");
     $string = "";
     //test adding a null value tag
     $content->tagsFromString($string);
     $tag_count = $content->tags()->count();
     $this->assertEqual($tag_count, 0);
     $content->delete();
     $user->delete();
 }
Esempio n. 5
0
 function testPeoplePodsCreateUser()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $this->assertIsA($user, 'Person');
     $this->assertNull($user->id);
     $user->email = '*****@*****.**';
     $user->password = '******';
     $user->nick = 'test';
     $user->save();
     $this->assertTrue($user->success());
     $this->assertNotNull($user->id);
     $POD->changeActor(array('id' => $user->id));
     $this->assertTrue($POD->isAuthenticated());
     $user->delete();
 }
Esempio n. 6
0
 function testCommentFunctions()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->nick = 'test';
     $user->save();
     $POD->changeActor(array('id' => $user->id));
     $content = $POD->getContent();
     $content->set('headline', 'this is the headline');
     $content->set('type', 'this is the type');
     $content->save();
     $comment = $content->addComment('amazing!');
     $comment->type = 'rating';
     $comment2 = $content->addComment('blah');
     $comment->type = 'rating';
     $this->assertEqual($comment->author()->get('id'), $user->id);
     $this->assertEqual($comment->parent()->id, $content->id);
     $comment_stack = $content->comments();
     $this->assertEqual($comment_stack->count(), 2);
     $next_comm = $comment_stack->getNext();
     $this->assertIsA($next_comm, 'Comment');
     $pod_comm_stack = $POD->getComments();
     $pod_comm = $pod_comm_stack->getNext();
     $this->assertIsA($pod_comm, 'Comment');
     //test getComment to return a specific comment
     $pull_comm = $POD->getComment(array('id' => $comment2->id));
     $this->assertEqual($pull_comm->comment, 'blah');
     //test getComment to create a comment and associate it with a person and content obj
     $new_comment = $POD->getComment();
     $new_comment->set('comment', 'This comment sucks!');
     $new_comment->set('userId', $user->id);
     $new_comment->set('contentId', $content->get('id'));
     $new_comment->save();
     $comment_stack = $POD->getComments(array('userId' => $user->id));
     $this->assertEqual($comment_stack->count(), 3);
     $comment->delete();
     $content->delete();
     $user->delete();
 }
Esempio n. 7
0
 function Test_relationship_functions()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->nick = 'test';
     $user->save();
     $POD->changeActor(array('id' => $user->id));
     $content = $POD->getContent();
     $content->set('headline', 'this is the test_tags headline');
     $content->set('type', 'this is the type');
     $content->save();
     $new_content = $POD->getContent();
     $new_content->set('headline', 'new child document');
     $new_content->set('type', 'post');
     $new_content->set('parentId', $content->get('id'));
     $new_content->save();
     //Below tests parent(), and  child()
     //test that the new content's id is set to it's parent's id
     $this->assertIdentical($new_content->get('parentId'), $content->get('id'));
     $this->assertIsA($content->children(), 'Stack');
     //$this->assertIdentical($new_content->parent()->get('id'), $content->get('id'));
     //$this->assertFalse(is_string($new_content->parent()->get('id')));
     //**Note** $new_content->'id' is either getting set, cashed, or returned as a string. While the parent 		  content is set to an integer
     $this->assertEqual($new_content->parent()->get('id'), $content->get('id'));
     $this->assertFalse(is_string($content->get('id')));
     //below tests comments()
     $content->addComment('first comment');
     $content->addComment('second comment');
     $content->addComment('third comment');
     $content_comments = $content->comments();
     $this->assertIsA($content_comments, 'Stack');
     $first = $content_comments->getNext();
     $this->assertEqual($first->comment, 'first comment');
     $first = $content_comments->getNext();
     $first = $content_comments->getNext();
     // this should be the 'third comment'
     $this->assertEqual($first->comment, 'third comment');
     $first = $content_comments->getNext();
     // this should return null
     $this->assertNull($first);
     $content_comments->reset();
     $first = $content_comments->getNext();
     $this->assertEqual($first->comment, 'first comment');
     //below tests files()
     $img_file = $content->files();
     $this->assertNotNull($img_file);
     //below tests group()
     $group = $POD->getGroup();
     $group->set('groupname', 'group 1');
     $group->set('description', 'this is the group');
     $group->save();
     $this->assertTrue($group->success());
     $content->setGroup($group->get('id'));
     $this->assertTrue($content->success());
     $this->assertEqual($group->get('id'), $content->get('groupId'));
     $this->assertIsA($content->group(), 'Group');
     // below tests tag()
     $string = "foo bar baz";
     $content->tagsFromString($string);
     $tag_stack = $content->tags();
     $this->assertIsA($tag_stack, 'Stack');
     $tag = $tag_stack->getNext();
     $this->assertIsA($tag, 'Tag');
     $this->assertEqual($tag->value, 'foo');
     $group->delete();
     $new_content->delete();
     $content->delete();
     $user->delete();
 }
Esempio n. 8
0
 function Test_favorite_watched()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->nick = 'test';
     $user->save();
     $POD->changeActor(array('id' => $user->id));
     //log in as user
     $content = $POD->getContent();
     $content->set('headline', 'this is the headline');
     $content->set('type', 'this is the type');
     $content->save();
     $isFavorite = $user->isFavorite($content);
     $this->assertFalse($isFavorite);
     $user->toggleFavorite($content);
     $isFavorite = $user->isFavorite($content);
     $this->assertTrue($isFavorite);
     $isWatched = $user->isWatched($content);
     $this->assertTrue($isWatched);
     $user->toggleWatch($content);
     $isWatched = $user->isWatched($content);
     $this->assertFalse($isWatched);
     $content->delete();
     $user->delete();
 }
Esempio n. 9
0
                        header("Location: " . $POD->siteRoot(false));
                        exit;
                    }
                }
            }
        }
    } catch (OAuthException $E) {
        $POD->addMessage("Your Twitter login failed. Try again!");
    }
}
if (isset($_GET['group'])) {
    setcookie('pp_group', $_GET['group'], time() + 60 * 60 * 24 * 30, "/");
}
$POD->header('Connect with Twitter');
if (!$POD->isAuthenticated()) {
    $user = $POD->getPerson();
    if (isset($access_token_info['oauth_token'])) {
        // set some vars
        $user->set('twitter_token', $access_token_info['oauth_token']);
        $user->set('twitter_secret', $access_token_info['oauth_token_secret']);
        $user->set('twitter_name', (string) $json->screen_name);
        $user->set('nick', (string) $json->name);
        $user->set('twitter_id', (string) $json->id);
        $user->set('group', @$_COOKIE['pp_group']);
        $user->set('invite', @$_COOKIE['pp_invite_code']);
        $user->set('redirect', $POD->siteRoot(false));
        $user->output('join');
        $POD->footer();
        exit;
    }
} else {
Esempio n. 10
0
        $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
    if ($_POST['redirect']) {
        header("Location: " . $_POST['redirect']);
    } else {
        header("Location: " . $POD->siteRoot(false));
    }
} else {
    $POD->header("Login");
    $p = $POD->getPerson();
    // create an empty person record
    $p->set('redirect', @$_GET['redirect']);
    $p->output('login');
    $POD->footer();
}
Esempio n. 11
0
        // 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);
        if ($invite_deets['groupId']) {
            $p->set('invited_to_group', $POD->getGroup(array('id' => $invite_deets['groupId'])), false);
        }
    } else {
Esempio n. 12
0
                 $data = $doc->asArray();
                 $data['lastVote'] = $_GET['vote'];
                 echo json_encode($data);
             } else {
                 echo json_encode(array('error' => $doc->error(), 'id' => $_GET['docId']));
             }
         } else {
             echo json_encode(array('error' => $doc->error(), 'id' => $_GET['docId']));
         }
     } else {
         echo json_encode(array('error' => 'PERMISSION DENIED', 'id' => $_GET['docId']));
     }
 }
 if ($method == "addFriend") {
     if ($POD->isAuthenticated()) {
         $newfriend = $POD->getPerson(array('id' => $_GET['id']));
         $POD->currentUser()->addFriend($newfriend);
         if ($POD->currentUser()->success()) {
             echo json_encode($newfriend->asArray());
         } else {
             echo json_encode(array('error' => $POD->currentUser()->error(), 'id' => $_GET['id']));
         }
     } else {
         echo json_encode(array('error' => 'PERMISSION DENIED', 'id' => $_GET['id']));
     }
 }
 if ($method == "removeFriend") {
     if ($POD->isAuthenticated()) {
         $newfriend = $POD->getPerson(array('id' => $_GET['id']));
         $POD->currentUser()->removeFriend($newfriend);
         if ($POD->currentUser()->success()) {
Esempio n. 13
0
                    if ($POD->libOptions('mysql_server')) {
                        echo "<p class=\"error\">The current settings aren't working. :(</p>";
                    }
                    echo '<form method="post">';
                    echo '<p><label for="mysql_server">MySQL Server:</label><input name="mysql_server"class="text" value="' . $POD->libOptions('mysql_server') . '" /></p>';
                    echo '<p><label for="mysql_db">Database Name:</label><input name="mysql_db"class="text" value="' . $POD->libOptions('mysql_db') . '" /></p>';
                    echo '<p><label for="mysql_user">Username:</label><input name="mysql_user"class="text" value="' . $POD->libOptions('mysql_user') . '"/></p>';
                    echo '<p><label for="mysql_pass">Password:</label><input name="mysql_pass"class="text" value="' . $POD->libOptions('mysql_pass') . '"/></p>';
                    echo '<p><input type="submit" value="Continue &#187;" /></p>';
                    echo '</form>';
                }
            } else {
                if (!$POD->hasAdminUser()) {
                    // create first user
                    if ($_POST['nick'] && $_POST['email'] && $_POST['password']) {
                        $NEWUSER = $POD->getPerson(array('nick' => $_POST['nick'], 'email' => $_POST['email'], 'password' => $_POST['password']));
                        $NEWUSER->save(true);
                        if ($NEWUSER->success()) {
                            $NEWUSER->verify($NEWUSER->get('verificationKey'));
                            $NEWUSER->addMeta('adminUser', 1);
                            $POD = new PeoplePod(array('debug' => 0, 'authSecret' => $NEWUSER->get('authSecret')));
                            // set the from address for site emails
                            $POD->setLibOptions('fromAddress', $NEWUSER->get('nick') . "<" . $NEWUSER->get('email') . ">");
                            $POD->saveLibOptions(true);
                        } else {
                            $error_msg = $NEWUSER->error();
                        }
                    }
                    if ($POD->isAuthenticated()) {
                        ?>
				
Esempio n. 14
0
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth']));
$POD->changeTheme('admin');
$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
$content = null;
$oflags = null;
$iflags = null;
$user = null;
$message = null;
if (isset($_GET['removeFlag'])) {
    $flag = $_GET['removeFlag'];
    $type = $_GET['type'];
    $itemId = $_GET['itemId'];
    $userId = $_GET['userId'];
    if ($type == "user") {
        $obj = $POD->getPerson(array('id' => $itemId));
    } else {
        $obj = $POD->getContent(array('id' => $itemId));
    }
    $u = $POD->getPerson(array('id' => $userId));
    $obj->removeFlag($flag, $u);
    if (!$obj->success()) {
        $ret['error'] = $obj->error();
    } else {
        $ret = $_GET;
        $ret['flag'] = $flag;
        $ret['new_action'] = "add";
        $ret['old_action'] = "remove";
    }
    echo json_encode($ret);
    exit;
Esempio n. 15
0
 function testGroupContentPrivacy()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->set('nick', 'test');
     $user->save();
     $POD->changeActor(array('id' => $user->id));
     //log in as user
     $content = $POD->getContent();
     $content->set('headline', 'this is the headline');
     $content->set('type', 'this is the type');
     $content->save();
     $content2 = $POD->getContent();
     $content2->set('headline', 'for friends');
     $content2->set('type', 'Friends only');
     $content2->set('privacy', 'friends_only');
     $content2->save();
     $content3 = $POD->getContent();
     $content3->set('headline', 'Group members only!');
     $content3->set('type', 'private');
     $content3->save();
     $group = $POD->getGroup();
     $group->set('groupname', 'Music Learning Club Austin');
     $group->set('description', 'A club where Austin people learn music.');
     $group->save();
     $group->addContent($content);
     $group->addContent($content2);
     $group->addContent($content3);
     $content3->set('privacy', 'group_only');
     $content3->save();
     $get_contents = $group->content();
     $this->assertEqual($get_contents->count(), 3);
     //$user should have access to all three contents
     $user2 = $POD->getPerson();
     $user2->email = '*****@*****.**';
     //create user
     $user2->password = '******';
     $user2->set('nick', 'test2');
     $user2->save();
     $POD->changeActor(array('id' => $user2->id));
     $group->POD->changeActor(array('id' => $user2->id));
     //
     $user2->addFriend($user);
     //at this point $user is in $user2's friendlist, but not in the group
     $get_contents = $group->content()->fill();
     $this->assertEqual($get_contents->count(), 1);
     while ($check = $get_contents->getNext()) {
         $this->assertNotEqual($check->get('headline'), 'Group members only!');
         $this->assertNotEqual($check->get('headline'), 'for friends');
     }
     $POD->changeActor(array('id' => $user->id));
     $group->delete();
     $user->delete();
     $POD->changeActor(array('id' => $user2->id));
     $user2->delete();
 }
Esempio n. 16
0
 $user = null;
 $group = null;
 $message = null;
 $newfile = null;
 if (isset($_GET['contentId'])) {
     $content = $POD->getContent(array('id' => $_GET['contentId']));
     if (!$content->success()) {
         $message = $content->error();
     } else {
         $files = $content->files();
         $title = $content->headline;
     }
     $newfile = $POD->getFile(array('contentId' => $content->get('id')));
 } else {
     if (isset($_GET['userId'])) {
         $user = $POD->getPerson(array('id' => $_GET['userId']));
         if (!$user->success()) {
             $message = $user->error();
         } else {
             $files = $user->files();
             $title = $user->nick;
         }
         $newfile = $POD->getFile(array('userId' => $user->get('id')));
     } else {
         if (isset($_GET['groupId'])) {
             $group = $POD->getGroup(array('id' => $_GET['groupId']));
             if (!$group->success()) {
                 $message = $group->error();
             } else {
                 $files = $group->files();
                 $title = $group->groupname;
Esempio n. 17
0
}
// set up our fail indicator var
$REDALERT = false;
// set up getDocuments parameters based on the URL parameters
$params = array();
$scope = "All ";
$type = " Posts ";
$conditions = array();
$baseUrl = $tBaseUrl = $pBaseUrl = $POD->siteRoot(false) . "/lists";
$u = null;
$t = null;
if ($param) {
    foreach ($param as $key => $value) {
        switch ($key) {
            case 'person':
                $u = $POD->getPerson(array('stub' => $value));
                if ($u->success()) {
                    $baseUrl .= "/person/" . $u->get('stub');
                    $tBaseUrl .= "/person/" . $u->get('stub');
                    $params['userId'] = $u->get('id');
                    $scope = $u->get('nick') . "'s ";
                } else {
                    $REDALERT = true;
                }
                break;
            case 'favorites':
                $u = $POD->getPerson(array('stub' => $value));
                if ($u->success()) {
                    $baseUrl .= "/favorites/" . $u->get('stub');
                    $tBaseUrl .= "/favorites/" . $u->get('stub');
                    $params['flag.name'] = 'favorite';
Esempio n. 18
0
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'], 'debug' => 0));
$POD->changeTheme('admin');
$group = $_GET['group'];
$person = $_GET['person'];
$type = $_GET['type'];
$action = 'add';
if (@$_GET['action']) {
    $action = $_GET['action'];
}
// load parent
$parent = $POD->getGroup(array('id' => $group));
if ($parent->success()) {
    // load child
    $child = $POD->getPerson(array('id' => $person));
    if ($child->success()) {
        if ($action == 'add') {
            $parent->addMember($child, $type);
        } else {
            if ($action == 'remove') {
                $parent->removeMember($child);
            }
        }
        if ($parent->success()) {
            // refill the children stack
            $parent->allmembers()->fill();
        } else {
            echo "Could not make change to membership! " . $parent->error();
        }
    } else {
Esempio n. 19
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();
Esempio n. 20
0
*
* core_private_messaging/thread.php
* Displays a single thread, accepts new messages
*
* Documentation for this pod can be found here:
* http://peoplepods.net/readme/messaging
/**********************************************/
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.");
Esempio n. 21
0
* http://peoplepods.net http://xoxco.com
*
* core_authentication/password.php
* Handles requests to /password_reset
*
* 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;
}
if (@$_POST['password'] && @$_POST['resetCode']) {
    $user = $POD->getPerson(array('passwordResetCode' => $_POST['resetCode']));
    if ($user->success()) {
        $user->set('password', $_POST['password']);
        $user->set('passwordResetCode', '');
        $user->save();
        $days = 1;
        setcookie('pp_auth', $user->get('authSecret'), time() + 86400 * $days, "/");
        header("Location: /");
        exit;
    } else {
        // nothing.  the user submitted a password reset attempt without a valid reset code, which means they are probably lying!
    }
}
$POD->header('Reset Password');
// get a blank person for the output.
$p = $POD->getPerson();
Esempio n. 22
0
<?php

include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth']));
if (isset($_GET['id']) && !isset($_GET['action'])) {
    $user = $POD->getPerson(array('id' => $_GET['id']));
    if (!$user->success()) {
        $message = "ERROR: " . $user->error();
    }
} else {
    if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "verify") {
        $user = $POD->getPerson(array('id' => $_GET['id']));
        if ($user->success()) {
            $user->set('verificationKey', null);
            $user->save();
            $message = $user->get('nick') . " has been manually verified.";
        } else {
            $message = "PeoplePods could not find the user you specified.";
        }
    } else {
        if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "welcome") {
            $user = $POD->getPerson(array('id' => $_GET['id']));
            if ($user->success()) {
                $user->welcomeEmail();
                $message = "Welcome email resent to " . $user->get('nick');
            } else {
                $message = "PeoplePods could not find the user you specified.";
            }
        } else {
            if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "delete") {
                $user = $POD->getPerson(array('id' => $_GET['id']));
Esempio n. 23
0
// at the end, we may have $content, $user, $comment, $file, and/or $group set.
if (@$_GET['content']) {
    if (is_numeric($_GET['content'])) {
        $content = $POD->getContent(array('id' => $_GET['content']));
    } else {
        $content = $POD->getContent(array('stub' => $_GET['content']));
    }
    if (!$content->success()) {
        echo results(array('error' => $content->error()));
        exit;
    }
    $data['content'] = $content->asArray();
}
if (@$_GET['person']) {
    if (is_numeric($_GET['person'])) {
        $person = $POD->getPerson(array('id' => $_GET['person']));
    } else {
        $person = $POD->getPerson(array('nick' => $_GET['person']));
    }
    if (!$person->success()) {
        echo results(array('error' => $person->error()));
        exit;
    }
    $data['person'] = $person->asArray();
}
if (@$_GET['group']) {
    if (is_numeric($_GET['group'])) {
        $group = $POD->getGroup(array('id' => $_GET['group']));
    } else {
        $group = $POD->getGroup(array('stub' => $_GET['group']));
    }
Esempio n. 24
0
/***********************************************
* This file is part of PeoplePods
* (c) xoxco, inc  
* http://peoplepods.net http://xoxco.com
*
* core_profiles/profile.php
* Handles requests to user profiles
*
* Documentation for this pod can be found here:
* http://peoplepods.net/readme/messaging
/**********************************************/
include_once "../../PeoplePods.php";
$POD = new PeoplePod(array('debug' => 0, 'authSecret' => @$_COOKIE['pp_auth']));
if (!$POD->libOptions('enable_core_profiles')) {
    header("Location: " . $POD->siteRoot(false));
    exit;
}
$profile_username = $_GET['username'];
$PROFILE_PERSON = $POD->getPerson(array('stub' => $profile_username));
if ($POD->isAuthenticated()) {
    $POD->currentUser()->expireAlertsAbout($PROFILE_PERSON);
}
if ($PROFILE_PERSON->success()) {
    $POD->header($PROFILE_PERSON->get('nick'), $POD->siteRoot(false) . '/feeds/person/' . $PROFILE_PERSON->get('stub'));
    $PROFILE_PERSON->output();
    $POD->footer();
} else {
    header("Status: 404 Not Found");
    echo "404 Not Found";
}