OSDN Git Service

Convert character code of the source code to UTF-8 from EUC-JP
[pukiwiki/pukiwiki.git] / plugin / links.inc.php
1 <?php
2 // PukiWiki - Yet another WikiWikiWeb clone
3 // $Id: links.inc.php,v 1.24 2007/04/08 10:29:24 henoheno Exp $
4 // Copyright (C) 2003-2005, 2007 PukiWiki Developers Team
5 // License: GPL v2 or (at your option) any later version
6 //
7 // Update link cache plugin
8
9 // Message setting
10 function plugin_links_init()
11 {
12         $messages = array(
13                 '_links_messages'=>array(
14                         'title_update'  => 'キャッシュ更新',
15                         'msg_adminpass' => '管理者パスワード',
16                         'btn_submit'    => '実行',
17                         'msg_done'      => 'キャッシュの更新が完了しました。',
18                         'msg_usage'     => "
19 * 処理内容
20
21 :キャッシュを更新|
22 全てのページをスキャンし、あるページがどのページからリンクされているかを調査して、キャッシュに記録します。
23
24 * 注意
25 実行には数分かかる場合もあります。実行ボタンを押したあと、しばらくお待ちください。
26
27 * 実行
28 管理者パスワードを入力して、[実行]ボタンをクリックしてください。
29 "
30                 )
31         );
32         set_plugin_messages($messages);
33 }
34
35 function plugin_links_action()
36 {
37         global $script, $post, $vars, $foot_explain;
38         global $_links_messages;
39
40         if (PKWK_READONLY) die_message('PKWK_READONLY prohibits this');
41
42         $msg = $body = '';
43         if (empty($vars['action']) || empty($post['adminpass']) || ! pkwk_login($post['adminpass'])) {
44                 $msg   = & $_links_messages['title_update'];
45                 $body  = convert_html($_links_messages['msg_usage']);
46                 $body .= <<<EOD
47 <form method="post" action="$script">
48  <div>
49   <input type="hidden" name="plugin" value="links" />
50   <input type="hidden" name="action" value="update" />
51   <label for="_p_links_adminpass">{$_links_messages['msg_adminpass']}</label>
52   <input type="password" name="adminpass" id="_p_links_adminpass" size="20" value="" />
53   <input type="submit" value="{$_links_messages['btn_submit']}" />
54  </div>
55 </form>
56 EOD;
57
58         } else if ($vars['action'] == 'update') {
59                 links_init();
60                 $foot_explain = array(); // Exhaust footnotes
61                 $msg  = & $_links_messages['title_update'];
62                 $body = & $_links_messages['msg_done'    ];
63         } else {
64                 $msg  = & $_links_messages['title_update'];
65                 $body = & $_links_messages['err_invalid' ];
66         }
67         return array('msg'=>$msg, 'body'=>$body);
68 }
69 ?>