' . $_msg_addline . '',
'
' . $_msg_delline . ''
);
$is_page = is_page($page);
if ($is_page) {
$menu[] = ' ' . str_replace('$1', '' .
$s_page . '', $_msg_goto) . '';
} else {
$menu[] = ' ' . str_replace('$1', $s_page, $_msg_deleted) . '';
}
$filename = DIFF_DIR . encode($page) . '.txt';
if (file_exists($filename)) {
if (! PKWK_READONLY) {
$menu[] = '' . str_replace('$1', $s_page, $_title_diff_delete) . '';
}
$msg = '' . diff_style_to_css(htmlsc(join('', file($filename)))) . '
' . "\n";
} else if ($is_page) {
$diffdata = trim(htmlsc(join('', get_source($page))));
$msg = '' . $diffdata . '
' . "\n";
} else {
return array('msg'=>$_title_diff, 'body'=>$_msg_notfound);
}
$menu = join("\n", $menu);
$body = <<
$menu
$hr
EOD;
return array('msg'=>$_title_diff, 'body'=>$body . $msg);
}
function plugin_diff_delete($page)
{
global $script, $vars;
global $_title_diff_delete, $_msg_diff_deleted;
global $_msg_diff_adminpass, $_btn_delete, $_msg_invalidpass;
$filename = DIFF_DIR . encode($page) . '.txt';
$body = '';
if (! is_pagename($page)) $body = 'Invalid page name';
if (! file_exists($filename)) $body = make_pagelink($page) . '\'s diff seems not found';
if ($body) return array('msg'=>$_title_diff_delete, 'body'=>$body);
if (isset($vars['pass'])) {
if (pkwk_login($vars['pass'])) {
unlink($filename);
return array(
'msg' => $_title_diff_delete,
'body' => str_replace('$1', make_pagelink($page), $_msg_diff_deleted)
);
} else {
$body .= '' . $_msg_invalidpass . '
' . "\n";
}
}
$s_page = htmlsc($page);
$body .= <<$_msg_diff_adminpass
EOD;
return array('msg'=>$_title_diff_delete, 'body'=>$body);
}