All pastes #14820 Raw Edit

Untitled

public php v1 · immutable
#14820 ·published 2005-06-17 00:17 UTC
rendered paste body
//////////////////////////////////////////////////////: index.php<?phpdefine('SYSTEM_ROOT', 'system/');require_once SYSTEM_ROOT . 'system_functions.php';using('BusinessRequest', SYSTEM_ROOT);using('components.PasteComponent', SYSTEM_ROOT);BusinessRequest::init();$tpl =& new Savant2();$tpl->setPath('template', CONF_TPL);$tpl->assign('title', 'PHPasteBin');$tpl->assignRef('pastes', PasteComponent::getPastes());$tpl->display('index.tpl.php');BusinessRequest::end();?>////////////////////////////////////////////////////:index.tpl.php<html>	<head>		<title><?php echo $this->title ?></title>	</head>	<body>		<?php if (is_array($this->pastes)): ?>			<form method="post" action="postpaste.php">			Name: <input type="text" name="name" />			Content <textarea name="content"></textarea>			<input type="submit" />			</form>			<table>				<tr>					<th>Name</th>					<th>Content</th>				</tr>				<?php foreach ($this->pastes as $paste): ?>					<tr>						<td><?= $paste->getName() ?></td>						<td><pre><?= htmlspecialchars($paste->getContent()) ?></pre></td>					</tr>				<?php endforeach; ?>			</table>		<?php else: ?>			<p>There are no books to display.</p>		<?php endif; ?>	</body></html>/////////////////////////////////////////////////////: postpaste.php<?phpdefine('SYSTEM_ROOT', 'system/');require_once SYSTEM_ROOT . 'system_functions.php';using('BusinessRequest', SYSTEM_ROOT);using('components.PasteComponent', SYSTEM_ROOT);using('entities.Paste', SYSTEM_ROOT);BusinessRequest::init();$name = $_REQUEST['name'];$content = $_REQUEST['content'];$paste =& new Paste();$paste->setName($name);$paste->setContent($content);// TODO: check for errors/exceptionsPasteComponent::persist($paste);if (!CONF_DEBUG) {	header('location: index.php');} else {	echo 'paste inserted. <a href="index.php">continue</a>';}BusinessRequest::end();?>