Ejemplo n.º 1
0
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();
    }
}
Ejemplo n.º 2
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();
$content = $POD->getContents(array(), 'date desc', 10);
$stats['content_total'] = $content->totalCount();
$active_content = $POD->getContents(array(), 'commentDate DESC', 10);
$comments = $POD->getComments(array('date:gte' => date('Y-m-d') . ' 00:00:00'));
$stats['comments_today'] = $comments->totalCount();
$comments = $POD->getComments(array('date:gte' => date('Y-m-d', strtotime('-7 days'))));
$stats['comments_week'] = $comments->totalCount();
$comments = $POD->getComments(array(), 'date desc', 10);
$stats['comments_total'] = $comments->totalCount();
$files = $POD->getFiles(array('date:gte' => date('Y-m-d') . ' 00:00:00'));
$stats['files_today'] = $files->totalCount();
$files = $POD->getFiles(array('date:gte' => date('Y-m-d', strtotime('-7 days'))));
Ejemplo n.º 3
0
 function Test_content_meta()
 {
     $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();
     //addMeta
     $content->addMeta('new_meta', 'new_meta_value');
     $new_meta = $POD->getContents(array('type' => 'new_meta'));
     $this->assertIsA($new_meta, 'stack');
     //getMeta
     $meta = $content->getMeta();
     $test_this = $meta['new_meta'];
     $this->assertEqual($test_this, 'new_meta_value');
     // remove meta
     $content->removeMeta('new_meta');
     $test_meta = $content->get('new_meta');
     $this->assertNull($test_meta);
     $content->delete();
     $user->delete();
 }
Ejemplo n.º 4
0
 function testPersonInheritedFunctions()
 {
     $POD = new PeoplePod();
     $user = $POD->getPerson();
     $user->email = '*****@*****.**';
     //create user
     $user->password = '******';
     $user->set('nick', 'test');
     $user->save();
     $this->assertTrue($user->success());
     $this->assertFalse($user->error());
     $POD->changeActor(array('id' => $user->id));
     // tests get/set
     $testget = $user->get('nick');
     $this->assertIdentical($testget, 'test');
     //below tests inherited meta functions
     $user->addMeta('about me', 'I live in Austin');
     $new_meta = $POD->getContents(array('type' => 'about me'));
     $this->assertIsA($new_meta, 'stack');
     $meta = $user->getMeta();
     $test_this = $meta['about me'];
     $this->assertEqual($test_this, 'I live in Austin');
     $user->removeMeta('about me');
     $test_meta = $user->get('about me');
     $this->assertNull($test_meta);
     //below tests inherited flag functions
     $user->addFlag('block', $POD->currentUser());
     $this->assertTrue($POD->currentUser()->hasFlag('block', $user));
     $user->removeFlag('block', $user);
     $this->assertFalse($POD->currentUser()->hasFlag('block', $user));
     $flag = FALSE;
     $this->assertFalse($user->hasFlag($flag, $user));
     $user->toggleFlag($flag, $user);
     $this->assertTrue($user->hasFlag($flag, $user));
     $user->delete();
 }
Ejemplo n.º 5
0
* 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")) 
			if($POD->isAuthenticated() && $POD->currentUser()->get('adminUser')){ ?>
				<p>Add a new wiki now! <a href="<? $POD->siteRoot(); echo $edit_pattern; ?>">Click here!</a></p>
		<? }
		else {
			?><p>This software is under developement. Adding new wikis by users will be enabled in coming releases inshalla!</p><?
		}
		
		?><p>To connect your account on one of the wikis below, please add it <a href="wikiman">here</a></p><?
Ejemplo n.º 6
0
                $pBaseUrl .= "/type/" . $value;
                $type = ucwords($value . 's');
                break;
        }
    }
} else {
    // no parameters were specified, we should send this person back to the homepage
    header("Location: " . $POD->siteRoot(false));
    exit;
}
$count = 20;
$offset = 0;
if (isset($_GET['offset'])) {
    $offset = $_GET['offset'];
}
$docs = $POD->getContents($params, null, $count, $offset);
$description = "{$scope} {$type} " . implode(" and ", $conditions);
$feedurl = $POD->siteRoot(false) . '/feeds/' . $_GET['args'];
$POD->header($description, $feedurl);
?>
	
	<div class="column_8">
		<?php 
$docs->output('short', 'header', 'pager', $description);
?>
	</div>	
	<div class="column_4 structure_only">
		<?php 
$POD->output('sidebars/search');
?>
		
Ejemplo n.º 7
0
* http://peoplepods.net/readme/messaging
/**********************************************/
include_once "../../PeoplePods.php";
$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">
Ejemplo n.º 8
0
                break;
            case 'search':
                $params['or'] = array('headline:like' => "%{$value}%", 'body:like' => "%{$value}%");
                array_push($conditions, "Matching '{$value}'");
                break;
            case 'type':
                $params['type'] = $value;
                $type = ucwords($value . 's');
                break;
        }
    }
} else {
    $params['1'] = '1';
}
$count = 20;
$DOCS = $POD->getContents($params);
$description = "{$scope} {$type} " . implode(" and ", $conditions) . " from " . $POD->siteName(false);
$year = date("Y");
$rss = new rss('utf-8');
$rss->channel(xmlformat($description), $POD->siteRoot(false), xmlformat($description));
$rss->language('en-us');
$rss->copyright('Copyright ' . $year . ' ' . $POD->siteName(false));
$rss->startRSS();
while ($doc = $DOCS->getNext()) {
    $rss->itemTitle(xmlformat($doc->get('headline')));
    if ($doc->get('link')) {
        $rss->itemLink($doc->get('link'));
    } else {
        $rss->itemLink($doc->get('permalink'));
    }
    $nTimestamp = strtotime($doc->get('date'));
Ejemplo n.º 9
0
* 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'];
}
$docs = $POD->getContents(array('type' => $content_type, 'status:!=' => 'friends_only'), null, 30, $offset);
$POD->header('What\'s New?');
?>

	<div class="column_8">
		<?php 
$docs->output('short', 'header', 'pager', 'What\'s New?', 'Nothing has been posted on this site yet. Wow, it must be brand new!');
?>
	</div>	
	<div class="column_4 structure_only">
		
		<?php 
$POD->output('sidebars/search');
?>

		<?php 
Ejemplo n.º 10
0
            } 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") {
            $results = $POD->getPeople($options, 'flag.date desc', 20, $offset);
        } else {
Ejemplo n.º 11
0
<?php

include_once "../../lib/Core.php";
// some useful functions :)
function inc_time_str($base, $format = "Y-m-d H:i:s")
{
    $temp = strtotime($base);
    $newtime = strtotime("+1 second", $temp);
    $newtime = date($format, $newtime);
    return $newtime;
}
// only allow logged in people
$POD = new PeoplePod();
$POD->header();
define('WIKI_USERNAME', '');
define('WIKI_PASSWORD', '');
$wikis = $POD->getContents(array('type' => 'wiki'));
foreach ($wikis as $wiki) {
    $_GET["api"] = $wiki->get('api');
    $_SERVER['REQUEST_METHOD'] = "GET";
    include 'default_requester.php';
}
$POD->footer();