<?php // vim: ts=4 sw=4 sts=4 fdm=marker ai noet:
// PukiWiki - Yet another WikiWikiWeb clone
// $Id: source.inc.php,v 1.6 2005/02/11 14:47:42 ishii Exp $
//
// Source plugin

// Output source text of the page
function plugin_source_action()
{
	global $vars, $_source_messages;

	if (PKWK_SAFE_MODE) die_message('PKWK_SAFE_MODE prohibits this');

	$page = isset($vars['page']) ? $vars['page'] : '';
	$vars['refer'] = $page;

	if (! is_page($page) || ! check_readable($page, false, false))
		return array('msg' => $_source_messages['msg_notfound'],
			'body' => $_source_messages['err_notfound']);

	return array('msg' => $_source_messages['msg_title'],
		'body' => '<pre id="source">' .
		htmlspecialchars(join('', get_source($page))) . '</pre>');
}
?>
