}
}
-// ÊÑ¿ô¤ò¼èÆÀ¤¹¤ë
+// 変数を取得する
function plugin_rename_getvar($key)
{
global $vars;
return isset($vars[$key]) ? $vars[$key] : '';
}
-// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òºî¤ë
+// エラーメッセージを作る
function plugin_rename_err($err, $page = '')
{
global $_rename_messages;
return $msg;
}
-//Âè°ìÃʳ¬:¥Ú¡¼¥¸Ì¾¤Þ¤¿¤ÏÀµµ¬É½¸½¤ÎÆþÎÏ
+//第一段階:ページ名または正規表現の入力
function plugin_rename_phase1($err = '', $page = '')
{
global $script, $_rename_messages;
return $ret;
}
-//ÂèÆóÃʳ¬:¿·¤·¤¤Ì¾Á°¤ÎÆþÎÏ
+//第二段階:新しい名前の入力
function plugin_rename_phase2($err = '')
{
global $script, $_rename_messages;
return $ret;
}
-//¥Ú¡¼¥¸Ì¾¤È´ØÏ¢¤¹¤ë¥Ú¡¼¥¸¤òÎóµó¤·¡¢phase3¤Ø
+//ページ名と関連するページを列挙し、phase3へ
function plugin_rename_refer()
{
$page = plugin_rename_getvar('page');
return plugin_rename_phase3($pages);
}
-//Àµµ¬É½¸½¤Ç¥Ú¡¼¥¸¤òÃÖ´¹
+//正規表現でページを置換
function plugin_rename_regex($arr_from, $arr_to)
{
$exists = array();
$matches = array();
foreach ($dirs as $path) {
$dir = opendir($path);
- if (! $dir) continue;
-
- while ($file = readdir($dir)) {
+ if (! $dir) continue; // TODO: !== FALSE or die()?
+ while (($file = readdir($dir)) !== FALSE) {
if ($file == '.' || $file == '..') continue;
-
- foreach ($pages as $from=>$to) {
+ foreach ($pages as $from => $to) {
+ // TODO: preg_quote()?
$pattern = '/^' . str_replace('/', '\/', $from) . '([._].+)$/';
- if (! preg_match($pattern, $file, $matches))
- continue;
-
- $newfile = $to . $matches[1];
- $files[$from][$path . $file] = $path . $newfile;
+ if (preg_match($pattern, $file, $matches)) {
+ $newfile = $to . $matches[1];
+ $files[$from][$path . $file] = $path . $newfile;
+ }
}
}
}
+
return $files;
}
unlink($new);
rename($old, $new);
- // link¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò¹¹¿·¤¹¤ë BugTrack/327 arino
+ // linkデータベースを更新する BugTrack/327 arino
links_update($old);
links_update($new);
}
$postdata[] = '-' . decode($old) .
$_rename_messages['msg_arrow'] . decode($new) . "\n";
- // ¹¹¿·¤Î¾×ÆͤϥÁ¥§¥Ã¥¯¤·¤Ê¤¤¡£
+ // 更新の衝突はチェックしない。
- // ¥Õ¥¡¥¤¥ë¤Î½ñ¤¹þ¤ß
+ // ファイルの書き込み
page_write(PLUGIN_RENAME_LOGPAGE, join('', $postdata));
- //¥ê¥À¥¤¥ì¥¯¥È
+ //リダイレクト
$page = plugin_rename_getvar('page');
if ($page == '') $page = PLUGIN_RENAME_LOGPAGE;
pkwk_headers_sent();
- header('Location: ' . get_script_uri() . '?' . rawurlencode($page));
+ header('Location: ' . get_script_uri() . '?' . pagename_urlencode($page));
exit;
}
EOD;
}
-?>
+