All pastes #576046 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-19 09:59 UTC
rendered paste body
<?php
global $config;
global $theme;
global $topic;
global $profile;
global $topic;

$theme_data = array();
$theme_data['header'] = <<<endHEADER
<html>
<head><title><[title]> - <[pagename]></title>
<link rel="stylesheet" href="pub/theme/Theme/Theme.css" />
</head>
<body>
<div class="header"><a href="."><[title]></a><br /><span class="subheader"><[pagename]></span>
<div class="menu"><[menu]></div>
</div>
<div class="body">
<br />
<[theme:loginbox]>
endHEADER
;
$f_version = VERSION;
$exectime = number_format(microtime(true) - $GLOBALS['start_exec'],3);
$timezone = date('O e');
$time = date($config->HappyDateFormat).' '.date($config->TimeFormat);
$theme_data['footer'] = <<<endFOOTER
<br />
</div>
<div class="footer">
Page generated in <b>$exectime</b> seconds at <b>$time</b><br />
All times are <b>$timezone</b><br />
<kbd><a href="http://php.forum.us.to/">FORUM</a> Version: <b>$f_version</b></kbd>
</div>
</body>
</html>
endFOOTER
;
if (substr($_SERVER['REQUEST_URI'],-1,1) == '/')
	$_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'].'index.php';
$current_page = htmlentities(rsn(basename($_SERVER['REQUEST_URI']),'a-zA-Z0-9 _.-?&=%'));
if (isset($_SESSION['username'])){
$cyou = user($_SESSION['username'],true);
$theme_data['loginbox'] = <<<endLOGINBOX
<div class="loginbox" id="staticlogin">
<big>$cyou</big><br />
<div style="text-align:right;">
<small><a href="login.php?logout&return=$current_page">Logout</a></small>
</div>
</div>
endLOGINBOX
;
} else {
$theme_data['loginbox'] = <<<endLOGINBOX
<div class="loginbox">
<form action="login.php" method="post">
<input type="hidden" name="return" value="$current_page" />
<table><tr><td>
<input type="textbox" name="username" value="Username" style="width:9em;height:1.5em" onfocus="if (this.value == 'Username') { this.value=''; }" onblur="if (this.value == '') { this.value='Username'; }"  /><br />
<input type="password" name="password" value="" style="width:9em;height:1.5em" class="password" />
</td><td>
<input type="submit" value="Login" style="width:4em;height:3em" class="button" />
</td></tr><tr><td><small><a href="register.php">Click here to register!</a></small></td></tr></table>
</form>
</div>
endLOGINBOX
;
}
$theme_data['errorbox'] = <<<endERRORBOX
<div class="errorbox">
<div class="errorbox-header">Forum Error</div>
<[errormsg]>
</div>
endERRORBOX
;
$register_list_html = '';
if (isset($config->register_list)){
$register_list = $config->register_list;
foreach ($register_list as $key => $data){
	if ($data == 'hr')
		$register_list_html .= "<tr><td style=\"text-align:center\" colspan=\"2\"><hr style=\"width:70%\" /></td></tr></tr>\n";		
	else {
		$name = $data[0];
		$ereg = '';
		$data[1] ? $req = '<span style="color:red">' : $req = '';
		$data[1] ? $ereq = '</span>' : $ereq = '';
		$register_list_html .= "<tr><td style=\"text-align:right\">$req$name$ereg</td><td><input type=\"textbox\" name=\"$key\" style=\"width:99%\"></td></tr>\n";
	}
}
}
$theme_data['registrationform'] = <<<endREGISTRATIONFORM
<div class="registrationform">
<form method="post">
<small>Red fields are required</small>
<table class="registrationform">
<tr><td style="text-align:right;width:20%"><span style="color:red">Username</span></td><td><input type="textbox" name="username" style="width:99%" maxlength="14"></td></tr>
<tr><td style="text-align:right"><span style="color:red">Password</span></td><td><input type="password" name="password" class="password" style="width:99%"></td></tr>
<tr><td style="text-align:right"><span style="color:red">Repeat Password</span></td><td><input type="password" name="passwordagain" class="password" style="width:99%"></td></tr>
<tr><td style="text-align:center" colspan="2"><hr style="width:70%" /></td></tr>
$register_list_html<tr><td style="text-align:center" colspan="2"><hr style="width:70%" /><input type="submit" value="Register" style="width:90%" class="button"></td></tr>
</table>
</form>
</div>
endREGISTRATIONFORM
;
$register_list_html = '';
if (isset($config->register_list)){
$register_list = $config->register_list;
foreach ($register_list as $key => $data){
	if ($data == 'hr')
		$register_list_html .= "<tr><td style=\"text-align:center\" colspan=\"2\"><hr style=\"width:70%\" /></td></tr></tr>\n";		
	else {
		$name = $data[0];
		$ereg = '';
		$data[1] ? $req = '<span style="color:red">' : $req = '';
		$data[1] ? $ereq = '</span>' : $ereq = '';
		if (isset($_SESSION['username']))
			$register_list_html .= "<tr><td style=\"text-align:right\">$req$name$ereg</td><td><input type=\"textbox\" name=\"$key\" style=\"width:99%\" value=\"{$profile->{$_SESSION['username']}->$key}\"></td></tr>\n";
		else
			$register_list_html .= "<tr><td style=\"text-align:right\">$req$name$ereg</td><td><input type=\"textbox\" name=\"$key\" style=\"width:99%\"></td></tr>\n";
	}
}
}
if (isset($_SESSION['username']))
	$theme_data['editprofile'] = <<<endEDITPROFILE
<div class="registrationform">
<form method="post">
<small>Red fields cannot be left blank.<br />
Leave the password boxes blank if you do not wish to change your password.</small>
<input type="hidden" name="username" style="display:none;" value="{$_SESSION['username']}" />
<table class="registrationform">
<tr><td style="text-align:right">Change Password<br /></td><td><input type="password" name="password" class="password" style="width:99%"></td></tr>
<tr><td style="text-align:right">Repeat Password</td><td><input type="password" name="passwordagain" class="password" style="width:99%"></td></tr>
<tr><td style="text-align:center" colspan="2"><hr style="width:70%" /></td></tr>
$register_list_html<tr><td style="text-align:center" colspan="2"><hr style="width:70%" /><input type="submit" value="Update Profile" style="width:90%" class="button"></td></tr>
</table>
</form>
</div>
endEDITPROFILE
;
$theme_data['profilebox'] = <<<endPROFILEBOX
<br /><center>
<br />
<div style="float:left"><[status]><br /><[avatar]></div>
<span class="h1"><[username]></span>
<span class="h2"><[fullname]></span><br />
<[rank]>
</center>
<blockquote><big>
<b>Posts</b> <[posts]><br />
<b>Email</b> <[email]><br />
<b>Website</b> <a href="<[website]>"><[website]></a><br />
<b>Location</b> <[location]><br />
<blockquote><i><small><[sig]></small></i></blockquote>
</big></blockquote><br />
endPROFILEBOX
;
if (isset($GLOBALS['forumlist'])){

$theme_data['forumlist'] = <<<endFORUMLIST
<div style="font-size:0.9em"><b><[title]></b><hr /></div>
<div class="forumlist"><table class="forumlist">
<tr class="forumlist"><th class="forumlist">Forum Title &amp; Description</td><th class="forumlist">Posts</th><th class="forumlist">Topics</th><th class="forumlist">Last Post</th></tr>
endFORUMLIST
;
$i = false;
	foreach ($GLOBALS['forumlist'] as $forum => $data){
		if (isset($data->LastPostDate))
			$postdate = hdate($data->LastPostDate,1);
		else
			$postdate = '';
		if (isset($data->LastPostAuthor))
			$clpa = user($data->LastPostAuthor,true);
		else
			$clpa = 'No posts';
		if ($i = !$i)
			$cforumlist = 'forumlist';
		else
			$cforumlist = 'altforumlist';
		$theme_data['forumlist'] .= <<<endFORUMLIST
<tr class="$cforumlist"><td class="$cforumlist" style="letter-spacing:0.1em;font-size:1.4em;font-family:Verdana,Tahoma,Arial,sans-serif"><b><a href="forum.php?forum=$forum">$forum</a></b><br /><div class="forumdesc">{$data->desc}</div></th><td class="$cforumlist">{$data->postcount}</td><td class="$cforumlist">{$data->topiccount}</td><td class="$cforumlist"><a href="profile.php?user={$data->LastPostAuthor}">$clpa</a><br /><small>$postdate</small></td></tr>
endFORUMLIST
		;
	}


$theme_data['forumlist'] .= <<<endFORUMLIST
<tr class="forumlist"><th class="forumlist">Forum Title &amp; Description</td><th class="forumlist">Posts</th><th class="forumlist">Topics</th><th class="forumlist">Last Post</th></tr>
</table></div>
endFORUMLIST
;

}
if (isset($GLOBALS['topics'])){
	$gforum = $GLOBALS['gforum'];
	$tc = count($GLOBALS['rtopics']);
	$page = $GLOBALS['pp'];
	$pages = 1;
	$pages = ceil($tc/$config->TopicsPerPage);
	$prevpage = '&lt;&lt;';
	$nextpage = '&gt;&gt;';
	if ($page > 1)
		$prevpage = "<a href=\"?forum=$gforum&page=".($page-1)."\"><u>&lt;&lt;</u></a>";
	if ($pages > $page)
		$nextpage = "<a href=\"?forum=$gforum&page=".($page+1)."\"><u>&gt;&gt;</u></a>";
if (isset($_SESSION['username']))
$tactions = <<<endTACTIONS
<a href="reply.php?action=new&forum=$gforum">New Topic</a>
endTACTIONS;
else
$tactions = '';
	$theme_data['topiclist'] = <<<endTOPICLIST
<div style="font-size:0.9em"><a href="index.php"><[title]></a> -&gt; <b>$gforum</b><hr /></div>
<div><div style="float:right">$prevpage <b>Page: $page of $pages</b> $nextpage</div><span class="block">&nbsp;$tactions</span></div><div class="forumlist"><table class="forumlist">
<tr class="forumlist"><th class="forumlist" style="width:50%">Topic Title</td><th class="forumlist">Author</th><th class="forumlist">Replies</th><th class="forumlist">Last Post</th></tr>
endTOPICLIST
;

	foreach ($GLOBALS['topics'] as $order => $data){
		$topicid = $data[0];
		$data = $data[1];
		if (isset($data->LastPostDate))
			$postdate = hdate($data->LastPostDate,1);
		else
			$postdate = '';
		$cauthor = user($data->Author,true);
		if (isset($data->LastPostAuthor))
			$clpa = user($data->LastPostAuthor,true);
		else
			$clpa = 'No posts';
		if ($order %2 == 1)
			$cforumlist = 'forumlist';
		else
			$cforumlist = 'altforumlist';
		$theme_data['topiclist'] .= <<<endTOPICLIST
<tr class="$cforumlist"><td class="$cforumlist" style="letter-spacing:0.1em;font-size:1.4em;font-family:Verdana,Tahoma,Arial,sans-serif"><b><a href="topic.php?topic=$topicid">{$data->Title}</a></b></th><td class="$cforumlist"><a href="profile.php?user={$data->Author}">$cauthor</a></td><td class="$cforumlist">{$data->Replies}</td><td class="$cforumlist"><a href="profile.php?user={$data->LastPostAuthor}">$clpa</a><br /><small>$postdate</small></td></tr>
endTOPICLIST
		;
	}


$theme_data['topiclist'] .= <<<endTOPICLIST
<tr class="forumlist"><th class="forumlist" style="width:50%">Topic Title</td><th class="forumlist">Author</th><th class="forumlist">Replies</th><th class="forumlist">Last Post</th></tr>
</table></div>
endTOPICLIST
;

}

if (isset($_SESSION['username']) && isset($GLOBALS['gtopic']))
	$you = $_SESSION['username'];
if (isset($you) && $profile->$you->Admin >= 40){
	$modtasks = <<<endMODTASKS
<div style="float:right"><span class="block"><a href="mod.php?action=lock&topic={$GLOBALS['gtopic']}"><span class="menuadmin">Lock</span></a> |
<a href="mod.php?action=move&topic={$GLOBALS['gtopic']}"><span class="menuadmin">Move</span></a> |
<a href="mod.php?action=delete&topic={$GLOBALS['gtopic']}"><span class="menuadmin">Delete</span></a></span></div>
endMODTASKS;
}

if (isset($_SESSION['username']) && isset($GLOBALS['gtopic']))
$actions = <<<endACTIONS
<a href="reply.php?topic={$GLOBALS['gtopic']}">Reply</a>
endACTIONS;

if (isset($GLOBALS['posts'])){
if (isset($GLOBALS['gtopic']))
	$gtopic = $GLOBALS['gtopic'];
else
	$gtopic = '';
if (!isset($modtasks)) $modtasks = '';
if (!isset($actions)) $actions = '';
$theme_data['topicdisplay'] = <<<endTOPICDISPLAY
<div style="font-size:0.9em"><a href="index.php"><[title]></a> -&gt; <a href="forum.php?forum={$topic->$gtopic->Forum}">{$topic->$gtopic->Forum}</a> -&gt; <b>{$topic->$gtopic->Title}</b><hr /></div>
<div class="actionbar">
$modtasks
<span class="block">&nbsp;$actions</span>
</div>
<div class="forumlist"><table class="forumlist">
<tr class="forumlist"><th class="forumlist" style="width:7em">Avatar</td><th class="forumlist">Post</th></tr>
endTOPICDISPLAY
;
$mod = (isset($you) && $profile->$you->Admin >= 40);
	foreach ($GLOBALS['posts'] as $postid => $data){
		$postdate = hdate($data['Date'],1);
		$cauthor = user($data['Author'],true);
		$author = $data['Author'];
		if (isset($profile->$author->Avatar) && !empty($profile->$author->Avatar))
			$avatar = '<img src="'.htmlentities($profile->$author->Avatar).'" class="avatar" /><br />';
		else
			$avatar = '';
		$postmod = '<div style="float:right;font-size:0.9em">';
		$usermod = <<<endUSERMOD
<span class="block" style="font-size:1em">
<a href="profile.php?user=$author" target="_blank">Profile</a> |
<a href="private.php?mode=write&user=$author">PM</a> 
endUSERMOD;
		if (isset($you) && $you == $author){
			$postmod .= <<<endPOSTMOD
<a href="reply.php?action=edit&topic={$GLOBALS['gtopic']}&post=$postid"><span class="menulogged">Edit</span></a> |
<a href="mod.php?mode=warn&user=$author"><span class="menulogged">Delete</span></a> 
endPOSTMOD;
		}
		if ($mod && $you != $author && $profile->$you->Admin > $profile->$author->Admin){
			$usermod .= <<<endUSERMOD
| <a href="mod.php?mode=warn&user=$author&topic={$GLOBALS['gtopic']}&post=$postid"><span class="menuadmin">Warn</span></a>
| <a href="mod.php?mode=ban&user=$author&topic={$GLOBALS['gtopic']}&post=$postid"><span class="menuadmin">Ban</span></a>
endUSERMOD;
			$postmod .= <<<endPOSTMOD
<a href="reply.php?action=edit&topic={$GLOBALS['gtopic']}"><span class="menuadmin">Edit</span></a> |
<a href="mod.php?mode=warn&user=$author"><span class="menuadmin">Delete</span></a> 
endPOSTMOD;
		}
		$usermod .= '</span>';
		$postmod .= '</div>';
		if (isset($profile->$author->Signature))
			$sigline = <<<endSIGLINE
<div class="forumdesc" style="margin-right:0px;"><div style="overflow:hidden">{$profile->$author->Signature}</div><div class="forumdesc" style="text-align:right;font-size:1.32em;margin-right:0px">$usermod &nbsp; $postdate</div></div>
endSIGLINE;
		else
			$sigline = <<<endSIGLINE
<div class="forumdesc" style="text-align:right;font-size:0.8em;margin-right:0px">$usermod &nbsp; $postdate</div>
endSIGLINE;
		if (isset($profile->$author->Rank))
			$avatar .= $profile->$author->Rank.'<br />';
		if ($postid %2 == 0)
			$cforumlist = 'forumlist';
		else
			$cforumlist = 'altforumlist';
		$theme_data['topicdisplay'] .= <<<endTOPICDISPLAY
<tr class="$cforumlist"><td class="$cforumlist" style="vertical-align:top;font-size:1.1em"><a href="profile.php?user=$author">$cauthor</a><br />{$avatar}<small>Posts: {$profile->$author->Posts}</small></td><td class="$cforumlist" style="text-align:left;vertical-align:top;"><div>$postmod{$data['Post']}</div><br />$sigline</td></tr>
endTOPICDISPLAY
		;
	}


$theme_data['topicdisplay'] .= <<<endTOPICDISPLAY
<tr class="forumlist"><th class="forumlist">Avatar</td><th class="forumlist">Post</th></tr>
</table></div>
endTOPICDISPLAY
;

}

if (isset($GLOBALS['preview'])){
	$preview = post_format($GLOBALS['preview']);
	$theme_data['postpreview'] = <<<endPOSTPREVIEW
{$preview}
<hr />
endPOSTPREVIEW
;
}

if (isset($GLOBALS['stopic'])){
	if (isset($GLOBALS['quote']) && isset($topic->{$GLOBALS['stopic']}->$GLBOALS['quote']->Post))
		$quote = htmlentities($topic->{$GLOBALS['stopic']}->$GLBOALS['quote']->Post);
	elseif (isset($GLOBALS['preview']))
		$quote = htmlentities($GLOBALS['preview']);
	else
		$quote = '';
	if (isset($config->AllowedHtml)) $allowedhtml = "<b>Allowed HTML Tags:</b> ".implode(', ',$config->AllowedHtml).', '.implode(', ',$config->AllowedSCHtml);
	if (isset($theme_data['replybox']))
		$rb = $theme_data['replybox'];
	else
		$rb = '';
	$theme_data['replybox'] = $rb . <<<endREPLYBOX
<div class="replybox"><form action="?action=submit&topic={$GLOBALS['stopic']}" method="post">
Enter your post here:<br /><textarea style="width:100%;height:50%" name="post">$quote</textarea><br />$allowedhtml<br />
<div style="text-align:center;margin:0px 10% 0px 10%"><input type="submit" value="Preview Post" name="preview" style="width:35%"> <input type="submit" value="Submit Post" name="submit" style="width:35%"></div>
</form></div>
endREPLYBOX
;
}

if (isset($GLOBALS['sforum'])){
	if (isset($GLOBALS['preview'])){
		$title = htmlentities($GLOBALS['title']);
		$quote = htmlentities($GLOBALS['preview']);
	}else{
		$title = '';
		$quote = '';
	}
	if (isset($config->AllowedHtml)) $allowedhtml = "<b>Allowed HTML Tags:</b> ".implode(', ',$config->AllowedHtml).', '.implode(', ',$config->AllowedSCHtml);
	if (isset($theme_data['newtopicbox']))
		$ntb = $theme_data['newtopicbox'];
	else
		$ntb = '';
	$theme_data['newtopicbox'] = $ntb . <<<endNEWTOPICBOX
<div class="replybox"><form action="?action=submitnew&forum={$GLOBALS['sforum']}" method="post">
Post title: <input type="input" name="title" style="width:50%" value="$title"><br />
Enter your post here:<br /><textarea style="width:100%;height:10em" name="post">$quote</textarea><br />$allowedhtml<br />
<div style="text-align:center;margin:0px 10% 0px 10%"><input type="submit" value="Preview Post" name="preview" style="width:35%"> <input type="submit" value="Submit Post" name="submit" style="width:35%"></div>
</form></div>
endNEWTOPICBOX
;
}