CVS リポジトリの参照
Contents of /pukiwiki/pukiwiki/plugin/diff.inc.php
Parent Directory
| Revision Log
| Revision Graph
Revision 1.1 -
( show annotations)
( download)
( as text)
Mon Jan 27 05:38:44 2003 UTC
(21 years, 3 months ago)
by panda
Branch: MAIN
CVS Tags: r1_4_pre2
File MIME type: application/x-httpd-php
PukiWiki/1.4 first beta release
1 |
<?php |
2 |
///////////////////////////////////////////////// |
3 |
// PukiWiki - Yet another WikiWikiWeb clone. |
4 |
// |
5 |
// $Id: pukiwiki.ini.php,v 1.13 2002/09/15 07:05:51 masui Exp $ |
6 |
// |
7 |
//ページの差分を表示する |
8 |
function plugin_diff_action() |
9 |
{ |
10 |
global $script,$get,$hr; |
11 |
global $_msg_notfound,$_msg_goto,$_msg_addline,$_msg_delline,$_title_diff; |
12 |
|
13 |
$r_page = rawurlencode($get['page']); |
14 |
$s_page = htmlspecialchars($get['page']); |
15 |
$s_name = strip_bracket($s_page); |
16 |
|
17 |
$msg = $_title_diff; |
18 |
$body = ''; |
19 |
|
20 |
if (is_page($get['page'])) { |
21 |
$link = str_replace('$1',"<a href=\"$script?$r_page\">$s_name</a>",$_msg_goto); |
22 |
$body = <<<EOD |
23 |
<ul> |
24 |
<li>$_msg_addline</li> |
25 |
<li>$_msg_delline</li> |
26 |
<li>$link</li> |
27 |
</ul> |
28 |
$hr |
29 |
EOD; |
30 |
} |
31 |
|
32 |
if (file_exists(DIFF_DIR.encode($get['page']).'.txt')) { |
33 |
$diffdata = htmlspecialchars(join('',file(DIFF_DIR.encode($get['page']).'.txt'))); |
34 |
$diffdata = preg_replace('/^(\-)(.*)$/m','<span class="diff_removed"> $2</span>',$diffdata); |
35 |
$diffdata = preg_replace('/^(\+)(.*)$/m','<span class="diff_added"> $2</span>',$diffdata); |
36 |
$diffdata = trim($diffdata); |
37 |
$body .= "<pre>$diffdata</pre>\n"; |
38 |
} |
39 |
else if (is_page($get['page'])) { |
40 |
$diffdata = trim(htmlspecialchars(join('',get_source($get['page'])))); |
41 |
$body .= "<pre><span class=\"diff_added\">$diffdata</span></pre>\n"; |
42 |
} |
43 |
else { |
44 |
$title = $s_name; |
45 |
$body = $_msg_notfound; |
46 |
} |
47 |
|
48 |
return array('msg'=>$msg,'body'=>$body); |
49 |
} |
50 |
?> |
| |