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'); }
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(); }
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(); } }
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; }
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(); }
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(); }
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(); }
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'])); $POD->changeTheme('admin'); $result_mode = 'fullscreen'; if (isset($_GET['result_mode'])) { $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"; }
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('lockdown' => 'adminuser', 'authSecret' => @$_COOKIE['pp_auth'])); $POD->changeTheme('admin'); $mode = $_GET['mode']; if ($mode == 'upload') { // someone just uploaded or modified an image } else { if ($mode == 'list') { $content = $POD->getContent(array('id' => $_GET['docId'])); ?> <div id="fileBrowser_list"> <?php // output an upload form $content->output('browser.upload'); // output list of files $content->files()->output('browser.list', 'list_header', 'list_footer', null, 'No files attached to this content.'); ?> </div> <div id="fileBrowser_details" style="display:none;"> </div> <?php } else { if ($mode == 'details') { $content = $POD->getContent(array('id' => $_GET['docId'])); $file = $content->files()->contains('id', $_GET['fileId']);
* * core_groups/index.php * Handles requests to /groups * Creates new groups * * Documentation for this pod can be found here: * http://peoplepods.net/readme /**********************************************/ include_once "../../PeoplePods.php"; if ($_POST) { $lockdown = 'verified'; } else { $lockdown = ''; // anyone can see the groups homepage. } $POD = new PeoplePod(array('debug' => 0, 'lockdown' => $lockdown, 'authSecret' => @$_COOKIE['pp_auth'])); if (!$POD->libOptions('enable_core_groups')) { 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();
<?php /*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * * core_profiles/editprofile.php * Handles requests to /editprofile * * 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());
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'])); $POD->changeTheme('admin'); $group = $_GET['group']; $doc = $_GET['doc']; $action = 'add'; if ($_GET['action']) { $action = $_GET['action']; } // load parent $parent = $POD->getGroup(array('id' => $group)); if ($parent->success()) { // load child $child = $POD->getContent(array('id' => $doc)); if ($child->success()) { if ($action == 'add') { $parent->addContent($child); } else { if ($action == 'remove') { $parent->removeContent($child); } } if ($parent->success()) { // refill the children stack $parent->content()->fill(); } else { echo "Could not add to group! " . $parent->error(); } } else {
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'])); if (@$_POST) { $POD->setLibOptions('peopleImageResize', $_POST['peopleImageResize']); $POD->setLibOptions('peopleImageMaxWidth', $_POST['peopleImageMaxWidth']); $POD->setLibOptions('peopleIconSquare', $_POST['peopleIconSquare']); $POD->setLibOptions('peopleIconMaxWidth', $_POST['peopleIconMaxWidth']); $POD->setLibOptions('documentImageResize', $_POST['documentImageResize']); $POD->setLibOptions('documentImageMaxWidth', $_POST['documentImageMaxWidth']); $POD->setLibOptions('documentIconSquare', $_POST['documentIconSquare']); $POD->setLibOptions('documentIconMaxWidth', $_POST['documentIconMaxWidth']); $POD->saveLibOptions(); if ($POD->success()) { $message = "Config updated."; } else { $message = $POD->error(); } } $POD->changeTheme('admin'); $POD->header(); $current_tab = "images"; ?> <?php include_once "option_nav.php"; ?> <?php if (isset($message)) { ?>
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 »" /></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()) { ?> <script type="text/javascript"> setCookie('<?php $NEWUSER->write('authSecret'); ?> ');
* Handles requests to /login * * 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; } } }
<?php /*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * * core_api_simple/index.php * Handles simple requests to /api * * Documentation for this pod can be found here: * http://peoplepods.net/readme /**********************************************/ include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('authSecret' => @$_COOKIE['pp_auth'], 'debug' => 2)); if ($POD->libOptions('enable_core_api_simple')) { $method = $_GET['method']; $POD->tolog("API CALL METHOD: {$method}"); if ($method == "alert.markAsRead") { if ($POD->isAuthenticated()) { $alert = $POD->getAlert(array('id' => $_GET['id'])); $alert->markAsRead(); if ($alert->success()) { echo json_encode($alert->asArray()); } else { echo json_encode(array('error' => $alert->error(), 'id' => $_GET['id'])); } } else { echo json_encode(array('error' => 'PERMISSION DENIED', 'id' => $_GET['docId'])); } }
<?php /*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * * core_api_simple/index.php * Handles simple requests to /api * * Documentation for this pod can be found here: * http://peoplepods.net/readme /**********************************************/ include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('authSecret' => @$_COOKIE['pp_auth'], 'debug' => 0)); // $method defines what action we are going to take $method = @$_GET['method']; // $data will hold all of information for our response $data = array(); // in order to avoid duplication in the methods below // let's load any objects specified up here, and properly handle them // 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;
/*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * * core_files/index.php * Handles simple requests to /download * Allows files to be downloaded with their original file name * * Documentation for this pod can be found here: * http://peoplepods.net/readme /**********************************************/ include_once "../../PeoplePods.php"; error_reporting(0); $POD = new PeoplePod(array('debug' => 0)); // no parameters, we want the most basic pod we can get to serve images if (!$POD->libOptions('enable_core_files')) { header("Location: " . $POD->siteRoot(false)); exit; } $f = $POD->getFile(array('id' => $_GET['id'])); if (!$f->success()) { header("Status: 404 Not Found"); echo "404 Not Found"; exit; } $f->download($_GET['size']); if (!$f->success()) { header("Status: 404 Not Found"); echo "Download Failed";
<?php /*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * * core_authentication/logout.php * Handles requests to /logout * * Documentation for this pod can be found here: * http://peoplepods.net/readme /**********************************************/ include_once "../../lib/Core.php"; $POD = new PeoplePod(); if (!$POD->libOptions('enable_core_authentication_login')) { header("Location: " . $POD->siteRoot(false)); exit; } setcookie('pp_user', '', 0, "/"); setcookie('pp_pass', '', 0, "/"); setcookie('pp_auth', '', 0, "/"); session_destroy(); if ($_SERVER['HTTP_REFERER']) { header("Location: " . $_SERVER['HTTP_REFERER']); } else { header("Location: " . $POD->siteRoot(false)); }
// if we have all the necessary fields, let's create a new user! if (@$_POST['email'] && @$_POST['name']) { if (!$_POST['password'] && !($_POST['meta_openid'] || $_POST['meta_fbuid'] || $_POST['meta_twitter_token'])) { $POD->addMessage("You must specify a password!"); } else { if (!$_POST['password'] && ($_POST['meta_openid'] || $_POST['meta_fbuid'] || $_POST['meta_twitter_token'])) { $password = generatePassword(); } else { $password = $_POST['password']; } } $NEWUSER = $POD->getPerson(array('nick' => $_POST['name'], 'email' => $_POST['email'], 'password' => $password, 'invite_code' => $_POST['code'])); $NEWUSER->save(); if ($NEWUSER->success()) { setcookie('pp_auth', $NEWUSER->get('authSecret'), time() + 60 * 60 * 24 * 30, "/"); $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());
<?php require_once "../PeoplePods.php"; $POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'])); $POD->changeTheme('admin'); if (!$POD->success()) { error_log($POD->error()); } if (isset($_GET['flushcache'])) { $POD->cacheflush(); $message = "Cache Flushed!"; } $POD->header(); // lets generate some stats! $today = date("Y-m-d"); /* $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
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(); }
/*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * * core_usercontent/list.php * Handles the blog style reverse chronological list this type of content * * Documentation for this pod can be found here: * http://peoplepods.net/readme/new-content-type /**********************************************/ include_once "content_type.php"; // this defines some variables for use within this pod include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('authSecret' => @$_COOKIE['pp_auth'], 'debug' => 0)); if (!$POD->libOptions("enable_contenttype_{$content_type}_list")) { header("Location: " . $POD->siteRoot(false)); exit; } $offset = 0; if (isset($_GET['offset'])) { $offset = $_GET['offset']; } $wikis = $POD->getContents(array('type' => $content_type)); $POD->header('List of supported wikis!'); ?> <div class="column_8"> <? if ($POD->libOptions("enable_contenttype_wiki_add"))
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('debug' => 0, 'lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'])); $POD->changeTheme('admin'); if (isset($_GET['delete'])) { // delete this comment $comment = $POD->getComment(array('id' => $_GET['delete'])); if ($comment->success()) { $comment->delete(); if (!$comment->success()) { $msg = $comment->error(); } else { $msg = "Comment deleted."; } } else { $msg = $comment->error(); } } $types = array(); $sql = "SELECT DISTINCT type FROM comments"; $res = mysql_query($sql, $POD->DATABASE); if (mysql_num_rows($res) > 0) { while ($type = mysql_fetch_row($res)) { if ($type[0] == '') { $type[0] = 'comment'; } array_push($types, $type[0]); } } $POD->header('Comments');
<? /*********************************************** * This file is part of PeoplePods * (c) xoxco, inc * http://peoplepods.net http://xoxco.com * /index.php * This file just redirects to the admin or install tools /**********************************************/ include_once("PeoplePods.php"); $POD = new PeoplePod(array('authSecret'=>@$_COOKIE['pp_auth'])); if ($POD->success()) { header("Location: admin"); } else { header("Location: install"); } ?>
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(); }
* * core_usercontent/view.php * Handles permalinks, comments and voting for this type of content * * Documentation for this pod can be found here: * http://peoplepods.net/readme/new-content-type /**********************************************/ include_once "content_type.php"; // this defines some variables for use within this pod 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_pages")) { header("Location: " . $POD->siteRoot(false)); exit; } if (isset($_GET['stub'])) { $doc = $POD->getContent(array('stub' => $_GET['stub'])); } else { if (isset($_GET['id'])) { $doc = $POD->getContent(array('id' => $_GET['id'])); } else { if (isset($_POST['id'])) { $doc = $POD->getContent(array('id' => $_POST['id'])); } } }
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('lockdown' => 'adminUser', 'authSecret' => @$_COOKIE['pp_auth'])); if ($_POST) { $POD->setLibOptions('friendEmail', @$_POST['friendEmail']); $POD->setLibOptions('friendAlert', @$_POST['friendAlert']); $POD->setLibOptions('friendActivity', @$_POST['friendActivity']); $POD->setLibOptions('friendActivity', @$_POST['friendActivity']); $POD->setLibOptions('friendActivity', @$_POST['friendActivity']); $POD->setLibOptions('contentCommentAlert', @$_POST['contentCommentAlert']); $POD->setLibOptions('contentCommentActivity', @$_POST['contentCommentActivity']); $POD->setLibOptions('profileCommentAlert', @$_POST['profileCommentAlert']); $POD->setLibOptions('profileCommentActivity', @$_POST['profileCommentActivity']); $POD->setLibOptions('alertEmail', @$_POST['alertEmail']); $POD->setLibOptions('contactEmail', @$_POST['contactEmail']); $POD->saveLibOptions(); if ($POD->success()) { $message = "Config updated."; } else { $message = $POD->error(); } } $POD->changeTheme('admin'); $POD->header(); $current_tab = "notifications"; include_once "option_nav.php"; ?> <?php if (isset($message)) {
<?php include_once "../../PeoplePods.php"; $POD = new PeoplePod(array('debug' => 0, 'authSecret' => @$_COOKIE['pp_auth'])); $request = 'http://twitter.com/oauth/request_token'; $access = 'http://twitter.com/oauth/access_token'; $auth = 'http://twitter.com/oauth/authorize'; $key = $POD->libOptions('twitter_api'); $secret = $POD->libOptions('twitter_secret'); 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; }
* Handles requests to /groups/mygroup * Handles requests to member manager * * Documentation for this pod can be found here: * http://peoplepods.net/readme /**********************************************/ include_once("../../PeoplePods.php"); if ($_POST || isset($_GET['command'])) { $lockdown = 'verified'; } else { $lockdown = null; } $POD = new PeoplePod(array('debug'=>0,'lockdown'=>$lockdown,'authSecret'=>@$_COOKIE['pp_auth'])); if (!$POD->libOptions('enable_core_groups')) { header("Location: " . $POD->siteRoot(false)); exit; } $group = $POD->getGroup(array('stub'=>$_GET['stub'])); if (!$group->success()) { header("Status: 404 Not Found"); echo "404 Not Found"; exit; } if ($group->get('type')=="private") { if (!$POD->isAuthenticated() || !$group->isMember($POD->currentUser())) {