2 // PukiWiki - Yet another WikiWikiWeb clone
3 // $Id: versionlist.inc.php,v 1.17 2007/05/12 08:37:38 henoheno Exp $
5 // 2002-2006 PukiWiki Developers Team
6 // 2002 S.YOSHIMURA GPL2 yosimura@excellence.ac.jp
9 // Listing cvs revisions of files
11 function plugin_versionlist_action()
13 global $_title_versionlist;
15 if (PKWK_SAFE_MODE) die_message('PKWK_SAFE_MODE prohibits this');
18 'msg' => $_title_versionlist,
19 'body' => plugin_versionlist_convert());
22 function plugin_versionlist_convert()
24 if (PKWK_SAFE_MODE) return ''; // Show nothing
27 $SCRIPT_DIR = array('./');
28 if (LIB_DIR != './') array_push($SCRIPT_DIR, LIB_DIR);
29 if (DATA_HOME != './' && DATA_HOME != LIB_DIR) array_push($SCRIPT_DIR, DATA_HOME);
30 array_push($SCRIPT_DIR, PLUGIN_DIR, SKIN_DIR);
34 foreach ($SCRIPT_DIR as $sdir)
36 if (!$dir = @dir($sdir))
38 // die_message('directory '.$sdir.' is not found or not readable.');
41 while($file = $dir->read())
43 if (!preg_match("/\.(php|lng|css|js)$/i",$file))
47 $data = join('',file($sdir.$file));
48 $comment = array('file'=>htmlsc($sdir.$file),'rev'=>'','date'=>'');
49 if (preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2})/',$data,$matches))
51 // $comment['file'] = htmlsc($sdir.$matches[1]);
52 $comment['rev'] = htmlsc($matches[2]);
53 $comment['date'] = htmlsc($matches[3]);
55 $comments[$sdir.$file] = $comment;
59 if (count($comments) == 0)
63 ksort($comments, SORT_STRING);
65 foreach ($comments as $comment)
70 <td>{$comment['file']}</td>
71 <td align="right">{$comment['rev']}</td>
72 <td>{$comment['date']}</td>