All pastes #238949 Raw Edit

Anonymous

public php v1 · immutable
·published 2006-11-05 04:34 UTC
rendered paste body
<?php$template['show_create'] = false;$tmp = $thread->get_element('views');$thread->set_element('views', $tmp+1);$posts_fldr = $thread->get_child('posts');$thread->set_element('views', $tmp+1);//print_r($template);if(isset($_GET['action'])){	switch($_GET['action'])	{	case 'create':		{			if(!empty($_POST))			{				if(empty($_POST['body']))					$errors[] = 'You must provide a message.';				if(empty($errors))				{					$posts_fldr->create_child((string)($thread->size()+1), array(					'author' =>  $g_user ? $g_user->get_id() : 0, // Logged in user ID (numeric) or IP address (string).					'ip' =>  $_SERVER['REMOTE_ADDR'],					'body' => $_POST['body'], // Original thread-starting post.					'time' => time()					));					//header('location: ' . $_SERVER['REQUEST_URI'] . '/' . urlencode($_POST['headline']));				}			}			$template['show_create'] = true;		}		break;	}}$posts = $posts_fldr->enum_children(isset($_GET['start']) ? $_GET['start'] : 0, 10, false);foreach($posts as $i){	$tmp = $i->get_contents();	if($tmp['author'])		$tmp['author'] = $core->get_folder($tmp['author'])->get_name();	else		$tmp['author'] = $tmp['ip'];	$template['posts'][] = $tmp;}$template['pagination'] = generate_pagination($posts_fldr->size(), 10);include('templates/thread.php');?>