}
}
+// Get a list of encoded files (must specify a directory and a suffix)
+function get_existfiles($dir = DATA_DIR, $ext = '.txt')
+{
+ $aryret = array();
+ $pattern = '/^(?:[0-9A-F]{2})+' . preg_quote($ext, '/') . '$/';
+
+ $dp = @opendir($dir) or die_message($dir . ' is not found or not readable.');
+ while (($file = readdir($dp)) !== FALSE) {
+ if (preg_match($pattern, $file)) {
+ $aryret[] = $dir . $file;
+ }
+ }
+ closedir($dp);
+
+ return $aryret;
+}
+
// Get a page list of this wiki
function get_existpages($dir = DATA_DIR, $ext = '.txt')
{
$aryret = array();
+ $pattern = '/^((?:[0-9A-F]{2})+)' . preg_quote($ext, '/') . '$/';
- $pattern = '((?:[0-9A-F]{2})+)';
- if ($ext != '') $ext = preg_quote($ext, '/');
- $pattern = '/^' . $pattern . $ext . '$/';
-
- $dp = @opendir($dir) or
- die_message($dir . ' is not found or not readable.');
+ $dp = @opendir($dir) or die_message($dir . ' is not found or not readable.');
$matches = array();
- while ($file = readdir($dp))
- if (preg_match($pattern, $file, $matches))
+ while (($file = readdir($dp)) !== FALSE) {
+ if (preg_match($pattern, $file, $matches)) {
$aryret[$file] = decode($matches[1]);
+ }
+ }
closedir($dp);
return $aryret;
return $readings;
}
-// Get a list of encoded files (must specify a directory and a suffix)
-function get_existfiles($dir, $ext)
-{
- $pattern = '/^(?:[0-9A-F]{2})+' . preg_quote($ext, '/') . '$/';
- $aryret = array();
- $dp = @opendir($dir) or die_message($dir . ' is not found or not readable.');
- while ($file = readdir($dp))
- if (preg_match($pattern, $file))
- $aryret[] = $dir . $file;
- closedir($dp);
- return $aryret;
-}
-
// Get a list of related pages of the page
function links_get_related($page)
{
$pattern = "/^({$page_pattern})_((?:[0-9A-F]{2})+){$age_pattern}$/";
$matches = array();
- while ($file = readdir($dir)) {
- if (! preg_match($pattern, $file, $matches))
- continue;
+ while (($file = readdir($dir)) !== FALSE) {
+ if (! preg_match($pattern, $file, $matches)) continue;
$_page = decode($matches[1]);
$_file = decode($matches[2]);
<?php
-// $Id: dump.inc.php,v 1.38 2007/05/12 09:17:14 henoheno Exp $
+// $Id: dump.inc.php,v 1.41 2007/11/03 15:17:52 henoheno Exp $
+// Copyright (C)
+// 2004-2007 PukiWiki Developers Team
+// 2004 teanan / Interfair Laboratory
+// License: GPL v2 or (at your option) any later version
//
// Remote dump / restore plugin
// Originated as tarfile.inc.php by teanan / Interfair Laboratory 2004.
@unlink($this->filename);
die_message($dir . ' is not found or not readable.');
}
-
- while ($filename = readdir($dp)) {
- if (preg_match("/$mask/", $filename))
+ while (($filename = readdir($dp)) !== FALSE) {
+ if (preg_match('/' . $mask . '/', $filename)) {
$files[] = $dir . $filename;
+ }
}
closedir($dp);