2 // $Id: versionlist.inc.php,v 1.15 2005/01/29 02:12:52 henoheno Exp $
4 * PukiWiki versionlist plugin
6 * CopyRight 2002 S.YOSHIMURA GPL2
7 * http://masui.net/pukiwiki/ yosimura@excellence.ac.jp
10 function plugin_versionlist_action()
12 global $_title_versionlist;
14 if (PKWK_SAFE_MODE) die_message('PKWK_SAFE_MODE prohibits this');
17 'msg' => $_title_versionlist,
18 'body' => plugin_versionlist_convert());
21 function plugin_versionlist_convert()
23 if (PKWK_SAFE_MODE) return ''; // Show nothing
25 /* õº÷¥Ç¥£¥ì¥¯¥È¥êÀßÄê */
26 $SCRIPT_DIR = array('./');
27 if (LIB_DIR != './') array_push($SCRIPT_DIR, LIB_DIR);
28 if (DATA_HOME != './' && DATA_HOME != LIB_DIR) array_push($SCRIPT_DIR, DATA_HOME);
29 array_push($SCRIPT_DIR, PLUGIN_DIR, SKIN_DIR);
33 foreach ($SCRIPT_DIR as $sdir)
35 if (!$dir = @dir($sdir))
37 // die_message('directory '.$sdir.' is not found or not readable.');
40 while($file = $dir->read())
42 if (!preg_match("/\.(php|lng|css|js)$/i",$file))
46 $data = join('',file($sdir.$file));
47 $comment = array('file'=>htmlspecialchars($sdir.$file),'rev'=>'','date'=>'');
48 if (preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2})/',$data,$matches))
50 // $comment['file'] = htmlspecialchars($sdir.$matches[1]);
51 $comment['rev'] = htmlspecialchars($matches[2]);
52 $comment['date'] = htmlspecialchars($matches[3]);
54 $comments[$sdir.$file] = $comment;
58 if (count($comments) == 0)
64 foreach ($comments as $comment)
69 <td>{$comment['file']}</td>
70 <td align="right">{$comment['rev']}</td>
71 <td>{$comment['date']}</td>